Skip to content

Commit

Permalink
Propagate kwargs in mb.load when backend is gmso. Fix #1034 (#1035)
Browse files Browse the repository at this point in the history
* Propagate kwargs in mb.load when backend is gmso. Fix #1034

* Fix failed test
Parmed don't have support for reading in "lj" type mol2, so removing
that kwarg from the load using parmed as backend

Co-authored-by: Co Quach <43968221+daico007@users.noreply.github.com>
Co-authored-by: Co Quach <daico007@gmail.com>
  • Loading branch information
3 people committed Apr 28, 2022
1 parent e12113a commit cd3e0de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mbuild/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def load_file(
if backend == "gmso":
gmso = import_("gmso")

top = gmso.Topology.load(filename=filename)
top = gmso.Topology.load(filename=filename, **kwargs)
compound = from_gmso(
topology=top,
compound=compound,
Expand Down
17 changes: 17 additions & 0 deletions mbuild/tests/test_mol2file.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,20 @@ def test_gmso_backend(self):
for particle in gmso_silica_surface:
element_set.add(particle.element)
assert len(element_set) == 2

def test_gmso_backend_lj_site_type(self):
pmd_silica_surface = mb.load(
filename_or_object=get_fn("beta-cristobalite-expanded.mol2"),
backend="parmed",
)
gmso_silica_surface = mb.load(
filename_or_object=get_fn("beta-cristobalite-expanded.mol2"),
backend="gmso",
site_type="lj",
)

assert pmd_silica_surface.n_particles == gmso_silica_surface.n_particles
assert pmd_silica_surface.n_bonds == gmso_silica_surface.n_bonds

for particle in gmso_silica_surface:
assert particle.element is None

0 comments on commit cd3e0de

Please sign in to comment.