mythos.energy.martini.base

Common Martini Energy Utilities.

Classes

MartiniTopology

Class representing the topology of a Martini system.

MartiniEnergyFunction

Base class for Martini energy functions.

MartiniEnergyConfiguration

Base class for Martini energy function configurations.

Functions

get_periodic(→ callable)

Return displacement function given box_size.

Module Contents

mythos.energy.martini.base.get_periodic(box_size: mythos.utils.types.Vector3D) callable[source]

Return displacement function given box_size.

class mythos.energy.martini.base.MartiniTopology[source]

Class representing the topology of a Martini system.

This class contains information about the atom types, bonded interactions, and angles in the system. It can be used to construct energy functions and to interpret simulation results.

atom_types

A tuple of atom type names.

atom_names

A tuple of atom names.

angles

An array of shape (n_angles, 3) containing the indices of the atoms involved in each angle.

bonded_neighbors

An array of shape (n_bonds, 2) containing the indices of the bonded pairs of atoms.

unbonded_neighbors

An array of shape (n_unbonded, 2) containing the indices of the unbonded pairs of atoms. If not supplied, it will be computed as all pairs of atoms that are not bonded.

atom_types: tuple[str, Ellipsis]
atom_names: tuple[str, Ellipsis]
residue_names: tuple[str, Ellipsis]
angles: mythos.utils.types.Arr_N
bonded_neighbors: mythos.utils.types.Arr_N
unbonded_neighbors: mythos.utils.types.Arr_N | None = None
__post_init__() None[source]
classmethod from_universe(universe: MDAnalysis.Universe) MartiniTopology[source]

Create a MartiniTopology from a Universe object.

classmethod from_tpr(tpr_file: pathlib.Path) MartiniTopology[source]

Create a MartiniTopology from a TPR format topology file.

class mythos.energy.martini.base.MartiniEnergyFunction[source]

Bases: mythos.energy.base.BaseEnergyFunction

Base class for Martini energy functions.

atom_types: tuple[str, Ellipsis]
atom_names: tuple[str, Ellipsis]
residue_names: tuple[str, Ellipsis]
angles: mythos.utils.types.Arr_N
displacement_fn: callable
classmethod from_topology(topology: MartiniTopology, **kwargs) MartiniEnergyFunction[source]

Create an energy function from a MartiniTopology.

property bond_names: tuple[str, Ellipsis]

Return bond names based on atom names and bonded neighbors.

property angle_names: tuple[str, Ellipsis]

Return angle names based on atom names and angles.

class mythos.energy.martini.base.MartiniEnergyConfiguration(couplings: dict[str, list[str]] | None = None, **kwargs)[source]

Base class for Martini energy function configurations.

Given the large size and sparse inclusion of parameters in Martini models, this class implements parameters as a dictionary while supporting operations of configuration classes used in EnergyFunction.

This class also supports parameter coupling, where a single proxy parameter controls multiple underlying parameters. Couplings should be provided as a dictionary of lists, where each key is a proxy parameter name and the value is a list of target parameter names that it controls. The params field of this will be populated with the expanded parameters.

Subclasses can override __post_init__ for additional initialization logic. Parameters will be available in self.params after initialization.

couplings
reversed_couplings
params
__post_init__() None[source]

Hook for additional initialization in subclasses.

init_params() MartiniEnergyConfiguration[source]

Dependent params initialization. Default to no-op.

property opt_params: dict[str, any]

Returns the parameters to optimize.

__getitem__(key: str) any[source]
__contains__(key: str) bool[source]
__or__(other: MartiniEnergyConfiguration) MartiniEnergyConfiguration[source]

Merge two configurations, with other taking precedence.