Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1211 #193

Open
wants to merge 3 commits into
base: release/1.2
Choose a base branch
from
Open

v1211 #193

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/cavity/ICavity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,30 @@ ICavity::ICavity(const Molecule & molec)
}

void ICavity::saveCavity(const std::string & fname) {
std::string ffname = std::tmpnam(nullptr);

// Write everything in a single .npz binary file
unsigned int dim = static_cast<unsigned int>(nElements_);
// Write the number of elements, it will be used to check sanity of the save/load
// operations.
const unsigned int shape[] = {1};
cnpy::npz_save(fname, "elements", &dim, shape, 1, "w", false);
cnpy::npz_save(ffname, "elements", &dim, shape, 1, "w", false);
// Write weights
cnpy::custom::npz_save(fname, "weights", elementArea_);
cnpy::custom::npz_save(ffname, "weights", elementArea_);
// Write element sphere center
cnpy::custom::npz_save(fname, "elSphCenter", elementSphereCenter_);
cnpy::custom::npz_save(ffname, "elSphCenter", elementSphereCenter_);
// Write element radius
cnpy::custom::npz_save(fname, "elRadius", elementRadius_);
cnpy::custom::npz_save(ffname, "elRadius", elementRadius_);
// Write centers
cnpy::custom::npz_save(fname, "centers", elementCenter_);
cnpy::custom::npz_save(ffname, "centers", elementCenter_);
// Write normals
cnpy::custom::npz_save(fname, "normals", elementNormal_);
cnpy::custom::npz_save(ffname, "normals", elementNormal_);
for (PCMSolverIndex i = 0; i < nElements_; ++i) {
// Write vertices
cnpy::custom::npz_save(
fname, "vertices_" + pcm::to_string(i), elements_[i].vertices());
ffname, "vertices_" + pcm::to_string(i), elements_[i].vertices());
// Write arcs
cnpy::custom::npz_save(fname, "arcs_" + pcm::to_string(i), elements_[i].arcs());
cnpy::custom::npz_save(ffname, "arcs_" + pcm::to_string(i), elements_[i].arcs());
}
}

Expand Down
9 changes: 7 additions & 2 deletions tools/pcmparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from copy import deepcopy
import re

from .getkw import Section, GetkwParser
from .pcmdata import CODATAdict, allowedSolvents

isAngstrom = False
Expand Down Expand Up @@ -80,6 +79,9 @@ def parse_pcm_input(inputFile, write_out=False):

...
"""
from importlib import reload
from . import getkw

# Set up valid keywords.
valid_keywords = setup_keywords()

Expand All @@ -88,7 +90,8 @@ def parse_pcm_input(inputFile, write_out=False):

# Set up a GetKw object and let it parse our input:
# here is where the magic happens.
inkw = GetkwParser().parseFile(uppercased)
getkw = reload(getkw)
inkw = getkw.GetkwParser().parseFile(uppercased)
# Remove temporary file
os.remove(uppercased)
inkw.sanitize(valid_keywords)
Expand Down Expand Up @@ -153,6 +156,8 @@ def setup_keywords():
"""
Sets up sections, keywords and respective callback functions.
"""
from .getkw import Section

# Top-level section
top = Section('toplevel', callback=verify_top)
top.set_status(True)
Expand Down
6 changes: 3 additions & 3 deletions tools/pyparsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def __dir__(self):
return dir(super(ParseResults, self)) + list(self.keys())


collections.MutableMapping.register(ParseResults)
collections.abc.MutableMapping.register(ParseResults)


def col(loc, strg):
Expand Down Expand Up @@ -2386,7 +2386,7 @@ def __init__(self, exprs, savelist=False):

if isinstance(exprs, basestring):
self.exprs = [Literal(exprs)]
elif isinstance(exprs, collections.Sequence):
elif isinstance(exprs, collections.abc.Sequence):
# if sequence of strings provided, wrap with Literal
if all(isinstance(expr, basestring) for expr in exprs):
exprs = map(Literal, exprs)
Expand Down Expand Up @@ -3439,7 +3439,7 @@ def oneOf(strs, caseless=False, useRegex=True):
symbols = []
if isinstance(strs, basestring):
symbols = strs.split()
elif isinstance(strs, collections.Sequence):
elif isinstance(strs, collections.abc.Sequence):
symbols = list(strs[:])
elif isinstance(strs, _generatorType):
symbols = list(strs)
Expand Down