Model

class mdk::Model

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

Residue &addResidue(Chain *chain = nullptr)
Chain &addChain()
Contact &addContact()
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
  • randRandom 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
  • randRandom 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
  • randRandom 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
  • randRandom 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<Residue> residues
std::vector<Chain> chains
std::vector<Contact> contacts
std::vector<StructuredPart> structuredParts
Topology top

Topology, or the box size.

Private Functions

std::vector<std::pair<Residue*, Residue*>> nonlocalPairs()

Generates the pairs of residues separated by at least two bonds, used in the SAW procedures.

Returns

Pairs of residues.

struct Chain

Public Members

int idx
int start
int end
std::vector<int> structuredParts

A list of indices of structured parts that are overlayed over the chain.

struct Contact

Public Members

int idx
int res[2]
ContactType type
double dist0
struct Residue

A structure representing a single “residue”, or a pseudoatom, of the model.

Public Members

int idx

Index of the residue in residues.

int chainIdx

Index of the parent chain, or -1 if it doesn’t belong to any chain.

Vector r
Vector v
double mass
ResType type
std::optional<Vector> nat_r

Native positions of the residues.

struct StructuredPart

Public Members

int idx
int off
int len
std::vector<double> angle
std::vector<double> dihedral