Skip to content

Commit

Permalink
Send original_molecule in Species when calling molecules_from_xyz()
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Oct 28, 2024
1 parent 4f144bf commit 74f22b4
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions arc/species/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,12 @@ def set_dihedral(self,
return None
mol = self.mol
if mol is None:
mols = molecules_from_xyz(xyz, multiplicity=self.multiplicity, charge=self.charge)
mols = molecules_from_xyz(xyz,
multiplicity=self.multiplicity,
charge=self.charge,
original_molecule=mol,
numer_of_radicals=self.number_of_radicals,
)
mol = mols[1] or mols[0]
if chk_rotor_list:
for rotor in self.rotors_dict.values():
Expand Down Expand Up @@ -1595,7 +1600,10 @@ def mol_from_xyz(self,
# self.mol should have come from another source, e.g., SMILES or yml.
mol_s, mol_b = molecules_from_xyz(xyz=xyz,
multiplicity=self.multiplicity,
charge=self.charge)
charge=self.charge,
original_molecule=self.mol,
numer_of_radicals=self.number_of_radicals,
)
perceived_mol = mol_b or mol_s
if perceived_mol is not None:
allow_nonisomorphic_2d = self.charge \
Expand All @@ -1615,7 +1623,12 @@ def mol_from_xyz(self,
if not self.keep_mol:
self.mol = perceived_mol
else:
mol_s, mol_b = molecules_from_xyz(xyz, multiplicity=self.multiplicity, charge=self.charge)
mol_s, mol_b = molecules_from_xyz(xyz,
multiplicity=self.multiplicity,
charge=self.charge,
original_molecule=self.mol,
numer_of_radicals=self.number_of_radicals,
)
if mol_b is not None and len(mol_b.atoms) == self.number_of_atoms:
self.mol = mol_b
elif mol_s is not None and len(mol_s.atoms) == self.number_of_atoms:
Expand Down Expand Up @@ -1788,7 +1801,12 @@ def check_xyz_isomorphism(self,

# 1. Perceive
try:
s_mol, b_mol = molecules_from_xyz(xyz, multiplicity=self.multiplicity, charge=self.charge)
s_mol, b_mol = molecules_from_xyz(xyz,
multiplicity=self.multiplicity,
charge=self.charge,
original_molecule=mol,
numer_of_radicals=self.number_of_radicals,
)
except Exception as e:
if verbose:
logger.error(f'Could not perceive the Cartesian coordinates of species {self.label}. This '
Expand Down

0 comments on commit 74f22b4

Please sign in to comment.