Skip to content

Commit 4f82c4a

Browse files
committed
merge upstream
2 parents d1d4bcc + aabbab6 commit 4f82c4a

24 files changed

+856
-6433
lines changed

.github/workflows/CI.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ jobs:
5454
- name: Test (OS -> ${{ matrix.os }} / Python -> ${{ matrix.python-version }})
5555
run: python -m pytest -v --cov=mbuild --cov-report=xml --cov-append --cov-config=setup.cfg --color yes --pyargs mbuild
5656

57-
- name: Tests for HOOMD-blue (V3)
58-
run: |
59-
micromamba install -c conda-forge "hoomd>3"
60-
python -m pytest -v --cov=mbuild --cov-report=xml --cov-append --cov-config=setup.cfg --color yes mbuild/tests/test_hoomd.py
61-
if: runner.os == 'Linux'
62-
6357
- name: Upload Coverage Report
6458
uses: codecov/codecov-action@v4
6559
with:

environment-dev-win.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- bump2version
77
- codecov
88
- ele
9-
- gmso>=0.9.0
9+
- gmso>=0.12.4
1010
- foyer>=0.11.0
1111
- garnett>=0.7.1
1212
- gsd>=2.9
@@ -20,7 +20,6 @@ dependencies:
2020
- parmed>=3.4.3
2121
- pip
2222
- pre-commit
23-
- protobuf
2423
- py3Dmol
2524
- pycifrw
2625
- pytest

environment-dev.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies:
2121
- parmed>=3.4.3
2222
- pip
2323
- pre-commit
24-
- protobuf
2524
- py3Dmol
2625
- pycifrw
2726
- pytest

mbuild/compound.py

Lines changed: 39 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,6 @@ def _visualize_py3dmol(
17461746
os.path.join(tmp_dir, "tmp.mol2"),
17471747
include_ports=show_ports,
17481748
overwrite=True,
1749-
parmed_kwargs={"infer_residues": False},
17501749
)
17511750

