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

Remove deprecated formats, update reader and writer backends #1191

Merged
merged 46 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0b0f0b6
remove hoomdxml
chrisjonesBSU Jul 2, 2024
e65c823
remove protobuf
chrisjonesBSU Jul 2, 2024
90c42dd
remove hoomd3 force writers
chrisjonesBSU Jul 2, 2024
8fd26d4
change backend for mol2 and xyz to gmso
chrisjonesBSU Jul 2, 2024
90d77b6
remove protobuf from dev environments
chrisjonesBSU Jul 2, 2024
dda2160
add some TODO notes
chrisjonesBSU Jul 3, 2024
904eba7
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Aug 7, 2024
b42fd4c
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Aug 19, 2024
afa108f
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Aug 19, 2024
9b2536a
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Aug 20, 2024
7602f35
change behavior of xyz test
chrisjonesBSU Aug 22, 2024
99e8146
Merge branch 'remove-dep' of github.com:chrisjonesBSU/mbuild into rem…
chrisjonesBSU Aug 22, 2024
1ed5413
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Aug 26, 2024
a36825a
comment out test for elements
chrisjonesBSU Aug 26, 2024
5079233
fix test based on expected behavior for xyz files, remove wrong n ato…
chrisjonesBSU Aug 26, 2024
11b385e
remove lammpsdata and tests
chrisjonesBSU Aug 29, 2024
8c417bf
Merge branch 'remove-dep' of github.com:chrisjonesBSU/mbuild into rem…
chrisjonesBSU Aug 29, 2024
98ac3c3
remove duplicate benzene fixture that reads benzene from a mol2 file
chrisjonesBSU Sep 9, 2024
aa3e726
update benzene naming to fix failing rigid tests
CalCraven Sep 13, 2024
6f82f71
Merge branch 'main' of github.com:mosdef-hub/mbuild into remove-dep
chrisjonesBSU Sep 13, 2024
95ab814
add hoomd_writer file that has GSD and snapshot writer
chrisjonesBSU Sep 13, 2024
4edad91
fix typo
chrisjonesBSU Sep 13, 2024
bc06bec
add else statement
chrisjonesBSU Sep 13, 2024
b8b123b
move to_hoomdsnapshot to conversion, add method in Compound class. De…
chrisjonesBSU Sep 13, 2024
1767c84
fix import
chrisjonesBSU Sep 13, 2024
fb25fe4
remove hoomd writer file, add TODO flags to conversion
chrisjonesBSU Sep 13, 2024
47d8012
add TODO notes, pass in overwrite to Topology.save(), comment out fil…
chrisjonesBSU Sep 16, 2024
595455c
remove tests for gsd, hoomd, cassandra and par writers, move tests fo…
chrisjonesBSU Sep 16, 2024
b4d333a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
3b02288
add check for charges back in save method
chrisjonesBSU Sep 16, 2024
2d148d3
Merge branch 'remove-dep' of github.com:chrisjonesBSU/mbuild into rem…
chrisjonesBSU Sep 16, 2024
885daee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
06c3c59
add if statement before checking charge is neutral
chrisjonesBSU Sep 16, 2024
053310a
remove .top from unit test
chrisjonesBSU Sep 17, 2024
af08a07
remove lammps and lammpsdata files from tests and support in conversi…
chrisjonesBSU Oct 3, 2024
5a60080
Don't use gmso mol2 backend
chrisjonesBSU Oct 5, 2024
955d999
Don't use gmso mol2 backend
chrisjonesBSU Oct 5, 2024
f5bdaf6
remove gmso as backend for mol2 saver
chrisjonesBSU Oct 6, 2024
b358ca4
remove Hoomd V3 test from CI
chrisjonesBSU Oct 6, 2024
d24c889
remove par writer and xyz reader/write
chrisjonesBSU Oct 6, 2024
b625c6b
pin gmso to latest ver in window env file
chrisjonesBSU Oct 21, 2024
e51631b
add has_hoomd back to io.py, handle tests that use hoomd via gmso
chrisjonesBSU Oct 25, 2024
d50d101
fix syntax
chrisjonesBSU Oct 25, 2024
e42cd01
remove unused import
chrisjonesBSU Oct 25, 2024
ef0b34f
update doc strings with new links, correct file types and methods
chrisjonesBSU Oct 26, 2024
bbffe82
add saver mapping to compound.save doc strings
chrisjonesBSU Oct 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion environment-dev-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- parmed>=3.4.3
- pip
- pre-commit
- protobuf
- py3Dmol
- pycifrw
- pytest
Expand Down
1 change: 0 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
- parmed>=3.4.3
- pip
- pre-commit
- protobuf
- py3Dmol
- pycifrw
- pytest
Expand Down
28 changes: 21 additions & 7 deletions mbuild/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -2997,7 +2997,7 @@ def save(
filename : str
Filesystem path in which to save the trajectory. The extension or
prefix will be parsed and control the format. Supported extensions:
'hoomdxml', 'gsd', 'gro', 'top', 'lammps', 'lmp', 'mcf', 'pdb', 'xyz',
'gsd', 'gro', 'top', 'lammps', 'lmp', 'mcf', 'pdb', 'xyz',
'json', 'mol2', 'sdf', 'psf'. See parmed/structure.py for more
information on savers.
include_ports : bool, optional, default=False
Expand Down Expand Up @@ -3030,29 +3030,29 @@ def save(
foyer_kwargs : dict, optional, default=None
Keyword arguments to provide to `foyer.Forcefield.apply`.
Depending on the file extension these will be passed to either
`write_gsd`, `write_hoomdxml`, `write_lammpsdata`,
`write_gsd`, `write_lammpsdata`,
`write_mcf`, or `parmed.Structure.save`.
See `parmed structure documentation
<https://parmed.github.io/ParmEd/html/structobj/parmed.structure.Structure.html#parmed.structure.Structure.save>`_
parmed_kwargs : dict, optional, default=None
Keyword arguments to provide to :meth:`mbuild.Compound.to_parmed`
**kwargs
Depending on the file extension these will be passed to either
`write_gsd`, `write_hoomdxml`, `write_lammpsdata`, `write_mcf`, or
`write_gsd`, `write_lammpsdata`, `write_mcf`, or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to pass the following conversion mapping in the documentation. Then we just link to

def save(
for more details?

`{GMSO: {".gro", ".gsd". ".data", ".xyz", ".mcf", ".top"},
ParmEd: {".mol2", ".pdb", ".prmtop", ".cif", ".crd"},
PyBel:{".sdf"}}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. This should be done, along with the other suggestions.

chrisjonesBSU marked this conversation as resolved.
Show resolved Hide resolved
`parmed.Structure.save`.
See https://parmed.github.io/ParmEd/html/structobj/parmed.structure.
Structure.html#parmed.structure.Structure.save

Other Parameters
----------------
ref_distance : float, optional, default=1.0
Normalization factor used when saving to .gsd and .hoomdxml formats
Normalization factor used when saving to the .gsd format
for converting distance values to reduced units.
ref_energy : float, optional, default=1.0
Normalization factor used when saving to .gsd and .hoomdxml formats
Normalization factor used when saving to the .gsd format
for converting energy values to reduced units.
ref_mass : float, optional, default=1.0
Normalization factor used when saving to .gsd and .hoomdxml formats
Normalization factor used when saving to the .gsd format
for converting mass values to reduced units.
atom_style: str, default='full'
Defines the style of atoms to be saved in a LAMMPS data file. The
Expand All @@ -3078,7 +3078,6 @@ def save(
--------
conversion.save : Main saver logic
formats.gsdwrite.write_gsd : Write to GSD format
formats.hoomdxml.write_hoomdxml : Write to Hoomd XML format
formats.xyzwriter.write_xyz : Write to XYZ format
formats.lammpsdata.write_lammpsdata : Write to LAMMPS data format
formats.cassandramcf.write_mcf : Write to Cassandra MCF format
Expand Down Expand Up @@ -3246,6 +3245,21 @@ def to_gmso(self, **kwargs):
"""
return conversion.to_gmso(self, **kwargs)

def to_hoomdsnapshot(self, **kwargs):
"""Create a HOOMD-Blue snapshot from an mBuild Compound.

Parameters
----------
compound : mb.Compound
The mb.Compound to be converted.

Returns
-------
snapshot : gsd.hoomd.Frame
HOOMD-Blue compatible topology.
"""
return conversion.to_hoomdsnapshot(self, **kwargs)

# Interface to Trajectory for reading/writing .pdb and .mol2 files.
# -----------------------------------------------------------------
def from_trajectory(
Expand Down
Loading
Loading