ForceBalance API  1.3
Automated optimization of force fields and empirical potentials
List of all members | Public Member Functions | Public Attributes
src.gmxio.GMX Class Reference

Derived from Engine object for carrying out general purpose GROMACS calculations. More...

Inheritance diagram for src.gmxio.GMX:
[legend]
Collaboration diagram for src.gmxio.GMX:
[legend]

Public Member Functions

def __init__ (self, name="gmx", kwargs)
 
def setopts (self, kwargs)
 Called by init ; Set GROMACS-specific options. More...
 
def readsrc (self, kwargs)
 Called by init ; read files from the source directory. More...
 
def prepare (self, pbc=False, kwargs)
 Called by init ; prepare the temp directory and figure out the topology. More...
 
def get_charges (self)
 
def links (self)
 
def callgmx (self, command, stdin=None, print_to_screen=False, print_command=False, kwargs)
 Call GROMACS; prepend the gmxpath to the call to the GROMACS program. More...
 
def warngmx (self, command, warnings=[], maxwarn=1, kwargs)
 Call gromacs and allow for certain expected warnings. More...
 
def energy_termnames (self, edrfile=None)
 Get a list of energy term names from the .edr file by parsing a system call to g_energy. More...
 
def optimize (self, shot, crit=1e-4, align=True, kwargs)
 Optimize the geometry and align the optimized geometry to the starting geometry. More...
 
def evaluate_ (self, force=False, dipole=False, traj=None)
 Utility function for computing energy, and (optionally) forces and dipoles using GROMACS. More...
 
def evaluate_snapshot (self, shot, force=False, dipole=False)
 Evaluate variables (energies, force and/or dipole) using GROMACS for a single snapshot. More...
 
def evaluate_trajectory (self, force=False, dipole=False, traj=None)
 Evaluate variables (energies, force and/or dipole) using GROMACS over a trajectory. More...
 
def make_gro_trajectory (self, fout=None)
 Return the MD trajectory as a Molecule object. More...
 
def energy_one (self, shot)
 Compute the energy using GROMACS for a snapshot. More...
 
def energy_force_one (self, shot)
 Compute the energy and force using GROMACS for a single snapshot; interfaces with AbInitio target. More...
 
def energy (self, traj=None)
 Compute the energy using GROMACS over a trajectory. More...
 
def energy_force (self, force=True, traj=None)
 Compute the energy and force using GROMACS over a trajectory. More...
 
def energy_dipole (self, traj=None)
 
def energy_rmsd (self, shot, optimize=True)
 Calculate energy of the selected structure (optionally minimize and return the minimized energy and RMSD). More...
 
def interaction_energy (self, fraga, fragb)
 Computes the interaction energy between two fragments over a trajectory. More...
 
def multipole_moments (self, shot=0, optimize=True, polarizability=False)
 Return the multipole moments of the 1st snapshot in Debye and Buckingham units. More...
 
def normal_modes (self, shot=0, optimize=True)
 
def generate_positions (self)
 
def n_snaps (self, nsteps, step_interval, timestep)
 
def scd_persnap (self, ndx, timestep, final_frame)
 
def calc_scd (self, n_snap, timestep)
 
def n_nonwater (self, structure_file)
 
def molecular_dynamics (self, nsteps, timestep, temperature=None, pressure=None, nequil=0, nsave=0, minimize=True, threads=None, verbose=False, bilayer=False, kwargs)
 Method for running a molecular dynamics simulation. More...
 
def md (self, nsteps=0, nequil=0, verbose=False, deffnm=None, kwargs)
 Method for running a molecular dynamics simulation. More...
 

