-
Notifications
You must be signed in to change notification settings - Fork 24
Skip 2D-graph isomorphism enforcement for TS species #876
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1621,6 +1621,8 @@ def mol_from_xyz(self, | |
| Important for TS searches and for identifying rotor indices. | ||
| This works by generating a molecule from xyz and using the | ||
| 2D structure to confirm that the perceived molecule is correct. | ||
| For TSs, the perceived molecule is accepted without enforcing | ||
| 2D-graph isomorphism, since TS connectivity is not strictly defined. | ||
| If ``xyz`` is not given, the species xyz attribute will be used. | ||
|
|
||
| Args: | ||
|
|
@@ -1643,28 +1645,32 @@ def mol_from_xyz(self, | |
| n_fragments=self.get_n_fragments(), | ||
| ) | ||
| if perceived_mol is not None: | ||
| allow_nonisomorphic_2d = (self.charge is not None and self.charge) \ | ||
| or self.mol.has_charge() or perceived_mol.has_charge() \ | ||
| or (self.multiplicity is not None and self.multiplicity >= 3) \ | ||
| or self.mol.multiplicity >= 3 or perceived_mol.multiplicity >= 3 | ||
| isomorphic = self.check_xyz_isomorphism(mol=perceived_mol, | ||
| xyz=xyz, | ||
| allow_nonisomorphic_2d=allow_nonisomorphic_2d) | ||
| if not isomorphic: | ||
| logger.warning(f'XYZ and the 2D graph representation for {self.label} are not isomorphic.\nGot ' | ||
| f'xyz:\n{xyz}\n\nwhich corresponds to {self.mol.copy(deep=True).to_smiles()}\n' | ||
| f'{self.mol.copy(deep=True).to_adjacency_list()}\n\nand: ' | ||
| f'{self.mol.copy(deep=True).to_smiles()}\n' | ||
| f'{self.mol.copy(deep=True).to_adjacency_list()}') | ||
| raise SpeciesError(f'XYZ and the 2D graph representation for {self.label} are not compliant.') | ||
| if not self.keep_mol: | ||
| if is_mol_valid(perceived_mol, charge=self.charge, multiplicity=self.multiplicity, n_radicals=self.number_of_radicals): | ||
| if self.is_ts: | ||
| if not self.keep_mol: | ||
| self.mol = perceived_mol | ||
| else: | ||
| try: | ||
| order_atoms(ref_mol=perceived_mol, mol=self.mol) | ||
| except SanitizationError: | ||
| else: | ||
| allow_nonisomorphic_2d = (self.charge is not None and self.charge) \ | ||
| or self.mol.has_charge() or perceived_mol.has_charge() \ | ||
| or (self.multiplicity is not None and self.multiplicity >= 3) \ | ||
| or self.mol.multiplicity >= 3 or perceived_mol.multiplicity >= 3 | ||
| isomorphic = self.check_xyz_isomorphism(mol=perceived_mol, | ||
| xyz=xyz, | ||
| allow_nonisomorphic_2d=allow_nonisomorphic_2d) | ||
| if not isomorphic: | ||
| logger.warning(f'XYZ and the 2D graph representation for {self.label} are not isomorphic.\nGot ' | ||
| f'xyz:\n{xyz}\n\nwhich corresponds to {self.mol.copy(deep=True).to_smiles()}\n' | ||
| f'{self.mol.copy(deep=True).to_adjacency_list()}\n\nand: ' | ||
| f'{perceived_mol.copy(deep=True).to_smiles()}\n' | ||
| f'{perceived_mol.copy(deep=True).to_adjacency_list()}') | ||
| raise SpeciesError(f'XYZ and the 2D graph representation for {self.label} are not compliant.') | ||
| if not self.keep_mol: | ||
| if is_mol_valid(perceived_mol, charge=self.charge, multiplicity=self.multiplicity, n_radicals=self.number_of_radicals): | ||
| self.mol = perceived_mol | ||
| else: | ||
| try: | ||
| order_atoms(ref_mol=perceived_mol, mol=self.mol) | ||
| except SanitizationError: | ||
| self.mol = perceived_mol | ||
|
Comment on lines
+1648
to
+1673
|
||
| else: | ||
| perceived_mol = perceive_molecule_from_xyz(xyz, | ||
| charge=self.charge, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.