Gromacs  2027.0-dev-20261009-dd255a67
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Enumerations | Functions | Variables
gmx::anonymous_namespace{checkpoint.cpp} Namespace Reference

Enumerations

enum  StateKineticEntry : int {
  EkinNumber, EkinHalfStep, DEkinDLambda, Mvcos,
  EkinFullStep, EkinHalfStepOld, EkinNoseHooverScaleFullStep, EkinNoseHooverScaleHalfStep,
  VelocityScale, EkinTotal, Count
}
 
enum  StateEnergyEntry : int {
  N, SumSqDev, Sum, NumSum,
  SumSim, NumSumSim, NumSteps, NumStepsSim,
  DeltaHNN, DeltaHList, DeltaHStartTime, DeltaHStartLambda,
  Count
}
 
enum  StatePullEntry : int {
  NumCoordinates, NumGroups, NumValuesInXSum, NumValuesInFSum,
  Count
}
 
enum  StatePullCoordEntry : int {
  ValueReferenceSum, ValueSum, DR01Sum, DR23Sum,
  DR45Sum, FScalarSum, DynaxSum, Count
}
 
enum  StatePullGroupEntry : int { XSum, Count }
 
enum  StateFepEntry : int {
  IsEquilibrated, NumAtLambdaStats, NumAtLambdaEquil, WangLandauHistogram,
  WangLandauDelta, SumWeights, SumDG, SumMinVar,
  SumVar, Accump, Accumm, Accump2,
  Accumm2, Tij, TijEmp, Count
}
 
enum  StateAwhEntry : int {
  InInitial, EquilibrateHistogram, HistogramSize, NumPoints,
  CoordPoint, UmbrellaGridPoint, UpdateList, LogScaledSampleWeight,
  NumUpdates, ForceCorrelationGrid, Count
}
 AWH biasing history variables.
 
enum  StatePullCommunicationEntry : int { PreviousStepCom, Count }
 
enum  CptElementType { CptElementType::integer, CptElementType::realnum, CptElementType::real3, CptElementType::matrix3x3 }
 Higher level vector element type, only used for formatting checkpoint dumps. More...
 

Functions

static const char * enumValueToString (StateKineticEntry enumValue)
 
static const char * enumValueToString (StatePullCoordEntry enumValue)
 
static const char * enumValueToString (StatePullGroupEntry enumValue)
 
static const char * enumValueToString (StateEnergyEntry enumValue)
 
static const char * enumValueToString (StatePullEntry enumValue)
 
static const char * enumValueToString (StateFepEntry enumValue)
 free energy history names
 
static const char * enumValueToString (StateAwhEntry enumValue)
 
static void cp_warning (FILE *fp)
 
static void cp_error ()
 
static void do_cpt_string_err (XdrSerializer *serializer, const char *desc, ArrayRef< char > s, FILE *list)
 
static int do_cpt_int (XdrSerializer *serializer, const char *desc, int *i, FILE *list)
 
static int do_cpt_u_chars (XdrSerializer *serializer, const char *desc, int n, unsigned char *i, FILE *list)
 
template<typename EnumType >
static int do_cpt_enum_as_int (XdrSerializer *serializer, const char *desc, EnumType *enumValue, FILE *list)
 
template<typename EnumType >
static int do_cpt_n_enum_as_int (XdrSerializer *serializer, const char *desc, int n, EnumType *enumValue, FILE *list)
 
static void do_cpt_int_err (XdrSerializer *serializer, const char *desc, int *i, FILE *list)
 
static void do_cpt_bool_err (XdrSerializer *serializer, const char *desc, bool *b, FILE *list)
 
static void do_cpt_step_err (XdrSerializer *serializer, const char *desc, int64_t *i, FILE *list)
 
static void do_cpt_double_err (XdrSerializer *serializer, const char *desc, double *f, FILE *list)
 
static void do_cpt_real_err (XdrSerializer *serializer, real *f)
 
static void do_cpt_n_rvecs_err (XdrSerializer *serializer, const char *desc, int n, rvec f[], FILE *list)
 
static unsigned int sizeOfXdrType (XdrDataType xdrType)
 Returns size in byte of an XdrDataType.
 
static xdrproc_t xdrProc (XdrDataType xdrType)
 Returns the XDR process function for i/o of an XDR type.
 
