Skip to content

Commit

Permalink
Merge pull request #92 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Bugfix: yet more issues with property handling
  • Loading branch information
seamm authored Dec 22, 2024
2 parents 9b5fc21 + ca05a5c commit baea413
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
2024.12.14 -- Bugfix: yet more issues with property handling
* This release ensures that types of properties are correctly handled when reading
SDF files.

2024.12.14 -- Bugfix: more issues with property handling.
* The types of properties were not kept when using Open Babel or RDKit, so when
properties were reread from an SDF file the JSON properties were converted into
Expand Down
7 changes: 6 additions & 1 deletion molsystem/openbabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,16 @@ def from_OBMol(
value = json.dumps(value)
else:
pass

if not self.properties.exists(_property):
self.properties.add(_property, _type=_type, units=units)

self.properties.put(_property, value)
else:
if not self.properties.exists(key):
_type = value.__class__.__name__
self.properties.add(key, _type)
self.properties.put(key, value)
self.properties.put(key, value)
return self

def coordinates_from_OBMol(self, ob_mol):
Expand Down
2 changes: 1 addition & 1 deletion molsystem/rdkit_.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def from_RDKMol(
if _type == "json":
value = json.dumps(value)

self.properties.put(key, value)
self.properties.put(_property, value)
else:
if not self.properties.exists(key):
_type = value.__class__.__name__
Expand Down

0 comments on commit baea413

Please sign in to comment.