@@ -1746,7 +1746,6 @@ def _visualize_py3dmol(
1746
1746
os .path .join (tmp_dir , "tmp.mol2" ),
1747
1747
include_ports = show_ports ,
1748
1748
overwrite = True ,
1749
- parmed_kwargs = {"infer_residues" : False },
1750
1749
)
1751
1750
1752
1751
view = py3Dmol .view ()
@@ -2718,15 +2717,9 @@ def save(
2718
2717
self ,
2719
2718
filename ,
2720
2719
include_ports = False ,
2721
- forcefield_name = None ,
2722
- forcefield_files = None ,
2723
- forcefield_debug = False ,
2724
2720
box = None ,
2725
2721
overwrite = False ,
2726
2722
residues = None ,
2727
- combining_rule = "lorentz" ,
2728
- foyer_kwargs = None ,
2729
- parmed_kwargs = None ,
2730
2723
** kwargs ,
2731
2724
):
2732
2725
"""Save the Compound to a file.
@@ -2736,22 +2729,11 @@ def save(
2736
2729
filename : str
2737
2730
Filesystem path in which to save the trajectory. The extension or
2738
2731
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 .
2742
2735
include_ports : bool, optional, default=False
2743
2736
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.
2755
2737
box : mb.Box, optional, default=self.boundingbox (with buffer)
2756
2738
Box information to be written to the output file. If 'None', a
2757
2739
bounding box is used with 0.25nm buffers at each face to avoid
@@ -2761,50 +2743,25 @@ def save(
2761
2743
residues : str of list of str
2762
2744
Labels of residues in the Compound. Residues are assigned by
2763
2745
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`
2778
2746
**kwargs
2747
+ See `mbuild.conversion.save()`.
2779
2748
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
2782
2750
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
2784
2753
2785
2754
Other Parameters
2786
2755
----------------
2787
2756
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
2789
2758
for converting distance values to reduced units.
2790
2759
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
2792
2761
for converting energy values to reduced units.
2793
2762
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
2795
2764
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.
2808
2765
2809
2766
Notes
2810
2767
-----
@@ -2813,29 +2770,24 @@ def save(
2813
2770
* filename
2814
2771
* include_ports
2815
2772
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
+
2816
2778
See Also
2817
2779
--------
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
2825
2783
"""
2826
2784
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 ,
2839
2791
** kwargs ,
2840
2792
)
2841
2793
@@ -2985,6 +2937,21 @@ def to_gmso(self, **kwargs):
2985
2937
"""
2986
2938
return conversion .to_gmso (self , ** kwargs )
2987
2939
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
+
2988
2955
# Interface to Trajectory for reading/writing .pdb and .mol2 files.
2989
2956
# -----------------------------------------------------------------
2990
2957
def from_trajectory (
0 commit comments