17521751
view = py3Dmol.view()
@@ -2718,15 +2717,9 @@ def save(
27182717
self,
27192718
filename,
27202719
include_ports=False,
2721-
forcefield_name=None,
2722-
forcefield_files=None,
2723-
forcefield_debug=False,
27242720
box=None,
27252721
overwrite=False,
27262722
residues=None,
2727-
combining_rule="lorentz",
2728-
foyer_kwargs=None,
2729-
parmed_kwargs=None,
27302723
**kwargs,
27312724
):
27322725
"""Save the Compound to a file.
@@ -2736,22 +2729,11 @@ def save(
27362729
filename : str
27372730
Filesystem path in which to save the trajectory. The extension or
27382731
prefix will be parsed and control the format. Supported extensions:
2739-
'hoomdxml', 'gsd', 'gro', 'top', 'lammps', 'lmp', 'mcf', 'pdb', 'xyz',
2740-
'json', 'mol2', 'sdf', 'psf'. See parmed/structure.py for more
2741-
information on savers.
2732+
'gsd', 'gro', 'top', 'mcf', 'pdb', 'xyz',
2733+
'json', 'mol2', 'sdf', 'psf'. See `mbuild.conversion.save()`
2734+
for more information about writer methods.
27422735
include_ports : bool, optional, default=False
27432736
Save ports contained within the compound.
2744-
forcefield_files : str, optional, default=None
2745-
Apply a forcefield to the output file using a forcefield provided
2746-
by the `foyer` package.
2747-
forcefield_name : str, optional, default=None
2748-
Apply a named forcefield to the output file using the `foyer`
2749-
package, e.g. 'oplsaa'. `Foyer forcefields
2750-
<https://github.com/mosdef-hub/foyer/tree/master/foyer/forcefields>`_
2751-
forcefield_debug : bool, optional, default=False
2752-
Choose verbosity level when applying a forcefield through `foyer`.
2753-
Specifically, when missing atom types in the forcefield xml file,
2754-
determine if the warning is condensed or verbose.
27552737
box : mb.Box, optional, default=self.boundingbox (with buffer)
27562738
Box information to be written to the output file. If 'None', a
27572739
bounding box is used with 0.25nm buffers at each face to avoid
@@ -2761,50 +2743,25 @@ def save(
27612743
residues : str of list of str
27622744
Labels of residues in the Compound. Residues are assigned by
27632745
checking against Compound.name.
2764-
combining_rule : str, optional, default='lorentz'
2765-
Specify the combining rule for nonbonded interactions. Only relevant
2766-
when the `foyer` package is used to apply a forcefield. Valid
2767-
options are 'lorentz' and 'geometric', specifying Lorentz-Berthelot
2768-
and geometric combining rules respectively.
2769-
foyer_kwargs : dict, optional, default=None
2770-
Keyword arguments to provide to `foyer.Forcefield.apply`.
2771-
Depending on the file extension these will be passed to either
2772-
`write_gsd`, `write_hoomdxml`, `write_lammpsdata`,
2773-
`write_mcf`, or `parmed.Structure.save`.
2774-
See `parmed structure documentation
2775-
<https://parmed.github.io/ParmEd/html/structobj/parmed.structure.Structure.html#parmed.structure.Structure.save>`_
2776-
parmed_kwargs : dict, optional, default=None
2777-
Keyword arguments to provide to :meth:`mbuild.Compound.to_parmed`
27782746
**kwargs
2747+
See `mbuild.conversion.save()`.
27792748
Depending on the file extension these will be passed to either
2780-
`write_gsd`, `write_hoomdxml`, `write_lammpsdata`, `write_mcf`, or
2781-
`parmed.Structure.save`.
2749+
Parmed or GMSO backend writers
27822750
See https://parmed.github.io/ParmEd/html/structobj/parmed.structure.
2783-
Structure.html#parmed.structure.Structure.save
2751+
Structure.html#parmed.structure.Structure.save and
2752+
https://github.com/mosdef-hub/gmso/tree/main/gmso/formats
27842753
27852754
Other Parameters
27862755
----------------
27872756
ref_distance : float, optional, default=1.0
2788-
Normalization factor used when saving to .gsd and .hoomdxml formats
2757+
Normalization factor used when saving to the .gsd format
27892758
for converting distance values to reduced units.
27902759
ref_energy : float, optional, default=1.0
2791-
Normalization factor used when saving to .gsd and .hoomdxml formats
2760+
Normalization factor used when saving to the .gsd format
27922761
for converting energy values to reduced units.
27932762
ref_mass : float, optional, default=1.0
2794-
Normalization factor used when saving to .gsd and .hoomdxml formats
2763+
Normalization factor used when saving to the .gsd format
27952764
for converting mass values to reduced units.
2796-
atom_style: str, default='full'
2797-
Defines the style of atoms to be saved in a LAMMPS data file. The
2798-
following atom styles are currently supported:
2799-
'full', 'atomic', 'charge', 'molecular'
2800-
See `LAMMPS atom style documentation
2801-
<https://lammps.sandia.gov/doc/atom_style.html>`_ for more
2802-
information.
2803-
unit_style: str, default='real'
2804-
Defines to unit style to be save in a LAMMPS data file. Defaults
2805-
to 'real' units. Current styles are supported: 'real', 'lj'. See
2806-
`LAMMPS unit style documentation_
2807-
<https://lammps.sandia.gov/doc/units.html>`_ for more information.
28082765
28092766
Notes
28102767
-----
@@ -2813,29 +2770,24 @@ def save(
28132770
* filename
28142771
* include_ports
28152772
2773+
The savers used for each supported file type are:
2774+
GMSO: .gro, .gsd, .data, .xyz, .mcf, .top
2775+
Parmed: .mol2, .pdb, .prmtop, .cif, .crd
2776+
PyBel: .sdf
2777+
28162778
See Also
28172779
--------
2818-
conversion.save : Main saver logic
2819-
formats.gsdwrite.write_gsd : Write to GSD format
2820-
formats.hoomdxml.write_hoomdxml : Write to Hoomd XML format
2821-
formats.xyzwriter.write_xyz : Write to XYZ format
2822-
formats.lammpsdata.write_lammpsdata : Write to LAMMPS data format
2823-
formats.cassandramcf.write_mcf : Write to Cassandra MCF format
2824-
formats.json_formats.compound_to_json : Write to a json file
2780+
mbuild.conversion.save : Main saver logic
2781+
mbuild.formats.cassandramcf.write_mcf : Write to Cassandra MCF format
2782+
mbuild.formats.json_formats.compound_to_json : Write to a json file
28252783
"""
28262784
conversion.save(
2827-
self,
2828-
filename,
2829-
include_ports,
2830-
forcefield_name,
2831-
forcefield_files,
2832-
forcefield_debug,
2833-
box,
2834-
overwrite,
2835-
residues,
2836-
combining_rule,
2837-
foyer_kwargs,
2838-
parmed_kwargs,
2785+
compound=self,
2786+
filename=filename,
2787+
include_ports=include_ports,
2788+
box=box,
2789+
overwrite=overwrite,
2790+
residues=residues,
28392791
**kwargs,
28402792
)
28412793

@@ -2985,6 +2937,21 @@ def to_gmso(self, **kwargs):
29852937
"""
29862938
return conversion.to_gmso(self, **kwargs)
29872939

2940+
def to_hoomdsnapshot(self, **kwargs):
2941+
"""Create a HOOMD-Blue snapshot from an mBuild Compound.
2942+
2943+
Parameters
2944+
----------
2945+
compound : mb.Compound
2946+
The mb.Compound to be converted.
2947+
2948+
Returns
2949+
-------
2950+
snapshot : gsd.hoomd.Frame
2951+
HOOMD-Blue compatible topology.
2952+
"""
2953+
return conversion.to_hoomdsnapshot(self, **kwargs)
2954+
29882955
# Interface to Trajectory for reading/writing .pdb and .mol2 files.
29892956
# -----------------------------------------------------------------
29902957
def from_trajectory(

0 commit comments

Comments
 (0)