Undesirable behavior of to_smiles
@lily90502
Bug Description
Getting wrong SMILES of oxygen atom when loading data from database.kinetics.families
How To Reproduce
Here is the code:
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
families = []
libraries = []
database = RMGDatabase()
database.load(
path = settings['database.directory'],
thermo_libraries = ['primaryThermoLibrary'],
kinetics_families = families or 'default',
reaction_libraries = libraries,
kinetics_depositories = ['training'],
)
family = database.kinetics.families['1+2_Cycloaddition']
all_entries = family.get_training_depository().entries
for num, reaction_entry in all_entries.items():
# To find out the reactants and products
rs = reaction_entry.item.reactants
ps = reaction_entry.item.products
r_smiles = [s.molecule[0].to_smiles() for s in rs]
p_smiles = [s.molecule[0].to_smiles() for s in ps]
print(r_smiles)
print(p_smiles)
I tried the following code as well:
from rmgpy.molecule.molecule import Molecule
m = Molecule().from_adjacency_list("""
O
1 O u0 p3 c0
""")
m_smiles = m.to_smiles()
print(m_smiles)
However, the oxygen atom SMILES is 'O' rather than '[O]'
Expected Behavior
Get the correct SMILES of oxygen atom
Installation Information
- OS (include version if known): Ubuntu 18
- Installation method: (Installation from binary, with anaconda)
- RMG version
- RMG-Py: 3.1.0
- RMG-database: 3.1.0
@lily90502, this looks similar to what you recently encountered. Can you take a look?
The issue occurs due to radical electron not updated to be 2 It will pass the radical electron = 0 to rdkit which will make rdkit automatically saturate with H (this does not change even with Chem.RemoveHs(rdkitmol)) The next thing to check is where the molecule information such as radical electron and lone pairs should be corrected (update_atomtypes or update_atoms or other functions)
This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days.