From 32c6af2b52c1b11a9025b6ac310c0684be4490da Mon Sep 17 00:00:00 2001 From: Bjarne Kreitz Date: Fri, 12 Jul 2024 16:13:08 -0400 Subject: [PATCH 1/4] draw vdW bond --- rmgpy/molecule/converter.py | 2 +- rmgpy/molecule/draw.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rmgpy/molecule/converter.py b/rmgpy/molecule/converter.py index e5e619a2b7..c2b6689704 100644 --- a/rmgpy/molecule/converter.py +++ b/rmgpy/molecule/converter.py @@ -97,7 +97,7 @@ def to_rdkit_mol(mol, remove_h=True, return_mapping=False, sanitize=True, save_o label_dict[label] = [saved_index] rd_bonds = Chem.rdchem.BondType orders = {'S': rd_bonds.SINGLE, 'D': rd_bonds.DOUBLE, 'T': rd_bonds.TRIPLE, 'B': rd_bonds.AROMATIC, - 'Q': rd_bonds.QUADRUPLE} + 'Q': rd_bonds.QUADRUPLE, 'vdW': rd_bonds.UNSPECIFIED} # Add the bonds for atom1 in mol.vertices: for atom2, bond in atom1.edges.items(): diff --git a/rmgpy/molecule/draw.py b/rmgpy/molecule/draw.py index 37a3b47e25..e3b6e3547a 100644 --- a/rmgpy/molecule/draw.py +++ b/rmgpy/molecule/draw.py @@ -1214,6 +1214,9 @@ def _render_bond(self, atom1, atom2, bond, cr): elif bond.is_hydrogen_bond(): # Draw a dashed line self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) + elif bond.is_van_der_waals(): + # Draw a dashed line + self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) else: self._draw_line(cr, x1, y1, x2, y2) else: From c4fea2541f09ffdc6d6b0a865c678cd19b03c756 Mon Sep 17 00:00:00 2001 From: Bjarne Kreitz Date: Mon, 15 Jul 2024 11:09:46 -0400 Subject: [PATCH 2/4] adjust remove vdW bond --- rmgpy/molecule/molecule.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rmgpy/molecule/molecule.py b/rmgpy/molecule/molecule.py index 5e02476550..a37a2699db 100644 --- a/rmgpy/molecule/molecule.py +++ b/rmgpy/molecule/molecule.py @@ -1258,9 +1258,19 @@ def remove_van_der_waals_bonds(self): Remove all van der Waals bonds. """ cython.declare(bond=Bond) - for bond in self.get_all_edges(): - if bond.is_van_der_waals(): - self.remove_bond(bond) + if self.is_multidentate(): + #bond_types = + #possible_bonds_with_resonance = #TODO: Include possible nitrogen bonds + if any([k in ['O-X', 'C#X', 'C=X', 'C-X'] for k in self.enumerate_bonds()]): + pass + else: + for bond in self.get_all_edges(): + if bond.is_van_der_waals(): + self.remove_bond(bond) + else: + for bond in self.get_all_edges(): + if bond.is_van_der_waals(): + self.remove_bond(bond) def sort_atoms(self): """ From e6ef71259f539ba348cd5dc02b975b888cc3aea6 Mon Sep 17 00:00:00 2001 From: Bjarne Kreitz Date: Wed, 17 Jul 2024 09:03:32 -0400 Subject: [PATCH 3/4] change is_molecule_forbidden --- rmgpy/data/kinetics/family.py | 19 +++++++++++++++---- rmgpy/molecule/molecule.py | 4 +++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index 43e3836169..3b7b379fd6 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1670,11 +1670,22 @@ def is_molecule_forbidden(self, molecule): return True # forbid vdw multi-dentate molecules for surface families + surface_sites = [] if "surface" in self.label.lower(): - if molecule.get_num_atoms('X') > 1: - for atom in molecule.atoms: - if atom.atomtype.label == 'Xv': - return True + if "surface_monodentate_to_vdw_bidentate" in self.label.lower() and molecule.get_num_atoms('X') > 1: + surface_sites = [atom.atomtype.label for atom in molecule.atoms if 'X' in atom.atomtype.label] + if all(site == 'Xv' for site in surface_sites): + return True + else: + if molecule.get_num_atoms('X') > 1: + for atom in molecule.atoms: + if atom.atomtype.label == 'Xv': + return True + # elif "surface" in self.label.lower(): + # if molecule.get_num_atoms('X') > 1: + # for atom in molecule.atoms: + # if atom.atomtype.label == 'Xv': + # return True return False diff --git a/rmgpy/molecule/molecule.py b/rmgpy/molecule/molecule.py index a37a2699db..274459f025 100644 --- a/rmgpy/molecule/molecule.py +++ b/rmgpy/molecule/molecule.py @@ -62,7 +62,7 @@ ################################################################################ -bond_orders = {'S': 1, 'D': 2, 'T': 3, 'B': 1.5} +bond_orders = {'S': 1, 'D': 2, 'T': 3, 'B': 1.5, 'vdW': 0} globals().update({ 'bond_orders': bond_orders, @@ -2952,6 +2952,8 @@ def get_desorbed_molecules(self): bonded_atom.increment_radical() bonded_atom.increment_lone_pairs() bonded_atom.label = '*4' + elif bond.is_van_der_waals(): + bonded_atom.label = '*5' else: raise NotImplementedError("Can't remove surface bond of type {}".format(bond.order)) desorbed_molecule.remove_atom(site) From f143e9edb6ee3303cb90363da07d89bfdfcbe3f6 Mon Sep 17 00:00:00 2001 From: Bjarne Kreitz Date: Wed, 17 Jul 2024 09:04:17 -0400 Subject: [PATCH 4/4] remove comments --- rmgpy/data/kinetics/family.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index 3b7b379fd6..fcefc2210d 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1681,11 +1681,6 @@ def is_molecule_forbidden(self, molecule): for atom in molecule.atoms: if atom.atomtype.label == 'Xv': return True - # elif "surface" in self.label.lower(): - # if molecule.get_num_atoms('X') > 1: - # for atom in molecule.atoms: - # if atom.atomtype.label == 'Xv': - # return True return False