Public Attributes

 valkwd
 Valid GROMACS-specific keywords. More...
 
 gmxsuffix
 Disable some optimizations. More...
 
 gmx_eq_barostat
 Barostat keyword for equilibration. More...
 
 gmxpath
 The directory containing GROMACS executables (e.g. More...
 
 gmxversion
 Figure out the GROMACS version - it will determine how programs are called. More...
 
 top
 Attempt to determine file names of .gro, .top, and .mdp files. More...
 
 mdp
 
 mol
 
 gmx_defs
 
 pbc
 
 have_constraints
 Link files into the temp directory. More...
 
 double
 Write out the trajectory coordinates to a .gro file. More...
 
 AtomMask
 
 AtomLists
 
 mdtraj
 
 mdene
 

Detailed Description

Derived from Engine object for carrying out general purpose GROMACS calculations.

Definition at line 533 of file gmxio.py.

Constructor & Destructor Documentation

◆ __init__()

def src.gmxio.GMX.__init__ (   self,
  name = "gmx",
  kwargs 
)

Definition at line 536 of file gmxio.py.

Member Function Documentation

◆ calc_scd()

def src.gmxio.GMX.calc_scd (   self,
  n_snap,
  timestep 
)

Definition at line 1194 of file gmxio.py.

Here is the call graph for this function:

◆ callgmx()

def src.gmxio.GMX.callgmx (   self,
  command,
  stdin = None,
  print_to_screen = False,
  print_command = False,
  kwargs 
)

Call GROMACS; prepend the gmxpath to the call to the GROMACS program.

Definition at line 793 of file gmxio.py.

Here is the call graph for this function:

◆ energy()

def src.gmxio.GMX.energy (   self,
  traj = None 
)

Compute the energy using GROMACS over a trajectory.

Definition at line 1015 of file gmxio.py.

Here is the call graph for this function:

◆ energy_dipole()

def src.gmxio.GMX.energy_dipole (   self,
  traj = None 
)

Definition at line 1028 of file gmxio.py.

Here is the call graph for this function:

◆ energy_force()

def src.gmxio.GMX.energy_force (   self,
  force = True,
  traj = None 
)

Compute the energy and force using GROMACS over a trajectory.

Definition at line 1022 of file gmxio.py.

Here is the call graph for this function:

◆ energy_force_one()

def src.gmxio.GMX.energy_force_one (   self,
  shot 
)

Compute the energy and force using GROMACS for a single snapshot; interfaces with AbInitio target.

Definition at line 1007 of file gmxio.py.

Here is the call graph for this function:

◆ energy_one()

def src.gmxio.GMX.energy_one (   self,
  shot 
)

Compute the energy using GROMACS for a snapshot.

Definition at line 1000 of file gmxio.py.

Here is the call graph for this function:

◆ energy_rmsd()

def src.gmxio.GMX.energy_rmsd (   self,
  shot,
  optimize = True 
)

Calculate energy of the selected structure (optionally minimize and return the minimized energy and RMSD).

In kcal/mol.

Definition at line 1034 of file gmxio.py.

Here is the call graph for this function:

◆ energy_termnames()

def src.gmxio.GMX.energy_termnames (   self,
  edrfile = None 
)

Get a list of energy term names from the .edr file by parsing a system call to g_energy.

Definition at line 857 of file gmxio.py.

Here is the call graph for this function:

◆ evaluate_()

def src.gmxio.GMX.evaluate_ (   self,
  force = False,
  dipole = False,
  traj = None 
)

Utility function for computing energy, and (optionally) forces and dipoles using GROMACS.

Inputs: force: Switch for calculating the force. dipole: Switch for calculating the dipole. traj: Trajectory file name. If present, will loop over these snapshots. Otherwise will do a single point evaluation at the current geometry.

Outputs: Result: Dictionary containing energies, forces and/or dipoles.

Definition at line 935 of file gmxio.py.

Here is the call graph for this function:

◆ evaluate_snapshot()

def src.gmxio.GMX.evaluate_snapshot (   self,
  shot,
  force = False,
  dipole = False 
)

Evaluate variables (energies, force and/or dipole) using GROMACS for a single snapshot.

Definition at line 968 of file gmxio.py.

Here is the call graph for this function:

◆ evaluate_trajectory()

def src.gmxio.GMX.evaluate_trajectory (   self,
  force = False,
  dipole = False,
  traj = None 
)

Evaluate variables (energies, force and/or dipole) using GROMACS over a trajectory.

Definition at line 977 of file gmxio.py.

Here is the call graph for this function:

◆ generate_positions()

def src.gmxio.GMX.generate_positions (   self)

Definition at line 1172 of file gmxio.py.

Here is the call graph for this function:

◆ get_charges()

def src.gmxio.GMX.get_charges (   self)

Definition at line 769 of file gmxio.py.

Here is the call graph for this function:

◆ interaction_energy()

def src.gmxio.GMX.interaction_energy (   self,
  fraga,
  fragb 
)

Computes the interaction energy between two fragments over a trajectory.

Definition at line 1049 of file gmxio.py.

Here is the call graph for this function:

◆ links()

def src.gmxio.GMX.links (   self)

Definition at line 785 of file gmxio.py.

Here is the call graph for this function:

◆ make_gro_trajectory()

def src.gmxio.GMX.make_gro_trajectory (   self,
  fout = None 
)

Return the MD trajectory as a Molecule object.

Definition at line 990 of file gmxio.py.

Here is the call graph for this function:

◆ md()

def src.gmxio.GMX.md (   self,
  nsteps = 0,
  nequil = 0,
  verbose = False,
  deffnm = None,
  kwargs 
)

Method for running a molecular dynamics simulation.

A little different than molecular_dynamics (for thermo.py)

   Required arguments:

   nsteps = (int) Number of total time steps

   nequil = (int) Number of additional time steps at the beginning
   for equilibration

   verbose = (bool) Be loud and noisy

   deffnm = (string) default names for simulation output files

   The simulation data is written to the working directory.

Definition at line 1406 of file gmxio.py.

Here is the call graph for this function:

◆ molecular_dynamics()

def src.gmxio.GMX.molecular_dynamics (   self,
  nsteps,
  timestep,
  temperature = None,
  pressure = None,
  nequil = 0,
  nsave = 0,
  minimize = True,
  threads = None,
  verbose = False,
  bilayer = False,
  kwargs 
)

Method for running a molecular dynamics simulation.

Required arguments: nsteps = (int) Number of total time steps timestep = (float) Time step in FEMTOSECONDS temperature = (float) Temperature control (Kelvin) pressure = (float) Pressure control (atmospheres) nequil = (int) Number of additional time steps at the beginning for equilibration nsave = (int) Step interval for saving data minimize = (bool) Perform an energy minimization prior to dynamics threads = (int) Number of MPI-threads

Returns simulation data: Rhos = (array) Density in kilogram m^-3 Potentials = (array) Potential energies Kinetics = (array) Kinetic energies Volumes = (array) Box volumes Dips = (3xN array) Dipole moments EComps = (dict) Energy components Als = (array) Average area per lipid in nm^2 Scds = (Nx28 array) Deuterium order parameter

Definition at line 1241 of file gmxio.py.

Here is the call graph for this function:

◆ multipole_moments()

def src.gmxio.GMX.multipole_moments (   self,
  shot = 0,
  optimize = True,
  polarizability = False 
)

Return the multipole moments of the 1st snapshot in Debye and Buckingham units.

Definition at line 1085 of file gmxio.py.

Here is the call graph for this function:

◆ n_nonwater()

def src.gmxio.GMX.n_nonwater (   self,
  structure_file 
)

Definition at line 1211 of file gmxio.py.

◆ n_snaps()

def src.gmxio.GMX.n_snaps (   self,
  nsteps,
  step_interval,
  timestep 
)

Definition at line 1180 of file gmxio.py.

◆ normal_modes()

def src.gmxio.GMX.normal_modes (   self,
  shot = 0,
  optimize = True 
)

Definition at line 1136 of file gmxio.py.

Here is the call graph for this function:

◆ optimize()

def src.gmxio.GMX.optimize (   self,
  shot,
  crit = 1e-4,
  align = True,
  kwargs 
)

Optimize the geometry and align the optimized geometry to the starting geometry.

Definition at line 889 of file gmxio.py.

Here is the call graph for this function:

◆ prepare()

def src.gmxio.GMX.prepare (   self,
  pbc = False,
  kwargs 
)

Called by init ; prepare the temp directory and figure out the topology.

Definition at line 608 of file gmxio.py.

◆ readsrc()

def src.gmxio.GMX.readsrc (   self,
  kwargs 
)

Called by init ; read files from the source directory.

Definition at line 596 of file gmxio.py.

◆ scd_persnap()

def src.gmxio.GMX.scd_persnap (   self,
  ndx,
  timestep,
  final_frame 
)

Definition at line 1183 of file gmxio.py.

Here is the call graph for this function:

◆ setopts()

def src.gmxio.GMX.setopts (   self,
  kwargs 
)

Called by init ; Set GROMACS-specific options.

Definition at line 543 of file gmxio.py.

◆ warngmx()

def src.gmxio.GMX.warngmx (   self,
  command,
  warnings = [],
  maxwarn = 1,
  kwargs 
)

Call gromacs and allow for certain expected warnings.

Definition at line 815 of file gmxio.py.

Here is the call graph for this function:

Member Data Documentation

◆ AtomLists

src.gmxio.GMX.AtomLists

Definition at line 737 of file gmxio.py.

◆ AtomMask

src.gmxio.GMX.AtomMask

Definition at line 736 of file gmxio.py.

◆ double

src.gmxio.GMX.double

Write out the trajectory coordinates to a .gro file.

At this point, we could have gotten a .mdp file from the target folder or as part of the force field. If it still missing, then we may write a default. Call grompp followed by gmxdump to read the trajectory

Definition at line 731 of file gmxio.py.

◆ gmx_defs

src.gmxio.GMX.gmx_defs

Definition at line 610 of file gmxio.py.

◆ gmx_eq_barostat

src.gmxio.GMX.gmx_eq_barostat

Barostat keyword for equilibration.

Definition at line 560 of file gmxio.py.

◆ gmxpath

src.gmxio.GMX.gmxpath

The directory containing GROMACS executables (e.g.

mdrun)

Definition at line 565 of file gmxio.py.

◆ gmxsuffix

src.gmxio.GMX.gmxsuffix

Disable some optimizations.

The suffix to GROMACS executables, e.g. '_d' for double precision.

Definition at line 553 of file gmxio.py.

◆ gmxversion

src.gmxio.GMX.gmxversion

Figure out the GROMACS version - it will determine how programs are called.

Always, always remove backup files.

Create symbolic links (mainly for the case of .top and .mdp files which don't exist at object creation) Call a GROMACS program as you would from the command line.

Definition at line 570 of file gmxio.py.

◆ have_constraints

src.gmxio.GMX.have_constraints

Link files into the temp directory.

Write the appropriate coordinate files.

Read the .mdp file to determine if there are constraints.

Definition at line 616 of file gmxio.py.

◆ mdene

src.gmxio.GMX.mdene

Definition at line 1459 of file gmxio.py.

◆ mdp

src.gmxio.GMX.mdp

Definition at line 600 of file gmxio.py.

◆ mdtraj

src.gmxio.GMX.mdtraj

Definition at line 1327 of file gmxio.py.

◆ mol

src.gmxio.GMX.mol

Definition at line 602 of file gmxio.py.

◆ pbc

src.gmxio.GMX.pbc

Definition at line 615 of file gmxio.py.

◆ top

src.gmxio.GMX.top

Attempt to determine file names of .gro, .top, and .mdp files.

Definition at line 599 of file gmxio.py.

◆ valkwd

src.gmxio.GMX.valkwd

Valid GROMACS-specific keywords.

Definition at line 538 of file gmxio.py.


The documentation for this class was generated from the following file: