mofbuilder.md.OpenmmSetup#

class mofbuilder.md.OpenmmSetup(gro_file, top_file, temperature_K=300, timestep_fs=1, comm=None, ostream=None)[source]#

Bases: object

Set up and execute GROMACS/OPENMM simulations for molecular dynamics.

Handles system initialization, energy minimization, equilibration in NVT/NPT ensembles, and trajectory/log file writing, with parallel output support via MPI.

Parameters:
  • gro_file (str)

  • top_file (str)

  • temperature_K (float)

  • timestep_fs (float)

  • comm (Any | None)

  • ostream (veloxchem.outputstream.OutputStream | None)

comm#

MPI communicator.

Type:

Any

rank#

MPI process rank.

Type:

int

nodes#

Number of MPI processes.

Type:

int

ostream#

Output stream for printing/logging.

Type:

OutputStream

system_pbc#

Whether to use periodic boundary conditions.

Type:

bool

gro_file#

Path to GROMACS .gro coordinates file.

Type:

str

top_file#

Path to GROMACS .top topology file.

Type:

str

temperature_K#

Simulation temperature in Kelvin.

Type:

float

timestep_fs#

Integration timestep in femtoseconds.

Type:

float

gro#

Loaded GROMACS structure file (GromacsGroFile).

top#

Loaded GROMACS topology file (GromacsTopFile).

positions#

Atomic positions.

barostat_added#

Tracks if barostat has been added for NPT.

Type:

bool

simulation#

The OpenMM Simulation object (initialized on demand).

temperature#

Temperature (set during pipeline).

Type:

openmm.unit.Quantity

timestep#

Timestep (set during pipeline).

Type:

openmm.unit.Quantity

system#

OpenMM System object (set during pipeline).

run_em(output_prefix='em', whole_traj_file=None)[source]#

Performs energy minimization using OpenMM and writes output.

Writes a minimized structure (PDB) to disk and logs potential/temperature. Optionally appends coordinates to a trajectory PDB.

Parameters:
  • output_prefix (str, optional) – Prefix for output and log files.

  • whole_traj_file (Optional[str], optional) – If provided, append structure to this PDB.

Return type:

None

run_nvt(nvt_time=100, output_prefix='nvt', record_interval=1, whole_traj_file=None)[source]#

Run an NVT (constant volume) MD segment.

Parameters:
  • nvt_time (float, optional) – Simulation time (ps).

  • output_prefix (str, optional) – Output file prefix.

  • record_interval (float, optional) – Frame/log interval (ps).

  • whole_traj_file (Optional[str], optional) – Append all frames to this PDB if provided.

Return type:

None

run_npt(npt_time=100, output_prefix='npt', record_interval=1, whole_traj_file=None)[source]#

Run an NPT (constant pressure) MD segment.

Parameters:
  • npt_time (float, optional) – Simulation time (ps).

  • output_prefix (str, optional) – Output file prefix.

  • record_interval (float, optional) – Frame/log interval (ps).

  • whole_traj_file (Optional[str], optional) – Append all frames to this PDB if provided.

Return type:

None

run_pipeline(steps=None, nvt_time=100, npt_time=100, output_prefix='mdsim', record_interval=1, whole_traj=False)[source]#

Executes an MD workflow: minimization, NVT, and/or NPT on demand.

The method prepares the system, then runs the requested steps in order. If whole_traj is enabled, all coordinates are appended to a single trajectory PDB.

Parameters:
  • steps (Optional[List[str]], optional) – List of stages to run (e.g., [‘em’, ‘nvt’, ‘npt’]).

  • nvt_time (float, optional) – Time for NVT segment (ps).

  • npt_time (float, optional) – Time for NPT segment (ps).

  • output_prefix (str, optional) – Prefix for all outputs/logs.

  • record_interval (float, optional) – Frame/log interval (ps).

  • whole_traj (bool, optional) – If True, write all frames to a single PDB.

Return type:

None

Note

The system and OpenMM integrator are initialized in this function.