Skip to content

Commit

Permalink
Changed constraint for max carbene radicals to be 1, added a new exce…
Browse files Browse the repository at this point in the history
…ption to atomtype because it was causing an error for 1,2+Cycloaddition, and had some issues with charges in CO2 so had to append hardcoded families in family.py to include 'co2_elimination_from_lactone_ether'
  • Loading branch information
Nora-Khalil committed Aug 13, 2024
1 parent a6815ef commit 4def2a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rmgpy/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def fails_species_constraints(species):
if struct.get_singlet_carbene_count() > max_carbenes:
return True

max_carbene_radicals = species_constraints.get('maximumCarbeneRadicals', 0)
max_carbene_radicals = species_constraints.get('maximumCarbeneRadicals', 1) #changing this from 0 to 1 (PFAS chemistry involves carbene radicals)
if max_carbene_radicals != -1:
if struct.get_singlet_carbene_count() > 0 and struct.get_radical_count() > max_carbene_radicals:
return True
Expand Down
6 changes: 3 additions & 3 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,8 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a
will be reversed to assist in identifying forbidden structures.
"""
#added in by NK
print(reactant_structures)
logging.info(reactant_structures)
#print(reactant_structures)
#logging.info(reactant_structures)

# There is some hardcoding of reaction families in this function, so
# we need the label of the reaction family for this
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a
struct.reset_ring_membership()
if label in ['1,2_insertion_co', 'r_addition_com', 'co_disproportionation',
'intra_no2_ono_conversion', 'lone_electron_pair_bond',
'1,2_nh3_elimination', '1,3_nh3_elimination']:
'1,2_nh3_elimination', '1,3_nh3_elimination', 'co2_elimination_from_lactone_ether']:
struct.update_charge()
else:
raise TypeError('Expecting Molecule or Group object, not {0}'.format(struct.__class__.__name__))
Expand Down
19 changes: 19 additions & 0 deletions rmgpy/molecule/atomtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,22 @@ def get_features(self):
'I','I1s',
'F','F1s'])


ATOMTYPES['R!O'] = AtomType(label='R!O', generic=['R'], specific=[
'Val4','Val5','Val6','Val7',
'He','Ne','Ar',
'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ctc','Ct','Cb','Cbf','Cq','C2s','C2sc','C2d','C2dc','C2tc',
'N','N0sc','N1s','N1sc','N1dc','N3s','N3sc','N3d','N3t','N3b','N5sc','N5dc','N5ddc','N5dddc','N5tc','N5b','N5bd',
'H',
'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf','Siq',
'P','P0sc','P1s','P1sc','P1dc','P3s','P3d','P3t','P3b','P5s','P5sc','P5d','P5dd','P5dc','P5ddc','P5t','P5td','P5tc','P5b','P5bd',
'S','Sa','S0sc','S2s','S2sc','S2d','S2dc','S2tc','S4s','S4sc','S4d','S4dd','S4dc','S4b','S4t','S4tdc','S6s','S6sc','S6d','S6dd','S6ddd','S6dc','S6t','S6td','S6tt','S6tdc',
'Cl','Cl1s',
'Br','Br1s',
'I','I1s',
'F','F1s'])


ATOMTYPES['R!H!Val7'] = AtomType(label='R!H!Val7', generic=['R'], specific=[
'Val4','Val5','Val6',
'He','Ne','Ar',
Expand Down Expand Up @@ -640,6 +656,9 @@ def get_features(self):

ATOMTYPES['R'].set_actions(increment_bond=['R'], decrement_bond=['R'], form_bond=['R'], break_bond=['R'], increment_radical=['R'], decrement_radical=['R'], increment_lone_pair=['R'], decrement_lone_pair=['R'])
ATOMTYPES['R!H'].set_actions(increment_bond=['R!H'], decrement_bond=['R!H'], form_bond=['R!H'], break_bond=['R!H'], increment_radical=['R!H'], decrement_radical=['R!H'], increment_lone_pair=['R!H'], decrement_lone_pair=['R!H'])

ATOMTYPES['R!O'].set_actions(increment_bond=['R!O'], decrement_bond=['R!O'], form_bond=['R!O'], break_bond=['R!O'], increment_radical=['R!O'], decrement_radical=['R!O'], increment_lone_pair=['R!O'], decrement_lone_pair=['R!O'])

ATOMTYPES['R!H!Val7'].set_actions(increment_bond=['R!H!Val7'], decrement_bond=['R!H!Val7'], form_bond=['R!H!Val7'], break_bond=['R!H!Val7'], increment_radical=['R!H!Val7'], decrement_radical=['R!H!Val7'], increment_lone_pair=['R!H!Val7'], decrement_lone_pair=['R!H!Val7'])
ATOMTYPES['Val4'].set_actions(increment_bond=['Val4'], decrement_bond=['Val4'], form_bond=['Val4'], break_bond=['Val4'], increment_radical=['Val4'], decrement_radical=['Val4'], increment_lone_pair=['Val4'], decrement_lone_pair=['Val4'])
ATOMTYPES['Val5'].set_actions(increment_bond=['Val5'], decrement_bond=['Val5'], form_bond=['Val5'], break_bond=['Val5'], increment_radical=['Val5'], decrement_radical=['Val5'], increment_lone_pair=['Val5'], decrement_lone_pair=['Val5'])
Expand Down

0 comments on commit 4def2a4

Please sign in to comment.