Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Enumerations | Functions | Variables
anonymous_namespace{edsam.cpp} Namespace Reference

Classes

struct  t_eigvec
 Essential dynamics vector. TODO: split into working data and input data NOTE: called eigvec, because traditionally eigenvectors from PCA analysis were used as essential dynamics vectors, however, vectors used for ED need not have any special properties. More...
 
struct  t_edvecs
 Essential dynamics vectors per method implementation. More...
 
struct  t_edflood
 Essential dynamics flooding parameters and work data. TODO: split into working data and input parameters NOTE: The implementation here follows: O.E. Lange, L.V. Schafer, and H. Grubmuller, “Flooding in GROMACS: Accelerated barrier crossings in molecular dynamics,” J. Comp. Chem., 27 1693–1702 (2006) More...
 

Enumerations

enum  EssentialDynamicsType { EssentialDynamicsType::None, EssentialDynamicsType::EDSampling, EssentialDynamicsType::Flooding }
 Identifies the type of ED: none, normal ED, flooding. More...
 
enum  EssentialDynamicsStructure { EssentialDynamicsStructure::Reference, EssentialDynamicsStructure::Average, EssentialDynamicsStructure::Origin, EssentialDynamicsStructure::Target }
 Identify on which structure to operate. More...
 

Functions

std::vector< t_edpar > read_edi_file (const char *fn, int nr_mdatoms)
 Read in the essential dynamics input file and return its contents. More...
 
bool bNeedDoEdsam (const t_edpar &edi)
 Determines whether to perform essential dynamics constraints other than flooding. More...
 
real projectx (const t_edpar &edi, rvec *xcoll, rvec *vec)
 The mass-weighted inner product of two coordinate vectors. Does not subtract average positions, projection on single eigenvector is returned used by: do_linfix, do_linacc, do_radfix, do_radacc, do_radcon Average position is subtracted in ed_apply_constraints prior to calling projectx. More...
 
void rad_project (const t_edpar &edi, rvec *x, t_eigvec *vec)
 Project coordinates onto vector after substracting average position. projection is stored in vec->refproj which is used for radacc, radfix, radcon and center of flooding potential. Average positions are first substracted from x, then added back again. More...
 
void project_to_eigvectors (rvec *x, t_eigvec *vec, const t_edpar &edi)
 Projects coordinates onto eigenvectors and stores result in vec->xproj. Mass-weighting is applied. Subtracts average positions prior to projection and add them afterwards to retain the unchanged vector. More...
 
real calc_radius (const t_eigvec &vec)
 Evaluates the distance from reference to current eigenvector projection. More...
 
void write_edo_flood (const t_edpar &edi, FILE *fp, real rmsd)
 Output flooding simulation settings and results to file. More...
 
void flood_blowup (const t_edpar &edi, rvec *forces_cart)
 Raise forces from subspace into cartesian space. This function lifts the forces from the subspace to the cartesian space all the values not contained in the subspace are assumed to be zero and then a coordinate transformation from eigenvector to cartesian vectors is performed The nonexistent values don't have to be set to zero explicitly, they would occur as zero valued summands, hence we just stop to compute this part of the sum. For every atom we add all the contributions to this atom from all the different eigenvectors. NOTE: one could add directly to the forcefield forces, would mean we wouldn't have to clear the field forces_cart prior the computation, but we compute the forces separately to have them accessible for diagnostics. More...
 
void scan_edvec (FILE *in, int numAtoms, rvec ***vec, int nEig)
 Read eigenvector coordinates for multiple eigenvectors from a file. More...
 
void read_edvec (FILE *in, int nrAtoms, t_eigvec *tvec)
 Read an essential dynamics eigenvector and corresponding step size. More...
 
bool readEdVecWithReferenceProjection (FILE *in, int nrAtoms, t_eigvec *tvec, real **initialReferenceProjection, real **referenceProjectionSlope)
 Read an essential dynamics eigenvector and initial reference projections and slopes if available. More...
 
void setup_edvec (t_eigvec *tvec)
 Allocate working memory for the eigenvectors. More...
 
void setup_edi (t_edpar *edi)
 Set up essential dynamics work parameters. More...
 
bool ediFileHasConstForceFlooding (int magicNumber)
 Check if edi file version supports CONST_FORCE_FLOODING. More...
 
bool ediFileHasValidDataSet (FILE *in, int *magicNumber)
 Reports reading success of the essential dynamics input file magic number. More...
 
void exitWhenMagicNumberIsInvalid (int magicNumber, const char *fn)
 Trigger fatal error if magic number is unsupported. More...
 
t_edpar read_edi (FILE *in, int nr_mdatoms, bool hasConstForceFlooding, const char *fn)
 reads an essential dynamics input file into a essential dynamics data structure. More...
 
