Skip to content

Commit

Permalink
use molecule.smiles instead of molecule.to_smiles() in yaml writer
Browse files Browse the repository at this point in the history
This should speed up execution time by accessing the property each time instead of regenerating it, see : ReactionMechanismGenerator#2499 (comment)
  • Loading branch information
JacksonBurns authored Jul 26, 2023
1 parent 224936e commit a191fbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rmgpy/yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_mech_dict(spcs, rxns, solvent='solvent', solvent_data=None):


def get_radicals(spc):
if spc.molecule[0].to_smiles() == "[O][O]": # treat oxygen as stable to improve radical analysis
if spc.molecule[0].smiles == "[O][O]": # treat oxygen as stable to improve radical analysis
return 0
else:
return spc.molecule[0].multiplicity-1
Expand All @@ -112,7 +112,7 @@ def obj_to_dict(obj, spcs, names=None, label="solvent"):
result_dict["type"] = "Species"
if obj.contains_surface_site():
result_dict["adjlist"] = obj.molecule[0].to_adjacency_list()
result_dict["smiles"] = obj.molecule[0].to_smiles()
result_dict["smiles"] = obj.molecule[0].smiles
result_dict["thermo"] = obj_to_dict(obj.thermo, spcs)
result_dict["radicalelectrons"] = get_radicals(obj)
if obj.liquid_volumetric_mass_transfer_coefficient_data:
Expand Down

0 comments on commit a191fbd

Please sign in to comment.