template<typename Enum >
static bool_t listXdrVector (XdrSerializer *serializer, Enum ecpt, int nf, XdrDataType xdrType, FILE *list, CptElementType cptElementType)
 Lists or only reads an xdr vector from checkpoint file. More...
 
static gmx_unused void convertArrayRealPrecision (const char *c, float *v, int n)
 Convert a double array, typed char*, to float.
 
static void convertArrayRealPrecision (const char *c, double *v, int n)
 Convert a float array, typed char*, to double.
 
static void convertArrayRealPrecision (const char gmx_unused *c, int gmx_unused *v, int gmx_unused n)
 Generate an error for trying to convert to integer.
 
template<typename T , typename AllocatorType , typename Enum >
static int doVectorLow (XdrSerializer *serializer, Enum ecpt, const int64_t nval, T **v, std::vector< T, AllocatorType > *vector, FILE *list, CptElementType cptElementType)
 Low-level routine for reading/writing a vector of reals from/to file. More...
 
template<typename T , typename Enum >
static int doVector (XdrSerializer *serializer, Enum ecpt, std::vector< T > *vector, FILE *list, int numElements=-1)
 Read/Write a std::vector, on read checks the number of elements matches numElements, if specified.
 
template<typename Enum >
static int doRealArrayRef (XdrSerializer *serializer, Enum ecpt, ArrayRef< float > vector, FILE *list)
 Read/Write an ArrayRef<float>.
 
template<typename Enum >
static int doRealArrayRef (XdrSerializer *serializer, Enum ecpt, ArrayRef< double > vector, FILE *list)
 Read/Write an ArrayRef<double>.
 
template<typename Enum >
static int doIntArrayRef (XdrSerializer *serializer, Enum ecpt, ArrayRef< int > vector, FILE *list)
 Read/Write an ArrayRef<int>.
 
template<typename T >
static ArrayRef< T > scalarArrayRefFromVecArrayRef (ArrayRef< BasicVector< T >> ofVecs)
 Convert from view of BasicVector to view of its scalar type.
 
template<typename VectorOfRVecType , typename Enum >
static int doRvecVector (XdrSerializer *serializer, Enum ecpt, VectorOfRVecType *v, Index numElements, FILE *list)
 Read/Write a Vector whose value_type is BasicVector.
 
template<typename Enum >
static int do_cpte_real (XdrSerializer *serializer, Enum ecpt, real *r, FILE *list)
 
template<typename Enum >
static int do_cpte_ints (XdrSerializer *serializer, Enum ecpt, int n, int **v, FILE *list)
 
template<typename Enum >
static int do_cpte_int (XdrSerializer *serializer, Enum ecpt, int *i, FILE *list)
 
template<typename Enum >
static int do_cpte_bool (XdrSerializer *serializer, Enum ecpt, bool *b, FILE *list)
 
template<typename Enum >
static int do_cpte_doubles (XdrSerializer *serializer, Enum ecpt, int n, double **v, FILE *list)
 
template<typename Enum >
static int do_cpte_double (XdrSerializer *serializer, Enum ecpt, double *r, FILE *list)
 
template<typename Enum >
static int do_cpte_matrix (XdrSerializer *serializer, Enum ecpt, matrix v, FILE *list)
 
template<typename Enum >
static int do_cpte_matrices (XdrSerializer *serializer, Enum ecpt, int n, std::vector< Matrix3x3 > *v, FILE *list)
 
static void do_cpt_header (XdrSerializer *serializer, gmx_bool bRead, FILE *list, CheckpointHeaderContents *contents)
 
static int do_cpt_footer (XdrSerializer *serializer, CheckPointVersion file_version)
 
static int do_cpt_state (XdrSerializer *serializer, t_state *state, FILE *list)
 
static int do_cpt_ekinstate (XdrSerializer *serializer, int fflags, ekinstate_t *ekins, FILE *list)
 
static int do_cpt_swapstate (XdrSerializer *serializer, gmx_bool bRead, SwapType eSwapCoords, swaphistory_t *swapstate, FILE *list)
 
static int do_cpt_enerhist (XdrSerializer *serializer, gmx_bool bRead, int fflags, energyhistory_t *enerhist, FILE *list)
 
static int doCptPullCoordHist (XdrSerializer *serializer, PullCoordinateHistory *pullCoordHist, FILE *list)
 