void do_linfix (rvec *xcoll, const t_edpar &edi, int64_t step)
 Apply fixed linear constraints to essential dynamics variable. More...
 
void do_linacc (rvec *xcoll, t_edpar *edi)
 Apply acceptance linear constraints to essential dynamics variable. More...
 
void write_edo (const t_edpar &edi, FILE *fp, real rmsd)
 Write out the projections onto the eigenvectors. The order of output corresponds to ed_output_legend(). More...
 

Variables

constexpr int c_oldestUnsupportedMagicNumber = 666
 Oldest (lowest) magic number indicating unsupported essential dynamics input.
 
constexpr int c_oldestSupportedMagicNumber = 669
 Oldest (lowest) magic number indicating supported essential dynamics input.
 
constexpr int c_latestSupportedMagicNumber = 670
 Latest (highest) magic number indicating supported essential dynamics input.
 

Enumeration Type Documentation

enum anonymous_namespace{edsam.cpp}::EssentialDynamicsStructure
strong

Identify on which structure to operate.

Enumerator
Reference 

Reference structure.

Average 

Average Structure.

Origin 

Origin Structure.

Target 

Target Structure.

enum anonymous_namespace{edsam.cpp}::EssentialDynamicsType
strong

Identifies the type of ED: none, normal ED, flooding.

Enumerator
None 

No essential dynamics.

EDSampling 

Essential dynamics sampling.

Flooding 

Essential dynamics flooding.

Function Documentation

bool anonymous_namespace{edsam.cpp}::bNeedDoEdsam ( const t_edpar &  edi)

Determines whether to perform essential dynamics constraints other than flooding.

Parameters
[in]edithe essential dynamics parameters
Returns
true if essential dyanmics constraints need to be performed
real anonymous_namespace{edsam.cpp}::calc_radius ( const t_eigvec &  vec)

Evaluates the distance from reference to current eigenvector projection.

Parameters
[in]veceigenvector
Returns
distance
void anonymous_namespace{edsam.cpp}::do_linacc ( rvec xcoll,
t_edpar *  edi 
)

Apply acceptance linear constraints to essential dynamics variable.

Parameters
[in,out]xcollThe collected coordinates.
[in]edithe essential dynamics parameters
void anonymous_namespace{edsam.cpp}::do_linfix ( rvec xcoll,
const t_edpar &  edi,
int64_t  step 
)

Apply fixed linear constraints to essential dynamics variable.

Parameters
[in,out]xcollThe collected coordinates.
[in]edithe essential dynamics parameters
[in]stepthe current simulation step
bool anonymous_namespace{edsam.cpp}::ediFileHasConstForceFlooding ( int  magicNumber)

Check if edi file version supports CONST_FORCE_FLOODING.

Parameters
[in]magicNumberindicates the essential dynamics input file version
Returns
true if CONST_FORCE_FLOODING is supported
bool anonymous_namespace{edsam.cpp}::ediFileHasValidDataSet ( FILE *  in,
int *  magicNumber 
)

Reports reading success of the essential dynamics input file magic number.

Parameters
[in]inpointer to input file
[out]magicNumberdetermines the edi file version
Returns
true if setting file version from input file was successful.
void anonymous_namespace{edsam.cpp}::exitWhenMagicNumberIsInvalid ( int  magicNumber,
const char *  fn 
)

Trigger fatal error if magic number is unsupported.

Parameters
[in]magicNumberA magic number read from the edi file
[in]fnname of input file for error reporting
void anonymous_namespace{edsam.cpp}::flood_blowup ( const t_edpar &  edi,
rvec forces_cart 
)

Raise forces from subspace into cartesian space. This function lifts the forces from the subspace to the cartesian space all the values not contained in the subspace are assumed to be zero and then a coordinate transformation from eigenvector to cartesian vectors is performed The nonexistent values don't have to be set to zero explicitly, they would occur as zero valued summands, hence we just stop to compute this part of the sum. For every atom we add all the contributions to this atom from all the different eigenvectors. NOTE: one could add directly to the forcefield forces, would mean we wouldn't have to clear the field forces_cart prior the computation, but we compute the forces separately to have them accessible for diagnostics.

Parameters
[in]ediEssential dynamics input parameters
[out]forces_cartThe cartesian forces
void anonymous_namespace{edsam.cpp}::project_to_eigvectors ( rvec x,
t_eigvec *  vec,
const t_edpar &  edi 
)

Projects coordinates onto eigenvectors and stores result in vec->xproj. Mass-weighting is applied. Subtracts average positions prior to projection and add them afterwards to retain the unchanged vector.

