Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMILES matching on UA need a better warning or different functionality #50

Open
NoahMontrose opened this issue Jun 29, 2023 · 0 comments

Comments

@NoahMontrose
Copy link

Using SMARTS matching on an United Atom system without the add_hydrogens flag gives a confusing result.
This works

pps = mb.load("c1ccc(S)cc1", smiles=True)
pps.save("pps_box_H.gsd", overwrite=True)
gsdfile = 'pps_box_H.gsd'
system = grits.CG_System(
            gsdfile,
            beads={"_A": "c1ccc(S)cc1"},
        )
system._compounds[0].visualize(show_atomistic = True)

This gives a warning

pps = mb.load("c1ccc(S)cc1", smiles=True)
pps.remove(pps.particles_by_element('H'))
pps.save("pps_box_noH.gsd", overwrite=True)
gsdfile = 'pps_box_noH.gsd'
system = grits.CG_System(
            gsdfile,
            beads={"_A": "c1ccc(S)cc1"},
            #add_hydrogens=True
        )
system._compounds[0].visualize(show_atomistic = True)
/Users/noah/miniconda3/envs/grits/lib/python3.8/site-packages/grits/coarsegrain.py:139: UserWarning: c1ccc(S)cc1 not found in compound!
  warn(f"{smart_str} not found in compound!")
/Users/noah/miniconda3/envs/grits/lib/python3.8/site-packages/grits/coarsegrain.py:169: UserWarning: Some atoms have been left out of coarse-graining!
  warn("Some atoms have been left out of coarse-graining!")

This warning is confusing when reading from a United Atom gsd and using the corresponding SMARTS string. It's not obvious that the hydrogens need to be added back in this case.

We should either add to the warning specifying that we might need the add_hydrogens=True flag or make the behavior automatically add hydrogens back to United Atom systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant