BFEE2.templates_gromacs

This is the interface for generating Gromacs input files.

class BFEE2.templates_gromacs.BFEEGromacs.BFEEGromacs(structureFile, topologyFile, ligandOnlyStructureFile, ligandOnlyTopologyFile, baseDirectory=None)[source]

Bases: object

The entry class for handling gromacs inputs in BFEE.

logger

logger object for debugging

Type

logging.Logger

handler

output stream of the debug output

Type

logging.StreamHandler

baseDirectory

output directory of the generated files

Type

str

structureFile

filename of the structure file (either in PDB or GRO format) of the protein-ligand binding complex

Type

str

topologyFile

filename of the GROMACS topology file of the protein-ligand binding complex

Type

str

ligandOnlyStructureFile

filename of the structure file (either in PDB or GRO format) of the ligand-only system

Type

str

system

MDAnalysis universe of the protein-ligand binding system

Type

MDAnalysis.core.universe

ligandOnlySystem

MDAnalysis universe of the ligand-only system

Type

MDAnalysis.core.universe

basenames

subdirectory names of all eight steps

Type

str

ligand

selected HEAVY ATOMS of the ligand in the protein-ligand binding complex. This attribute does not exist until the call of setLigandHeavyAtomsGroup.

Type

MDAnalysis.core.groups.AtomGroup

ligandOnly

selected HEAVY ATOMS of the ligand in the ligand-only system. This attribute does not exist until the call of setLigandHeavyAtomsGroup.

Type

MDAnalysis.core.groups.AtomGroup

protein

selected HEAVY ATOMS of the protein in the protein-ligand binding complex. This attribute does not exist until the call of setProteinHeavyAtomsGroup.

Type

MDAnalysis.core.groups.AtomGroup

solvent

selected atoms of the solvents in the protein-ligand binding complex. This attribute does not exist until the call of setSolventAtomsGroup.

Type

MDAnalysis.core.groups.AtomGroup

temperature

the temperature of simulations (default : 300.0)

Type

float

generate000()[source]

generate files for running an equilibrium simulation

generate001()[source]

generate files for determining the PMF along the RMSD of the ligand with respect to its bound state

generate002()[source]

generate files for determining the PMF along the pitch (theta) angle of the ligand

generate003()[source]

generate files for determining the PMF along the roll (phi) angle of the ligand

generate004()[source]

generate files for determining the PMF along the yaw (psi) angle of the ligand

generate005()[source]

generate files for determining the PMF along the polar theta angle of the ligand relative to the protein

generate006()[source]

generate files for determining the PMF along the polar phi angle of the ligand relative to the protein

generate007()[source]

generate files for determining the PMF along the distance between the the ligand and the protein

generate008()[source]

generate files for determining the PMF along the RMSD of the ligand with respect to its unbound state

generateGromacsIndex(outputFile)[source]

generate a GROMACS index file for atom selection in Colvars

saveStructure(outputFile, selection='all')[source]

a helper method for selecting a group of atoms and save it

Parameters
  • outputFile (str) – filename of the output file

  • selection (str, optional) – MDAnalysis atom selection string. Defaults to ‘all’.

Raises

SelectionError – if the selection corresponds to nothing

setLigandHeavyAtomsGroup(selection)[source]
select the heavy atoms of the ligand in both the protein-ligand complex

and the ligand-only systems

Parameters

selection (str) – MDAnalysis atom selection string

Raises

SelectionError – if the selection corresponds to nothing

setProteinHeavyAtomsGroup(selection)[source]

select the heavy atoms of the protein

Parameters

selection (str) – MDAnalysis atom selection string

Raises

SelectionError – if the selection corresponds to nothing

setSolventAtomsGroup(selection)[source]

select the solvent atoms

Parameters

selection (str) – MDAnalysis atom selection string

Raises

SelectionError – if the selection corresponds nothing

setTemperature(newTemperature)[source]

set the temperature

Parameters

newTemperature (float) – new value of the temperature

exception BFEE2.templates_gromacs.BFEEGromacs.SelectionError(arg)[source]

Bases: RuntimeError

BFEE2.templates_gromacs.BFEEGromacs.generateColvars(colvarsTemplate, outputPrefix, logger=None, **kwargs)[source]

generate a Colvars configuration file from a template suffixed with ‘.dat’

Parameters
  • colvarsTemplate (str) – path to a colvars template

  • outputPrefix (str) – (no .dat extension) of the output Colvars configuration file

  • logger (Logging.logger, optional) – logger for debugging. Defaults to None.

  • **kwargs – additional arguments passed to safe_substitute()

BFEE2.templates_gromacs.BFEEGromacs.generateMDP(MDPTemplate, outputPrefix, timeStep, numSteps, temperature, pressure, logger=None)[source]

generate a GROMACS mdp file from a template

Parameters
  • MDPTemplate (str) – template MDP file with $dt and $nsteps

  • outputPrefix (str) – prefix (no .mdp extension) of the output MDP file

  • timeStep (float) – timestep for running the simulation

  • numSteps (int) – number of steps for running the simulation

  • temperature (float) – simulation temperature

  • pressure (float) – simulation pressure

  • logger (Logging.logger, optional) – logger for debugging. Defaults to None.

BFEE2.templates_gromacs.BFEEGromacs.generateShellScript(shellTemplate, outputPrefix, logger=None, **kwargs)[source]

generate a shell script from a template

Parameters
  • shellTemplate (str) – path to a shell template

  • outputPrefix (str) – prefix (no .sh extension) of the output Colvars configuration file

  • logger (Logging.logger, optional) – logger for debugging. Defaults to None.

  • **kwargs – additional arguments passed to safe_substitute()

BFEE2.templates_gromacs.BFEEGromacs.get_cell(atom_positions)[source]

mimic the VMD script get_cell.tcl to calculate the cell units

Parameters

atom_positions (numpy.array) – a numpy array containing the XYZ coordinates of N atoms. The shape should be (N, 3).

Returns

a shape of (3,3) array contains periodic cell information

Return type

Numpy.array

BFEE2.templates_gromacs.BFEEGromacs.mearsurePolarAngles(proteinCenter, ligandCenter)[source]

measure the polar angles between the protein and the ligand

Parameters
  • proteinCenter (numpy.array) – center-of-mass of the protein

  • ligandCenter (numpy.array) – center-of-mass of the ligand

Returns

a (theta, phi) tuple where theta and phi are measured in degrees

Return type

tuple

BFEE2.templates_gromacs.BFEEGromacs.measure_center(atom_positions)[source]

mimic the VMD command “measure center”

Parameters

atom_positions (numpy.array) – a numpy array containing the XYZ coordinates of N atoms. The shape should be (N, 3).

Returns

a shape of (3,) array contains the geometric center

Return type

Numpy.array

BFEE2.templates_gromacs.BFEEGromacs.measure_minmax(atom_positions)[source]

mimic the VMD command “measure minmax”

Parameters

atom_positions (numpy.array) – a numpy array containing the XYZ coordinates of N atoms. The shape should be (N, 3).

Returns

a shape of (2, 3) array, where the first subarray has the minimum

values in XYZ directions, and the second subarray has the maximum values in XYZ directions.

Return type

Numpy.array

BFEE2.templates_gromacs.BFEEGromacs.scanGromacsTopologyInclude(gmxTopFile, logger=None)[source]

scan the files included by a gromacs topology file

Parameters
  • gmxTopFile (str) – filename of the gromacs topology file

  • logger (Logging.logger, optional) – logger for debugging. Defaults to None.

Returns

tuple:

a (list, list) tuple. The first list contains the absolute pathnames of included files. The second list contains the strings in the quotation marks for handling relative paths.

Logging.logger:

logger for debugging

Return type

tuple