HOOMD-blue File Writers
Write GSD (General Simulation Data)
Default data file format for HOOMD-blue
GSD format.
https://gsd.readthedocs.io/en/stable/
- mbuild.formats.gsdwriter.write_gsd(structure, filename, ref_distance=1.0, ref_mass=1.0, ref_energy=1.0, rigid_bodies=None, shift_coords=True, write_special_pairs=True, **kwargs)[source]
Output a GSD file (HOOMD v2 default data format).
- Parameters
- structureparmed.Structure
ParmEd Structure object
- filenamestr
Path of the output file.
- ref_distancefloat, optional, default=1.0
Reference distance for conversion to reduced units
- ref_massfloat, optional, default=1.0
Reference mass for conversion to reduced units
- ref_energyfloat, optional, default=1.0
Reference energy for conversion to reduced units
- rigid_bodieslist of int, optional, default=None
List of rigid body information. An integer value is required for each atom corresponding to the index of the rigid body the particle is to be associated with. A value of None indicates the atom is not part of a rigid body.
- shift_coordsbool, optional, default=True
Shift coordinates from (0, L) to (-L/2, L/2) if necessary.
- write_special_pairsbool, optional, default=True
Writes out special pair information necessary to correctly use the OPLS fudged 1,4 interactions in HOOMD.
Notes
Force field parameters are not written to the GSD file and must be included manually into a HOOMD input script.
Create HOOMD-blue force field (>= 3.0)
HOOMD v3 forcefield format.
- mbuild.formats.hoomd_forcefield.create_hoomd_forcefield(structure, r_cut, ref_distance=1.0, ref_mass=1.0, ref_energy=1.0, auto_scale=False, nlist_buffer=0.4, snapshot_kwargs={}, pppm_kwargs={'Nx': 8, 'Ny': 8, 'Nz': 8, 'order': 4}, init_snap=None)[source]
Convert a parametrized pmd.Structure to a HOOMD snapshot and forces.
- Parameters
- structureparmed.Structure
ParmEd Structure object
- r_cutfloat
Cutoff radius in simulation units
- ref_distancefloat, optional, default=1.0
Reference distance for unit conversion (from Angstrom)
- ref_massfloat, optional, default=1.0
Reference mass for unit conversion (from Dalton)
- ref_energyfloat, optional, default=1.0
Reference energy for unit conversion (from kcal/mol)
- auto_scalebool, optional, default=False
Scale to reduced units by automatically using the largest sigma value as ref_distance, largest mass value as ref_mass, and largest epsilon value as ref_energy
- nlist_bufferfloat, optional, default=True
buffer argument to pass to hoomd.md.nlist.Cell
- snapshot_kwargsdict
Keyword arguments to pass to to_hoomdsnapshot
- pppm_kwargsdict
Keyword arguments to pass to hoomd.md.long_range.pppm.make_pppm_coulomb_forces
- init_snaphoomd.Snapshot, optional, default=None
Initial snapshot to which to add the ParmEd structure object (useful for rigid bodies)
- Returns
- hoomd_snapshothoomd.Snapshot
HOOMD snapshot object to initialize the simulation
- hoomd_forcefieldlist[hoomd.md.force.Force]
List of hoomd force computes created during conversion
- ReferenceValuesnamedtuple
Values used in scaling
Create HOOMD-blue Simulation (v2.x)
HOOMD simulation format.
- mbuild.formats.hoomd_simulation.create_hoomd_simulation(structure, r_cut, ref_distance=1.0, ref_mass=1.0, ref_energy=1.0, auto_scale=False, snapshot_kwargs={}, pppm_kwargs={'Nx': 8, 'Ny': 8, 'Nz': 8, 'order': 4}, init_snap=None, restart=None, nlist=<Mock name='mock.md.nlist.cell' id='140519230441072'>)[source]
Convert a parametrized pmd.Structure to hoomd.SimulationContext.
- Parameters
- structureparmed.Structure
ParmEd Structure object
- r_cutfloat
Cutoff radius in simulation units
- ref_distancefloat, optional, default=1.0
Reference distance for unit conversion (from Angstrom)
- ref_massfloat, optional, default=1.0
Reference mass for unit conversion (from Dalton)
- ref_energyfloat, optional, default=1.0
Reference energy for unit conversion (from kcal/mol)
- auto_scalebool, optional, default=False
Scale to reduced units by automatically using the largest sigma value as ref_distance, largest mass value as ref_mass, and largest epsilon value as ref_energy
- snapshot_kwargsdict
Kwargs to pass to to_hoomdsnapshot
- pppm_kwargsdict
Kwargs to pass to hoomd’s pppm function
- init_snaphoomd.data.SnapshotParticleData, optional, default=None
Initial snapshot to which to add the ParmEd structure object (useful for rigid bodies)
- restartstr, optional, default=None
Path to the gsd file from which to restart the simulation. https://hoomd-blue.readthedocs.io/en/v2.9.4/restartable-jobs.html Note: It is assumed that the ParmEd structure and the system in restart.gsd contain the same types. The ParmEd structure is still used to initialize the forces, but restart.gsd is used to initialize the system state (e.g., particle positions, momenta, etc).
- nlisthoomd.md.nlist, default=hoomd.md.nlist.cell
Type of neighborlist to use, see https://hoomd-blue.readthedocs.io/en/stable/module-md-nlist.html for more information.
- Returns
- hoomd_objectslist
List of hoomd objects created during conversion
- ReferenceValuesnamedtuple
Values used in scaling
HOOMD-blue Snapshot
HOOMD snapshot format.
- mbuild.formats.hoomd_snapshot.from_snapshot(snapshot, scale=1.0)[source]
Convert a Snapshot to a Compound.
Snapshot can be a hoomd.Snapshot or a gsd.hoomd.Snapshot.
- Parameters
- snapshothoomd.Snapshot or gsd.hoomd.Snapshot
Snapshot from which to build the mbuild Compound.
- scalefloat, optional, default 1.0
Value by which to scale the length values
- Returns
- compCompound
- mbuild.formats.hoomd_snapshot.to_hoomdsnapshot(structure, ref_distance=1.0, ref_mass=1.0, ref_energy=1.0, rigid_bodies=None, shift_coords=True, write_special_pairs=True, auto_scale=False, parmed_kwargs={}, hoomd_snapshot=None)[source]
Convert a Compound or parmed.Structure to hoomd.Snapshot.
- Parameters
- structureparmed.Structure
ParmEd Structure object
- ref_distancefloat, optional, default=1.0
Reference distance for conversion to reduced units
- ref_massfloat, optional, default=1.0
Reference mass for conversion to reduced units
- ref_energyfloat, optional, default=1.0
Reference energy for conversion to reduced units
- rigid_bodieslist of int, optional, default=None
List of rigid body information. An integer value is required for each atom corresponding to the index of the rigid body the particle is to be associated with. A value of None indicates the atom is not part of a rigid body.
- shift_coordsbool, optional, default=True
Shift coordinates from (0, L) to (-L/2, L/2) if necessary.
- auto_scalebool, optional, default=False
Automatically use largest sigma value as ref_distance, largest mass value as ref_mass and largest epsilon value as ref_energy
- write_special_pairsbool, optional, default=True
Writes out special pair information necessary to correctly use the OPLS fudged 1,4 interactions in HOOMD.
- hoomd_snapshothoomd.Snapshot, optional, default=None
Initial snapshot to which to add the ParmEd structure object. The box information of the initial snapshot will be overwritten. (useful for rigid bodies)
- Returns
- hoomd_snapshothoomd.Snapshot
- ReferenceValuesnamedtuple
Values used in scaling
Notes
Force field parameters are not written to the hoomd_snapshot