antechamber
– Generating forcefields with Antechamber¶
The antechamber submodule of mol.mm defines functions to use Antechamber (from
AmberTools) to automatically generate force field parameters and load the
results into Forcefield
objects.
Example usage:
from ost.mol import mm
# create parameters for RVP using PDB's component dictionary
mm.antechamber.RunAntechamber('RVP', 'components.cif', base_out_dir='ligands')
# create force field
ff = mm.Forcefield()
ff = mm.antechamber.AddFromPath(ff, 'ligands/RVP')
# equivalent: ff = mm.antechamber.AddFromFiles(ff, 'ligands/RVP/frcmod',
# 'ligands/RVP/out.mpdb')
# since Antechamber cannot deal with ions, you can do it manually
ff = mm.antechamber.AddIon(ff, 'CL', 'CL', 35.45, -1.0, 0.4401, 0.4184)
# save it
ff.Save('ligands/ff.dat')
Functions:
- AddFromFiles(force_field, frcmod_filename, mpdb_filename)¶
Add data from a frcmod and an mpdb file to a force field.
This will add a new
BuildingBlock
to force_field for the residue defined in those files (residue name is extracted from the mpdb file which can only contain a single residue). Charges for each atom are extracted from the mpdb file. According to the frcmod file, anInteraction
is added for each bond, angle, dihedral and improper. Atom types with masses and non-bonded interactions are added to force_field as needed.- Parameters:
force_field (
Forcefield
) – A force field object to which the new parameters are added.frcmod_filename (
str
) – Path tofrcmod
file as generated byparmchk2
.mpdb_filename (
str
) – Path to mpdb file as generated byantechamber
.
- Returns:
The updated force field (same as force_field).
- Return type:
- AddFromPath(force_field, out_dir)¶
Add data from a directory created with
Run()
to a force field. SeeAddFromFiles()
for details.- Parameters:
force_field (
Forcefield
) – A force field object to which the new parameters are added.out_dir (
str
) – Output directory as created withRun()
. Must contain filesfrcmod
andout.mpdb
.
- Returns:
The updated force field (same as force_field).
- Return type:
- AddIon(force_field, res_name, atom_name, atom_mass, atom_charge, lj_sigma, lj_epsilon)¶
Add a single atom as an ion to a force field.
Since Antechamber cannot deal with ions, you can add simple ones easily with this function. This adds a
BuildingBlock
to force_field for the given residue name containing a single atom. The atom will have a type with the same name as the atom name and the given mass, charge and non-bonded (LJ) interaction parameters.- Parameters:
force_field (
Forcefield
) – A force field object to which the ion is added.res_name (
str
) – Residue name for the ion to be added.atom_name (
str
) – Atom name which is also used as atom type name.atom_mass (
float
) – Mass of the atom.atom_charge (
float
) – Charge of the atom.lj_sigma (
float
in nm) – The sigma parameter for the non-bonded LJ interaction.lj_epsilon (
float
in kJ/mol) – The sigma parameter for the non-bonded LJ interaction.
- RunAntechamber(res_name, filename, format='ccif', amberhome=None, base_out_dir=None)¶
Run Antechamber to guess force field parameters for a given residue name.
This requires an installation of AmberTools (tested with AmberTools15) with binaries
antechamber
andparmchk2
.This has the same restrictions as Antechamber itself and we assume the input to be uncharged. Note that Antechamber cannot deal with metal ions and other non-organic elements.
The results are stored in a separate folder named res_name within base_out_dir (if given, otherwise the current working directory). The main output files are
frcmod
andout.mpdb
. The former contains force field parameters and masses. The latter maps atom names to atom types and defines the partial charges. The same output could be obtained as follows:$ antechamber -i <FILENAME> -fi <FORMAT> -bk '<RES_NAME>' -o out.mol2 -fo mol2 -c bcc -pf yes $ parmchk2 -i out.mol2 -f mol2 -o frcmod -a Y $ antechamber -i out.mol2 -fi mol2 -o out.mpdb -fo mpdb -pf yes
The force field parameters can be manually modified if needed. It can for instance happen that some parameters cannot be identified. Those lines will be marked with a comment “ATTN, need revision”.
- Parameters:
res_name (
str
) – Residue name for which we desire force field parameters.filename (
str
) – Path to a file which contains the necessary information for res_name. It must include all hydrogens.format (
str
) – Format of file given with filename. Common formats are ‘ccif’ for PDB’s component dictionary or ‘pdb’ for a PDB file containing the desired residue with all hydrogens.amberhome (
str
) – Base path of your AmberTools installation. If not None, we look forantechamber
andparmchk2
withinAMBERHOME/bin
additionally to the system’sPATH
.base_out_dir (
str
) – Path to a base path, where the output will be stored. If None, the current working directory is used.