config
#
Common configuration models.
Classes:
-
FlatBottomRestraint–Configuration for a flat bottom restraint.
-
BoreschRestraint–Configuration for a Boresch style restraint between three receptor atoms
-
Prepare–Configuration for preparing a system for simulation.
-
LangevinIntegrator–Configuration for a Langevin integrator.
-
REST–Configure REST2 setup.
-
Minimization–Configuration for a minimization.
-
Simulation–Configuration for an MD simulation.
-
Anneal–Configuration for a temperature annealing NVT MD simulation.
-
HREMDSwapMode–The mode in which to propose state swaps between replicas.
-
HREMD–Configuration for Hamiltonian replica exchange sampling
Functions:
-
merge_configs–Merge multiple configurations together.
Attributes:
-
DEFAULT_TEMPERATURE–The default temperature to simulate at
-
DEFAULT_PRESSURE–The default pressure to simulate at
-
DEFAULT_OPENMM_FF_SOURCES–The default parameter files to load when parameterizing the solvent / receptor
DEFAULT_TEMPERATURE
module-attribute
#
The default temperature to simulate at
DEFAULT_PRESSURE
module-attribute
#
The default pressure to simulate at
DEFAULT_OPENMM_FF_SOURCES
module-attribute
#
DEFAULT_OPENMM_FF_SOURCES = [
"amber/protein.ff14SB.xml",
"amber/tip3p_standard.xml",
"amber/tip3p_HFE_multivalent.xml",
]
The default parameter files to load when parameterizing the solvent / receptor
FlatBottomRestraint
pydantic-model
#
Bases: BaseModel
Configuration for a flat bottom restraint.
Fields:
-
type(Literal['flat-bottom']) -
k(OpenMMQuantity[_KCAL_PER_ANG_SQR]) -
radius(OpenMMQuantity[_ANGSTROM])
k
pydantic-field
#
Force constant [kcal/mol/Å^2] of the restraint.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
BoreschRestraint
pydantic-model
#
Bases: BaseModel
Configuration for a Boresch style restraint between three receptor atoms (r1, r2, r3) and three ligand atoms (l1, l2, l3).
See Also
femto.md.restraints.create_boresch_restraint
Fields:
-
type(Literal['boresch']) -
k_distance(OpenMMQuantity[_KCAL_PER_ANG_SQR]) -
k_angle_a(OpenMMQuantity[_KCAL_PER_RAD_SQR]) -
k_angle_b(OpenMMQuantity[_KCAL_PER_RAD_SQR]) -
k_dihedral_a(OpenMMQuantity[_KCAL_PER_RAD_SQR]) -
k_dihedral_b(OpenMMQuantity[_KCAL_PER_RAD_SQR]) -
k_dihedral_c(OpenMMQuantity[_KCAL_PER_RAD_SQR])
k_distance
pydantic-field
#
Force constant [kcal/mol/Å^2] of the harmonic distance restraint between r3 and l1.
k_angle_a
pydantic-field
#
Force constant [kcal/mol/rad^2] of the harmonic angle restraint on the angle formed by r2, r3, and l1.
k_angle_b
pydantic-field
#
Force constant [kcal/mol/rad^2] of the harmonic angle restraint on the angle formed by r3, l1, and l2.
k_dihedral_a
pydantic-field
#
Force constant [kcal/mol/rad^2] of the harmonic dihedral restraint on the dihedral angle formed by r1, r2, r3, and l1.
k_dihedral_b
pydantic-field
#
Force constant [kcal/mol/rad^2] of the harmonic dihedral restraint on the dihedral angle formed by r2, r3, l1, and l2.
k_dihedral_c
pydantic-field
#
Force constant [kcal/mol/rad^2] of the harmonic dihedral restraint on the dihedral angle formed by r3, l1, l2, and l3.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
Prepare
pydantic-model
#
Bases: BaseModel
Configuration for preparing a system for simulation.
Fields:
-
ionic_strength(OpenMMQuantity[molar]) -
neutralize(bool) -
cation(Literal['Na+', 'K+']) -
anion(Literal['Cl-']) -
water_model(Literal['tip3p']) -
default_protein_ff(list[str]) -
default_ligand_ff(str | None) -
box_padding(OpenMMQuantity[_ANGSTROM] | None) -
box_shape(Literal['cube', 'cubeoid']) -
n_waters(int | None)
Validators:
-
_validate_n_waters
ionic_strength
pydantic-field
#
The total concentration of ions pairs (anion and cation) to add to approximate an ionic strength. This does not include ions that are added to neutralize the system.
neutralize
pydantic-field
#
Whether to add counter ions to neutralize the system.
cation
pydantic-field
#
The cation to use when neutralizing the system.
water_model
pydantic-field
#
The water model to use when generating solvent coordinates. The actual force field parameters used for the solvent are determined by the default_protein_ff or any extra parameters provided while preparing the system.
default_protein_ff
pydantic-field
#
default_protein_ff: list[str] = [*DEFAULT_OPENMM_FF_SOURCES]
The default parameters to use when parameterizing the protein, solvent, and ions.
default_ligand_ff
pydantic-field
#
The default parameters to apply when parameterizing ligands, or None otherwise. Currently, only the path to an OpenFF offxml file can be specified.
box_padding
pydantic-field
#
The minimum distance between any complex atom (including any offset ligands) and the box wall. This option is mutually exclusive with n_waters.
box_shape
pydantic-field
#
The shape of the box to use when solvating the complex, when box_padding is specified.
n_waters
pydantic-field
#
The number of extra waters to solvate the complex using. This option is mutually exclusive with box_padding.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
LangevinIntegrator
pydantic-model
#
Bases: BaseModel
Configuration for a Langevin integrator.
Fields:
-
type(Literal['langevin']) -
timestep(OpenMMQuantity[picosecond]) -
friction(OpenMMQuantity[picosecond ** -1]) -
constraint_tolerance(float)
timestep
pydantic-field
#
The timestep to use.
friction
pydantic-field
#
The friction coefficient.
constraint_tolerance
pydantic-field
#
The tolerance with which constraints are maintained.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
REST
pydantic-model
#
Bases: BaseModel
Configure REST2 setup.
Fields:
-
scale_bonds(bool) -
scale_angles(bool) -
scale_torsions(bool) -
scale_nonbonded(bool)
scale_bonds
pydantic-field
#
Whether to scale bond force constants by beta_m / beta_0.
scale_angles
pydantic-field
#
Whether to scale angle force constants by beta_m / beta_0.
scale_torsions
pydantic-field
#
Whether to scale torsion barrier heights by beta_m / beta_0.
scale_nonbonded
pydantic-field
#
Whether to scale non-bonded epsilons by beta_m / beta_0 and charges by sqrt(beta_m / beta_0).
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
Minimization
pydantic-model
#
Bases: BaseModel
Configuration for a minimization.
Fields:
-
type(Literal['minimization']) -
restraints(dict[str, FlatBottomRestraint]) -
tolerance(OpenMMQuantity[_KCAL_PER_MOL / _ANGSTROM]) -
max_iterations(int)
restraints
pydantic-field
#
restraints: dict[str, FlatBottomRestraint] = {}
The position restraints to apply during the minimization. The keys should be AMBER style selection masks.
tolerance
pydantic-field
#
Minimization will be halted once the root-mean-square value of all force components reaches this tolerance.
max_iterations
pydantic-field
#
The maximum number of iterations to perform. If 0, minimization will continue until the tolerance is met.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
Simulation
pydantic-model
#
Bases: _SimulationStep
Configuration for an MD simulation.
Fields:
-
type(Literal['simulation']) -
temperature(OpenMMQuantity[kelvin]) -
pressure(OpenMMQuantity[atmospheres] | None) -
barostat_frequency(int) -
n_steps(int)
integrator
pydantic-field
#
integrator: LangevinIntegrator
The integrator to use during the simulation.
restraints
pydantic-field
#
restraints: dict[str, FlatBottomRestraint] = {}
The position restraints to apply during the minimization. The keys should be AMBER style selection masks.
pressure
pydantic-field
#
The pressure to simulate at, or none to run in NVT.
barostat_frequency
pydantic-field
#
The frequency at which to apply the barostat. This is ignored if pressure is None.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
Anneal
pydantic-model
#
Bases: _SimulationStep
Configuration for a temperature annealing NVT MD simulation.
Fields:
-
type(Literal['anneal']) -
temperature_initial(OpenMMQuantity[kelvin]) -
temperature_final(OpenMMQuantity[kelvin]) -
n_steps(int) -
frequency(int)
integrator
pydantic-field
#
integrator: LangevinIntegrator
The integrator to use during the simulation.
restraints
pydantic-field
#
restraints: dict[str, FlatBottomRestraint] = {}
The position restraints to apply during the minimization. The keys should be AMBER style selection masks.
temperature_initial
pydantic-field
#
The starting temperature to simulate at.
temperature_final
pydantic-field
#
The final temperature to simulate at.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
HREMDSwapMode
#
Bases: str, Enum
The mode in which to propose state swaps between replicas.
NEIGHBOURS: Only allow swapping the current state with neighbouring states.ALL: Allow swapping the current state with any other state.
HREMD
pydantic-model
#
Bases: BaseModel
Configuration for Hamiltonian replica exchange sampling
Fields:
-
temperature(OpenMMQuantity[kelvin]) -
n_warmup_steps(int) -
n_steps_per_cycle(int) -
n_cycles(int) -
max_step_retries(int) -
swap_mode(HREMDSwapModeLiteral | None) -
max_swaps(int | None) -
trajectory_interval(int | None) -
trajectory_enforce_pbc(bool) -
checkpoint_interval(int | None)
temperature
pydantic-field
#
temperature: OpenMMQuantity[kelvin] = DEFAULT_TEMPERATURE
The temperature to sample at.
n_warmup_steps
pydantic-field
#
The number of steps to run each replica for before starting hremd trials. All energies gathered during this period will be discarded.
n_steps_per_cycle
pydantic-field
#
The number of steps to propagate the system by before attempting an exchange.
n_cycles
pydantic-field
#
The number of cycles of 'propagate the system' -> 'exchange replicas' to run.
max_step_retries
pydantic-field
#
The maximum number of times to attempt to step if a NaN is encountered before raising an exception
swap_mode
pydantic-field
#
The mode in which to propose state swaps between replicas. This can either be: 'neighbours', only try and swap adjacent states or ii. 'all', try and swap all states stochastically. If None, no replica exchanges will be attempted.
max_swaps
pydantic-field
#
The maximum number of swap proposals to make if running in 'all' mode. This variable does nothing when running in 'neighbours' mode.
trajectory_interval
pydantic-field
#
The number of cycles to run before saving the current replica states to DCD trajectory files. If None, no trajectories will be saved.
trajectory_enforce_pbc
pydantic-field
#
Whether to apply periodic boundary conditions when retrieving coordinates for writing to trajectory files.
checkpoint_interval
pydantic-field
#
The number of cycles to run before saving the current replica states to checkpoint files. If None, no checkpoints will be saved.
model_dump_yaml
#
Dump the model to a YAML representation.
Parameters:
-
output_path(Path | None, default:None) –The (optional) path to save the YAML representation to.
Returns:
-
str–The YAML representation.
Source code in femto/md/utils/models.py
merge_configs
#
Merge multiple configurations together.
Parameters:
-
configs(_T, default:()) –The configurations to merge. These should either be dataclasses or plain dictionaries. Values in subsequent configs will overwrite values in previous ones.
Returns:
-
dict[str, Any]–The merged configuration.