NPTSampler

class grandfep.sampler.NPTSampler(system, topology, temperature, collision_rate, timestep, log, platform=<openmm.openmm.Platform; proxy of <Swig Object of type 'OpenMM::Platform *'> >, rst_file='md.rst7', dcd_file=None, append=False, set_reporter=True)

Bases: object

NPT Sampler class

Parameters:
  • system (openmm.System) – OpenMM system object, this system should include a barostat

  • topology (app.Topology) – OpenMM topology object

  • temperature (unit.Quantity) – Reference temperature of the system, with unit

  • collision_rate (unit.Quantity) – Collision rate of the system, with unit. e.g., 1 / (1.0 * unit.picoseconds)

  • timestep (unit.Quantity) – Timestep of the simulation, with unit. e.g., 4 * unit.femtoseconds with Hydrogen Mass Repartitioning

  • log (Union[str, Path]) – Log file path for the simulation

  • platform (openmm.Platform) – OpenMM platform to use for the simulation. Default is ‘CUDA’.

  • rst_file (str) – Restart file path for the simulation. Default is “md.rst7”.

  • dcd_file (str) – DCD file path for the simulation. Default is None, which means no dcd output.

  • append (bool) – If True, append to the existing dcd file. Default is False, which means overwrite the existing dcd file.

check_temperature()

Check the reference temperature in the integrator and barostat. If they are not close, raise an Error

Returns:

temperature

Return type:

unit.Quantity

load_rst(rst_input)

Load positions/boxVector/velocities from a restart file

Parameters:

rst_input (Union[str, Path]) – Amber inpcrd file

Return type:

None

report_dcd(state=None)

Append a frame to the DCD trajectory file.

Returns:

None

report_rst(state=None)

Write an Amber rst7 restart file.

Returns:

None

dcd_reporter_dict

A dictionary of all the dcd reporter. Call the reporter inside to write the dcd trajectory file.

kBT

kB* T, with unit.

logger

Logger for the Sampler

rst_reporter_dict

A dictionary of all the rst7 reporter. Call the reporter inside to write the rst7 restart file.

simulation: openmm.app.simulation.Simulation

Simulation ties together Topology, System, Integrator, and Context in this sampler.

system

The OpenMM System object.

temperature: openmm.unit.quantity.Quantity

reference temperature of the system, with unit

topology

The OpenMM Topology object. All the res_name, atom_index, atom_name, etc. are in this topology.