Parameters
[in]xThe coordinates to project to an eigenvector
[in,out]vecThe eigenvectors
[in]ediessential dynamics parameters holding average structure and masses
real anonymous_namespace{edsam.cpp}::projectx ( const t_edpar &  edi,
rvec xcoll,
rvec vec 
)

The mass-weighted inner product of two coordinate vectors. Does not subtract average positions, projection on single eigenvector is returned used by: do_linfix, do_linacc, do_radfix, do_radacc, do_radcon Average position is subtracted in ed_apply_constraints prior to calling projectx.

Parameters
[in]ediEssential dynamics parameters
[in]xcollvector of atom coordinates
[in]vecvector of coordinates to project onto
Returns
mass-weighted projection.
void anonymous_namespace{edsam.cpp}::rad_project ( const t_edpar &  edi,
rvec x,
t_eigvec *  vec 
)

Project coordinates onto vector after substracting average position. projection is stored in vec->refproj which is used for radacc, radfix, radcon and center of flooding potential. Average positions are first substracted from x, then added back again.

Parameters
[in]ediessential dynamics parameters with average position
[in]xCoordinates to be projected
[out]veceigenvector, radius and refproj are overwritten here
t_edpar anonymous_namespace{edsam.cpp}::read_edi ( FILE *  in,
int  nr_mdatoms,
bool  hasConstForceFlooding,
const char *  fn 
)

reads an essential dynamics input file into a essential dynamics data structure.

Parameters
[in]ininput file
[in]nr_mdatomsthe number of md atoms, used for consistency checking
[in]hasConstForceFloodingdetermines if field "CONST_FORCE_FLOODING" is available in input file
[in]fnthe file name of the input file for error reporting
Returns
edi essential dynamics parameters
std::vector< t_edpar > anonymous_namespace{edsam.cpp}::read_edi_file ( const char *  fn,
int  nr_mdatoms 
)

Read in the essential dynamics input file and return its contents.

Parameters
[in]fnthe file name of the edi file to be read
[in]nr_mdatomsthe number of atoms in the simulation
Returns
A vector of containing the essentiail dyanmics parameters. NOTE: edi files may that it may contain several ED data sets from concatenated edi files. The standard case would be a single ED data set, though.
void anonymous_namespace{edsam.cpp}::read_edvec ( FILE *  in,
int  nrAtoms,
t_eigvec *  tvec 
)

Read an essential dynamics eigenvector and corresponding step size.

Parameters
[in]ininput file
[in]nrAtomsnumber of atoms/coordinates
[out]tvecthe eigenvector
bool anonymous_namespace{edsam.cpp}::readEdVecWithReferenceProjection ( FILE *  in,
int  nrAtoms,
t_eigvec *  tvec,
real **  initialReferenceProjection,
real **  referenceProjectionSlope 
)

Read an essential dynamics eigenvector and initial reference projections and slopes if available.

Eigenvector and its initial reference and slope are stored on the same line in the .edi format. To avoid re-winding the .edi file, the reference eigen-vector and reference data are read in one go.

Parameters
[in]ininput file
[in]nrAtomsnumber of atoms/coordinates
[out]tvecthe eigenvector
[out]initialReferenceProjectionThe projection onto eigenvectors as read from file.
[out]referenceProjectionSlopeThe slope of the reference projections.
void anonymous_namespace{edsam.cpp}::scan_edvec ( FILE *  in,
int  numAtoms,
rvec ***  vec,
int  nEig 
)

Read eigenvector coordinates for multiple eigenvectors from a file.

Parameters
[in]inthe file to read from
[in]numAtomsthe number of atoms/coordinates for the eigenvector
[out]vecthe eigen-vectors
[in]nEigthe number of eigenvectors
void anonymous_namespace{edsam.cpp}::setup_edi ( t_edpar *  edi)

Set up essential dynamics work parameters.

Parameters
[in]ediEssential dynamics working structure.
void anonymous_namespace{edsam.cpp}::setup_edvec ( t_eigvec *  tvec)

Allocate working memory for the eigenvectors.

Parameters
[in,out]tveceigenvector for which memory will be allocated
void anonymous_namespace{edsam.cpp}::write_edo ( const t_edpar &  edi,
FILE *  fp,
real  rmsd 
)

Write out the projections onto the eigenvectors. The order of output corresponds to ed_output_legend().

Parameters
[in]ediThe essential dyanmics parameters
[in]fpThe output file
[in]rmsdthe rmsd to the reference structure
void anonymous_namespace{edsam.cpp}::write_edo_flood ( const t_edpar &  edi,
FILE *  fp,
real  rmsd 
)

Output flooding simulation settings and results to file.

Parameters
[in]ediEssential dynamics input parameters
[in]fpoutput file
[in]rmsdrmsd to reference structure