Skip to content

Commit

Permalink
Merge pull request #59 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Supporting in-line uncertainties for values in CIF files.
  • Loading branch information
seamm committed Apr 6, 2023
2 parents 0bd7352 + 5581ba8 commit e45de73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Expand Up @@ -2,6 +2,9 @@
History
=======

2023.4.6 -- Enhancements for CIF files
* Handle uncertainties in CIF files expressed as '(x)' at end of value.

2023.3.30 -- Enhancements to QCSchema support
* Improved naming of molecule in QCSchema
* Added creation of configurations from QCSchema objects.
Expand Down
18 changes: 9 additions & 9 deletions molsystem/cif.py
Expand Up @@ -216,12 +216,12 @@ def from_cif_text(self, text):
dot = "."
if "_cell_length_a" in data_block:
dot = "_"
a = data_block["_cell" + dot + "length_a"]
b = data_block["_cell" + dot + "length_b"]
c = data_block["_cell" + dot + "length_c"]
alpha = data_block["_cell" + dot + "angle_alpha"]
beta = data_block["_cell" + dot + "angle_beta"]
gamma = data_block["_cell" + dot + "angle_gamma"]
a = data_block["_cell" + dot + "length_a"].split("(")[0]
b = data_block["_cell" + dot + "length_b"].split("(")[0]
c = data_block["_cell" + dot + "length_c"].split("(")[0]
alpha = data_block["_cell" + dot + "angle_alpha"].split("(")[0]
beta = data_block["_cell" + dot + "angle_beta"].split("(")[0]
gamma = data_block["_cell" + dot + "angle_gamma"].split("(")[0]
if float(a) != 1 and float(b) != 1 and float(c) != 1:
self.periodicity = 3
self.coordinate_system = "fractional"
Expand Down Expand Up @@ -388,9 +388,9 @@ def from_cif_text(self, text):
if symbol == "D":
symbol = "H"
# These variables *are* used in the eval below.
x = float(x)
y = float(y)
z = float(z)
x = float(x.split("(")[0])
y = float(y.split("(")[0])
z = float(z.split("(")[0])
logger.debug(f"xyz = {x:7.3f} {y:7.3f} {z:7.3f}")
if self.periodicity == 3:
if not have_fractionals:
Expand Down

0 comments on commit e45de73

Please sign in to comment.