Skip to content

Commit

Permalink
Add properties for CCS and stdev CCS, propagate to geometry object as…
Browse files Browse the repository at this point in the history
… needed
  • Loading branch information
smcolby committed Jan 24, 2025
1 parent 89c5de7 commit 2f9429e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
33 changes: 32 additions & 1 deletion isicle/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class Geometry(GeometryInterface):
"_frequency",
"_molden",
"_charge",
"_connectivity"
"_connectivity",
"_formal_charge",
"_ccs",
"_ccs_std"
]
_default_value = None

Expand Down Expand Up @@ -154,6 +157,34 @@ def formal_charge(self):

return Chem.rdmolops.GetFormalCharge(self.to_mol())

@property
def ccs(self):
"""
Get CCS of the molecule.
Returns
-------
float
Collision cross section.
"""

return self._ccs

@property
def ccs_std(self):
"""
Get standard deviation of CCS prediction of the molecule.
Returns
-------
float
Standard deviation of collision cross section.
"""

return self._ccs_std

def view(self):
"""
View internal rdkit mol object representation.
Expand Down
3 changes: 3 additions & 0 deletions isicle/mobility.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def finish(self):
except UnicodeDecodeError:
result[ext] = contents

# Propagate geometry object
result["geometry"] = self.geom

# Assign to attribute
self.result = result
return self.result
Expand Down
11 changes: 10 additions & 1 deletion isicle/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,16 @@ def parse(self):
elif "standard deviation (percent)" in line:
done = True
if done is True:
self.result["ccs"] = {"mean": ccs_mn, "std": ccs_std}
self.result["ccs"] = ccs_mn
self.result["ccs_std"] = ccs_std

self.result["geometry"] = self.data["geometry"]

# Update geometry attributes
self.result["geometry"].add___dict__(
{"_" + k: v for k, v in self.result.items() if k not in ["geometry"]},
override=True
)

return self.result

Expand Down

0 comments on commit 2f9429e

Please sign in to comment.