From 218a63fa3567ea190f3847d846a35d1c1dfed3e4 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 8 Jan 2025 16:50:15 -0800 Subject: [PATCH] fix TS vdW handling for cov_dep --- pynta/main.py | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/pynta/main.py b/pynta/main.py index cd5a47c3..53ac5497 100644 --- a/pynta/main.py +++ b/pynta/main.py @@ -701,20 +701,36 @@ def setup_active_learning_loop(self): info_path = os.path.join(self.pynta_run_directory,ts,"info.json") reactants = Molecule().from_adjacency_list(info["reactants"]) products = Molecule().from_adjacency_list(info["products"]) - keep_binding_vdW_bonds=False - keep_vdW_surface_bonds=False - for mol in [reactants,products]: - for bd in mol.get_all_edges(): - if bd.order == 0: - if bd.atom1.is_surface_site() or bd.atom2.is_surface_site(): - keep_binding_vdW_bonds = True - m = mol.copy(deep=True) - b = m.get_bond(m.atoms(mol.atoms.index(bd.atom1)),m.atoms[mol.atoms.index(bd.atom2)]) - m.remove_bond(b) - out = m.split() - if len(out) == 1: #vdW bond is not only thing connecting adsorbate to surface - keep_vdW_surface_bonds = True - + keep_binding_vdW_bonds_in_reactants=False + keep_vdW_surface_bonds_in_reactants=False + mol = reactants + for bd in mol.get_all_edges(): + if bd.order == 0: + if bd.atom1.is_surface_site() or bd.atom2.is_surface_site(): + keep_binding_vdW_bonds_in_reactants = True + m = mol.copy(deep=True) + b = m.get_bond(m.atoms(mol.atoms.index(bd.atom1)),m.atoms[mol.atoms.index(bd.atom2)]) + m.remove_bond(b) + out = m.split() + if len(out) == 1: #vdW bond is not only thing connecting adsorbate to surface + keep_vdW_surface_bonds_in_reactants = True + keep_binding_vdW_bonds_in_products=False + keep_vdW_surface_bonds_in_products=False + mol = products + for bd in mol.get_all_edges(): + if bd.order == 0: + if bd.atom1.is_surface_site() or bd.atom2.is_surface_site(): + keep_binding_vdW_bonds_in_products = True + m = mol.copy(deep=True) + b = m.get_bond(m.atoms(mol.atoms.index(bd.atom1)),m.atoms[mol.atoms.index(bd.atom2)]) + m.remove_bond(b) + out = m.split() + if len(out) == 1: #vdW bond is not only thing connecting adsorbate to surface + keep_vdW_surface_bonds_in_products = True + + keep_binding_vdW_bonds = keep_binding_vdW_bonds_in_reactants and keep_binding_vdW_bonds_in_products + keep_vdW_surface_bonds = keep_vdW_surface_bonds_in_reactants and keep_vdW_surface_bonds_in_products + atoms = read(admol_name_path_dict[ts]) st,_,_ = generate_TS_2D(atoms, info_path, self.metal, self.surface_type, self.sites, self.site_adjacency, self.nslab, max_dist=np.inf, allowed_structure_site_structures=allowed_structure_site_structures,