Skip to content

Commit

Permalink
prevents resonance generation of S#S structures by find_lone_pair_mul…
Browse files Browse the repository at this point in the history
…tiplebond_paths and find_adj_lone_pair_multiple_bond_delocalization_paths
  • Loading branch information
rgillis8 committed Oct 8, 2019
1 parent 041c19e commit 5075f1e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions rmgpy/molecule/pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,15 @@ def find_lone_pair_multiple_bond_paths(atom1):

paths = []
for atom2, bond12 in atom1.edges.items():
# Bond must be capable of gaining an order
if bond12.is_single() or bond12.is_double():
for atom3, bond23 in atom2.edges.items():
# Bond must be capable of losing an order without breaking, atom3 must be able to gain a lone pair
if atom1 is not atom3 and (bond23.is_double() or bond23.is_triple()) \
and (atom3.is_carbon() or is_atom_able_to_gain_lone_pair(atom3)):
paths.append([atom1, atom2, atom3, bond12, bond23])
#if both atom1 and atom2 are sulfur then don't do this type of resonance
if not atom1.is_sulfur() or not atom2.is_sulfur():
# Bond must be capable of gaining an order
if bond12.is_single() or bond12.is_double():
for atom3, bond23 in atom2.edges.items():
# Bond must be capable of losing an order without breaking, atom3 must be able to gain a lone pair
if atom1 is not atom3 and (bond23.is_double() or bond23.is_triple()) \
and (atom3.is_carbon() or is_atom_able_to_gain_lone_pair(atom3)):
paths.append([atom1, atom2, atom3, bond12, bond23])
return paths


Expand Down Expand Up @@ -382,7 +384,7 @@ def find_adj_lone_pair_multiple_bond_delocalization_paths(atom1):
# Find paths in the direction <increasing> the bond order,
# atom1 must posses at least one lone pair to loose it
if ((bond12.is_single() or bond12.is_double())
and is_atom_able_to_lose_lone_pair(atom1)):
and is_atom_able_to_lose_lone_pair(atom1)) and not (atom1.is_sulfur() and atom2.is_sulfur() and bond12.is_double()): #the final clause of this prevents S#S from forming by this resonance pathway
paths.append([atom1, atom2, bond12, 1]) # direction = 1
# Find paths in the direction <decreasing> the bond order,
# atom1 gains a lone pair, hence cannot already have more than two lone pairs
Expand Down

0 comments on commit 5075f1e

Please sign in to comment.