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

Going back and forth between ParmEd and and GMSO raises issues #655

Closed
CalCraven opened this issue May 10, 2022 · 1 comment
Closed

Going back and forth between ParmEd and and GMSO raises issues #655

CalCraven opened this issue May 10, 2022 · 1 comment
Labels
bug Something isn't working conversions conversions of GMSO to and from other format

Comments

@CalCraven
Copy link
Contributor

In order to get feature parity with Foyer, we need to test back and forth with different ParmEd structures. As such, a workflow below might be useful.

import mbuild as mb
import foyer
cpd = mb.load("CC[N+](=O)[O-]", smiles=True)
opls = foyer.Forcefield(name="oplsaa")
pmd = cpd.to_parmed()

from gmso.external import from_parmed, to_parmed
top = from_parmed(pmd, refer_type=False)
pmd = to_parmed(top)

typed_pmd = opls.apply(pmd, assert_improper_params=False)

However, this leads to the output

AttributeError                            Traceback (most recent call last)
Input In [5], in <module>
      9 from gmso.external import from_parmed, to_parmed
     10 top = from_parmed(pmd, refer_type=False)
---> 11 pmd = to_parmed(top)
     13 typed_pmd = opls.apply(pmd, assert_improper_params=False)

File ~/Dropbox/Mac/Documents/Vanderbilt/Research/MoSDeF/gomc-gmso-paper/gmso/gmso/external/convert_parmed.py:482, in to_parmed(top, refer_type)
    477 else:
    478     atomic_number = 0
    479 pmd_atom = pmd.Atom(
    480     atomic_number=atomic_number,
    481     name=site.name,
--> 482     mass=site.mass.to(u.amu).value,
    483     charge=site.charge.to(u.elementary_charge).value,
    484 )
    485 pmd_atom.xx, pmd_atom.xy, pmd_atom.xz = site.position.to(
    486     "angstrom"
    487 ).value
    489 # Add atom to structure

AttributeError: 'NoneType' object has no attribute 'to'

To fix this, line 482 should be changed based on the elements mass.

site.element.mass.to(u.amu).value

python version 3.8
gmso version 0.8.0

@daico007 daico007 added bug Something isn't working conversions conversions of GMSO to and from other format labels Aug 11, 2022
@chrisjonesBSU
Copy link
Contributor

This should be fixed by #737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working conversions conversions of GMSO to and from other format
Projects
None yet
Development

No branches or pull requests

3 participants