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

Angle and dihedral information not populated in gsd when Compound.save is used #1025

Closed
jennyfothergill opened this issue Apr 6, 2022 · 2 comments

Comments

@jennyfothergill
Copy link
Contributor

jennyfothergill commented Apr 6, 2022

Bug summary

This issue was discovered by @marjanalb: Basically when creating a gsd file from an mbuild compound--the bonds and particles information is present in the gsd, but the angle and dihedral information is not.

(Angle and dihedral information in create_hoomd_simulation and create_hoomd_forcefield works just fine. I think this is due to those functions using a parmed structure--the mbuild to parmed conversion handles the angle/dihedral detection.)

Code to reproduce the behavior

Please include a code snippet that can be used to reproduce this bug.

import mbuild as mb
import gsd.hoomd

ethane = mb.load("CC", smiles=True)
ethane.save('ethane.gsd')
with gsd.hoomd.open('ethane.gsd', 'rb') as t:
    frame = t[0]
    print(frame.angles.N)

This prints 0 when it should print 36 (I think).

Software versions

  • Which version of mBuild are you using? (python -c "import mbuild as mb; print(mb.__version__)") 0.10.13
  • Which version of Python (python --version)? 3.7.10
  • Which operating system? osx
@daico007
Copy link
Member

daico007 commented Apr 7, 2022

Yeah, I think that is correct, an mBuild compound itself has no idea about angles and dihedrals, those information only get populated during the atomtyping step with OpenMM and Parmed. I am not sure what would be the best route to fix this issue (either convert it to gmso and identify all the angles and dihedrals before writing out, or go through parmed, but we can figure something out)

@chrisjonesBSU
Copy link
Contributor

chrisjonesBSU commented Aug 5, 2022

Closing this as you can now populate angle and dihedrals when writing a gsd file if you use gmso.identify_connections() along with gmso's GSD writer as opposed to gsd writer in mBuild.

Quick example:

comp = mb.load("CCCC", smiles=True)
system = mb.fill_box(comp, n_compounds=3, density=100)
top = from_mbuild(system)
top.identify_connections()
top.save("out.gsd")

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

3 participants