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

Chemical identity comparison for Molecules and Species #1329

Merged
merged 20 commits into from May 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3da3c0e
Refactor some class properties using @property decorator
mliu49 Jan 25, 2018
db1e492
Refactor Molecule SMILES and InChI attributes
mliu49 Jan 25, 2018
aeaf3b5
Add read-only inchi property to Species
mliu49 Jan 25, 2018
3594fc5
Add read-only fingerprint property to Species
mliu49 Jan 25, 2018
010513e
Add read-only multiplicity property to Species
mliu49 Feb 5, 2018
1b9884b
Add unit tests for new Species properties
mliu49 Jan 26, 2018
3d3473f
Add strict argument for isomorphism comparison
mliu49 Aug 27, 2018
da870ca
Add strict argument to Species.isIsomorphic
mliu49 Apr 3, 2019
e36c78e
Remove generate_res argument from Species.isIsomorphic
mliu49 Apr 4, 2019
4422e9c
Rename isomorphic_species_lists to same_species_lists
mliu49 Apr 3, 2019
f2a2296
Add strict argument to Reaction.isIsomorphic
mliu49 Apr 3, 2019
75da1f3
Refactor CERM.checkForExistingSpecies using strict=False isomorphism
mliu49 Apr 4, 2019
de012ad
Refactor product checking in __generateReactions
mliu49 Sep 13, 2018
9e8a491
Revise test for prod_resonance option for generating reactions
mliu49 Sep 13, 2018
7b4604e
Add strict option to Graph.isMappingValid
mliu49 Apr 4, 2019
9052975
Add strict argument to isIdentical methods
mliu49 Apr 4, 2019
78f8a2d
Do not generate resonance structures for degeneracy determination
mliu49 Apr 4, 2019
4084b1e
Make sure selected molecule is reactive
mliu49 Oct 30, 2018
27baa4e
Enable Species instantiation by SMILES or InChI argument
mliu49 Apr 4, 2019
b3ff5c5
Fix reaction degeneracy bug with keep_isomorphic argument
mliu49 Apr 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions rmgpy/species.pxd
Expand Up @@ -53,6 +53,7 @@ cdef class Species:
cdef public bint isSolvent
cdef public int creationIteration
cdef public bint explicitlyAllowed
cdef str _inchi

cpdef generate_resonance_structures(self, bint keep_isomorphic=?, bint filter_structures=?)

Expand Down
9 changes: 9 additions & 0 deletions rmgpy/species.py
Expand Up @@ -106,6 +106,7 @@ def __init__(self, index=-1, label='', thermo=None, conformer=None,
self.isSolvent = False
self.creationIteration = creationIteration
self.explicitlyAllowed = explicitlyAllowed
self._inchi = None
# Check multiplicity of each molecule is the same
if molecule is not None and len(molecule)>1:
mult = molecule[0].multiplicity
Expand Down Expand Up @@ -154,6 +155,14 @@ def __reduce__(self):
"""
return (Species, (self.index, self.label, self.thermo, self.conformer, self.molecule, self.transportData, self.molecularWeight, self.energyTransferModel, self.reactive, self.props))

@property
def InChI(self):
"""InChI string representation of this species. Read-only."""
if self._inchi is None:
if self.molecule:
self._inchi = self.molecule[0].InChI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is self.molecule[0].InChI always not None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Molecule.InChI is a property which will set the InChI if it's not already there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

return self._inchi

@property
def molecularWeight(self):
"""The molecular weight of the species. (Note: value_si is in kg/molecule not kg/mol)"""
Expand Down