From 76ca9e4a2accffe7b539962c9075b6a12caa4911 Mon Sep 17 00:00:00 2001 From: Alon Grinberg Dana Date: Thu, 10 Oct 2024 15:33:24 +0300 Subject: [PATCH] Send original_molecule in Species when calling molecules_from_xyz() --- arc/species/species.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/arc/species/species.py b/arc/species/species.py index 91db9f9ab8..6bb763fdc4 100644 --- a/arc/species/species.py +++ b/arc/species/species.py @@ -1385,7 +1385,7 @@ 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) mol = mols[1] or mols[0] if chk_rotor_list: for rotor in self.rotors_dict.values(): @@ -1595,7 +1595,9 @@ 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, + ) perceived_mol = mol_b or mol_s if perceived_mol is not None: allow_nonisomorphic_2d = self.charge \ @@ -1615,7 +1617,11 @@ 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, + ) 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: @@ -1788,7 +1794,11 @@ 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, + ) except Exception as e: if verbose: logger.error(f'Could not perceive the Cartesian coordinates of species {self.label}. This '