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

Can't use kwargs with mbuild.load when backend is gmso. #1034

Closed
umesh-timalsina opened this issue Apr 26, 2022 · 0 comments
Closed

Can't use kwargs with mbuild.load when backend is gmso. #1034

umesh-timalsina opened this issue Apr 26, 2022 · 0 comments

Comments

@umesh-timalsina
Copy link
Member

I found an issue where, any kwargs that are provided to mbuild.load when using gmso as a backend, is not propagated. The issue stems from the following line in mbuild's conversion.py.

top = gmso.Topology.load(filename=filename)

Reproduce with non-atomistic mol2 files

@<TRIPOS>MOLECULE
PEN
    6    5    1    0    0
SMALL
NO_CHARGES
****
Energy = 0

@<TRIPOS>ATOM
      1  _CH3       0.0000    0.0000    0.0000    C    1  HEX        0.000000
      2  _CH2      -1.5000    0.0000    0.0000    C    1  HEX        0.000000
      3  _CH2      -2.2500    1.2990    0.0000    C    1  HEX        0.000000
      4  _CH2      -2.3176    2.1344    1.2440    C    1  HEX        0.000000
      5  _CH2      -2.4830    1.4760    2.5816    C    1  HEX        0.000000
      6  _CH3      -2.1676    0.0185    2.7441    C    1  HEX        0.000000
@<TRIPOS>BOND
    1     1     2  1
    2     2     3  1
    3     3     4  1
    4     4     5  1
    5     5     6  1

@<TRIPOS>SUBSTRUCTURE
1 ****        1 TEMP                        0 ****  **** 0 ROOT

#generated by VMD

Copy the content above and save it to a hexane.mol2 file.

from gmso.core.topology import Topology
from gmso.external.convert_mbuild import to_mbuild
import mbuild as mb

## With site_type='lj', elements are not inferred
gmso_top = Topology.load('hexane.mol2', site_type='lj')
mbuild_compound_using_gmso = to_mbuild(gmso_top)

print('Using gmso.Topology.load')
for particle in mbuild_compound_using_gmso.particles():
    print(particle.element)

print()
    
## Same with mbuild infers element
print('Using mbuild.load')
mbuild_compound_using_mbuild_dot_load = mb.load('hexane.mol2', site_type='lj', backend='gmso')
for particle in mbuild_compound_using_mbuild_dot_load.particles():
    print(particle.element)
print()
Using gmso.Topology.load
None
None
None
None
None
None

Using mbuild.load
Element: carbon, symbol: C, atomic number: 6, mass: 12.011
Element: carbon, symbol: C, atomic number: 6, mass: 12.011
Element: carbon, symbol: C, atomic number: 6, mass: 12.011
Element: carbon, symbol: C, atomic number: 6, mass: 12.011
Element: carbon, symbol: C, atomic number: 6, mass: 12.011
Element: carbon, symbol: C, atomic number: 6, mass: 12.011

Software versions

  • Which version of mBuild are you using? (0.14.2)
  • Which version of Python (3.9.7)?
  • Which operating system? unix
umesh-timalsina added a commit to umesh-timalsina/mbuild that referenced this issue Apr 26, 2022
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