Entire namespace¶
-
namespace mdk¶
Typedefs
-
using Scalars = Eigen::VectorXd¶
A list of scalars (i.e. doubles).
-
typedef Eigen::Vector3d Vector¶
A vector (writing
Eigen::Vector3d
everywhere is annoying).
-
typedef Vector const &VRef¶
Constant reference to a vector. Given the size of a Vector, passing copies wouldn’t be inefficient; it’s here chiefly to hide the warnings.
-
using Bytes = std::vector<int8_t>¶
List of small integers (usually we use this to store various enums and true/false values).
-
using VectorBase = Eigen::Matrix<double, 3, Eigen::Dynamic, Eigen::ColMajor>¶
Enums
-
enum AminoAcidIdx¶
An underlying amino acid index.
Values:
-
enumerator ALA¶
-
enumerator ARG¶
-
enumerator ASN¶
-
enumerator ASP¶
-
enumerator CYS¶
-
enumerator GLU¶
-
enumerator GLN¶
-
enumerator GLY¶
-
enumerator HIS¶
-
enumerator ILE¶
-
enumerator LEU¶
-
enumerator LYS¶
-
enumerator MET¶
-
enumerator PHE¶
-
enumerator PRO¶
-
enumerator SER¶
-
enumerator THR¶
-
enumerator TRP¶
-
enumerator TYR¶
-
enumerator VAL¶
-
enumerator ALA¶
-
enum ContactTypeIdx¶
An underlying contact type index.
Values:
-
enumerator NAT¶
-
enumerator NAT_BB¶
-
enumerator NAT_BS¶
-
enumerator NAT_SB¶
-
enumerator NAT_SS¶
-
enumerator SSBOND¶
-
enumerator NAT¶
-
enum PairType¶
A “pair type”, as distinguished by a number of force fields, such as
HeuresticBondAngles
orHeuresticDihedralAngles
.Values:
-
enumerator GG¶
-
enumerator GP¶
-
enumerator GX¶
-
enumerator PG¶
-
enumerator PP¶
-
enumerator PX¶
-
enumerator XG¶
-
enumerator XP¶
-
enumerator XX¶
-
enumerator GG¶
-
enum ResTypeIdx¶
Underlying residue type index.
Values:
-
enumerator ALA¶
-
enumerator ARG¶
-
enumerator ASN¶
-
enumerator ASP¶
-
enumerator CYS¶
-
enumerator GLU¶
-
enumerator GLN¶
-
enumerator GLY¶
-
enumerator HIS¶
-
enumerator ILE¶
-
enumerator LEU¶
-
enumerator LYS¶
-
enumerator MET¶
-
enumerator PHE¶
-
enumerator PRO¶
-
enumerator SER¶
-
enumerator THR¶
-
enumerator TRP¶
-
enumerator TYR¶
-
enumerator VAL¶
-
enumerator ALA¶
Functions
Variables
-
constexpr int numOfPTs = 9¶
-
Unit f77unit = 1.0¶
-
Unit nanosecond = 1.0¶
-
Unit tau = 1.0 * nanosecond¶
-
Unit microsecond = nanosecond * 1.0e3¶
-
Unit millisecond = nanosecond * 1.0e6¶
-
Unit second = nanosecond * 1.0e9¶
-
Unit atom = 1.0¶
-
Unit eps = 1.0¶
-
Unit eps_kB = 1.0¶
-
Unit f77mass = eps * tau * tau / (f77unit * f77unit)¶
In the Fortran version of the model, distance of
f77unit
, time oftau
, energy ofeps
and the average mass of an aminoacid were units; these are however incongruent, it’s a confirmed bug.
-
Unit echarge = 1.0¶
-
Unit rad = 1.0¶
-
class Chains¶
- #include <Chains.hpp>
This data structure contains all the data pertaining to chains, especially the pairs, triples etc. in the model. It’s here due to similarity of computation and some degree of reuse of the same data.
The definitions of pairs, triples etc. follow convention from CPC14.pdf.
Public Functions
-
Chains() = default¶
-
explicit Chains(Model const &model)¶
Generate a Chains structure for a given model.
- Parameters
model – The model, chain data whereof we wish to obtain.
-
inline bool sepByAtLeastN(int i1, int i2, int n) const¶
Check bond distance between residues.
- Parameters
i1 – First residue
i2 – Second residue
n – Bond offset
- Returns
true if residues i1 and i2 are either in separate chains or in a single chain but separated by at least n bonds.
Public Members
-
Model const *model = nullptr¶
Const ptr to an underlying model (necessarily it must have at least as long a lifetime as this class).
-
Integers chainIdx¶
chainIdx[i] is the index of the chain for residue i, or -1 if a residue is in no chain.
-
Bytes isTerminal¶
isTerminal[i] = 1 if the i’th residue is first or last in the chain (and thus lacks a neighbor), or 0 otherwise.
-
Bytes pairs¶
pairs[i] = 1 if the pair (i, i+1) is entirely in one chain, or 0 otherwise. Result of tuples(2). Used in harmonic tether forcefield.
-
Bytes triples¶
triples[i] = 1 if the triple (i-1, i, i+1) is entirely in one chain, or 0 otherwise. Result of tuples(3). Used for QA (in computing n, h) and for bond angle potentials.
-
Bytes quads¶
quads[i] = 1 if the quadruple (i-2, i-1, i, i+1) is entirely in one chain, or 0 otherwise. Result of tuples(4). Used in dihedral potential.
-
Chains() = default¶
-
class Charges : public Scalars¶
- #include <Charges.hpp>
A data structure containing the charges of residues in a model, as derived from a parameter file, in an array form.
-
class DataFactory¶
- #include <DataFactory.hpp>
A generic provider of data classes derived from a model and a parameter file. This class is provided chiefly for convenience.
Public Functions
-
inline DataFactory(Model const &model, param::Parameters const ¶ms)¶
-
template<typename Data>
inline Data const &data()¶ Extract a data class of type Data, if such is defined; otherwise, one will most likely get a linker error, as relevant template specialzations of /p create are placed in a .cpp file.
- Template Parameters
Data – Type of data class to retrieve
- Returns
A const reference to a stored data class.
Private Functions
Private Members
-
param::Parameters const *params¶
-
inline DataFactory(Model const &model, param::Parameters const ¶ms)¶
-
class Masses : public Scalars¶
- #include <Masses.hpp>
Data class containing masses associated with residues, in an array form.
-
class Types : public Eigen::Matrix<ResType, Eigen::Dynamic, 1>¶
- #include <Types.hpp>
Data class containing types of residues, in an array form.
-
class Vectors : public VectorBase¶
- #include <Vectors.hpp>
This class is a sort of a decorator over standard Eigen::Matrix3Xd. The chief difference is that this class offers an interface more appropriate for dealing with it as though it were a list of vectors (for example, one needs not use m.col(i) to get t’th vector in the matrix. Also, now size() corresponds to the number of vectors and not the elements of the array. The array itself is not (easily) resizeable.
Public Functions
-
Vectors() = default¶
-
inline explicit Vectors(int n)¶
Create an unitialized list of n vectors.
- Parameters
n – Number of vectors
-
inline Vectors(int n, Vector const &init)¶
Create an initialized list of n vectors.
- Parameters
n – Number of vectors
init – Initial value
-
inline auto vectorwise()¶
Returns an iterator over constituent vectors.
- Returns
An interator over constituent vectors.
-
inline auto vectorwise() const¶
Returns a const iterator over constituent vectors.
- Returns
A const interator over constituent vectors.
-
inline int size() const¶
- Returns
A number of vectors.
-
inline auto operator[](int i)¶
Access to vector.
- Parameters
i – Index of a vector to access
- Returns
A slice of a matrix corresponding to i’th vector.
-
inline auto operator[](int i) const¶
Const access to vector.
- Parameters
i – Index of a vector to access
- Returns
A const slice of a matrix corresponding to i’th vector.
-
Vectors() = default¶
-
class BondAngles : public mdk::Force¶
- #include <BondAngles.hpp>
A force field for bond angles (both heurestic and native variants, depending on whether a triple has an associated native bond angle (in such cases the native variant supercedes the heurestic variant).
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force field to a simulation.
- Parameters
simulation – Simulation to bind to.
Private Members
-
HeuresticBA *heurBA = nullptr¶
The “heurestic” part of the potential.
Friends
- friend class HeuresticBA
- friend class NativeBA
-
virtual void bind(Simulation &simulation) override¶
-
class HeuresticBA : public mdk::SimulVar¶
- #include <HeuresticBA.hpp>
“Heurestic” part of the bond angle potential, applied when a triple has no associated native bond angle.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the part to the simulation - in particular, find (and possibly create)
BondAngles
force field and add itself to it.- Parameters
simulation – Simulation to bind to.
-
inline void term(int i, double theta, double &V, double &dV_dth) const¶
Term of the formula for bond angle potential. Note: it’s inline in order for the compiler to inline it in
BondAngles.cpp
file.- Parameters
i – The index i in the triple (i-1, i, i+1).
theta – Value of the bond angle between i-1, i and i+1.
V – Potential energy reference to add to.
dV_dth – Derivative of potential energy wrt the angle theta to add to.
Private Members
Private Static Attributes
-
static constexpr const int D = 6¶
Degree of the polynomial.
Friends
- friend class BondAngles
-
virtual void bind(Simulation &simulation) override¶
-
class NativeBA : public mdk::SimulVar¶
- #include <NativeBA.hpp>
“Native” part of the bond angle potential, applied when a triple has an associated native bond angle.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the part to the simulation - in particular, find (and possibly create)
BondAngles
force field and add itself to it.- Parameters
simulation – Simulation to bind to.
-
inline void term(int i, double theta, double &V, double &dV_dth) const¶
Term of the formula for bond angle potential. Note: it’s inline in order for the compiler to inline it in
BondAngles.cpp
file.- Parameters
i – The index i in the triple (i-1, i, i+1).
theta – Value of the bond angle between i-1, i and i+1.
V – Potential energy reference to add to.
dV_dth – Derivative of potential energy wrt the angle theta to add to.
Private Members
Friends
- friend class BondAngles
-
virtual void bind(Simulation &simulation) override¶
-
class Chirality : public mdk::Force¶
- #include <Chirality.hpp>
Chirality potential for the models with a native structure (in particular the positions of the residues). It’s supposed to be a more replacement for bond and dihedral potentials, if the native structure is provided.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force field to the simulation.
- Parameters
simulation – Simulation to bind to.
-
virtual void bind(Simulation &simulation) override¶
-
class ComplexNativeDihedral : public mdk::NativeDihedralBase¶
- #include <ComplexNativeDihedral.hpp>
The complex variant of the native part of the dihedral angle potential.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the part to the simulation - in particular, find (and possibly create)
DihedralAngles
force field and add itself to it.- Parameters
simulation – Simulation to bind to.
-
inline void term(int i, double phi, double &V, double &dV_dphi) const¶
Term of the formula for the dihedral angle potential of a single quadruple. Note: it’s inline in order for the compiler to inline it in
DihedralAngles.cpp
file.- Parameters
i – The index i in the quadruple (i-2, i-1, i, i+1).
phi – Dihedral angle between planes defined by sequences i-2, i-1, i and i-1, i, i+1.
V – Potential energy reference to add to.
dV_dphi – Derivative of potential energy wrt the angle phi to add to.
Friends
- friend class DihedralAngles
-
virtual void bind(Simulation &simulation) override¶
-
class DihedralAngles : public mdk::Force¶
- #include <DihedralAngles.hpp>
A force field for dihedral angles, composed of:
the “native” part, which exists in two mutually exclusive variants (simple and complex);
the “heurestic” part. The native part supercedes heurestic part whenever native dihedral angle is defined for a quadruple.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force field to a simulation.
- Parameters
simulation – Simulation to bind to.
Private Members
-
std::variant<std::monostate, ComplexNativeDihedral*, SimpleNativeDihedral*> natDih = std::monostate()¶
The “native” part, i.e. either nothing, complex variant or the simple variant.
-
HeuresticDihedral *heurDih = nullptr¶
The “heurestic” part of the potential.
Friends
- friend class ComplexNativeDihedral
- friend class SimpleNativeDihedral
- friend class HeuresticDihedral
-
class HeuresticDihedral : public mdk::SimulVar¶
- #include <HeuresticDihedral.hpp>
Heurestic part of the dihedral potential, applied when with the quadruple (i-2, i-1, i, i+1) is not associated a native dihedral angle.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the part to the simulation - in particular, find (and possibly create)
DihedralAngles
force field and add itself to it.- Parameters
simulation – Simulation to bind to.
-
inline void term(int i, double phi, double &V, double &dV_dphi) const¶
Term of the formula for the dihedral angle potential of a single quadruple. Note: it’s inline in order for the compiler to inline it in
DihedralAngles.cpp
file.- Parameters
i – The index i in the quadruple (i-2, i-1, i, i+1).
phi – Dihedral angle between planes defined by sequences i-2, i-1, i and i-1, i, i+1.
V – Potential energy reference to add to.
dV_dphi – Derivative of potential energy wrt the angle phi to add to.
Private Members
Friends
- friend class DihedralAngles
-
virtual void bind(Simulation &simulation) override¶
-
class NativeDihedralBase : public mdk::SimulVar¶
- #include <NativeDihedralBase.hpp>
A common part of simple and complex native dihedral variants. In particular, it stores whether a quadruple (i-2, i-1, i, i+1) has an associated native dihedral angle, and its value if it is the case.
Subclassed by mdk::ComplexNativeDihedral, mdk::SimpleNativeDihedral
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the variant to the simulation. Technically one shouldn’t add this base to the simulation itself; it serves as a prototype for
bind
inComplexNativeDihedral
andSimpleNativeDihedral
in particular, it retrieves and computesisNative
andphi0
.- Parameters
simulation –
-
virtual void bind(Simulation &simulation) override¶
-
class SimpleNativeDihedral : public mdk::NativeDihedralBase¶
- #include <SimpleNativeDihedral.hpp>
The simple variant of the native part of the dihedral angle potential.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the part to the simulation - in particular, find (and possibly create)
DihedralAngles
force field and add itself to it.- Parameters
simulation – Simulation to bind to.
-
inline void term(int i, double phi, double &V, double &dV_dphi) const¶
Term of the formula for the dihedral angle potential of a single quadruple. Note: it’s inline in order for the compiler to inline it in
DihedralAngles.cpp
file.- Parameters
i – The index i in the quadruple (i-2, i-1, i, i+1).
phi – Dihedral angle between planes defined by sequences i-2, i-1, i and i-1, i, i+1.
V – Potential energy reference to add to.
dV_dphi – Derivative of potential energy wrt the angle phi to add to.
Friends
- friend class DihedralAngles
-
virtual void bind(Simulation &simulation) override¶
-
class ConstDH : public mdk::ESBase¶
- #include <ConstDH.hpp>
Debye-Hueckel screeened electrostatic potential with constant electric permittivity of the medium.
Public Functions
-
class ESBase : public mdk::NonlocalForce¶
- #include <ESBase.hpp>
A base class for the Debye-Hueckel screened electrostatic potentials.
Subclassed by mdk::ConstDH, mdk::RelativeDH
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the class to the simulation. It initializes
charge
and adds the force to the VL list. Note: this class (ESBase
) shouldn’t be added to the simulation class, only the derived classes.- Parameters
simulation – Simulation to bind to.
-
virtual void vlUpdateHook() override¶
An action to be performed when the Verlet list is updated. Here we want to recreate
pairs
, i.e. filter the Verlet list so that only charged pairs are present.
Protected Attributes
-
std::vector<Contact> pairs¶
A local, filtered Verlet list of pairs. Since most residues are not charged, and pairs even moreso, it benefits us to keep a local list and not check the pairs which we would know cannot interact with each other.
-
Eigen::Matrix<int8_t, Eigen::Dynamic, 1> charge¶
A list of charges of the residues (in units of
echarge
).
-
struct Contact¶
- #include <ESBase.hpp>
A struct detailing a contact between pairs. We store the indices and the product of the charges.
-
virtual void bind(Simulation &simulation) override¶
-
class RelativeDH : public mdk::ESBase¶
- #include <RelativeDH.hpp>
Debye-Hueckel screened electrostatic potential with a distance-dependent electric permittivity (specifically eps_r = r_0/r).
Public Functions
-
class Force : public mdk::SimulVar¶
- #include <Force.hpp>
An abstract interface for the force fields. Certain forces (QA in particular) have a multi-stage evaluation. Thus we separated the computation to an “asynchronous” and “synchronous” parts, where the latter get executed in order of addition to the
Simulation
object.Subclassed by mdk::BondAngles, mdk::Chirality, mdk::DihedralAngles, mdk::NonlocalForce, mdk::SolidWall, mdk::Tether
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force to the simulation. This class shouldn’t be actually added to the simulation, but rather serves as a prototype for actual forces; in particular it saved
state
from theSimulation
object.- Parameters
simulation –
-
virtual void bind(Simulation &simulation) override¶
-
class NativeContacts : public mdk::NonlocalForce¶
- #include <NativeContacts.hpp>
Go model potential. It is somewhat special as it interferes with the Verlet list and with the quasi-adiabatic potential. It should go first in the list of nonlocal forces added to the simulation object.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force to the simulation, and also to the Verlet list.
- Parameters
simulation – Simulation to bind to.
-
virtual void asyncPart(Dynamics &dynamics) override¶
Asynchronous part of the force computation.
- Parameters
dynamics – Dynamics object to add potential energy and forces to.
-
virtual void vlUpdateHook() override¶
Action to perform when the Verlet list is updated. We want to (a) retrieve the pairs that are in native contact into a list (
curPairs
), (b) remove those pairs from the global Verlet list.
Private Functions
Private Members
-
struct Contact¶
- #include <NativeContacts.hpp>
A struct with contact data.
-
virtual void bind(Simulation &simulation) override¶
-
class NonlocalForce : public mdk::Force¶
- #include <NonlocalForce.hpp>
A nonlocal force interface. It differs from the standard force interface in that it must provide some specs for the VL list, and needs to implement a hook to run when a VL list is updated.
Subclassed by mdk::ESBase, mdk::NativeContacts, mdk::PauliExclusion, mdk::PseudoImproperDihedral, mdk::QuasiAdiabatic
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the nonlocal force to the simulation object. This class shouldn’t be bound to the simulation object, rather invoked by derived classes. In particular, it fetches Verlet list into
vl
.- Parameters
simulation – Simulation to bind to.
-
virtual void vlUpdateHook() = 0¶
An action to be performed when Verlet list is updated; usually one copies the relevant pairs into a local list, perhaps with some modifications. The actions are invoked in the order of being added to the Verlet list.
Protected Functions
-
virtual vl::Spec spec() const = 0¶
Compute the spec to register to the VL list.
- Returns
Generated VL spec.
-
void installIntoVL()¶
Registers the spec into the Verlet list. Note: it must be executed only one all the data required for its generation has been fetched, i.e. usually at the end of
bind
.
-
virtual void bind(Simulation &simulation) override¶
-
class PauliExclusion : public mdk::NonlocalForce¶
- #include <PauliExclusion.hpp>
A “Pauli exclusion force” that keeps the residues from overlapping.
Public Functions
-
PauliExclusion()¶
-
virtual void bind(Simulation &simulation) override¶
Bind the object to the simulation.
- Parameters
simulation – Simulation to bind to.
-
virtual void asyncPart(Dynamics &dynamics) override¶
Asynchronous part of the force computation.
- Parameters
dynamics – Dynamics object to add potential energy and forces to.
-
virtual void vlUpdateHook() override¶
An action performed when a Verlet list is reconstructed; here we simply copy the list verbatim.
Public Members
-
ShiftedTruncatedLJ stlj¶
A shifted and truncated version of the Lennard-Jones potential that is used as the actual force.
Protected Functions
-
PauliExclusion()¶
-
class LambdaPeak¶
- #include <PseudoImproperDihedral.hpp>
An object representing either of the three lambda functions. It is theoretically a Gaussian function, but we implement it here in terms of computationally faster functions (either cosine or an “algebraic version” thereof, with a cutoff at the far ends).
Public Functions
-
bool supp(double psi) const¶
Check whether a value $psi$ is in the support of the function.
- Parameters
psi – Value to test.
- Returns
true if $lambda(psi) != 0$, false otherwise.
-
void eval(double psi, double &L, double &dL_dpsi) const¶
Compute the value of the function.
- Parameters
psi – Argument, i.e. the improper dihedral angle
L – Value of the lambda function at
psi
,dL_dpsi – Derivative of L wrt
psi
-
bool supp(double psi) const¶
-
class PseudoImproperDihedral : public mdk::NonlocalForce¶
- #include <PseudoImproperDihedral.hpp>
The “pseudo-improper-dihedral” custom potential. A more computationally expensive but more accurate and Hamiltonian alternative to the quasi-adiabatic potential.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the object to the simulation. Here we also fetch from it the types and chains.
- Parameters
simulation – Simulation to bind to.
-
virtual void asyncPart(Dynamics &dynamics) override¶
Asynchronous part of the force computation.
- Parameters
dynamics – Dynamics object to add potential energy and forces to.
-
virtual void vlUpdateHook() override¶
An action to be performed when the Verlet list is updated. We essentially copy the residues but exclude the pairs within bond distance of less than 4, or at the ends of their chains.
Public Members
-
LambdaPeak bb_pos¶
Lambda function corresponding to the bb+ part of the potential.
-
LennardJones bb_pos_lj¶
Lennard-Jones potential corresponding to the bb+ part of the potential.
-
LambdaPeak bb_neg¶
Lambda function corresponding to the bb- part of the potential.
-
LennardJones bb_neg_lj¶
Lennard-Jones potential corresponding to the bb- part of the potential.
-
LambdaPeak ss¶
Lambda function corresponding to the ss part of the potential.
Protected Functions
Private Functions
-
void deriveAngles(vl::PairInfo const &pair, double psi[2], Vector dpsi_dr[2][6]) const¶
Derive the angle data (specifically the angles and derivatives) pertaining to the pair.
- Parameters
pair – Pair of residues.
psi – An array, where psi[0] is the improper dihedral angle between i_1-1, i_1, i_1+1 and i_2, and psi[1] is the improper dihedral angle between i_2-1, i_2, i_2+1 and i_1.
dpsi_dr – An array, where dpsi_dr[0][0..2] are the derivatives d psi_1/d r_{i_1-1 .. i_1+1} and dspi_dr[0][3..6] are the derivatives d psi_1/d r_{i_2-1 .. i_2+1}; dpsi_dr[1][0..3] is defined as for 0, but with psi_2 instead of psi_1 (order of variables is not changed).
-
virtual void bind(Simulation &simulation) override¶
-
struct QAContact¶
- #include <QuasiAdiabatic.hpp>
A struct detailing the present QA contact.
Public Types
-
struct QAFreePair¶
- #include <QuasiAdiabatic.hpp>
A struct detailing a free pair that can form a QA contact.
Public Types
-
struct QADiff¶
- #include <QuasiAdiabatic.hpp>
A “diff” with respect to the QA contact. Since the formation of the contact requires there to be enough “stat slots”, and it’s possible that in an asynchronous execution more contacts would be formed while they shouldn’t, i.e. oversaturate the pool of stat slots, we separate the formation into a “virtual formation” which is done asynchronously and which adds a
QADiff
to a list of diffs, and a synchronous part which adds these diffs one after another, thus preventing an oversaturation.Public Functions
-
class QuasiAdiabatic : public mdk::NonlocalForce¶
- #include <QuasiAdiabatic.hpp>
The quasi-adiabatic potential.
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind the force to the simulation. In particular, we fetch the
types
andchains
, load sidechain distances etc.- Parameters
simulation – Simulation to bind to.
-
virtual void asyncPart(Dynamics &dynamics) override¶
Asynchronous part of the computation. In particular, we compute forces between currently-existing pairs and check which of the free pairs could form contacts.
- Parameters
dynamics – Dynamics object to add potential energy and forces to.
-
virtual void syncPart(Dynamics &dynamics) override¶
Synchronous part of the computation. We sort the list of potentially-added contacts and try to add them sequentially.
- Parameters
dynamics – Dynamics object to add potential energy and forces to; here it should be unused unless we want to account for the forces and potential energy of the added contacts.
-
virtual void vlUpdateHook() override¶
Action to be performed when the Verlet list is updated. Here we update the lists of pairs in contact and free pairs, preserving the pairs that were in contact in the old list and is present in the new Verlet list.
Private Functions
-
virtual vl::Spec spec() const override¶
Generate a spec for the Verlet list.
- Returns
Generated spec for the Verlet list.
-
void computeNH()¶
Compute a list of vectors $n_i$ and $h_i$.
-
bool geometryPhase(vl::PairInfo const &p, QADiff &diff) const¶
Perform a geometry check between two residues during the formation pass.
- Parameters
p – Data regarding the pair currently processed.
diff – A
QADiff
structure to modify if the check is successful.
- Returns
true
if the geometry check has succeeded,false
otherwise.
Private Members
-
Types const *types = nullptr¶
Types of residues, used when selecting the sidechain-sidechain potential.
-
Chains const *chains = nullptr¶
Chains data structure, here used mostly to filter the residues that are at the ends of the residues (there $n_i$ and $h_i$ cannot be computed).
-
LennardJones bb_lj = LennardJones(5.0 * angstrom, 1.0 * eps)¶
Lennard-Jones potential for the backbone-backbone contacts.
-
LennardJones bs_lj = LennardJones(6.8 * angstrom, 1.0 * eps)¶
Lennard-Jones potential for the backbone-sidechain contacts.
-
SidechainLJ ss_ljs[AminoAcid::N][AminoAcid::N]¶
An array of sidechain L-J potentials, one for every pair of types of amino acids.
-
double formationMaxDistSq¶
A maximum distance (across all types of contacts) between residues for the formation to occur. Has no “physical” sense, is used chiefly for optimization.
-
double hr_abs_min = 0.92¶
Minimum value of <h_i, r_j> for the formation of a backbone contact (with backbone part for i).
-
double hh_abs_min = 0.75¶
Minimum value of <h_i, h_j> for the formation of a backbone-backbone contact to occur.
-
double nr_max = 0.5¶
Maximum value of <n_i, r_j> for the formation of a sidechain contact (with sidechain part for i).
-
double formationTolerance = 1.0¶
A scalar factor by which the “usual” minimum formation distance is multiplied.
-
double formationTime = 10.0 * tau¶
A timespan during which a formed QA contact “thermalizes”, i.e. reaches the full depth of the L-J potential. The increase of the depth is linear.
-
double breakingTolerance = 1.0¶
A scalar factor by which the “usual” maximum distance before breaking is multiplied.
-
double breakingTime = 10.0 * tau¶
Timespan during which a broken QA contact “dissipates”, i.e. loses its force. The decrease in the depth of the L-J potential is linear.
-
std::vector<QAContact> oldPairs¶
The list of old pairs, with which the new pairs are swapped. This is done in order to not have to allocate new memory each time a Verlet list is regenerated.
-
std::vector<QAFreePair> freePairs¶
A list of free pairs, i.e. ones which are not in a QA contact but which potentially could form one.
-
Stats *stats¶
A reference to
Stats
variable. Note: this is a non-const reference, and in particular it gets potentially modified in thesyncPart
.
-
virtual void bind(Simulation &simulation) override¶
-
class Tether : public mdk::Force¶
- #include <Tether.hpp>
Harmonic tether forces between consecutive residues in a chain.
Public Functions
-
explicit Tether(bool fromNative)¶
Construct a
Tether
object.- Parameters
fromNative – Whether the equilibrium bond distances should be derived from the native structure or set to a default value (3.8 angstrem).
-
virtual void bind(Simulation &simulation) override¶
Bind the object to the simulation. Additionally we fetch the chain data to determine which of the pairs (i, i+1) are connected.
- Parameters
simulation – Simulation to bind to.
Private Members
-
Harmonic harm¶
The underlying harmonic force kernel. It is separated from this class because it’s used in some other places, notably for standard SSBOND interactions.
-
bool fromNative¶
Whether the equilibrium bond distances should be derived from the native structure or set to a default value (3.8 angstrem).
-
int n¶
Number of residues, saved for convenience.
-
explicit Tether(bool fromNative)¶
-
class SolidWall : public mdk::Force¶
- #include <SolidWall.hpp>
Solid walls.
Public Functions
Public Members
-
Eigen::Hyperplane<double, 3> wall¶
-
Eigen::Hyperplane<double, 3> wall¶
-
class ExportPDB : public mdk::Hook, private mdk::SimulVar¶
- #include <ExportPDB.hpp>
The hook for exporting current positions of the residues to a PDB file. The positions are stored as MODELs within the PDB file; (at this moment) the file is output only after the resolution of the simulation, i.e. in the destructor. Also, at the moment only the positions (and not for example REMARKs with QA stats or contacts) are saved.
Public Functions
-
inline explicit ExportPDB(std::filesystem::path modelPath, double period = 1000.0 * microsecond)¶
Construct a
ExportPDB
hook with a model path and the period.- Parameters
modelPath – Path to the file to which to output the positions.
period – Span between consecutive exports.
-
~ExportPDB()¶
This destructor saves the
to
the file.
-
virtual void bind(Simulation &simulation) override¶
Bind the hook to the simulation. Also, fetch the state.
- Parameters
simulation – Simulation to bind to.
-
virtual void execute(int step_nr) override¶
Execute the hook, i.e. check if the span since the last time the positions were exported is greater than
period
and if it is, export the positions and set the last time to current time.- Parameters
step_nr – Number of the step of the simulation when the hook is invoked.
-
inline explicit ExportPDB(std::filesystem::path modelPath, double period = 1000.0 * microsecond)¶
-
class Hook¶
- #include <Hook.hpp>
This interface defines actions to be performed after the force evaluation, i.e. a hook.
Subclassed by mdk::ExportPDB, mdk::PositionDiff, mdk::ProgressBar
Public Functions
-
virtual void execute(int step_nr) = 0¶
Execute the hook.
- Parameters
step_nr – Number of the step of the simulation when the hook is activated.
-
virtual void execute(int step_nr) = 0¶
-
class PositionDiff : public mdk::Hook, private mdk::SimulVar¶
- #include <PositionDiff.hpp>
A hook which saves position diffs. I assume this takes the path to the positions as outputted by the Fortran implementation and compares the positions in the consecutive steps with the current positions, whereafter it outputs the diffs to the
outputPath
.Public Functions
-
inline PositionDiff(std::string inputPath, std::string const &outputPath)¶
Create a
PositionDiff
object with given input and output paths.- Parameters
inputPath – Path to the file with Fortran positions.
outputPath – Path to the diff file to create.
-
virtual void bind(Simulation &simulation) override¶
Bind the hook to the simulation; also fetch the state and load the reference positions.
- Parameters
simulation –
-
virtual void execute(int step_nr) override¶
Execute the hook, i.e. output the diffs for the current step to the diff file.
- Parameters
step_nr – Number of the step of the simulation at which the hook was invoked.
-
inline PositionDiff(std::string inputPath, std::string const &outputPath)¶
-
class ProgressBar : public mdk::Hook, private mdk::SimulVar¶
- #include <ProgressBar.hpp>
A progress bar. Chiefly for convenience. Prints a status bar, current (internal and clock) time and total simulation span, and the current potential energy. Note: Because it flushes the output, care must be taken not to invoke it too often.
Public Functions
-
explicit ProgressBar(double totalTime, double updatePeriod, int width = 70)¶
Construct a
ProgressBar
object.- Parameters
totalTime – Total span of the simulation; used for normalizing the current time to display it as a percentage.
updatePeriod – How often to update the progrss bar.
width – Width of the progress bar in characters.
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
virtual void execute(int step_nr) override¶
Execute the hook.
- Parameters
step_nr – Number of the step of the simulation when the hook is activated.
Private Members
-
Simulation *simul = nullptr¶
-
time_point realTime0¶
Real (clock) time when the simulation was started.
-
double totalTime¶
-
double updatePeriod¶
-
double prevTime¶
-
int width¶
-
explicit ProgressBar(double totalTime, double updatePeriod, int width = 70)¶
-
class Harmonic¶
- #include <Harmonic.hpp>
Harmonic force “kernel”, i.e. a separated class responsible only for the computation of the formula. The definitions are inlined in order for the compiler to inline them.
Public Functions
-
Harmonic() = default¶
-
inline Harmonic(double H1, double H2)¶
-
inline void computeV(double dx, double &V, double &dV_dx) const¶
Compute the potential energy of the force field.
- Parameters
dx – Displacement, i.e. the difference between current length and the equilibrium length
V – Variable to add the potential to.
dV_dx – Variable to add the derivative to.
-
template<typename T1, typename T2>
inline void computeF(VRef unit, double dx, double &V, T1 F1, T2 F2) const¶ Compute and add the harmonic force between two residues. The templates are here in order for us to be able to pass Eigen expressions to it.
- Template Parameters
T1 – Type of an lvalue to add the force on the first residue to.
T2 – Type of an lvalue to add the force on the second residue to.
- Parameters
unit – Normalized vector between the residues.
dx – Displacement, i.e. the difference between current length and the equilibrium length;
V – Variable to add the potential to.
F1 – Lvalue to add the force on the first residue to.
F2 – Lvalue to add the force on the second residue to.
-
Harmonic() = default¶
-
class LennardJones¶
- #include <LennardJones.hpp>
Standard Lennard-Jones potential.
Public Functions
-
LennardJones() = default¶
-
inline LennardJones(double r_min, double depth)¶
-
inline double cutoff() const¶
The cutoff distance for the L-J potential. I’m not sure what is the “industry standard” cutoff but at 2.5 sigma the value of the potential is -0.016 epsilon, which seems fine as a cutoff. For comparison, at 2 sigma the value is -0.06225 epsilon which seems too high to cut off.
- Returns
The cutoff distance.
-
inline void computeV(double norm, double &V, double &dV_dn) const¶
Compute the potential energy of the force field.
- Parameters
norm – Distance between the residues.
V – Variable to add the potential to.
dV_dn – Variable to add the derivative to.
-
template<typename T1, typename T2>
inline void computeF(VRef unit, double norm, double &V, T1 F1, T2 F2) const¶ Compute and add the L-J force between two residues. The templates are here in order for us to be able to pass Eigen expressions to it.
- Template Parameters
T1 – Type of an lvalue to add the force on the first residue to.
T2 – Type of an lvalue to add the force on the second residue to.
- Parameters
unit – Normalized vector between the residues.
norm – Distance between the residues.
V – Variable to add the potential to.
F1 – Lvalue to add the force on the first residue to.
F2 – Lvalue to add the force on the second residue to.
-
LennardJones() = default¶
-
class ShiftedTruncatedLJ¶
- #include <ShiftedTruncatedLJ.hpp>
A shifted and truncated version of the L-J potential, used chiefly by the Pauli exclusion force field.
Public Functions
-
ShiftedTruncatedLJ() = default¶
-
inline ShiftedTruncatedLJ(double r_cut, double depth)¶
-
inline double cutoff() const¶
-
inline void computeV(double norm, double &V, double &dV_dn) const¶
Compute the potential energy of the force field.
- Parameters
norm – Distance between the residues.
V – Variable to add the potential to.
dV_dn – Variable to add the derivative to.
-
template<typename T1, typename T2>
inline void computeF(VRef unit, double norm, double &V, T1 F1, T2 F2) const¶ Compute and add the L-J force between two residues. The templates are here in order for us to be able to pass Eigen expressions to it.
- Template Parameters
T1 – Type of an lvalue to add the force on the first residue to.
T2 – Type of an lvalue to add the force on the second residue to.
- Parameters
unit – Normalized vector between the residues.
norm – Distance between the residues.
V – Variable to add the potential to.
F1 – Lvalue to add the force on the first residue to.
F2 – Lvalue to add the force on the second residue to.
-
ShiftedTruncatedLJ() = default¶
-
class SidechainLJ¶
- #include <SidechainLJ.hpp>
Sidechain version of the L-J potential (for a single pair of
depth
andsink_max
). In the CPC14.pdf it’s described as an L-J potential with a well bounded from both ends; in practice this is implemented as a one-sided well, i.e. for r < sink_max, V = - depth and the other side of the well is handled by the Pauli exclusion.Public Functions
-
SidechainLJ() = default¶
-
inline SidechainLJ(double depth, double sink_max)¶
-
inline double cutoff() const¶
-
inline void computeV(double norm, double &V, double &dV_dn) const¶
Compute the potential energy of the force field.
- Parameters
norm – Distance between the residues.
V – Variable to add the potential to.
dV_dn – Variable to add the derivative to.
-
template<typename T1, typename T2>
inline void computeF(VRef unit, double norm, double &V, T1 F1, T2 F2) const¶ Compute and add the L-J force between two residues. The templates are here in order for us to be able to pass Eigen expressions to it.
- Template Parameters
T1 – Type of an lvalue to add the force on the first residue to.
T2 – Type of an lvalue to add the force on the second residue to.
- Parameters
unit – Normalized vector between the residues.
norm – Distance between the residues.
V – Variable to add the potential to.
F1 – Lvalue to add the force on the first residue to.
F2 – Lvalue to add the force on the second residue to.
-
SidechainLJ() = default¶
-
class Model¶
- #include <Model.hpp>
A model object, which serves as one of two objects (other being
param::Parameters
) which instantiate the simulation. Contains residues (with types, messes, positions etc.), chains and structured parts, topological information (i.e. the box shape), along with an array of utilities for the modification of the model, in particular initializing the velocities or preparing the model into a conformation (a line or a self-avoiding walk).Public Functions
-
StructuredPart &addSP()¶
-
void morphIntoLine()¶
-
void morphIntoSAW(Random &rand, bool useTop = false, double density = 1e-4 * atom / pow(angstrom, 3.0), double minDist = 4.56 * angstrom)¶
Morphing the model into a self-avoiding walk. A custom version with clarity in mind, doesn’t replicate the positions from the Fortran code which makes testing difficult.
Note: it doesn’t use native bond angles correctly at the moment.
- Parameters
rand – Random number source to use.
useTop – Whether to create and use the topology during the creation process.
density – Target density of the box. 0 means an infinite box?
minDist – Minimum distance for the conformation to be considered intersecting, and therefore invalid.
-
void legacyMorphIntoSAW(Random &rand, bool useTop = false, double density = 1e-4 * atom / pow(angstrom, 3.0), double minDist = 4.56 * angstrom, bool nativeBondLen = false)¶
Morphing the model into a self-avoiding walk. A version which replicates the behavior of the Fortran code but in a more clear way.
- Parameters
rand – Random number source to use.
useTop – Whether to create and use the topology during the creation process.
density – Target density of the box. 0 means an infinite box?
minDist – Minimum distance for the conformation to be considered intersecting, and therefore invalid.
nativeBondLen – Whether to derive the bond lengths from the native structure. By default the bond lengths are 3.8 angstrem; if
nativeBondLen
is true, the bond length is taken to be a mean bond length in the native structure.
-
void exactLegacySAW(Random &rand, bool useTop = false, double density = 0.0 * atom / pow(angstrom, 3.0), double minDist = 4.56 * angstrom, double bond = 3.8 * angstrom)¶
Morphing the model into a self-avoiding walk. A version which replicates (one-by-one) the code of the Fortran version. It is also less intuitive because of it.
- Parameters
rand – Random number source to use.
useTop – Whether to create and use the topology during the creation process.
density – Target density of the box. 0 means an infinite box?
minDist – Minimum distance for the conformation to be considered intersecting, and therefore invalid. Note, from what I see the intersection is checked only for each chain internally, and not across the chains.
bond – Default bond length to use.
-
void initVelocity(Random &rand, double temperature, bool useMass = true)¶
Initialize velocities of the residues, assuming they are placed in a medium with a given temperature.
- Parameters
rand – Random number source to use.
temperature – Temperature of the medium.
useMass – Whether to account for different masses of the residues.
-
StructuredPart &addContactMap(cmap::ContactMap const &contactMap)¶
-
void addCMapContacts(cmap::ContactMap const &contactMap, Chain &chain)¶
-
void useAverageMasses()¶
Set the masses of all residues to be equal to the mean of the current masses.
Public Members
-
int n = 0¶
The number of residues in the model.
-
std::vector<StructuredPart> structuredParts¶
Private Functions
-
struct Chain¶
-
struct Contact¶
-
struct Residue¶
- #include <Model.hpp>
A structure representing a single “residue”, or a pseudoatom, of the model.
-
struct StructuredPart¶
-
StructuredPart &addSP()¶
-
class Simulation¶
- #include <Simulation.hpp>
The main class of the library, responsible for:
storing the simulation state;
storing the forces and other associated objects, and (optionally) binding them to the simulation;
running, or rather stepping through, the simulation.
Public Functions
-
inline Simulation(Model model, param::Parameters params)¶
Initialize simulation from a
Model
object and the parameters.- Parameters
model – Model of the simulation.
params – Parameters of the simulation.
-
template<typename Data>
inline Data const &data()¶ Access the “static” data as created by the
DataFactory
. We access the data by the type, but insofar as these objects represent functions of the state and the simulation, this is (in my estimation) appropriate. Providing an invalid type will lead to linker error.- Template Parameters
Data – Type of static data to access.
- Returns
Const reference to the data object.
-
template<typename Var>
inline Var &var()¶ Accesses the variables associated with the simulation. The access is by type, thus it’s most suited to variables that are effectively functions of the simulation (for example the physical state or the Verlet list). If the referenced variable has not been yet added, the function tries to emplace it (if it’s default-constructible) such is, for example, the case with
State
orvl::List
. Cannot be run after simulation initialization. The reference is never invalidated.- Template Parameters
Var – Type of the variable to access.
- Returns
Accessed variable. The function returns a non-const reference, thus care must be taken as to modify the variables only on agreed-upon points of the simulation (say, integration of forces).
-
template<typename T, typename ...Args>
inline T &add(Args&&... args)¶ Add a variable to the simulation. Depending on the type of the variable, additional actions may be performed (such as binding to the simulation or adding forces and/or nonlocal forces to appropriate lists). Cannot be run after simulation initialization. The reference is never invalidated.
- Template Parameters
T – Type of the variable to add.
Args – Types of arguments to use in construction.
- Parameters
args – Values of arguments to use in construction.
- Returns
Reference to a constructed and emplaced
T
(Args
…).
-
inline void addAsyncTask(std::function<void()> const &f)¶
Add an “async task”. Cannot be run after simulation initialization.
- Parameters
f – Function/lambda to add. (Seemingly the lambda cannot capture the environment, i.e. must be trivial)
-
void init()¶
Initialize the simulation.
-
void step()¶
Step once through the simulation; the time step is as determined by the used integrator (usually 5 ps).
-
void step(double t)¶
Step a total of time
t
through the simulation.- Parameters
t – Time to advance.
Private Functions
-
void calcForces()¶
Internal function for invoking force fields.
Private Members
-
param::Parameters params¶
Parameters of the simulation.
-
DataFactory df¶
Data factory.
-
std::unordered_map<std::type_index, std::shared_ptr<void>> vars¶
A heterogeneous collection of objects (stored as shared pointers to void) indexed by their types.
-
std::vector<NonlocalForce*> nonlocalForces¶
List of nonlocal forces of the simulation - the distinction is used when the Verlet list is updated, so as to invoke appropriate update functions.
-
Integrator *integrator = nullptr¶
Pointer to the integrator used in the simulation.
-
bool initialized = false¶
Whether simulation has yet been initialized; used for running the init function only once.
-
int step_nr = 0¶
Number of steps performed.
-
class SimulVar¶
- #include <SimulVar.hpp>
A “simulation variable”, i.e. an object which can be bound to a particular simulation (usually to finish instantiation).
Subclassed by mdk::ExportPDB, mdk::Force, mdk::HeuresticBA, mdk::HeuresticDihedral, mdk::Integrator, mdk::NativeBA, mdk::NativeDihedralBase, mdk::PositionDiff, mdk::ProgressBar, mdk::State, mdk::Stats, mdk::vl::List
Public Functions
-
virtual void bind(Simulation &simulation) = 0¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
virtual void bind(Simulation &simulation) = 0¶
-
struct Stat¶
- #include <Stat.hpp>
An object containing the coordination stats for a given residue. As opposed to the Fortran version, where the numbers represent the number of contacts formed, here it’s the number of slots remaining. This simplifies the checking procedure, as we can simply compare the coordination numbers with zero. We also provide facilities for manipulating these stats, such as addition etc. This object can also naturally represent a stat difference.
Public Functions
-
inline bool valid() const¶
Checks whether a stat is valid; in particular, one can check whether the formation of a contact will exceed the number of available slots this way.
- Returns
Whether a stat is valid.
Public Members
-
int8_t backbone = 0¶
Number of remaining backbone contacts that can be formed.
-
int8_t sidechain = 0¶
Number of remaining sidechain contacts that can be formed.
-
int8_t hydrophobicSS = 0¶
Number of remaining sidechain contacts that can be formed with hydrophobic residues.
-
int8_t polarSS = 0¶
Number of remaining sidechain contacts that can be formed with polar residues.
-
inline bool valid() const¶
-
class Stats : public mdk::SimulVar¶
- #include <Stats.hpp>
An object containing stats for the residues. Also initializes these numbers in one place.
Public Types
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
inline void creationDiffs(int i1, int i2, Type type, Stat diffs[2]) const¶
Generate diffs for if a contact between residues
i1
andi2
of typetype
were created. It’s inline so as for the compiler to insert it and not have to call the function.- Parameters
i1 – First residue.
i2 – Second residue.
type – Type of a contact.
diffs – An array of diffs; diffs[0] is the diff for the first residue, diffs[1] is the diff for the second residue.
Private Members
-
std::vector<param::Polarization> polarization¶
List of polarization values taken from the
param::Parameters
object.
-
virtual void bind(Simulation &simulation) override¶
-
class Integrator : public mdk::SimulVar¶
- #include <Integrator.hpp>
An integrator object; after the forces have been computed, it takes the forces and adjusts the positions, velocities etc.
Subclassed by mdk::LangPredictorCorrector, mdk::Leapfrog
Public Functions
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
virtual void init() = 0¶
Initialize the state of the integrator.
-
virtual void integrate() = 0¶
-
virtual void bind(Simulation &simulation) override¶
-
class LangPredictorCorrector : public mdk::Integrator¶
- #include <LangPredictorCorrector.hpp>
Langevin predictor-corrector fifth-order integrator, combined with a Langevin noise. Apparently these two are combined because in the Fortran code, the velocities are set in
lang
orlang_mass
. Now, this looks like a bug, but we replicate it nonetheless.Public Functions
-
inline explicit LangPredictorCorrector(double dt)¶
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
virtual void init() override¶
Initialize the state of the integrator.
-
virtual void integrate() override¶
Private Functions
-
void generateNoise()¶
-
inline explicit LangPredictorCorrector(double dt)¶
-
class Leapfrog : public mdk::Integrator¶
- #include <Leapfrog.hpp>
Leapfrog integration algorithm.
Public Functions
-
inline explicit Leapfrog(double dt)¶
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
virtual void init() override¶
Initialize the state of the integrator.
-
virtual void integrate() override¶
-
inline explicit Leapfrog(double dt)¶
-
struct Dynamics¶
- #include <State.hpp>
An object containing the dynamical state of the simulation, i.e. forces and the potential energy.
Public Functions
-
inline void zero(int n)¶
-
inline void zero(int n)¶
-
class State : public mdk::SimulVar¶
- #include <State.hpp>
An object containing the physical state of the simulation, i.e. current positions, velocities of the residues, time and the box shape.
Public Functions
-
void prepareDyn()¶
-
virtual void bind(Simulation &simul) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
void prepareDyn()¶
-
struct AAAtomInfo¶
- #include <AminoAcid.hpp>
Info pertaining to a single atom type in an amino acid (for example SG in cysteine).
-
struct AminoAcidInfo¶
- #include <AminoAcid.hpp>
Info pertaining to an amino acid type.
-
class AminoAcid¶
- #include <AminoAcid.hpp>
An object representing an amino acid type, along with a number of facilities, conversion from/to other types, general static data etc.
Public Functions
-
AminoAcid() = default¶
-
inline explicit constexpr AminoAcid(AminoAcidIdx type)¶
-
explicit operator AminoAcidIdx const&() const¶
-
inline constexpr AminoAcid(int8_t x)¶
-
operator int8_t() const¶
-
explicit AminoAcid(char code)¶
-
explicit operator char const&() const¶
-
AminoAcidInfo const &info() const¶
Public Static Functions
-
static std::vector<AminoAcidIdx> types()¶
Public Static Attributes
-
static constexpr const int N = 20¶
Private Members
-
AminoAcidIdx type¶
Friends
- friend struct std::hash< AminoAcid >
-
AminoAcid() = default¶
-
class ContactType¶
- #include <ContactType.hpp>
An object representing a contact type, along with a number of facilities, conversions from/to other types etc.
Public Functions
-
ContactType() = default¶
-
inline explicit constexpr ContactType(ContactTypeIdx code)¶
-
explicit operator ContactTypeIdx const&() const¶
-
inline constexpr ContactType(int8_t x)¶
-
operator int8_t() const¶
Private Members
-
ContactTypeIdx code¶
Friends
- friend struct std::hash< ContactType >
-
ContactType() = default¶
-
class Random¶
- #include <Random.hpp>
A random number generator. We use two versions: a legacy version taken from Fortran, and a modern version. Aside from sampling from [0, 1], we add sampling from [a, b], N(0, 1), N(mu, sigma^2) or points on S^2.
Public Functions
-
inline Random(int seed)¶
-
inline double uniform()¶
-
inline double uniform(double a, double b)¶
-
inline double normal()¶
-
inline double normal(double mu, double sigma)¶
-
inline Eigen::Vector3d sphere()¶
Private Functions
-
Random() = default¶
Private Members
-
uint64_t state¶
-
inline Random(int seed)¶
-
class ResType¶
- #include <ResType.hpp>
An object representing a residue type, along with a number of facilities, conversions from/to other types etc. At this moment, it is equivalent with the amino acids, but one may want to add other pseudo-atoms, sites, water molecules or groups etc. so we thought it wiser to separate the two.
Public Functions
-
ResType() = default¶
-
inline explicit constexpr ResType(ResTypeIdx code)¶
-
explicit operator ResTypeIdx const&() const¶
-
inline constexpr ResType(int8_t x)¶
-
operator int8_t() const¶
-
double mass() const¶
Private Members
-
ResTypeIdx code¶
Friends
- friend struct std::hash< ResType >
-
ResType() = default¶
-
class Topology¶
- #include <Topology.hpp>
An object representing the “topology” of the simulation box. In particular, we want to compute PBC-adjusted distances between residues.
Public Functions
-
namespace cmap¶
-
class ContactMap¶
- #include <ContactMap.hpp>
A POD representing a contact map (a.k.a. structured part), as represented in the legacy contact map file): specifically, the location and extent of the structured part, associated native bond and dihedral angles and Go-model contacts.
This data structure doesn’t provide its own means of parsing (
cmap::LegacyParser
must be used, for example), since a change of format shouldn’t influence this POD.Public Members
-
int len¶
Length of the structured part.
-
int offset¶
Offset of the structured part (w.r.t. the chain beginning).
-
std::vector<double> angle¶
angle[i] denotes the native bond angle value for triple (i-1, i, i+1), relative to the position as indicated by /p off, i.e. if (i+off-1, i+off, i+off+1) relative to the start of the chain. Note: the native angles near the ends of the structured part are undefined.
-
std::vector<double> dihedral¶
dihedral[i] denotes the native dihedral angle value for quadruple (i-2, i-1, i, i+1), relative to the position as indicated by /p off, i.e. if (i+off-2, i+off-1, i+off, i+off+1) relative to the start of the chain. Note: the native angles near the ends of the structured part are undefined.
-
struct Contact¶
-
int len¶
-
class LegacyParser¶
- #include <LegacyParser.hpp>
A parser of contact map files in the legacy format (as described in legacy README.txt).
Public Functions
-
ContactMap read(std::istream &is)¶
Read contact map from a stream.
- Parameters
is – Input stream wherefrom to read the contact map
- Returns
Parsed contact map.
-
std::ostream &write(std::ostream &os, ContactMap const &cmap)¶
Write contact map to a stream.
- Parameters
os – Output stream whereto to write the contact map
cmap – Contact map to write
- Returns
os
-
ContactMap read(std::istream &is)¶
-
class ContactMap¶
-
namespace param¶
Enums
-
class LegacyParser¶
- #include <LegacyParser.hpp>
A parser of parameter files in the legacy format (as described in legacy README.txt).
Public Functions
-
Parameters read(std::istream &is)¶
Read parameter file from a stream.
- Parameters
is – Input stream wherefrom to read the contact map
- Returns
Parsed parameter file.
-
std::ostream &write(std::ostream &os, Parameters const &data)¶
Write parameter file to a stream.
- Parameters
os – Output stream whereto to write the contact map
data – Parameter file to write
- Returns
os
-
Parameters read(std::istream &is)¶
-
class Parameters¶
- #include <Parameters.hpp>
A POD representing the parameters from the parameter file. Arguably the legacy file could be split so that everything wouldn’t be in one structure.
Public Types
Public Functions
-
Parameters()¶
Public Members
-
Coeffs defAngleParams¶
“Default” angle parameters. These are I assume for the simplified angle potential (option
lsimpang
).
-
PerPTData<Coeffs> angleParams¶
A set of bond angle parameters (for heurestic potential) for each pair of types of residues i, i+1 in a triple (i-1, i, i+1).
-
PerPTData<Coeffs> dihedralParams¶
A set of dihedral angle parameters (for heurestic potential) for each pair of types of residues i-1, i in a quadruple (i-2, i-1, i, i+1).
-
PerAcidData<SpecificityParams> specificity¶
Specificity parameters for every amino acid type.
-
PerAcidData<double> radius¶
Radii of amino acids (for use in non-full-atomic derivation of a contact map from the native structure).
-
PerPairData<double> pairwiseMinDist¶
A maximum in a distribution of sidechain-sidechain contacts between two given amino acids.
-
std::optional<PerPairData<double>> mjMatrix¶
An optional MJ matrix of Lennard-Jones potential depths depending on the amino acid types in the pair.
-
struct SpecificityParams¶
- #include <Parameters.hpp>
Specificity parameters POD.
Public Members
-
Polarization polarization¶
Polarization of an amino acid.
-
int maxSidechain¶
Maximum number of sidechain contacts an amino acid can form.
-
int maxHydrophobicSS¶
Maximum number of sidechain contacts an amino acid can form with hydrophobic amino acids.
-
int maxPolarSS¶
Maximum number of sidechain contacts an amino acid can form with polar amino acids.
-
Polarization polarization¶
-
Parameters()¶
-
class LegacyParser¶
-
namespace pdb¶
Enums
-
enum Mode¶
A mode enum, which modifies how to position and parse strings. Note: most enums in the program are enum classes; here we need a standard enum in order for combining via
| to work
Values:
-
enumerator Exact¶
Beginning of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
enumerator Trim¶
When parsing, the final value is a trimmed string read from the line.
-
enumerator Left¶
When writing, the string is written left-aligned in the line.
-
enumerator Right¶
When writing, the string is written right-aligned in the line.
-
enumerator Exact¶
Functions
-
class Data¶
- #include <Data.hpp>
PDB file in the “raw format”, i.e. as a list of PDB records. Certain utility functions, like parsing from/to
pdb::Model
and retrieving only atom positions, are provided.Public Functions
-
Data() = default¶
Public Static Functions
-
static Data onlyAtoms(pdb::Model const &model)¶
Extract only ATOM records from a PDB model. Useful for outputting a single file with lots of conformations of the same amino acid chain, for example when we output PDB model with consecutive positions in the simulation.
- Parameters
model – PDB model to convert.
- Returns
PDB data object containing only ATOM records.
-
Data() = default¶
-
class Model¶
- #include <Model.hpp>
PDB model object. As opposed to
Model
, here we store atomic data, chiefly for the use in the derivation of full-atomic contact maps. Also, non-full-atomic contact maps may be derived;Model
doesn’t contain such a method because it’s ill-defined for models obtained fromSequence
file, which doesn’t have native residue positions.Public Functions
-
Atom &addAtom(int serial, Residue *res = nullptr)¶
Add an atom to a residue.
- Parameters
serial – Serial number of an atom
res – Parent residue, or
nullptr
- Returns
Reference to the added atom.
-
Residue &addResidue(int serial, Chain *chain = nullptr)¶
Add a residue to a chain.
- Parameters
serial – Serial number of a residue to add.
chain – Parent chain or
nullptr
- Returns
Reference to the added residue.
-
Chain &addChain(char serial)¶
Add a chain with a specified serial character.
- Parameters
serial – Serial character of the chain.
- Returns
Reference to the added chain.
-
Model() = default¶
-
explicit Model(mdk::Model const &coarse)¶
Construct a
pdb::Model
from aModel
. Doesn’t extrapolate extra atoms, i.e. only CA atoms are in the final model.- Parameters
coarse –
Model
from which to construct the PDB model.
-
void addContactsFromAtomOverlap()¶
Adds contacts based on the overlap of atoms. This method also derives types of contacts based on whether the atoms are in the backbone or the sidechain of an amino acid.
-
void addContactsFromResOverlap(param::Parameters const ¶ms)¶
Adds contacts based on approximate residue overlap, given the
aminoAcidRadii
data from the parameter file.- Parameters
params – Parameter file with amino acid radii data.
-
mdk::Model coarsen()¶
Construct a
mdk::Model
from the PDB model. Collapses residues to a singleModel
residue and copies the contacts (if two atoms are connected, the residues containing them are connected in the final model).- Returns
A reduced (“coarsened”) model.
Public Members
-
std::unordered_map<int, Atom> atoms¶
A map from the serial number of an atom to the
Atom
structure. Note that the order of serial numbers is (1) not necessarily consecutive, (2) not starting from 0, in some degenerate cases. Also, adding new atoms doesn’t invalidate pointers or references.
-
std::unordered_map<int, Residue> residues¶
A map from residue serial number to Residue struct. Note that the order of serial numbers is (1) not necessarily consecutive, (2) not starting from 0, in some degenerate cases. Also, adding new residues doesn’t invalidate pointers or references.
-
struct Atom¶
- #include <Model.hpp>
A struct containing data for a single atom.
Public Members
-
int serial¶
PDB serial number of an atom. Zero-indexed.
-
int idxInRes¶
Index of an atom in the
Residue::atoms
list of the parent residue, or -1 if it’s not a part of any residue.
-
Eigen::Vector3d r¶
(Native) position of the atom.
-
int serial¶
-
struct Chain¶
- #include <Model.hpp>
A struct containing PDB chain data.
-
struct Contact¶
- #include <Model.hpp>
A struct containing contacts. Technically this isn’t represented 1-to-1 in the PDB data, but an unification of SSBONDs and LINKs is useful, especially for the reduction of the
pdb::Model
intoModel
.
-
struct Residue¶
- #include <Model.hpp>
A struct containing data for a PDB residue.
Public Functions
Public Members
-
int serial¶
Serial number of a residue. 0-indexed.
-
int idxInChain¶
Index in the
Chain::residues
of the parent chain, or -1 if it’s not in any chain.
-
int serial¶
-
Atom &addAtom(int serial, Residue *res = nullptr)¶
-
class Parser¶
- #include <Parser.hpp>
A parser of PDB files.
Public Functions
-
Parser()¶
Private Members
-
std::unordered_map<int, std::shared_ptr<RecordParser>> parsers¶
(Internal) set of record parsers.
-
Parser()¶
-
class Field¶
- #include <Field.hpp>
An object representing a single field of a PDB record, along with the means of parsing and printing it. The field objects signal parsing failure by throwing.
Subclassed by mdk::pdb::Char, mdk::pdb::Integer, mdk::pdb::Literal, mdk::pdb::Real, mdk::pdb::String, mdk::pdb::SymOp
-
class Integer : public mdk::pdb::Field¶
- #include <Field.hpp>
Integer field.
Public Functions
-
inline Integer(int i, int j, int &v, int offset = 0)¶
Private Members
-
int i¶
Beginning of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
int j¶
End of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
int offset¶
A value that is added to the read value and subtracted when a value is written. It’s chiefly used to convert 0-indexed ordinals to 1-indexed and vice versa.
-
int *v¶
A pointer to the integer to save the value to and load the value from. It allows us in particular to have the same field class for many different PDB records, only having to provide different pointer to the underlying value.
-
inline Integer(int i, int j, int &v, int offset = 0)¶
-
class Real : public mdk::pdb::Field¶
- #include <Field.hpp>
Real (floating number) field.
Public Functions
-
inline Real(int i, int j, int n, int m, double &v, double scalar = 1.0)¶
Private Members
-
int i¶
Beginning of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
int j¶
End of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
int n¶
Width of the read real number. Follows the conventions from the PDB format docs and Fortran specifiers (it’s n in f{n}.{m})
-
int m¶
Precision of the read real number. Follows the conventions from the PDB format docs and Fortran specifiers (it’s m in f{n}.{m})
-
double *v¶
A pointer to the double to save the value to and load the value from. It allows us in particular to have the same field class for many different PDB records, only having to provide different pointer to the underlying value.
-
double scalar¶
Scalar by which to multiply a read value and divide a written value. In particular, it allows us to convert PDB file formats to internal units and back.
-
inline Real(int i, int j, int n, int m, double &v, double scalar = 1.0)¶
-
class String : public mdk::pdb::Field¶
- #include <Field.hpp>
String field. By default read values are trimmed, and written values are right-aligned.
Public Functions
Private Members
-
int i¶
Beginning of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
int j¶
End of the field in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
std::string *v¶
A pointer to the string to save the value to and load the value from. It allows us in particular to have the same field class for many different PDB records, only having to provide different pointer to the underlying value.
-
int8_t mode¶
Mode of string parsing and writing. See
Mode
for details.
-
int i¶
-
class Char : public mdk::pdb::Field¶
- #include <Field.hpp>
(Single) character field.
Public Functions
-
inline Char(int i, char &v)¶
Private Members
-
int i¶
The location of the character in the line. Inclusive and 1-indexed, as in the PDB format docs, in order to make writing new fields easier.
-
char *v¶
A pointer to the character to save the value to and load the value from. It allows us in particular to have the same field class for many different PDB records, only having to provide different pointer to the underlying value.
-
inline Char(int i, char &v)¶
-
class SymOp : public mdk::pdb::Field¶
- #include <Field.hpp>
“Symmetry operator” field. At the moment it’s parsed just like a normal string.
Public Functions
-
class Literal : public mdk::pdb::Field¶
- #include <Field.hpp>
A literal. As opposed to a normal field, here there’s no reading or writing values by pointers, rather comparing the read value with the literal and printing out the literal. It’s chiefly used for parsing the record headers, like “ATOM ” or “MODEL “.
Public Functions
-
class RecordParser¶
- #include <RecordParsers.hpp>
A parser of a single record. Because of the “bidirectionality” of
Field
structures and ability to swap out the pointers, we can elegantly represent as a list of the fields in the line of a record, and the parsing and writing of the record are essentially provided out-of-the-box.Subclassed by mdk::pdb::AtomParser, mdk::pdb::Cryst1Parser, mdk::pdb::EndParser, mdk::pdb::EndmdlParser, mdk::pdb::HetatmParser, mdk::pdb::LinkParser, mdk::pdb::ModelParser, mdk::pdb::RemarkParser, mdk::pdb::SSBondParser, mdk::pdb::TerParser
Public Functions
Protected Attributes
-
Record record¶
Underlying record, which serves as a base of variable (integers, strings etc. of a record) to which field parsers write parsed values and from which the field parsers read the values to write.
-
Record record¶
-
class RemarkParser : public mdk::pdb::RecordParser¶
Public Functions
-
RemarkParser()¶
-
RemarkParser()¶
-
class AtomParser : public mdk::pdb::RecordParser¶
Public Functions
-
AtomParser()¶
-
AtomParser()¶
-
class HetatmParser : public mdk::pdb::RecordParser¶
Public Functions
-
HetatmParser()¶
-
HetatmParser()¶
-
class SSBondParser : public mdk::pdb::RecordParser¶
Public Functions
-
SSBondParser()¶
-
SSBondParser()¶
-
class Cryst1Parser : public mdk::pdb::RecordParser¶
Public Functions
-
Cryst1Parser()¶
-
Cryst1Parser()¶
-
class LinkParser : public mdk::pdb::RecordParser¶
Public Functions
-
LinkParser()¶
-
LinkParser()¶
-
class ModelParser : public mdk::pdb::RecordParser¶
Public Functions
-
ModelParser()¶
-
ModelParser()¶
-
class EndmdlParser : public mdk::pdb::RecordParser¶
Public Functions
-
EndmdlParser()¶
-
EndmdlParser()¶
-
class EndParser : public mdk::pdb::RecordParser¶
Public Functions
-
EndParser()¶
-
EndParser()¶
-
class TerParser : public mdk::pdb::RecordParser¶
Public Functions
-
TerParser()¶
-
TerParser()¶
-
enum Mode¶
-
namespace seq¶
-
class LegacyParser¶
- #include <LegacyParser.hpp>
A parser of sequence files. Here we need an explicit path since the sequence files reference contact maps by relative path.
-
class Sequence¶
- #include <Sequence.hpp>
A sequence file, i.e. a set of chains with optional interposed contact maps.
Public Functions
Public Members
-
std::unordered_map<std::string, cmap::ContactMap> contactMaps¶
A map from the contact map path to a parsed contact map.
-
struct Chain¶
- #include <Sequence.hpp>
A single chain in the sequence file.
-
std::unordered_map<std::string, cmap::ContactMap> contactMaps¶
-
class LegacyParser¶
-
namespace vl¶
-
struct PairInfo¶
- #include <List.hpp>
A struct containing data about pairs; this is stored in this fashion chiefly to avoid having to pass all of these as arguments.
-
class List : public mdk::SimulVar¶
- #include <List.hpp>
A Verlet list.
Public Functions
-
void registerNF(NonlocalForce &force, Spec const &spec)¶
Register a nonlocal force, in particular adjust the current specs so as to accomodate the newly added force (for example increase the cutoff distance), and add it to the internal list of the forces whose hooks to call when a list is reconstructed.
- Parameters
force – Nonlocal force to register.
spec – Spec with which to register the force.
-
virtual void bind(Simulation &simulation) override¶
Bind an object to a simulation.
- Parameters
simulation – Simulation to bind the object to.
-
void check()¶
Check whether the list needs updating, and if it does update it and invoke the relevant update hooks for the non-local forces.
Public Members
Private Functions
-
bool needToReset() const¶
-
void update()¶
Updates the Verlet list in the “legacy fashion”, i.e. going through a list of pairs and checking the distances.
-
int indexOf(Eigen::Vector3i const &loc)¶
Computes the flattened index of a cell in the grid.
- Parameters
loc – Unflattened index.
- Returns
Flattened index.
-
void perPair(int c1, int c2)¶
-
void perCell(int c1)¶
-
void updateGrid()¶
Updates the Verlet list, but instead of going through each pair we first place the residues into cells of (rough) size
effCutoff
and then only take the pairs from the neighboring cells, which reduces the computational cost from O(N^2) to O(N) (although the constant behind O(N) may be significant). In practice this version is much faster, especially for large numbers of residues.
Private Members
-
double t0 = 0.0¶
Time from when the list was last reconstructed.
-
std::vector<NonlocalForce*> forces¶
A list of nonlocal forces, saved in order to invoke their update hooks when the list is reconstructed.
-
bool initial = false¶
-
double pad = 10.0 * angstrom¶
An extra “buffer”. The list by default contains elements that may be outside the maximal cutoff, which allows us to not have to reconstruct the verlet list at every time step, at the cost of spurious distance comparisons.
-
int minBondSep = 0¶
Minimal bond-distance between the residues among registered nonlocal forces.
-
Eigen::Vector3i grid¶
Dimensions of the grid of cells used in the cell version of the computation.
-
std::vector<int> first¶
A list of size equal to the number of cells in the grid, where a nonnegative number indicates an index of the residue which is first in the linked list of residues in a given cell. If the cell is empty, the value is -1.
-
std::vector<int> last¶
A list of size equal to the number of cells in the grid, where a nonnegative number indicates an index of the residue which is last in the linked list of residues in a given cell. If the cell is empty, the value is -1.
-
std::vector<int> next¶
A list of size equal to the number of residues, where a nonnegative number indicates an index of a residue which is next in the linked list associated with the cell in which the residue is placed.
-
double effCutoff¶
-
double effCutoffSq¶
-
void registerNF(NonlocalForce &force, Spec const &spec)¶
-
struct Spec¶
- #include <Spec.hpp>
A specification (spec for short) for the non-local force. Technically one could generate a Verlet list for every non-local force, however this would be wasteful - thus we generate a most restrictive possible Verlet list which contains the “sub-Verlet lists” of the particular non-local forces and let them filter the general list on their own accord into a local list.
-
struct PairInfo¶
-
using Scalars = Eigen::VectorXd¶