static int doCptPullGroupHist (XdrSerializer *serializer, PullGroupHistory *pullGroupHist, FILE *list)
 
static int doCptPullHist (XdrSerializer *serializer, gmx_bool bRead, int fflags, PullHistory *pullHist, FILE *list)
 
static int do_cpt_df_hist (XdrSerializer *serializer, int fflags, int nlambda, std::shared_ptr< df_history_t > *dfhistPtr, FILE *list)
 
static int do_cpt_EDstate (XdrSerializer *serializer, gmx_bool bRead, int nED, edsamhistory_t *EDstate, FILE *list)
 
static int do_cpt_correlation_grid (XdrSerializer *serializer, gmx_bool bRead, gmx_unused int fflags, CorrelationGridHistory *corrGrid, FILE *list, StateAwhEntry eawhh)
 
static int do_cpt_awh_bias (XdrSerializer *serializer, gmx_bool bRead, int fflags, AwhBiasHistory *biasHistory, FILE *list, const CheckPointVersion fileVersion)
 
static int do_cpt_awh (XdrSerializer *serializer, gmx_bool bRead, int fflags, AwhHistory *awhHistory, FILE *list, const CheckPointVersion fileVersion)
 
static void do_cpt_mdmodules (CheckPointVersion fileVersion, ISerializer *serializer, const MDModulesNotifiers &mdModulesNotifiers, FILE *outputFile)
 
static int do_cpt_files (XdrSerializer *serializer, gmx_bool bRead, std::vector< gmx_file_position_t > *outputfiles, FILE *list, CheckPointVersion file_version)
 

Variables

constexpr CheckPointVersion cpt_version = CheckPointVersion::CurrentVersion
 Version number of the file format written to checkpoint files by this version of the code. More...
 

Enumeration Type Documentation

enum gmx::anonymous_namespace{checkpoint.cpp}::CptElementType
strong

Higher level vector element type, only used for formatting checkpoint dumps.

Enumerator
integer 

integer

realnum 

float or double, not linked to precision of type real

real3 

float[3] or double[3], not linked to precision of type real

matrix3x3 

float[3][3] or double[3][3], not linked to precision of type real

Function Documentation

template<typename T , typename AllocatorType , typename Enum >
static int gmx::anonymous_namespace{checkpoint.cpp}::doVectorLow ( XdrSerializer *  serializer,
Enum  ecpt,
const int64_t  nval,
T **  v,
std::vector< T, AllocatorType > *  vector,
FILE *  list,
CptElementType  cptElementType 
)
static

Low-level routine for reading/writing a vector of reals from/to file.

This is the only routine that does the actually i/o of real vector, all other routines are intermediate level routines for specific real data types, calling this routine. Currently this routine is (too) complex, since it handles both real * and std::vector<real>. Using real * is deprecated and this routine will simplify a lot when only std::vector needs to be supported.

The routine is generic to vectors with different allocators, because as part of reading a checkpoint there are vectors whose size is not known until reading has progressed far enough, so a resize method must be called.

When not listing, we use either v or vector, depending on which is !=NULL. If nval >= 0, nval is used; on read this should match the passed value. If nval n<0, vector->size() is used.

template<typename Enum >
static bool_t gmx::anonymous_namespace{checkpoint.cpp}::listXdrVector ( XdrSerializer *  serializer,
Enum  ecpt,
int  nf,
XdrDataType  xdrType,
FILE *  list,
CptElementType  cptElementType 
)
static

Lists or only reads an xdr vector from checkpoint file.

When list!=NULL reads and lists the nf vector elements of type xdrType. The header for the print is set by part and ecpt. The formatting of the printing is set by cptElementType. When list==NULL only reads the elements.

Variable Documentation

constexpr CheckPointVersion gmx::anonymous_namespace{checkpoint.cpp}::cpt_version = CheckPointVersion::CurrentVersion

Version number of the file format written to checkpoint files by this version of the code.

cpt_version should normally only be changed, via adding a new field to cptv enumeration, when the header or footer format changes.

The state data format itself is backward and forward compatible. But old code can not read a new entry that is present in the file (but can read a new format when new entries are not present).

The cpt_version increases whenever the file format in the main development branch changes, due to an extension of the CheckPointVersion enum (see src/gromacs/fileio/checkpoint.h). Backward compatibility for reading old run input files is maintained by checking this version number against that of the file and then using the correct code path.