Topo
Provides a class for generating Amber topology and coordinate files using the tleap
program.
This module defines the AmberTopoGen
class, which inherits from
simlify.simulation.topo.TopoGen
. It implements the logic to create input files for
tleap
, execute tleap
, and parse its output to generate Amber topology (.prmtop
)
and coordinate (.inpcrd
) files. It also handles the loading of force fields,
solvation, and ion addition based on the provided SimlifyConfig
.
FF_WATER_SOLVENT_BOX_MAP = {'tip3p': 'TIP3PBOX', 'tip4p': 'TIP4PBOX', 'tip4pew': 'TIP4PEWBOX', 'tip5p': 'TIP5PBOX', 'opc': 'OPCBOX', 'opc3': 'OPC3BOX', 'pol3': 'POL3BOX', 'spce': 'SPCBOX'}
¶
Maps ff_water
in simulation contexts to tleap box types.
TLEAP_PATH = os.environ.get('TLEAP_PATH', 'tleap')
¶
AmberTopoGen()
¶
Bases: TopoGen
Standardized framework for generating topology files for Amber simulations using tleap.
dry_run(path_structure, simlify_config, **kwargs)
¶
Performs a dry run of tleap
to obtain preliminary information about the system.
This method executes tleap
with a minimal input script that loads the
structure, solvates it, saves a temporary PDB file, and calculates the
total charge. The output log is then parsed to extract information such as
box dimensions, volume, mass, density, the number of solvent molecules, and
the net charge. This information is then used to determine the number of ions
needed to neutralize the system or achieve a desired ionic concentration.
PARAMETER | DESCRIPTION |
---|---|
path_structure
|
Path to the structure file (must be a PDB file for Amber).
TYPE:
|
simlify_config
|
Simlify configuration object.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
A dictionary containing keyword arguments to be passed
into the |
Examples:
The base tleap
input file generated for a dry run with standard
Amber protein context might look like this:
ff_lines(simlify_config)
¶
Prepares tleap
commands to load specified force fields.
This method generates a list of source leaprc.
commands for tleap
based on the force field settings in the provided SimlifyConfig
.
It checks for the presence of protein, water, DNA, RNA, GLYCAM, lipid,
small molecule, and ion force fields in the configuration and creates
the corresponding source
or loadAmberParams
commands.
PARAMETER | DESCRIPTION |
---|---|
simlify_config
|
A
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Iterable[str]
|
list of strings, where each string is a |
command to load a specific force field.
Examples:
>>> from simlify import SimlifyConfig
>>> config = SimlifyConfig(
... engine={
... "ff": {
... "protein": "ff14SB",
... "water": "tip3p",
... "small_molecule": "gaff2",
... }
... }
... )
>>> list(AmberTopoGen.ff_lines(config))
['source leaprc.protein.ff14SB', 'source leaprc.water.tip3p', 'source leaprc.gaff2']
run(path_structure, simlify_config, charge_anion_num=0, charge_cation_num=0, path_tleap_pdb=None, **kwargs)
¶
Runs tleap
to generate Amber topology and coordinate files for the system.
This method takes the path to the structure file, the SimlifyConfig
object,
and keyword arguments (typically obtained from the dry_run
method) to
generate the final tleap
input script. It adds ions to neutralize the system
or achieve a desired concentration, solvates the system, and then saves the
Amber topology (.prmtop
) and coordinate (.inpcrd
) files to the specified
output paths.
PARAMETER | DESCRIPTION |
---|---|
path_structure
|
Path to the structure file (must be a PDB file for Amber).
TYPE:
|
simlify_config
|
Simlify configuration object.
TYPE:
|
charge_anion_num
|
The number of anions to add.
TYPE:
|
charge_cation_num
|
The number of cations to add.
TYPE:
|
path_tleap_pdb
|
Specify the path to the prepared system as a
PDB file after
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
A dictionary containing information parsed from the
|