Skip to content

Commit

Permalink
change is_molecule_forbidden
Browse files Browse the repository at this point in the history
  • Loading branch information
bjkreitz committed Dec 16, 2024
1 parent c4fea25 commit e6ef712
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 15 additions & 4 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion rmgpy/molecule/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e6ef712

Please sign in to comment.