Gromacs  2018.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Typedefs | Enumerations | Functions | Variables
gmx Namespace Reference

Description

Generic GROMACS namespace.

Declares the integrator for test particle insertion.

Declares the integrators for energy minimization and NMA.

Convenience macro to help us avoid ifdefs each time we use sysconf.

Author
David van der Spoel david.nosp@m..van.nosp@m.dersp.nosp@m.oel@.nosp@m.icm.u.nosp@m.u.se
Berk Hess hess@.nosp@m.kth..nosp@m.se

Classes

class  AbstractAnalysisData
 Abstract base class for all objects that provide data. More...
 
class  AnalysisData
 Parallelizable data container for raw data. More...
 
class  AnalysisDataHandle
 Handle for inserting data into AnalysisData. More...
 
class  AbstractAnalysisArrayData
 Abstract base class for data objects that present in-memory data. More...
 
class  AnalysisArrayData
 Simple in-memory data array. More...
 
class  AnalysisDataValue
 Value type for representing a single value in analysis data objects. More...
 
class  AnalysisDataFrameHeader
 Value type for storing frame-level information for analysis data. More...
 
class  AnalysisDataPointSetRef
 Value type wrapper for non-mutable access to a set of data column values. More...
 
class  AnalysisDataFrameRef
 Value type wrapper for non-mutable access to a data frame. More...
 
class  IAnalysisDataModule
 Interface for a module that gets notified whenever data is added. More...
 
class  AnalysisDataModuleSerial
 Convenience base class for serial analysis data modules. More...
 
class  AnalysisDataModuleParallel
 Convenience base class for parallel analysis data modules. More...
 
class  AnalysisDataAverageModule
 Data module for independently averaging each column in input data. More...
 
class  AnalysisDataFrameAverageModule
 Data module for averaging of columns for each frame. More...
 
class  AnalysisDataDisplacementModule
 Data module for calculating displacements. More...
 
class  AnalysisHistogramSettingsInitializer
 Provides "named parameter" idiom for constructing histograms. More...
 
class  AnalysisHistogramSettings
 Contains parameters that specify histogram bin locations. More...
 
class  AbstractAverageHistogram
 Base class for representing histograms averaged over frames. More...
 
class  AnalysisDataSimpleHistogramModule
 Data module for per-frame histograms. More...
 
class  AnalysisDataWeightedHistogramModule
 Data module for per-frame weighted histograms. More...
 
class  AnalysisDataBinAverageModule
 Data module for bin averages. More...
 
class  AnalysisDataLifetimeModule
 Data module for computing lifetime histograms for columns in input data. More...
 
class  AnalysisDataPlotSettings
 Common settings for data plots. More...
 
class  AbstractPlotModule
 Abstract data module for writing data into a file. More...
 
class  AnalysisDataPlotModule
 Plotting module for straightforward plotting of data. More...
 
class  AnalysisDataVectorPlotModule
 Plotting module specifically for data consisting of vectors. More...
 
class  ArrayRef
 STL-like container for an interface to a C array of T (or part of a std::vector<T, A> or std::array<T>). More...
 
class  CommandLineHelpWriter
 Writes help information for Options. More...
 
class  CommandLineModuleSettings
 Settings to pass information between a module and the general runner. More...
 
class  ICommandLineModule
 Module that can be run from command line using CommandLineModuleManager. More...
 
class  ICommandLineOptionsModuleSettings
 Settings to pass information between a CommandLineOptionsModule and generic code that runs it. More...
 
class  ICommandLineOptionsModule
 Module that can be run from a command line and uses gmx::Options for argument processing. More...
 
class  CommandLineParser
 Implements command-line parsing for Options objects. More...
 
struct  StaticLog2
 Evaluate log2(n) for integer n statically at compile time. More...
 
struct  StaticLog2< 1 >
 Specialization of StaticLog2<n> for n==1. More...
 
struct  StaticLog2< 0 >
 Specialization of StaticLog2<n> for n==0. More...
 
class  BasicVector
 C++ class for 3D vectors. More...
 
class  AbstractOption
 Abstract base class for specifying option properties. More...
 
class  OptionTemplate
 Templated base class for constructing concrete option settings classes. More...
 
class  OptionInfo
 Gives information and allows modifications to an option after creation. More...
 
class  AbstractOptionSection
 Base class for specifying option section properties. More...
 
class  AbstractOptionSectionHandle
 Base class for handles to option sections. More...
 
class  BooleanOption
 Specifies an option that provides boolean values. More...
 
class  IntegerOption
 Specifies an option that provides integer values. More...
 
class  Int64Option
 Specifies an option that provides 64-bit integer values. More...
 
class  DoubleOption
 Specifies an option that provides floating-point (double) values. More...
 
class  FloatOption
 Specifies an option that provides floating-point (float) values. More...
 
class  StringOption
 Specifies an option that provides string values. More...
 
class  EnumOption
 Specifies an option that accepts enumerated string values and writes the selected index into an enum variable. More...
 
class  BooleanOptionInfo
 Wrapper class for accessing boolean option information. More...
 
class  IntegerOptionInfo
 Wrapper class for accessing integer option information. More...
 
class  Int64OptionInfo
 Wrapper class for accessing 64-bit integer option information. More...
 
class  DoubleOptionInfo
 Wrapper class for accessing floating-point option information. More...
 
class  FloatOptionInfo
 Wrapper class for accessing floating-point option information. More...
 
class  StringOptionInfo
 Wrapper class for accessing string option information. More...
 
class  EnumOptionInfo
 Wrapper class for accessing enum option information. More...
 
class  FileNameOption
 Specifies an option that provides file names. More...
 
class  FileNameOptionInfo
 Wrapper class for accessing file name option information. More...
 
class  FileNameOptionManager
 Handles interaction of file name options with global options. More...
 
class  IOptionsBehavior
 Interface to provide extension points for options parsing. More...
 
class  IOptionsContainer
 Interface for adding input options. More...
 
class  IOptionsContainerWithSections
 Interface for adding input options with sections. More...
 
class  IOptionManager
 Base class for option managers. More...
 
class  Options
 Collection of options. More...
 
class  OptionSection
 Declares a simple option section. More...
 
class  OptionSectionHandle
 Allows adding options to an OptionSection. More...
 
class  RepeatingOptionSectionHandle
 Allows adding options to an RepeatingOptionSection. More...
 
class  RepeatingOptionSection
 Declares an option section that creates a structure for each instance. More...
 
class  TimeUnitManager
 Provides common functionality for time unit conversions. More...
 
class  TimeUnitBehavior
 Options behavior to add a time unit option. More...
 
class  ExponentialDistribution
 Exponential distribution. More...
 
class  GammaDistribution
 Gamma distribution. More...
 
class  NormalDistribution
 Normal distribution. More...
 
class  TabulatedNormalDistribution
 Tabulated normal random distribution. More...
 
class  ThreeFry2x64General
 General implementation class for ThreeFry counter-based random engines. More...
 
class  ThreeFry2x64
 ThreeFry2x64 random engine with 20 iteractions. More...
 
class  ThreeFry2x64Fast
 ThreeFry2x64 random engine with 13 iteractions. More...
 
class  UniformIntDistribution
 Uniform integer distribution. More...
 
class  UniformRealDistribution
 Uniform real distribution. More...
 
class  AnalysisNeighborhoodPositions
 Input positions for neighborhood searching. More...
 
class  AnalysisNeighborhood
 Neighborhood searching for analysis tools. More...
 
class  AnalysisNeighborhoodPair
 Value type to represent a pair of positions found in neighborhood searching. More...
 
class  AnalysisNeighborhoodSearch
 Initialized neighborhood search with a fixed set of reference positions. More...
 
class  AnalysisNeighborhoodPairSearch
 Initialized neighborhood pair search with a fixed set of positions. More...
 
class  Selection
 Provides access to a single selection. More...
 
class  SelectionPosition
 Provides access to information about a single selected position. More...
 
class  SelectionCollection
 Collection of selections. More...
 
struct  SelectionTopologyProperties
 Describes topology properties required for selection evaluation. More...
 
class  SelectionOption
 Specifies an option that provides selection(s). More...
 
class  SelectionOptionInfo
 Wrapper class for accessing and modifying selection option information. More...
 
class  ITopologyProvider
 Provides topology information to SelectionOptionBehavior. More...
 
class  SelectionOptionBehavior
 Options behavior to allow using SelectionOptions. More...
 
class  SelectionOptionManager
 Handles interaction of selection options with other options and user input. More...
 
class  TrajectoryAnalysisModuleData
 Base class for thread-local data storage during trajectory analysis. More...
 
class  TrajectoryAnalysisModule
 Base class for trajectory analysis modules. More...
 
class  TrajectoryAnalysisSettings
 Trajectory analysis module configuration object. More...
 
class  TopologyInformation
 Topology information passed to a trajectory analysis module. More...
 
class  TrajectoryAnalysisCommandLineRunner
 Runner for command-line trajectory analysis tools. More...
 
struct  EmptyArrayRef
 Tag type to initialize empty array references. More...
 
class  PrivateImplPointer
 Helper class to manage a pointer to a private implementation class. More...
 
class  DataFileOptions
 Search parameters for DataFileFinder. More...
 
struct  DataFileInfo
 Information about a data file found by DataFileFinder::enumerateFiles(). More...
 
class  DataFileFinder
 Searches data files from a set of paths. More...
 
class  ExceptionInfo
 Stores additional context information for exceptions. More...
 
class  ExceptionInitializer
 Provides information for Gromacs exception constructors. More...
 
class  GromacsException
 Base class for all exception objects in Gromacs. More...
 
class  FileIOError
 Exception class for file I/O errors. More...
 
class  UserInputError
 Exception class for user input errors. More...
 
class  InvalidInputError
 Exception class for situations where user input cannot be parsed/understood. More...
 
class  InconsistentInputError
 Exception class for situations where user input is inconsistent. More...
 
class  ToleranceError
 Exception class when a specified tolerance cannot be achieved. More...
 
class  SimulationInstabilityError
 Exception class for simulation instabilities. More...
 
class  InternalError
 Exception class for internal errors. More...
 
class  APIError
 Exception class for incorrect use of an API. More...
 
class  RangeError
 Exception class for out-of-range values or indices. More...
 
class  NotImplementedError
 Exception class for use of an unimplemented feature. More...
 
class  FlagsTemplate
 Template class for typesafe handling of combination of flags. More...
 
struct  InstallationPrefixInfo
 Provides information about installation prefix (see IProgramContext::installationPrefix()). More...
 
class  IProgramContext
 Provides context information about the program that is calling the library. More...
 
class  StringFormatter
 Function object that wraps a call to formatString() that expects a single conversion argument, for use with algorithms. More...
 
class  IdentityFormatter
 Function object to implement the same interface as StringFormatter to use with strings that should not be formatted further. More...
 
class  TextLineWrapperSettings
 Stores settings for line wrapping. More...
 
class  TextLineWrapper
 Wraps lines to a predefined length. More...
 

Typedefs

typedef std::shared_ptr
< IAnalysisDataModule
AnalysisDataModulePointer
 Smart pointer for managing a generic analysis data module.
 
typedef ArrayRef< const
AnalysisDataValue
AnalysisDataValuesRef
 Shorthand for reference to an array of data values.
 
typedef std::shared_ptr
< AnalysisDataAverageModule
AnalysisDataAverageModulePointer
 Smart pointer to manage an AnalysisDataAverageModule object.
 
typedef std::shared_ptr
< AnalysisDataFrameAverageModule
AnalysisDataFrameAverageModulePointer
 Smart pointer to manage an AnalysisDataFrameAverageModule object.
 
typedef std::shared_ptr
< AnalysisDataDisplacementModule
AnalysisDataDisplacementModulePointer
 Smart pointer to manage an AnalysisDataDisplacementModule object.
 
typedef std::unique_ptr
< AbstractAverageHistogram
AverageHistogramPointer
 Smart pointer to manage an AbstractAverageHistogram object.
 
typedef std::shared_ptr
< AnalysisDataSimpleHistogramModule
AnalysisDataSimpleHistogramModulePointer
 Smart pointer to manage an AnalysisDataSimpleHistogramModule object.
 
typedef std::shared_ptr
< AnalysisDataWeightedHistogramModule
AnalysisDataWeightedHistogramModulePointer
 Smart pointer to manage an AnalysisDataWeightedHistogramModule object.
 
typedef std::shared_ptr
< AnalysisDataBinAverageModule
AnalysisDataBinAverageModulePointer
 Smart pointer to manage an AnalysisDataBinAverageModule object.
 
typedef std::shared_ptr
< AnalysisDataLifetimeModule
AnalysisDataLifetimeModulePointer
 Smart pointer to manage an AnalysisDataLifetimeModule object.
 
typedef std::shared_ptr
< AnalysisDataPlotModule
AnalysisDataPlotModulePointer
 Smart pointer to manage an AnalysisDataPlotModule object.
 
typedef std::shared_ptr
< AnalysisDataVectorPlotModule
AnalysisDataVectorPlotModulePointer
 Smart pointer to manage an AnalysisDataVectorPlotModule object.
 
typedef double awh_dvec [c_biasMaxNumDim]
 A real vector in AWH coordinate space.
 
typedef int awh_ivec [c_biasMaxNumDim]
 An integer vector in AWH coordinate space.
 
typedef std::map< std::string,
CommandLineModulePointer
CommandLineModuleMap
 Container type for mapping module names to module objects.
 
typedef std::unique_ptr
< CommandLineModuleGroupData > 
CommandLineModuleGroupDataPointer
 Smart pointer type for managing a CommandLineModuleGroup.
 
typedef std::vector
< CommandLineModuleGroupDataPointer
CommandLineModuleGroupList
 Container type for keeping a list of module groups.
 
typedef std::unique_ptr
< ICommandLineModule
CommandLineModulePointer
 Smart pointer type for managing a ICommandLineModule.
 
typedef std::unique_ptr
< ICommandLineOptionsModule
ICommandLineOptionsModulePointer
 Smart pointer to manage an ICommandLineOptionsModule.
 
typedef std::unique_ptr
< IExecutableEnvironment > 
ExecutableEnvironmentPointer
 Shorthand for a smart pointer to IExecutableEnvironment.
 
template<class T >
using HostAllocator = Allocator< T, HostAllocationPolicy >
 Memory allocator that uses HostAllocationPolicy. More...
 
template<class T >
using HostVector = std::vector< T, HostAllocator< T > >
 Convenience alias for std::vector that uses HostAllocator.
 
using PaddedRVecVector = std::vector< RVec, Allocator< RVec, AlignedAllocationPolicy > >
 Temporary definition of a type usable for SIMD-style loads of RVec quantities. More...
 
template<typename T >
using PaddedArrayRef = ArrayRef< T >
 Temporary definition of a type usable for SIMD-style loads of RVec quantities from a view. More...
 
typedef BasicVector< realRVec
 Shorthand for C++ rvec-equivalent type.
 
typedef BasicVector< int > IVec
 Shorthand for C++ ivec-equivalent type.
 
typedef double integrator_t (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, MDAtoms *mdatoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Integrator algorithm implementation. More...
 
typedef std::array
< SimulationSignal, eglsNR > 
SimulationSignals
 Convenience typedef for the group of signals used.
 
typedef std::unique_ptr
< IHelpTopic > 
HelpTopicPointer
 Smart pointer type to manage a IHelpTopic object.
 
typedef EnumOption< int > EnumIntOption
 Shorthand for an enumerated option that stores into an int variable.
 
typedef FloatOption RealOption
 Typedef for either DoubleOption or FloatOption, depending on precision. More...
 
typedef FloatOptionInfo RealOptionInfo
 Typedef for either DoubleOptionInfo or FloatOptionInfo, depending on precision. More...
 
typedef std::shared_ptr
< IOptionsBehavior
OptionsBehaviorPointer
 Smart pointer for behaviors stored in OptionsBehaviorCollection.
 
typedef std::random_device RandomDevice
 Random device. More...
 
typedef ThreeFry2x64Fast DefaultRandomEngine
 Default fast and accurate random engine in Gromacs. More...
 
typedef std::list
< SelectionParserValue > 
SelectionParserValueList
 Container for a list of SelectionParserValue objects.
 
typedef std::unique_ptr
< SelectionParserValueList
SelectionParserValueListPointer
 Smart pointer type for managing a SelectionParserValueList.
 
typedef std::list
< SelectionParserParameter > 
SelectionParserParameterList
 Container for a list of SelectionParserParameter objects.
 
typedef std::unique_ptr
< SelectionParserParameterList
SelectionParserParameterListPointer
 Smart pointer type for managing a SelectionParserParameterList.
 
typedef std::vector< SelectionSelectionList
 Container of selections used in public selection interfaces.
 
typedef std::unique_ptr
< internal::SelectionData > 
SelectionDataPointer
 Smart pointer for managing an internal selection data object.
 
typedef std::vector
< SelectionDataPointer
SelectionDataList
 Container for storing a list of selections internally.
 
typedef std::shared_ptr
< SelectionTreeElement > 
SelectionTreeElementPointer
 Smart pointer type for selection tree element pointers.
 
using GpuTaskAssignment = std::vector< GpuTaskMapping >
 Container of GPU tasks on a rank, specifying the task type and GPU device ID, e.g. potentially ready for consumption by the modules on that rank.
 
using GpuTasksOnRanks = std::vector< std::vector< GpuTask > >
 Container of compute tasks suitable to run on a GPU e.g. on each rank of a node.
 
using GpuTaskAssignments = std::vector< GpuTaskAssignment >
 Container of RankGpuTaskAssignments e.g. for all ranks on a node.
 
typedef std::unique_ptr
< TrajectoryAnalysisModuleData
TrajectoryAnalysisModuleDataPointer
 Smart pointer to manage a TrajectoryAnalysisModuleData object.
 
typedef std::unique_ptr
< TrajectoryAnalysisModule
TrajectoryAnalysisModulePointer
 Smart pointer to manage a TrajectoryAnalysisModule.
 
template<class T >
using AlignedAllocator = Allocator< T, AlignedAllocationPolicy >
 Aligned memory allocator. More...
 
template<class T >
using PageAlignedAllocator = Allocator< T, PageAlignedAllocationPolicy >
 PageAligned memory allocator. More...
 
typedef ExceptionInfo< struct
ExceptionInfoErrno_, int > 
ExceptionInfoErrno
 Stores errno value that triggered the exception.
 
typedef ExceptionInfo< struct
ExceptionInfoApiFunc_, const
char * > 
ExceptionInfoApiFunction
 Stores the function name that returned the errno in ExceptionInfoErrno.
 
typedef ExceptionInfo< struct
ExceptionInfoLocation_,
ThrowLocation > 
ExceptionInfoLocation
 Stores the location where the exception was thrown.
 
typedef std::shared_ptr
< TextInputStream > 
TextInputStreamPointer
 Shorthand for a smart pointer to a TextInputStream.
 
typedef std::shared_ptr
< TextOutputStream > 
TextOutputStreamPointer
 Shorthand for a smart pointer to a TextOutputStream.
 
template<typename T , void D = sfree_wrapper>
using unique_cptr = std::unique_ptr< T, functor_wrapper< T, D > >
 unique_ptr which takes function pointer (has to return void) as template argument
 
typedef unique_cptr< void > sfree_guard
 Simple guard which calls sfree. See unique_cptr for details.
 

Enumerations

enum  AwhOutputEntryType {
  AwhOutputEntryType::MetaData, AwhOutputEntryType::CoordValue, AwhOutputEntryType::Pmf, AwhOutputEntryType::Bias,
  AwhOutputEntryType::Visits, AwhOutputEntryType::Weights, AwhOutputEntryType::Target, AwhOutputEntryType::ForceCorrelationVolume,
  AwhOutputEntryType::FrictionTensor
}
 Enum with the AWH variables to write. More...
 
enum  AwhOutputMetaData { AwhOutputMetaData::NumBlock, AwhOutputMetaData::TargetError, AwhOutputMetaData::ScaledSampleWeight, AwhOutputMetaData::Count }
 Enum with the types of metadata to write. More...
 
enum  Normalization { Normalization::None, Normalization::Coordinate, Normalization::FreeEnergy, Normalization::Distribution }
 Enum with different ways of normalizing the output. More...
 
enum  PinningPolicy : int { CannotBePinned, CanBePinned }
 Helper enum for pinning policy of the allocation of HostAllocationPolicy. More...
 
enum  Architecture { Unknown, Architecture::X86, Architecture::Arm, Architecture::PowerPC }
 Enum for GROMACS CPU hardware detection support. More...
 
enum  {
  eawhtargetCONSTANT, eawhtargetCUTOFF, eawhtargetBOLTZMANN, eawhtargetLOCALBOLTZMANN,
  eawhtargetNR
}
 Target distribution enum.
 
enum  { eawhgrowthEXP_LINEAR, eawhgrowthLINEAR, eawhgrowthNR }
 Weight histogram growth enum.
 
enum  { eawhpotentialCONVOLVED, eawhpotentialUMBRELLA, eawhpotentialNR }
 AWH potential type enum.
 
enum  { eawhcoordproviderPULL, eawhcoordproviderNR }
 AWH bias reaction coordinate provider.
 
enum  OptionFileType {
  eftUnknown, eftTopology, eftTrajectory, eftEnergy,
  eftPDB, eftIndex, eftPlot, eftGenericData,
  eftOptionFileType_NR
}
 Purpose of file(s) provided through an option.
 
enum  TimeUnit {
  TimeUnit_fs, TimeUnit_ps, TimeUnit_ns, TimeUnit_us,
  TimeUnit_ms, TimeUnit_s, TimeUnit_Default = TimeUnit_ps
}
 Time values for TimeUnitManager. More...
 
enum  RandomDomain {
  RandomDomain::Other = 0x00000000, RandomDomain::MaxwellVelocities = 0x00001000, RandomDomain::TestParticleInsertion = 0x00002000, RandomDomain::UpdateCoordinates = 0x00003000,
  RandomDomain::UpdateConstraints = 0x00004000, RandomDomain::Thermostat = 0x00005000, RandomDomain::Barostat = 0x00006000, RandomDomain::ReplicaExchange = 0x00007000,
  RandomDomain::ExpandedEnsemble = 0x00008000, RandomDomain::AwhBiasing = 0x00009000
}
 Enumerated values for fixed part of random seed (domain) More...
 
enum  TaskTarget : int { Auto, Cpu, Gpu }
 Record where a compute task is targetted.
 
enum  GpuTask : int { GpuTask::Nonbonded, GpuTask::Pme }
 Types of compute tasks that can be run on a GPU. More...
 
enum  ErrorCode {
  eeOK, eeOutOfMemory, eeFileNotFound, eeFileIO,
  eeInvalidInput, eeInconsistentInput, eeTolerance, eeInstability,
  eeNotImplemented, eeInvalidValue, eeInvalidCall, eeInternalError,
  eeAPIError, eeRange, eeCommunication, eeUnknownError
}
 Possible error return codes from Gromacs functions. More...
 

Functions

AnalysisHistogramSettingsInitializer histogramFromRange (real min, real max)
 Initializes a histogram using a range and a bin width. More...
 
AnalysisHistogramSettingsInitializer histogramFromBins (real start, int nbins, real binwidth)
 Initializes a histogram using bin width and the number of bins. More...
 
std::unique_ptr< IMDModule > createElectricFieldModule ()
 Creates a module for an external electric field. More...
 
static gmx_int64_t countSamples (const std::vector< PointState > &pointState)
 Count the total number of samples / sample weight over all grid points. More...
 
static void ensureStateAndRunConsistency (const BiasParams &params, const BiasState &state)
 Check if the state (loaded from checkpoint) and the run are consistent. More...
 
bool haveBiasSharingWithinSimulation (const AwhParams &awhParams)
 Returns if any bias is sharing within a simulation. More...
 
void biasesAreCompatibleForSharingBetweenSimulations (const AwhParams &awhParams, const std::vector< size_t > &pointSize, const gmx_multisim_t *multiSimComm)
 Checks if biases are compatible for sharing between simulations, throws if not. More...
 
static void normalizeFreeEnergyAndPmfSum (std::vector< PointState > *pointState)
 Normalizes the free energy and PMF sum. More...
 
static int countTrailingZeroRows (const double *const *data, int numRows, int numColumns)
 Count trailing data rows containing only zeros. More...
 
static void readUserPmfAndTargetDistribution (const std::vector< DimParams > &dimParams, const Grid &grid, const std::string &filename, int numBias, int biasIndex, std::vector< PointState > *pointState)
 Initializes the PMF and target with data read from an input table. More...
 
static void normalizeBlock (AwhEnergyBlock *block, const Bias &bias)
 Normalizes block data for output. More...
 
void initCorrelationGridHistory (CorrelationGridHistory *correlationGridHistory, int numCorrelationTensors, int tensorSize, int blockDataListSize)
 Initialize correlation grid history, sets all sizes. More...
 
CorrelationGridHistory initCorrelationGridHistoryFromState (const CorrelationGrid &corrGrid)
 Allocate a correlation grid history with the same structure as the given correlation grid. More...
 
void updateCorrelationGridHistory (CorrelationGridHistory *corrGridHist, const CorrelationGrid &corrGrid)
 Update the correlation grid history for checkpointing. More...
 
void restoreCorrelationGridStateFromHistory (const CorrelationGridHistory &corrGridHist, CorrelationGrid *corrGrid)
 Restores the correlation grid state from the correlation grid history. More...
 
double getDeviationFromPointAlongGridAxis (const Grid &grid, int dimIndex, int pointIndex, double value)
 Get the deviation along one dimension from the given value to a point in the grid. More...
 
void linearArrayIndexToMultiDim (int indexLinear, int ndim, const awh_ivec numPointsDim, awh_ivec indexMulti)
 Convert a linear array index to a multidimensional one. More...
 
void linearGridindexToMultiDim (const Grid &grid, int indexLinear, awh_ivec indexMulti)
 Convert a linear grid point index to a multidimensional one. More...
 
int multiDimArrayIndexToLinear (const awh_ivec indexMulti, int numDim, const awh_ivec numPointsDim)
 Convert multidimensional array index to a linear one. More...
 
int multiDimGridIndexToLinear (const Grid &grid, const awh_ivec indexMulti)
 Convert a multidimensional grid point index to a linear one. More...
 
bool advancePointInSubgrid (const Grid &grid, const awh_ivec subgridOrigin, const awh_ivec subgridNpoints, int *gridPointIndex)
 Find the next grid point in the sub-part of the grid given a starting point. More...
 
static int pointDistanceAlongAxis (const GridAxis &axis, double x, double x0)
 Returns the point distance between from value x to value x0 along the given axis. More...
 
static bool valueIsInGrid (const awh_dvec value, const std::vector< GridAxis > &axis)
 Query if a value is in range of the grid. More...
 
static int getNearestIndexInGrid (const awh_dvec value, const std::vector< GridAxis > &axis)
 Map a value to the nearest point in the grid. More...
 
void mapGridToDataGrid (std::vector< int > *gridpointToDatapoint, const double *const *data, int numDataPoints, const std::string &dataFilename, const Grid &grid, const std::string &correctFormatMessage)
 Maps each point in the grid to a point in the data grid. More...
 
static void readDimParams (int *ninp_p, t_inpfile **inp_p, const char *prefix, AwhDimParams *dimParams, const pull_params_t *pull_params, warninp_t wi, bool bComment)
 Read parameters of an AWH bias dimension. More...
 
static void checkInputConsistencyAwhBias (const AwhBiasParams &awhBiasParams, warninp_t wi)
 Check consistency of input at the AWH bias level. More...
 
static void read_bias_params (int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhBiasParams, const char *prefix, const t_inputrec *ir, warninp_t wi, bool bComment)
 Read parameters of an AWH bias. More...
 
static void checkInputConsistencyAwh (const AwhParams &awhParams, warninp_t wi)
 Check consistency of input at the AWH level. More...
 
AwhParams * readAndCheckAwhParams (int *ninp_p, t_inpfile **inp_p, const t_inputrec *inputrec, warninp_t wi)
 Allocate, initialize and check the AWH parameters with values from the input file. More...
 
static double get_pull_coord_period (const pull_params_t *pull_params, int coord_ind, const matrix box)
 Gets the period of a pull coordinate. More...
 
static bool intervalIsInPeriodicInterval (double origin, double end, double period)
 Checks if the given interval is defined in the correct periodic interval. More...
 
static bool valueIsInInterval (double origin, double end, double period, double value)
 Checks if a value is within an interval. More...
 
static void checkInputConsistencyInterval (const AwhParams *awhParams, warninp_t wi)
 Check if the starting configuration is consistent with the given interval. More...
 
void setStateDependentAwhParams (AwhParams *awhParams, const pull_params_t *pull_params, pull_t *pull_work, const matrix box, int ePBC, const t_grpopts *inputrecGroupOptions, warninp_t wi)
 Sets AWH parameters that need state parameters such as the box vectors. More...
 
CommandLineProgramContext & initForCommandLine (int *argc, char ***argv)
 Initializes the GROMACS library for command-line use. More...
 
void finalizeForCommandLine ()
 Deinitializes the GROMACS library after initForCommandLine(). More...
 
int processExceptionAtExitForCommandLine (const std::exception &ex)
 Handles an exception and deinitializes after initForCommandLine. More...
 
int runCommandLineModule (int argc, char *argv[], ICommandLineModule *module)
 Implements a main() method that runs a single module. More...
 
int runCommandLineModule (int argc, char *argv[], const char *name, const char *description, std::function< std::unique_ptr< ICommandLineOptionsModule >()> factory)
 Implements a main() method that runs a single module. More...
 
void writeKeyValueTreeAsMdp (TextWriter *writer, const KeyValueTreeObject &tree)
 Write a flat key-value tree to writer in mdp style. More...
 
template<class T >
void changePinningPolicy (HostVector< T > *v, PinningPolicy pinningPolicy)
 Helper function for changing the pinning policy of a HostVector. More...
 
void pinBuffer (void *pointer, std::size_t numBytes) noexcept
 Pin the allocation to physical memory. More...
 
void unpinBuffer (void *pointer) noexcept
 Unpin the allocation. More...
 
void doDeviceTransfers (const gmx_gpu_info_t &gpuInfo, ArrayRef< const char > input, ArrayRef< char > output)
 Helper function for GPU test code to be platform agnostic. More...
 
bool cpuIsX86Nehalem (const CpuInfo &cpuInfo)
 Return true if the CPU is an Intel x86 Nehalem. More...
 
static void gmx_detect_gpus (const gmx::MDLogger &mdlog, const t_commrec *cr)
 Detect GPUs, if that makes sense to attempt.
 
static void gmx_collect_hardware_mpi (const gmx::CpuInfo &cpuInfo)
 Reduce the locally collected hwinfo_g over MPI ranks.
 
static void spinUpCore () noexcept
 Utility that does dummy computing for max 2 seconds to spin up cores. More...
 
static void hardwareTopologyPrepareDetection ()
 Prepare the system before hardware topology detection. More...
 
static void hardwareTopologyDoubleCheckDetection (const gmx::MDLogger &mdlog, const gmx::HardwareTopology &hardwareTopology)
 Sanity check hardware topology and print some notes to log. More...
 
gmx_hw_info_t * gmx_detect_hardware (const gmx::MDLogger &mdlog, const t_commrec *cr)
 Run detection, consistency checks, and make available on all ranks. More...
 
bool compatibleGpusFound (const gmx_gpu_info_t &gpu_info)
 Return whether compatible GPUs were found.
 
void gmx_hardware_info_free ()
 Free the hwinfo structure.
 
int identifyAvx512FmaUnits ()
 Test whether machine has dual AVX512 FMA units. More...
 
unsigned int log2I (std::uint32_t x)
 Compute floor of logarithm to base 2, 32 bit unsigned argument. More...
 
unsigned int log2I (std::uint64_t x)
 Compute floor of logarithm to base 2, 64 bit unsigned argument. More...
 
unsigned int log2I (std::int32_t x)
 Compute floor of logarithm to base 2, 32 bit signed argument. More...
 
unsigned int log2I (std::int64_t x)
 Compute floor of logarithm to base 2, 64 bit signed argument. More...
 
std::int64_t greatestCommonDivisor (std::int64_t p, std::int64_t q)
 Find greatest common divisor of two numbers. More...
 
double erfinv (double x)
 Inverse error function, double precision. More...
 
float erfinv (float x)
 Inverse error function, single precision. More...
 
static float invsqrt (float x)
 Calculate 1.0/sqrt(x) in single precision. More...
 
static double invsqrt (double x)
 Calculate 1.0/sqrt(x) in double precision, but single range. More...
 
static double invsqrt (int x)
 Calculate 1.0/sqrt(x) for integer x in double precision. More...
 
static float invcbrt (float x)
 Calculate inverse cube root of x in single precision. More...
 
static double invcbrt (double x)
 Calculate inverse sixth root of x in double precision. More...
 
static double invcbrt (int x)
 Calculate inverse sixth root of integer x in double precision. More...
 
static float sixthroot (float x)
 Calculate sixth root of x in single precision. More...
 
static double sixthroot (double x)
 Calculate sixth root of x in double precision. More...
 
static double sixthroot (int x)
 Calculate sixth root of integer x, return double. More...
 
static float invsixthroot (float x)
 Calculate inverse sixth root of x in single precision. More...
 
static double invsixthroot (double x)
 Calculate inverse sixth root of x in double precision. More...
 
static double invsixthroot (int x)
 Calculate inverse sixth root of integer x in double precision. More...
 
template<typename T >
square (T x)
 calculate x^2 More...
 
template<typename T >
power3 (T x)
 calculate x^3 More...
 
template<typename T >
power4 (T x)
 calculate x^4 More...
 
template<typename T >
power5 (T x)
 calculate x^5 More...
 
template<typename T >
power6 (T x)
 calculate x^6 More...
 
template<typename T >
power12 (T x)
 calculate x^12 More...
 
static real series_sinhx (real x)
 Maclaurin series for sinh(x)/x. More...
 
void invertBoxMatrix (const matrix src, matrix dest)
 Invert a simulation-box matrix in src, return in dest. More...
 
void invertMatrix (const matrix src, matrix dest)
 Invert a general 3x3 matrix in src, return in dest. More...
 
static size_t paddedRVecVectorSize (size_t numAtoms)
 Returns the padded size for PaddedRVecVector given the number of atoms. More...
 
template<typename ValueType >
static BasicVector< ValueType >
::RawArray * 
as_vec_array (BasicVector< ValueType > *x)
 Casts a gmx::BasicVector array into an equivalent raw C array.
 
template<typename ValueType >
static const BasicVector
< ValueType >::RawArray * 
as_vec_array (const BasicVector< ValueType > *x)
 Casts a gmx::BasicVector array into an equivalent raw C array.
 
static rvec * as_rvec_array (RVec *x)
 Casts a gmx::RVec array into an rvec array.
 
static const rvec * as_rvec_array (const RVec *x)
 Casts a gmx::RVec array into an rvec array.
 
std::unique_ptr< MDAtoms > makeMDAtoms (FILE *fp, const gmx_mtop_t &mtop, const t_inputrec &ir, bool useGpuForPme)
 Builder function for MdAtomsWrapper. More...
 
double do_cg (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Do conjugate gradients minimization. More...
 
double do_lbfgs (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Do L-BFGS conjugate gradients minimization. More...
 
double do_steep (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Do steepest descents minimization. More...
 
double do_nm (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Do normal modes analysis. More...
 
double do_tpi (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)
 Do test particle insertion. More...
 
bool boxesAreEqual (const matrix box1, const matrix box2)
 Returns whether two boxes are of equal size and shape (within reasonable tolerance).
 
bool boxIsZero (const matrix box)
 Returns whether a box is only initialised to zero or not.
 
gmx_uint64_t makeRandomSeed ()
 Return 64 random bits from the random device, suitable as seed. More...
 
template<class RealType = real, unsigned int Bits, class Rng >
RealType generateCanonical (Rng &g)
 Generate a floating-point value with specified number of random bits. More...
 
static void simdPrefetch (void *m)
 Prefetch memory at address m. More...
 
static void store (float *m, float a)
 Store contents of float variable to aligned memory m. More...
 
static void storeU (float *m, float a)
 Store contents of float variable to unaligned memory m. More...
 
static float fma (float a, float b, float c)
 Float Fused-multiply-add. Result is a*b + c. More...
 
static float fms (float a, float b, float c)
 Float Fused-multiply-subtract. Result is a*b - c. More...
 
static float fnma (float a, float b, float c)
 Float Fused-negated-multiply-add. Result is -a*b + c. More...
 
static float fnms (float a, float b, float c)
 Float Fused-negated-multiply-subtract. Result is -a*b - c. More...
 
static float maskAdd (float a, float b, float m)
 Add two float variables, masked version. More...
 
static float maskzMul (float a, float b, float m)
 Multiply two float variables, masked version. More...
 
static float maskzFma (float a, float b, float c, float m)
 Float fused multiply-add, masked version. More...
 
static float abs (float a)
 Float Floating-point abs(). More...
 
static float max (float a, float b)
 Set each float element to the largest from two variables. More...
 
static float min (float a, float b)
 Set each float element to the smallest from two variables. More...
 
static float round (float a)
 Float round to nearest integer value (in floating-point format). More...
 
static float trunc (float a)
 Truncate float, i.e. round towards zero - common hardware instruction. More...
 
static float reduce (float a)
 Return sum of all elements in float variable (i.e., the variable itself). More...
 
static float andNot (float a, float b)
 Bitwise andnot for two scalar float variables. More...
 
static bool testBits (float a)
 Return true if any bits are set in the float variable. More...
 
static bool anyTrue (bool a)
 Returns if the boolean is true. More...
 
static float selectByMask (float a, bool mask)
 Select from single precision variable where boolean is true. More...
 
static float selectByNotMask (float a, bool mask)
 Select from single precision variable where boolean is false. More...
 
static float blend (float a, float b, bool sel)
 Blend float selection. More...
 
static std::int32_t cvtR2I (float a)
 Round single precision floating point to integer. More...
 
static std::int32_t cvttR2I (float a)
 Truncate single precision floating point to integer. More...
 
static std::int32_t cvtI2R (std::int32_t a)
 Return integer. More...
 
static void store (double *m, double a)
 Store contents of double variable to aligned memory m. More...
 
static void storeU (double *m, double a)
 Store contents of double variable to unaligned memory m. More...
 
static double fma (double a, double b, double c)
 double Fused-multiply-add. Result is a*b + c. More...
 
static double fms (double a, double b, double c)
 double Fused-multiply-subtract. Result is a*b - c. More...
 
static double fnma (double a, double b, double c)
 double Fused-negated-multiply-add. Result is - a*b + c. More...
 
static double fnms (double a, double b, double c)
 double Fused-negated-multiply-subtract. Result is -a*b - c. More...
 
static double maskAdd (double a, double b, double m)
 Add two double variables, masked version. More...
 
static double maskzMul (double a, double b, double m)
 Multiply two double variables, masked version. More...
 
static double maskzFma (double a, double b, double c, double m)
 double fused multiply-add, masked version. More...
 
static double abs (double a)
 double doubleing-point abs(). More...
 
static double max (double a, double b)
 Set each double element to the largest from two variables. More...
 
static double min (double a, double b)
 Set each double element to the smallest from two variables. More...
 
static double round (double a)
 double round to nearest integer value (in doubleing-point format). More...
 
static double trunc (double a)
 Truncate double, i.e. round towards zero - common hardware instruction. More...
 
static double reduce (double a)
 Return sum of all elements in double variable (i.e., the variable itself). More...
 
static double andNot (double a, double b)
 Bitwise andnot for two scalar double variables. More...
 
static bool testBits (double a)
 Return true if any bits are set in the double variable. More...
 
static double selectByMask (double a, bool mask)
 Select from double precision variable where boolean is true. More...
 
static double selectByNotMask (double a, bool mask)
 Select from double precision variable where boolean is false. More...
 
static double blend (double a, double b, bool sel)
 Blend double selection. More...
 
static std::int32_t cvtR2I (double a)
 Round single precision doubleing point to integer. More...
 
static std::int32_t cvttR2I (double a)
 Truncate single precision doubleing point to integer. More...
 
static double cvtF2D (float a)
 Convert float to double (mimicks SIMD conversion) More...
 
static float cvtD2F (double a)
 Convert double to float (mimicks SIMD conversion) More...
 
static void store (std::int32_t *m, std::int32_t a)
 Store contents of integer variable to aligned memory m. More...
 
static void storeU (std::int32_t *m, std::int32_t a)
 Store contents of integer variable to unaligned memory m. More...
 
static std::int32_t andNot (std::int32_t a, std::int32_t b)
 Bitwise andnot for two scalar integer variables. More...
 
static bool testBits (std::int32_t a)
 Return true if any bits are set in the integer variable. More...
 
static std::int32_t selectByMask (std::int32_t a, bool mask)
 Select from integer variable where boolean is true. More...
 
static std::int32_t selectByNotMask (std::int32_t a, bool mask)
 Select from integer variable where boolean is false. More...
 
static std::int32_t blend (std::int32_t a, std::int32_t b, bool sel)
 Blend integer selection. More...
 
static bool cvtB2IB (bool a)
 Just return a boolean (mimicks SIMD real-to-int bool conversions) More...
 
static bool cvtIB2B (bool a)
 Just return a boolean (mimicks SIMD int-to-real bool conversions) More...
 
static float copysign (float x, float y)
 Composes single value with the magnitude of x and the sign of y. More...
 
static void invsqrtPair (float x0, float x1, float *out0, float *out1)
 Calculate 1/sqrt(x) for two floats. More...
 
static float inv (float x)
 Calculate 1/x for float. More...
 
static float maskzInvsqrt (float x, bool m)
 Calculate 1/sqrt(x) for masked entry of float. More...
 
static float maskzInv (float x, bool m)
 Calculate 1/x for masked entry of float. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float sqrt (float x)
 Float sqrt(x). This is the square root. More...
 
static float log (float x)
 Float log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float exp2 (float x)
 Float 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static float exp (float x)
 Float exp(x). More...
 
static float erf (float x)
 Float erf(x). More...
 
static float erfc (float x)
 Float erfc(x). More...
 
static void sincos (float x, float *sinval, float *cosval)
 Float sin & cos. More...
 
static float sin (float x)
 Float sin. More...
 
static float cos (float x)
 Float cos. More...
 
static float tan (float x)
 Float tan. More...
 
static float asin (float x)
 float asin. More...
 
static float acos (float x)
 Float acos. More...
 
static float atan (float x)
 Float atan. More...
 
static float atan2 (float y, float x)
 Float atan2(y,x). More...
 
static float pmeForceCorrection (float z2)
 Calculate the force correction due to PME analytically in float. More...
 
static float pmePotentialCorrection (float z2)
 Calculate the potential correction due to PME analytically in float. More...
 
static double copysign (double x, double y)
 Composes double value with the magnitude of x and the sign of y. More...
 
static void invsqrtPair (double x0, double x1, double *out0, double *out1)
 Calculate 1/sqrt(x) for two doubles. More...
 
static double inv (double x)
 Calculate 1/x for double. More...
 
static double maskzInvsqrt (double x, bool m)
 Calculate 1/sqrt(x) for masked entry of double. More...
 
static double maskzInv (double x, bool m)
 Calculate 1/x for masked entry of double. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double sqrt (double x)
 Double sqrt(x). This is the square root. More...
 
static double log (double x)
 Double log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double exp2 (double x)
 Double 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static double exp (double x)
 Double exp(x). More...
 
static double erf (double x)
 Double erf(x). More...
 
static double erfc (double x)
 Double erfc(x). More...
 
static void sincos (double x, double *sinval, double *cosval)
 Double sin & cos. More...
 
static double sin (double x)
 Double sin. More...
 
static double cos (double x)
 Double cos. More...
 
static double tan (double x)
 Double tan. More...
 
static double asin (double x)
 Double asin. More...
 
static double acos (double x)
 Double acos. More...
 
static double atan (double x)
 Double atan. More...
 
static double atan2 (double y, double x)
 Double atan2(y,x). More...
 
static double pmeForceCorrection (double z2)
 Calculate the force correction due to PME analytically in double. More...
 
static double pmePotentialCorrection (double z2)
 Calculate the potential correction due to PME analytically in double. More...
 
static double invsqrtSingleAccuracy (double x)
 Calculate 1/sqrt(x) for double, but with single accuracy. More...
 
static void invsqrtPairSingleAccuracy (double x0, double x1, double *out0, double *out1)
 Calculate 1/sqrt(x) for two doubles, but with single accuracy. More...
 
static double invSingleAccuracy (double x)
 Calculate 1/x for double, but with single accuracy. More...
 
static double maskzInvsqrtSingleAccuracy (double x, bool m)
 Calculate 1/sqrt(x) for masked entry of double, but with single accuracy. More...
 
static double maskzInvSingleAccuracy (double x, bool m)
 Calculate 1/x for masked entry of double, but with single accuracy. More...
 
static double sqrtSingleAccuracy (double x)
 Calculate sqrt(x) for double, but with single accuracy. More...
 
static double logSingleAccuracy (double x)
 Double log(x), but with single accuracy. This is the natural logarithm. More...
 
static double exp2SingleAccuracy (double x)
 Double 2^x, but with single accuracy. More...
 
static double expSingleAccuracy (double x)
 Double exp(x), but with single accuracy. More...
 
static double erfSingleAccuracy (double x)
 Double erf(x), but with single accuracy. More...
 
static double erfcSingleAccuracy (double x)
 Double erfc(x), but with single accuracy. More...
 
static void sincosSingleAccuracy (double x, double *sinval, double *cosval)
 Double sin & cos, but with single accuracy. More...
 
static double sinSingleAccuracy (double x)
 Double sin, but with single accuracy. More...
 
static double cosSingleAccuracy (double x)
 Double cos, but with single accuracy. More...
 
static double tanSingleAccuracy (double x)
 Double tan, but with single accuracy. More...
 
static double asinSingleAccuracy (double x)
 Double asin, but with single accuracy. More...
 
static double acosSingleAccuracy (double x)
 Double acos, but with single accuracy. More...
 
static double atanSingleAccuracy (double x)
 Double atan, but with single accuracy. More...
 
static double atan2SingleAccuracy (double y, double x)
 Double atan2(y,x), but with single accuracy. More...
 
static double pmeForceCorrectionSingleAccuracy (double z2)
 Force correction due to PME in double, but with single accuracy. More...
 
static double pmePotentialCorrectionSingleAccuracy (double z2)
 Potential correction due to PME in double, but with single accuracy. More...
 
template<int align>
static void gatherLoadTranspose (const float *base, const std::int32_t offset[], float *v0, float *v1, float *v2, float *v3)
 Load 4 consecutive floats from base/offset into four variables. More...
 
template<int align>
static void gatherLoadTranspose (const float *base, const std::int32_t offset[], float *v0, float *v1)
 Load 2 consecutive floats from base/offset into four variables. More...
 
template<int align>
static void gatherLoadUTranspose (const float *base, const std::int32_t offset[], float *v0, float *v1, float *v2)
 Load 3 consecutive floats from base/offsets, store into three vars. More...
 
template<int align>
static void transposeScatterStoreU (float *base, const std::int32_t offset[], float v0, float v1, float v2)
 Store 3 floats to 3 to base/offset. More...
 
template<int align>
static void transposeScatterIncrU (float *base, const std::int32_t offset[], float v0, float v1, float v2)
 Add 3 floats to base/offset. More...
 
template<int align>
static void transposeScatterDecrU (float *base, const std::int32_t offset[], float v0, float v1, float v2)
 Subtract 3 floats from base/offset. More...
 
static void expandScalarsToTriplets (float scalar, float *triplets0, float *triplets1, float *triplets2)
 Copy single float to three variables. More...
 
template<int align>
static void gatherLoadBySimdIntTranspose (const float *base, std::int32_t offset, float *v0, float *v1, float *v2, float *v3)
 Load 4 floats from base/offsets and store into variables. More...
 
template<int align>
static void gatherLoadUBySimdIntTranspose (const float *base, std::int32_t offset, float *v0, float *v1)
 Load 2 floats from base/offsets and store into variables (unaligned). More...
 
template<int align>
static void gatherLoadBySimdIntTranspose (const float *base, std::int32_t offset, float *v0, float *v1)
 Load 2 floats from base/offsets and store into variables (aligned). More...
 
static float reduceIncr4ReturnSum (float *m, float v0, float v1, float v2, float v3)
 Add each float to four consecutive memory locations, return sum. More...
 
template<int align>
static void gatherLoadTranspose (const double *base, const std::int32_t offset[], double *v0, double *v1, double *v2, double *v3)
 Load 4 consecutive doubles from base/offset into four variables. More...
 
template<int align>
static void gatherLoadTranspose (const double *base, const std::int32_t offset[], double *v0, double *v1)
 Load 2 consecutive doubles from base/offset into four variables. More...
 
template<int align>
static void gatherLoadUTranspose (const double *base, const std::int32_t offset[], double *v0, double *v1, double *v2)
 Load 3 consecutive doubles from base/offsets, store into three vars. More...
 
template<int align>
static void transposeScatterStoreU (double *base, const std::int32_t offset[], double v0, double v1, double v2)
 Store 3 doubles to 3 to base/offset. More...
 
template<int align>
static void transposeScatterIncrU (double *base, const std::int32_t offset[], double v0, double v1, double v2)
 Add 3 doubles to base/offset. More...
 
template<int align>
static void transposeScatterDecrU (double *base, const std::int32_t offset[], double v0, double v1, double v2)
 Subtract 3 doubles from base/offset. More...
 
static void expandScalarsToTriplets (double scalar, double *triplets0, double *triplets1, double *triplets2)
 Copy single double to three variables. More...
 
template<int align>
static void gatherLoadBySimdIntTranspose (const double *base, std::int32_t offset, double *v0, double *v1, double *v2, double *v3)
 Load 4 doubles from base/offsets and store into variables. More...
 
template<int align>
static void gatherLoadUBySimdIntTranspose (const double *base, std::int32_t offset, double *v0, double *v1)
 Load 2 doubles from base/offsets and store into variables (unaligned). More...
 
template<int align>
static void gatherLoadBySimdIntTranspose (const double *base, std::int32_t offset, double *v0, double *v1)
 Load 2 doubles from base/offsets and store into variables (aligned). More...
 
static double reduceIncr4ReturnSum (double *m, double v0, double v1, double v2, double v3)
 Add each double to four consecutive memory locations, return sum. More...
 
bool decideWhetherToUseGpusForNonbondedWithThreadMpi (const TaskTarget nonbondedTarget, const std::vector< int > &gpuIdsToUse, const std::vector< int > &userGpuTaskAssignment, const EmulateGpuNonbonded emulateGpuNonbonded, const bool usingVerletScheme, const bool nonbondedOnGpuIsUseful, const int numRanksPerSimulation)
 Decide whether this thread-MPI simulation will run nonbonded tasks on GPUs. More...
 
bool decideWhetherToUseGpusForPmeWithThreadMpi (const bool useGpuForNonbonded, const TaskTarget pmeTarget, const std::vector< int > &gpuIdsToUse, const std::vector< int > &userGpuTaskAssignment, const bool canUseGpuForPme, const int numRanksPerSimulation, const int numPmeRanksPerSimulation)
 Decide whether this thread-MPI simulation will run PME tasks on GPUs. More...
 
bool decideWhetherToUseGpusForNonbonded (const TaskTarget nonbondedTarget, const std::vector< int > &userGpuTaskAssignment, const EmulateGpuNonbonded emulateGpuNonbonded, const bool usingVerletScheme, const bool nonbondedOnGpuIsUseful, const bool gpusWereDetected)
 Decide whether the simulation will try to run nonbonded tasks on GPUs. More...
 
bool decideWhetherToUseGpusForPme (const bool useGpuForNonbonded, const TaskTarget pmeTarget, const std::vector< int > &userGpuTaskAssignment, const bool canUseGpuForPme, const int numRanksPerSimulation, const int numPmeRanksPerSimulation, const bool gpusWereDetected)
 Decide whether the simulation will try to run tasks of different types on GPUs. More...
 
GpuTasksOnRanks findAllGpuTasksOnThisNode (ArrayRef< const GpuTask > gpuTasksOnThisRank, int numRanksOnThisNode, MPI_Comm communicator)
 Returns container of all tasks on all ranks of this node that are eligible for GPU execution. More...
 
void reportGpuUsage (const MDLogger &mdlog, bool userSetGpuIds, const GpuTaskAssignments &gpuTaskAssignmentOnRanksOfThisNode, size_t numGpuTasksOnThisNode, size_t numPpRanks, bool bPrintHostName)
 Log a report on how GPUs are being used on the ranks of the physical node of rank 0 of the simulation. More...
 
GpuTaskAssignments::value_type runTaskAssignment (const std::vector< int > &gpuIdsToUse, const std::vector< int > &userGpuTaskAssignment, const gmx_hw_info_t &hardwareInfo, const MDLogger &mdlog, const t_commrec *cr, const std::vector< GpuTask > &gpuTasksOnThisRank)
 Coordinate the final stages of task assignment and reporting, and return the assignment for this rank. More...
 
template<GpuTask TaskType>
bool hasTaskType (const GpuTaskMapping &mapping)
 Function for whether the task of mapping has value TaskType.
 
std::vector< int > parseUserGpuIds (const std::string &gpuIdString)
 Parse a GPU ID string into a container describing the task types and associated device IDs. More...
 
std::vector< int > makeGpuIds (ArrayRef< const int > compatibleGpus, size_t numGpuTasks)
 Make a vector containing numGpuTasks IDs of the IDs found in compatibleGpus. More...
 
std::string makeGpuIdString (const std::vector< int > &gpuIds, int totalNumberOfTasks)
 Convert a container of GPU deviced IDs to a string that can be used by gmx tune_pme as input to mdrun -gputasks. More...
 
void checkUserGpuIds (const gmx_gpu_info_t &gpu_info, const std::vector< int > &compatibleGpus, const std::vector< int > &gpuIds)
 Check that all user-selected GPUs are compatible. More...
 
static std::size_t getPageSize ()
 Return a page size, from a sysconf/WinAPI query if available, or a default guess (4096 bytes). More...
 
std::size_t pageSize ()
 Return the memory page size on this system. More...
 
template<typename T >
ArrayRef< typename
std::conditional
< std::is_const< T >::value,
const typename T::value_type,
typename T::value_type >::type > 
makeArrayRef (T &c)
 Create ArrayRef from container with type deduction. More...
 
template<typename T >
ArrayRef< const typename
T::value_type > 
makeConstArrayRef (const T &c)
 Create ArrayRef to const T from container with type deduction. More...
 
template<typename T >
void swap (ArrayRef< T > &a, ArrayRef< T > &b)
 Simple swap method for ArrayRef objects. More...
 
void printBinaryInformation (FILE *fp, const IProgramContext &programContext)
 Print basic information about the executable. More...
 
void printBinaryInformation (FILE *fp, const IProgramContext &programContext, const BinaryInformationSettings &settings)
 Print basic information about the executable with custom settings. More...
 
void printBinaryInformation (TextWriter *writer, const IProgramContext &programContext, const BinaryInformationSettings &settings)
 Print basic information about the executable with custom settings. More...
 
std::string bromacs ()
 Return a cool definition for the acronym GROMACS.
 
std::string getCoolQuote ()
 Return a string with a cool quote.
 
std::pair< int, int > getCudaDriverVersion ()
 Returns a (major, minor) tuple of the CUDA driver version.
 
std::pair< int, int > getCudaRuntimeVersion ()
 Returns a (major, minor) tuple of the CUDA runtime version.
 
const char * getErrorCodeString (int errorcode)
 Returns a short string description of an error code. More...
 
void printFatalErrorMessage (FILE *fp, const std::exception &ex)
 Formats a standard fatal error message for reporting an exception. More...
 
std::string formatExceptionMessageToString (const std::exception &ex)
 Formats an error message for reporting an exception. More...
 
void formatExceptionMessageToFile (FILE *fp, const std::exception &ex)
 Formats an error message for reporting an exception. More...
 
void formatExceptionMessageToWriter (TextWriter *writer, const std::exception &ex)
 Formats an error message for reporting an exception. More...
 
int processExceptionAtExit (const std::exception &ex)
 Handles an exception that is causing the program to terminate. More...
 
void processExceptionAsFatalError (const std::exception &ex)
 Helper function for terminating the program on an exception. More...
 
template<class Exception , class Tag , class T >
std::enable_if
< std::is_base_of
< GromacsException, Exception >
::value, const Exception & >
::type 
operator<< (const Exception &ex, const ExceptionInfo< Tag, T > &item)
 Associates extra information with an exception. More...
 
const DataFileFindergetLibraryFileFinder ()
 Gets a finder for locating data files from share/top/. More...
 
void setLibraryFileFinder (const DataFileFinder *finder)
 Sets a finder for location data files from share/top/. More...
 
void init (int *argc, char ***argv)
 Initializes the GROMACS library. More...
 
void finalize ()
 Deinitializes the GROMACS library. More...
 
void niceHeader (TextWriter *writer, const char *fn, char commentChar)
 Prints creation time stamp and user information into a string as comments, and returns it. More...
 
const IProgramContextgetProgramContext ()
 Returns the global IProgramContext instance. More...
 
void setProgramContext (const IProgramContext *context)
 Sets the global IProgramContext instance. More...
 
std::size_t countWords (const char *s)
 Returns number of space-separated words in zero-terminated char ptr. More...
 
std::size_t countWords (const std::string &str)
 Returns the number of space-separated words in a string object. More...
 
bool endsWith (const char *str, const char *suffix)
 Tests whether a string ends with another string. More...
 
std::string stripSuffixIfPresent (const std::string &str, const char *suffix)
 Removes a suffix from a string. More...
 
std::string stripString (const std::string &str)
 Removes leading and trailing whitespace from a string. More...
 
std::string formatString (const char *fmt,...)
 Formats a string (snprintf() wrapper). More...
 
std::string formatStringV (const char *fmt, va_list ap)
 Formats a string (vsnprintf() wrapper). More...
 
std::vector< std::string > splitString (const std::string &str)
 Splits a string to whitespace separated tokens. More...
 
std::vector< std::string > splitDelimitedString (const std::string &str, char delim)
 Splits a string to tokens separated by a given delimiter. More...
 
std::vector< std::string > splitAndTrimDelimitedString (const std::string &str, char delim)
 Splits str to tokens separated by delimiter delim. Removes leading and trailing whitespace from those strings with std::isspace. More...
 
std::string replaceAll (const std::string &input, const char *from, const char *to)
 Replace all occurrences of a string with another string. More...
 
std::string replaceAll (const std::string &input, const std::string &from, const std::string &to)
 Replace all occurrences of a string with another string. More...
 
std::string replaceAllWords (const std::string &input, const char *from, const char *to)
 Replace whole words with others. More...
 
std::string replaceAllWords (const std::string &input, const std::string &from, const std::string &to)
 Replace whole words with others. More...
 
static bool isNullOrEmpty (const char *str)
 Tests whether a string is null or empty. More...
 
static bool startsWith (const std::string &str, const std::string &prefix)
 Tests whether a string starts with another string. More...
 
static bool startsWith (const char *str, const char *prefix)
 Tests whether a string starts with another string. More...
 
static bool endsWith (const std::string &str, const char *suffix)
 Tests whether a string ends with another string. More...
 
static bool contains (const std::string &str, const char *substr)
 Tests whether a string contains another as a substring. More...
 
static bool contains (const std::string &str, const std::string &substr)
 Tests whether a string contains another as a substring. More...
 
static bool endsWith (const std::string &str, const std::string &suffix)
 Tests whether a string ends with another string. More...
 
template<typename InputIterator , typename FormatterType >
std::string formatAndJoin (InputIterator begin, InputIterator end, const char *separator, const FormatterType &formatter)
 Formats all the range as strings, and then joins them with a separator in between. More...
 
template<typename ContainerType , typename FormatterType >
std::string formatAndJoin (const ContainerType &container, const char *separator, const FormatterType &formatter)
 Formats all elements of the container as strings, and then joins them with a separator in between. More...
 
template<typename InputIterator >
std::string joinStrings (InputIterator begin, InputIterator end, const char *separator)
 Joins strings from a range with a separator in between. More...
 
template<typename ContainerType >
std::string joinStrings (const ContainerType &container, const char *separator)
 Joins strings from a container with a separator in between. More...
 
template<size_t count>
std::string joinStrings (const char *const (&array)[count], const char *separator)
 Joins strings from an array with a separator in between. More...
 
template<class T >
void free_wrapper (T *p)
 Wrapper of standard library free(), to be used as unique_cptr deleter for memory allocated by malloc, e.g. by an external library such as TNG.
 
template<class T >
void sfree_wrapper (T *p)
 sfree wrapper to be used as unique_cptr deleter
 
template<typename T , typename D >
std::unique_ptr< T, D > create_unique_with_deleter (T *t, D d)
 Create unique_ptr with any deleter function or lambda.
 
static void mdrunner_start_fn (void *arg)
 The callback used for running on spawned threads. More...
 
static bool gpuAccelerationOfNonbondedIsUseful (const MDLogger &mdlog, const t_inputrec *ir, bool issueWarning)
 Return whether GPU acceleration of nonbondeds is supported with the given settings. More...
 
static integrator_tmy_integrator (unsigned int ei)
 Return the correct integrator function.
 
static gmx::LoggerOwner buildLogger (FILE *fplog, const t_commrec *cr)
 Initializes the logger for mdrun.
 
static TaskTarget findTaskTarget (const char *optionString)
 Make a TaskTarget from an mdrun argument string.
 

Variables

static const int c_linewidth = 80 - 2
 Linewidth used for warning output.
 
static const int c_indent = 0
 Indent used for warning output.
 
static const int c_biasMaxNumDim = 4
 The maximum dimensionality of the AWH coordinate.
 
const char * eawhtarget_names [eawhtargetNR+1]
 String for target distribution. More...
 
const char * eawhgrowth_names [eawhgrowthNR+1]
 String for weight histogram growth. More...
 
const char * eawhpotential_names [eawhpotentialNR+1]
 String for AWH potential type. More...
 
const char * eawhcoordprovider_names [eawhcoordproviderNR+1]
 String for AWH bias reaction coordinate provider. More...
 
static constexpr Architecture c_architecture
 Constant that tells what the architecture is. More...
 
static const bool bGPUBinary = GMX_GPU != GMX_GPU_NONE
 Convenience macro to help us avoid ifdefs each time we use sysconf. More...
 
static std::unique_ptr
< gmx_hw_info_t > 
hwinfo_g
 The hwinfo structure (common to all threads in this process). More...
 
static int n_hwinfo = 0
 A reference counter for the hwinfo structure.
 
static tMPI_Thread_mutex_t hw_info_lock = TMPI_THREAD_MUTEX_INITIALIZER
 A lock to protect the hwinfo structure.
 
integrator_t do_steep
 Steepest descents energy minimization.
 
integrator_t do_cg
 Conjugate gradient energy minimization.
 
integrator_t do_lbfgs
 Conjugate gradient energy minimization using the L-BFGS algorithm.
 
integrator_t do_nm
 Normal mode analysis.
 
integrator_t do_tpi
 Test particle insertion.
 
integrator_t do_md
 MD simulations.
 

Typedef Documentation

template<class T >
using gmx::AlignedAllocator = typedef Allocator<T, AlignedAllocationPolicy>

Aligned memory allocator.

Template Parameters
TType of objects to allocate

This convenience partial specialization can be used for the optional allocator template parameter in standard library containers, which is necessary e.g. to use SIMD aligned load and store operations on data in those containers. The memory will always be aligned according to the behavior of AlignedAllocationPolicy.

Default fast and accurate random engine in Gromacs.

This engine will return 2*2^64 random results using the default gmx::RandomDomain::Other stream, and can be initialized with a single seed argument without having to remember empty template angle brackets.

template<class T >
using gmx::HostAllocator = typedef Allocator<T, HostAllocationPolicy>

Memory allocator that uses HostAllocationPolicy.

Template Parameters
TType of objects to allocate

This convenience partial specialization can be used for the optional allocator template parameter in standard library containers whose memory may be used for e.g. GPU transfers. The memory will always be allocated according to the behavior of HostAllocationPolicy.

typedef double gmx::integrator_t(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, ObservablesHistory *observablesHistory, MDAtoms *mdatoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting)

Integrator algorithm implementation.

Parameters
[in]fplogLog file for output
[in]crCommunication record
[in]mdlogLog writer for important output
[in]nfileNumber of files
[in]fnmFilename structure array
[in]oenvOutput information
[in]mdrunOptionsOptions for mdrun
[in]vsiteVirtual site information
[in]constrConstraint information
[in]outputProviderAdditional output provider
[in]inputrecInput record with mdp options
[in]top_globalMolecular topology for the whole system
[in]fcdForce and constraint data
[in]state_globalThe state (x, v, f, box etc.) of the whole system
[in]observablesHistoryThe observables statistics history
[in]mdAtomsAtom information
[in]nrnbAccounting for floating point operations
[in]wcycleWall cycle timing information
[in]frForce record with cut-off information and more
[in]replExParamsParameters for the replica exchange algorithm
[in]membedMembrane embedding data structure
[in]walltime_accountingMore timing information
template<typename T >
using gmx::PaddedArrayRef = typedef ArrayRef<T>

Temporary definition of a type usable for SIMD-style loads of RVec quantities from a view.

Todo:
Find a more permanent solution that permits the update code to safely use a padded, aligned array-ref type.
using gmx::PaddedRVecVector = typedef std::vector < RVec, Allocator < RVec, AlignedAllocationPolicy > >

Temporary definition of a type usable for SIMD-style loads of RVec quantities.

Note
When resizing paddedRVecVector, the size should be chosen with paddedRVecVectorSize() to ensure correct padding.
Todo:

Consider replacing the padding applied in resizePaddedRVecVector() by automated padding on resize() of the vector.

Undo the move of allocator.h and alignedallocator.h from the internal to be public API applied in Change-Id: Ifb8dacf, needed to use AlignedAllocationPolicy here, when replacing std::vector here.

template<class T >
using gmx::PageAlignedAllocator = typedef Allocator<T, PageAlignedAllocationPolicy>

PageAligned memory allocator.

Template Parameters
TType of objects to allocate

This convenience partial specialization can be used for the optional allocator template parameter in standard library containers, which is necessary for locking memory pages for asynchronous transfer between a GPU device and the host. The memory will always be aligned according to the behavior of PageAlignedAllocationPolicy.

typedef std::random_device gmx::RandomDevice

Random device.

For now this is identical to the standard library, but since we use the GROMACS random module for all other random engines and distributions it is convenient to have this too in the same module.

Enumeration Type Documentation

enum gmx::Architecture
strong

Enum for GROMACS CPU hardware detection support.

Enumerator
X86 

Not one of the cases below.

Arm 

X86.

PowerPC 

ARM.

IBM PowerPC

Enum with the AWH variables to write.

Enumerator
MetaData 

Meta data.

CoordValue 

Coordinate value.

Pmf 

The pmf.

Bias 

The bias.

Visits 

The number of visits.

Weights 

The weights.

Target 

The target distribition.

ForceCorrelationVolume 

The volume of the force correlation tensor.

FrictionTensor 

The full friction tensor.

Enum with the types of metadata to write.

Enumerator
NumBlock 

The number of blocks.

TargetError 

The target error.

ScaledSampleWeight 

The logarithm of the sample weight relative to a sample weight of 1 at the initial time.

Count 

The number of enum values, not including Count.

enum gmx::GpuTask : int
strong

Types of compute tasks that can be run on a GPU.

These names refer to existing practice in GROMACS, which is not strictly accurate.

Enumerator
Nonbonded 

Short-ranged interactions.

Pme 

Long-ranged interactions.

enum gmx::Normalization
strong

Enum with different ways of normalizing the output.

Enumerator
None 

No normalization.

Coordinate 

Scale using the internal/user input coordinate scaling factor.

FreeEnergy 

Normalize free energy values by subtracting the minimum value.

Distribution 

Normalize the distribution to 1.

enum gmx::PinningPolicy : int
strong

Helper enum for pinning policy of the allocation of HostAllocationPolicy.

For an efficient non-blocking transfer (e.g. to a GPU), the memory pages for a buffer need to be pinned to a physical page. Aligning such buffers to a physical page should miminize the number of pages that need to be pinned. However, some buffers that may be used for such transfers may also be used in either GROMACS builds or run paths that cannot use such a device, so the policy can be configured so that the resource consumption is no higher than required for correct, efficient operation in all cases.

enum gmx::RandomDomain
strong

Enumerated values for fixed part of random seed (domain)

Random numbers are used in many places in GROMACS, and to avoid identical streams the random seeds should be different. Instead of keeping track of several different user-provided seeds, it is better to use the fact that generators like ThreeFry take two 64-bit keys, and combine a general user-provided 64-bit random seed with a second constant value from this list to make each stream guaranteed unique.

Note
There is no reason to go overboard with adding options; we only need to guarantee different streams for cases that might be present simultaneously in a single simulation. As an example, two different integrators (or thermostats) can reuse the same domain.
When you do add options, leave some space between the values so you can group new options with old ones without changing old values.
Enumerator
Other 

Generic - stream uniqueness is not important.

MaxwellVelocities 

Veolcity assignment from Maxwell distribution.

TestParticleInsertion 

Test particle insertion.

UpdateCoordinates 

Particle integrators.

UpdateConstraints 

Second integrator step for constraints.

Thermostat 

Stochastic temperature coupling.

Barostat 

Stochastic pressure coupling.

ReplicaExchange 

Replica exchange metropolis moves.

ExpandedEnsemble 

Expanded ensemble lambda moves.

AwhBiasing 

AWH biasing reference value moves.

Function Documentation

static float gmx::abs ( float  a)
inlinestatic

Float Floating-point abs().

Parameters
aany floating point values
Returns
abs(a) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::abs ( double  a)
inlinestatic

double doubleing-point abs().

Parameters
aany doubleing point values
Returns
abs(a) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::acos ( float  x)
inlinestatic

Float acos.

Parameters
xThe argument to evaluate acos for
Returns
Acos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::acos ( double  x)
inlinestatic

Double acos.

Parameters
xThe argument to evaluate acos for
Returns
Acos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::acosSingleAccuracy ( double  x)
inlinestatic

Double acos, but with single accuracy.

Parameters
xThe argument to evaluate acos for
Returns
Acos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
bool gmx::advancePointInSubgrid ( const Grid &  grid,
const awh_ivec  subgridOrigin,
const awh_ivec  subgridNpoints,
int *  gridPointIndex 
)

Find the next grid point in the sub-part of the grid given a starting point.

The given grid point index is updated to the next valid grid point index by traversing the sub-part of the grid, here termed the subgrid. Since the subgrid range might extend beyond the actual size of the grid, the subgrid is traversed until a point both in the subgrid and grid is found. If no point is found, the function returns false and the index is not modified. The starting point needs to be inside of the subgrid. However, if this index is not given, meaning < 0, then the search is initialized at the subgrid origin, i.e. in this case the "next" grid point index is defined to be the first common grid/subgrid point.

Parameters
[in]gridThe grid.
[in]subgridOriginVector locating the subgrid origin relative to the grid origin.
[in]subgridNpointsNumber of points along each subgrid dimension.
[in,out]gridPointIndexPointer to the starting/next grid point index.
Returns
true if the grid point was updated.
static float gmx::andNot ( float  a,
float  b 
)
inlinestatic

Bitwise andnot for two scalar float variables.

Parameters
adata1
bdata2
Returns
(~data1) & data2
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::andNot ( double  a,
double  b 
)
inlinestatic

Bitwise andnot for two scalar double variables.

Parameters
adata1
bdata2
Returns
(~data1) & data2
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::andNot ( std::int32_t  a,
std::int32_t  b 
)
inlinestatic

Bitwise andnot for two scalar integer variables.

Parameters
adata1
bdata2
Returns
(~data1) & data2
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static bool gmx::anyTrue ( bool  a)
inlinestatic

Returns if the boolean is true.

Parameters
aLogical variable.
Returns
true if a is true, otherwise false.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::asin ( float  x)
inlinestatic

float asin.

Parameters
xThe argument to evaluate asin for
Returns
Asin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::asin ( double  x)
inlinestatic

Double asin.

Parameters
xThe argument to evaluate asin for
Returns
Asin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::asinSingleAccuracy ( double  x)
inlinestatic

Double asin, but with single accuracy.

Parameters
xThe argument to evaluate asin for
Returns
Asin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::atan ( float  x)
inlinestatic

Float atan.

Parameters
xThe argument to evaluate atan for
Returns
Atan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::atan ( double  x)
inlinestatic

Double atan.

Parameters
xThe argument to evaluate atan for
Returns
Atan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::atan2 ( float  y,
float  x 
)
inlinestatic

Float atan2(y,x).

Parameters
yY component of vector, any quartile
xX component of vector, any quartile
Returns
Atan(y,x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::atan2 ( double  y,
double  x 
)
inlinestatic

Double atan2(y,x).

Parameters
yY component of vector, any quartile
xX component of vector, any quartile
Returns
Atan(y,x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::atan2SingleAccuracy ( double  y,
double  x 
)
inlinestatic

Double atan2(y,x), but with single accuracy.

Parameters
yY component of vector, any quartile
xX component of vector, any quartile
Returns
Atan(y,x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::atanSingleAccuracy ( double  x)
inlinestatic

Double atan, but with single accuracy.

Parameters
xThe argument to evaluate atan for
Returns
Atan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
void gmx::biasesAreCompatibleForSharingBetweenSimulations ( const AwhParams &  awhParams,
const std::vector< size_t > &  pointSize,
const gmx_multisim_t *  multiSimComm 
)

Checks if biases are compatible for sharing between simulations, throws if not.

Should be called simultaneously on the master rank of every simulation. Note that this only checks for technical compatibility. It is up to the user to check that the sharing physically makes sense. Throws an exception when shared biases are not compatible.

Parameters
[in]awhParamsThe AWH parameters.
[in]pointSizeVector of grid-point sizes for each bias.
[in]multiSimCommStruct for multi-simulation communication.
static float gmx::blend ( float  a,
float  b,
bool  sel 
)
inlinestatic

Blend float selection.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
Select b if sel is true, a otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::blend ( double  a,
double  b,
bool  sel 
)
inlinestatic

Blend double selection.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
Select b if sel is true, a otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::blend ( std::int32_t  a,
std::int32_t  b,
bool  sel 
)
inlinestatic

Blend integer selection.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
Select b if sel is true, a otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<class T >
void gmx::changePinningPolicy ( HostVector< T > *  v,
PinningPolicy  pinningPolicy 
)

Helper function for changing the pinning policy of a HostVector.

Declare as a friend function the only supported way to change the pinning policy.

If the vector has contents, then a full reallocation and buffer copy are needed if the policy change requires tighter restrictions, and desirable even if the policy change requires looser restrictions. That cost is OK, because GROMACS will do this operation very rarely (e.g. when auto-tuning and deciding to switch whether a task will run on a GPU, or not).

static void gmx::checkInputConsistencyAwh ( const AwhParams &  awhParams,
warninp_t  wi 
)
static

Check consistency of input at the AWH level.

Parameters
[in]awhParamsAWH parameters.
[in,out]wiStruct for bookkeeping warnings.
static void gmx::checkInputConsistencyAwhBias ( const AwhBiasParams &  awhBiasParams,
warninp_t  wi 
)
static

Check consistency of input at the AWH bias level.

Parameters
[in]awhBiasParamsAWH bias parameters.
[in,out]wiStruct for bookkeeping warnings.
static void gmx::checkInputConsistencyInterval ( const AwhParams *  awhParams,
warninp_t  wi 
)
static

Check if the starting configuration is consistent with the given interval.

Parameters
[in]awhParamsAWH parameters.
[in,out]wiStruct for bookeeping warnings.
void gmx::checkUserGpuIds ( const gmx_gpu_info_t &  gpu_info,
const std::vector< int > &  compatibleGpus,
const std::vector< int > &  gpuIds 
)

Check that all user-selected GPUs are compatible.

Given the gpuIds and hardwareInfo, throw if any selected GPUs is not compatible.

The error is given with a suitable descriptive message, which will have context if this check is done after the hardware detection results have been reported to the user. However, note that only the GPUs detected on the master rank are reported, because of the existing limitations of that reporting.

Todo:
Note that the selected GPUs can be different on each rank, and the IDs of compatible GPUs can be different on each node, so this routine ought to do communication to determine whether all ranks are able to proceed. Currently this relies on the MPI runtime to kill the other processes because GROMACS lacks the appropriate infrastructure to do a good job of coordinating error messages and behaviour across MPMD ranks and multiple simulations.
Parameters
[in]gpu_infoInformation detected about GPUs
[in]compatibleGpusVector of GPUs that are compatible
[in]gpuIdsThe GPU IDs selected by the user.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the assigned GPUs are not valid
static float gmx::copysign ( float  x,
float  y 
)
inlinestatic

Composes single value with the magnitude of x and the sign of y.

Parameters
xValue to set sign for
yValue used to set sign
Returns
Magnitude of x, sign of y
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::copysign ( double  x,
double  y 
)
inlinestatic

Composes double value with the magnitude of x and the sign of y.

Parameters
xValue to set sign for
yValue used to set sign
Returns
Magnitude of x, sign of y
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::cos ( float  x)
inlinestatic

Float cos.

Parameters
xThe argument to evaluate cos for
Returns
Cos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::cos ( double  x)
inlinestatic

Double cos.

Parameters
xThe argument to evaluate cos for
Returns
Cos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::cosSingleAccuracy ( double  x)
inlinestatic

Double cos, but with single accuracy.

Parameters
xThe argument to evaluate cos for
Returns
Cos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static gmx_int64_t gmx::countSamples ( const std::vector< PointState > &  pointState)
static

Count the total number of samples / sample weight over all grid points.

Parameters
[in]pointStateThe state of the points in a bias.
Returns
the total sample count.
static int gmx::countTrailingZeroRows ( const double *const *  data,
int  numRows,
int  numColumns 
)
static

Count trailing data rows containing only zeros.

Parameters
[in]data2D data array.
[in]numRowsNumber of rows in array.
[in]numColumnsNumber of cols in array.
Returns
the number of trailing zero rows.
bool gmx::cpuIsX86Nehalem ( const CpuInfo &  cpuInfo)

Return true if the CPU is an Intel x86 Nehalem.

Parameters
cpuInfoObject with cpu information
Returns
True if running on Nehalem CPU
std::unique_ptr< IMDModule > gmx::createElectricFieldModule ( )

Creates a module for an external electric field.

The returned class describes the time dependent electric field that can be applied to all charges in a simulation. The field is described by the following: E(t) = A cos(omega*(t-t0))*exp(-sqr(t-t0)/(2.0*sqr(sigma))); If sigma = 0 there is no pulse and we have instead E(t) = A cos(omega*t)

force is kJ mol^-1 nm^-1 = e * kJ mol^-1 nm^-1 / e

WARNING: There can be problems with the virial. Since the field is not self-consistent this is unavoidable. For neutral molecules the virial is correct within this approximation. For neutral systems with many charged molecules the error is small. But for systems with a net charge or a few charged molecules the error can be significant when the field is high. Solution: implement a self-consistent electric field into PME.

static bool gmx::cvtB2IB ( bool  a)
inlinestatic

Just return a boolean (mimicks SIMD real-to-int bool conversions)

Parameters
aboolean
Returns
same boolean
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::cvtD2F ( double  a)
inlinestatic

Convert double to float (mimicks SIMD conversion)

Parameters
adouble
Returns
a, as float
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::cvtF2D ( float  a)
inlinestatic

Convert float to double (mimicks SIMD conversion)

Parameters
afloat
Returns
a, as double double
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::cvtI2R ( std::int32_t  a)
inlinestatic

Return integer.

This function mimicks the SIMD integer-to-real conversion routines. By simply returning an integer, we let the compiler sort out whether the conversion should be to float or double rather than using proxy objects.

Parameters
ainteger
Returns
same value (a)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static bool gmx::cvtIB2B ( bool  a)
inlinestatic

Just return a boolean (mimicks SIMD int-to-real bool conversions)

Parameters
aboolean
Returns
same boolean
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::cvtR2I ( float  a)
inlinestatic

Round single precision floating point to integer.

Parameters
afloat
Returns
Integer format, a rounded to nearest integer.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::cvtR2I ( double  a)
inlinestatic

Round single precision doubleing point to integer.

Parameters
adouble
Returns
Integer format, a rounded to nearest integer.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::cvttR2I ( float  a)
inlinestatic

Truncate single precision floating point to integer.

Parameters
afloat
Returns
Integer format, a truncated to integer.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::cvttR2I ( double  a)
inlinestatic

Truncate single precision doubleing point to integer.

Parameters
adouble
Returns
Integer format, a truncated to integer.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
bool gmx::decideWhetherToUseGpusForNonbonded ( const TaskTarget  nonbondedTarget,
const std::vector< int > &  userGpuTaskAssignment,
const EmulateGpuNonbonded  emulateGpuNonbonded,
const bool  usingVerletScheme,
const bool  nonbondedOnGpuIsUseful,
const bool  gpusWereDetected 
)

Decide whether the simulation will try to run nonbonded tasks on GPUs.

The final decision cannot be made until after the duty of the rank is known. But we need to know if nonbonded will run on GPUs for setting up DD (particularly rlist) and determining duty. If the user requires GPUs for the tasks of that duty, then it will be an error when none are found.

With thread-MPI, calls have been made to decideWhetherToUseGpusForNonbondedWithThreadMpi() and decideWhetherToUseGpusForPmeWithThreadMpi() to help determine the number of ranks and run some checks, but the final decision is made in this routine, along with many more consistency checks.

Parameters
[in]nonbondedTargetThe user's choice for mdrun -nb for where to assign short-ranged nonbonded interaction tasks.
[in]userGpuTaskAssignmentThe user-specified assignment of GPU tasks to device IDs.
[in]emulateGpuNonbondedWhether we will emulate GPU calculation of nonbonded interactions.
[in]usingVerletSchemeWhether the nonbondeds are using the Verlet scheme.
[in]nonbondedOnGpuIsUsefulWhether computing nonbonded interactions on a GPU is useful for this calculation.
[in]gpusWereDetectedWhether compatible GPUs were detected on any node.
Returns
Whether the simulation will run nonbonded and PME tasks, respectively, on GPUs.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the user requirements are inconsistent.
bool gmx::decideWhetherToUseGpusForNonbondedWithThreadMpi ( const TaskTarget  nonbondedTarget,
const std::vector< int > &  gpuIdsToUse,
const std::vector< int > &  userGpuTaskAssignment,
const EmulateGpuNonbonded  emulateGpuNonbonded,
const bool  usingVerletScheme,
const bool  nonbondedOnGpuIsUseful,
const int  numRanksPerSimulation 
)

Decide whether this thread-MPI simulation will run nonbonded tasks on GPUs.

The number of GPU tasks and devices influences both the choice of the number of ranks, and checks upon any such choice made by the user. So we need to consider this before any automated choice of the number of thread-MPI ranks.

Parameters
[in]nonbondedTargetThe user's choice for mdrun -nb for where to assign short-ranged nonbonded interaction tasks.
[in]gpuIdsToUseThe compatible GPUs that the user permitted us to use.
[in]userGpuTaskAssignmentThe user-specified assignment of GPU tasks to device IDs.
[in]emulateGpuNonbondedWhether we will emulate GPU calculation of nonbonded interactions.
[in]usingVerletSchemeWhether the nonbondeds are using the Verlet scheme.
[in]nonbondedOnGpuIsUsefulWhether computing nonbonded interactions on a GPU is useful for this calculation.
[in]numRanksPerSimulationThe number of ranks in each simulation.
Returns
Whether the simulation will run nonbonded tasks on GPUs.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the user requirements are inconsistent.
bool gmx::decideWhetherToUseGpusForPme ( const bool  useGpuForNonbonded,
const TaskTarget  pmeTarget,
const std::vector< int > &  userGpuTaskAssignment,
const bool  canUseGpuForPme,
const int  numRanksPerSimulation,
const int  numPmeRanksPerSimulation,
const bool  gpusWereDetected 
)

Decide whether the simulation will try to run tasks of different types on GPUs.

The final decision cannot be made until after the duty of the rank is known. But we need to know if nonbonded will run on GPUs for setting up DD (particularly rlist) and determining duty. If the user requires GPUs for the tasks of that duty, then it will be an error when none are found.

With thread-MPI, calls have been made to decideWhetherToUseGpusForNonbondedWithThreadMpi() and decideWhetherToUseGpusForPmeWithThreadMpi() to help determine the number of ranks and run some checks, but the final decision is made in this routine, along with many more consistency checks.

Parameters
[in]useGpuForNonbondedWhether GPUs will be used for nonbonded interactions.
[in]pmeTargetThe user's choice for mdrun -pme for where to assign long-ranged PME nonbonded interaction tasks.
[in]userGpuTaskAssignmentThe user-specified assignment of GPU tasks to device IDs.
[in]canUseGpuForPmeWhether the form of PME chosen can run on a GPU
[in]numRanksPerSimulationThe number of ranks in each simulation.
[in]numPmeRanksPerSimulationThe number of PME ranks in each simulation.
[in]gpusWereDetectedWhether compatible GPUs were detected on any node.
Returns
Whether the simulation will run nonbonded and PME tasks, respectively, on GPUs.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the user requirements are inconsistent.
bool gmx::decideWhetherToUseGpusForPmeWithThreadMpi ( const bool  useGpuForNonbonded,
const TaskTarget  pmeTarget,
const std::vector< int > &  gpuIdsToUse,
const std::vector< int > &  userGpuTaskAssignment,
const bool  canUseGpuForPme,
const int  numRanksPerSimulation,
const int  numPmeRanksPerSimulation 
)

Decide whether this thread-MPI simulation will run PME tasks on GPUs.

The number of GPU tasks and devices influences both the choice of the number of ranks, and checks upon any such choice made by the user. So we need to consider this before any automated choice of the number of thread-MPI ranks.

Parameters
[in]useGpuForNonbondedWhether GPUs will be used for nonbonded interactions.
[in]pmeTargetThe user's choice for mdrun -pme for where to assign long-ranged PME nonbonded interaction tasks.
[in]gpuIdsToUseThe compatible GPUs that the user permitted us to use.
[in]userGpuTaskAssignmentThe user-specified assignment of GPU tasks to device IDs.
[in]canUseGpuForPmeWhether the form of PME chosen can run on a GPU
[in]numRanksPerSimulationThe number of ranks in each simulation.
[in]numPmeRanksPerSimulationThe number of PME ranks in each simulation.
Returns
Whether the simulation will run PME tasks on GPUs.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the user requirements are inconsistent.
double gmx::do_cg ( FILE *  fplog,
t_commrec *  cr,
const gmx::MDLogger &  mdlog,
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions,
gmx_vsite_t *  vsite,
gmx_constr_t  constr,
gmx::IMDOutputProvider *  outputProvider,
t_inputrec *  inputrec,
gmx_mtop_t *  top_global,
t_fcdata *  fcd,
t_state state_global,
ObservablesHistory *  observablesHistory,
gmx::MDAtoms *  mdAtoms,
t_nrnb *  nrnb,
gmx_wallcycle_t  wcycle,
t_forcerec *  fr,
const ReplicaExchangeParameters &  replExParams,
gmx_membed_t *  membed,
gmx_walltime_accounting_t  walltime_accounting 
)

Do conjugate gradients minimization.

double gmx::do_lbfgs ( FILE *  fplog,
t_commrec *  cr,
const gmx::MDLogger &  mdlog,
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions,
gmx_vsite_t *  vsite,
gmx_constr_t  constr,
gmx::IMDOutputProvider *  outputProvider,
t_inputrec *  inputrec,
gmx_mtop_t *  top_global,
t_fcdata *  fcd,
t_state state_global,
ObservablesHistory *  observablesHistory,
gmx::MDAtoms *  mdAtoms,
t_nrnb *  nrnb,
gmx_wallcycle_t  wcycle,
t_forcerec *  fr,
const ReplicaExchangeParameters &  replExParams,
gmx_membed_t *  membed,
gmx_walltime_accounting_t  walltime_accounting 
)

Do L-BFGS conjugate gradients minimization.

double gmx::do_nm ( FILE *  fplog,
t_commrec *  cr,
const gmx::MDLogger &  mdlog,
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions,
gmx_vsite_t *  vsite,
gmx_constr_t  constr,
gmx::IMDOutputProvider *  outputProvider,
t_inputrec *  inputrec,
gmx_mtop_t *  top_global,
t_fcdata *  fcd,
t_state state_global,
ObservablesHistory *  observablesHistory,
gmx::MDAtoms *  mdAtoms,
t_nrnb *  nrnb,
gmx_wallcycle_t  wcycle,
t_forcerec *  fr,
const ReplicaExchangeParameters &  replExParams,
gmx_membed_t *  membed,
gmx_walltime_accounting_t  walltime_accounting 
)

Do normal modes analysis.

double gmx::do_steep ( FILE *  fplog,
t_commrec *  cr,
const gmx::MDLogger &  mdlog,
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions,
gmx_vsite_t *  vsite,
gmx_constr_t  constr,
gmx::IMDOutputProvider *  outputProvider,
t_inputrec *  inputrec,
gmx_mtop_t *  top_global,
t_fcdata *  fcd,
t_state state_global,
ObservablesHistory *  observablesHistory,
gmx::MDAtoms *  mdAtoms,
t_nrnb *  nrnb,
gmx_wallcycle_t  wcycle,
t_forcerec *  fr,
const ReplicaExchangeParameters &  replExParams,
gmx_membed_t *  membed,
gmx_walltime_accounting_t  walltime_accounting 
)

Do steepest descents minimization.

double gmx::do_tpi ( FILE *  fplog,
t_commrec *  cr,
const gmx::MDLogger &  mdlog,
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions,
gmx_vsite_t *  vsite,
gmx_constr_t  constr,
gmx::IMDOutputProvider *  outputProvider,
t_inputrec *  inputrec,
gmx_mtop_t *  top_global,
t_fcdata *  fcd,
t_state state_global,
ObservablesHistory *  observablesHistory,
gmx::MDAtoms *  mdAtoms,
t_nrnb *  nrnb,
gmx_wallcycle_t  wcycle,
t_forcerec *  fr,
const ReplicaExchangeParameters &  replExParams,
gmx_membed_t *  membed,
gmx_walltime_accounting_t  walltime_accounting 
)

Do test particle insertion.

Integrator algorithm implementation. (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,

Parameters
[in]fplogLog file for output
[in]crCommunication record
[in]mdlogLog writer for important output
[in]nfileNumber of files
[in]fnmFilename structure array
[in]oenvOutput information
[in]mdrunOptionsOptions for mdrun
[in]vsiteVirtual site information
[in]constrConstraint information
[in]outputProviderAdditional output provider
[in]inputrecInput record with mdp options
[in]top_globalMolecular topology for the whole system
[in]fcdForce and constraint data
[in]state_globalThe state (x, v, f, box etc.) of the whole system
[in]observablesHistoryThe observables statistics history
[in]mdAtomsAtom information
[in]nrnbAccounting for floating point operations
[in]wcycleWall cycle timing information
[in]frForce record with cut-off information and more
[in]replExParamsParameters for the replica exchange algorithm
[in]membedMembrane embedding data structure
[in]walltime_accountingMore timing information (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions, gmx_vsite_t *vsite, gmx_constr_t constr, gmx::IMDOutputProvider *outputProvider, t_inputrec *inputrec, gmx_mtop_t *top_global, t_fcdata *fcd, t_state *state_global, gmx::MDAtoms *mdAtoms, t_nrnb *nrnb, gmx_wallcycle_t wcycle, gmx_edsam_t ed, t_forcerec *fr, const ReplicaExchangeParameters &replExParams, gmx_membed_t gmx_unused *membed, gmx_walltime_accounting_t walltime_accounting)
void gmx::doDeviceTransfers ( const gmx_gpu_info_t &  gpuInfo,
ArrayRef< const char >  input,
ArrayRef< char >  output 
)

Helper function for GPU test code to be platform agnostic.

Transfers input to device 0, if present, and transfers it back into output. Both sizes must match. If no devices are present, do a simple host-side buffer copy instead.

Exceptions
InternalErrorUpon any GPU API error condition.
static void gmx::ensureStateAndRunConsistency ( const BiasParams &  params,
const BiasState &  state 
)
static

Check if the state (loaded from checkpoint) and the run are consistent.

When the state and the run setup are inconsistent, an exception is thrown.

Parameters
[in]paramsThe parameters of the bias.
[in]stateThe state of the bias.
static float gmx::erf ( float  x)
inlinestatic

Float erf(x).

Parameters
xArgument.
Returns
erf(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::erf ( double  x)
inlinestatic

Double erf(x).

Parameters
xArgument.
Returns
erf(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::erfc ( float  x)
inlinestatic

Float erfc(x).

Parameters
xArgument.
Returns
erfc(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::erfc ( double  x)
inlinestatic

Double erfc(x).

Parameters
xArgument.
Returns
erfc(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::erfcSingleAccuracy ( double  x)
inlinestatic

Double erfc(x), but with single accuracy.

Parameters
xArgument.
Returns
erfc(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
double gmx::erfinv ( double  x)

Inverse error function, double precision.

Parameters
xArgument, should be in the range -1.0 < x < 1.0
Returns
The inverse of the error function if the argument is inside the range, +/- infinity if it is exactly 1.0 or -1.0, and NaN otherwise.
float gmx::erfinv ( float  x)

Inverse error function, single precision.

Parameters
xArgument, should be in the range -1.0 < x < 1.0
Returns
The inverse of the error function if the argument is inside the range, +/- infinity if it is exactly 1.0 or -1.0, and NaN otherwise.
static double gmx::erfSingleAccuracy ( double  x)
inlinestatic

Double erf(x), but with single accuracy.

Parameters
xArgument.
Returns
erf(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<MathOptimization opt = MathOptimization::Safe>
static float gmx::exp ( float  x)
inlinestatic

Float exp(x).

Parameters
xArgument.
Returns
exp(x). Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::exp ( double  x)
inlinestatic

Double exp(x).

Parameters
xArgument.
Returns
exp(x). Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<MathOptimization opt = MathOptimization::Safe>
static float gmx::exp2 ( float  x)
inlinestatic

Float 2^x.

Parameters
xArgument.
Returns
2^x. Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::exp2 ( double  x)
inlinestatic

Double 2^x.

Parameters
xArgument.
Returns
2^x. Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::exp2SingleAccuracy ( double  x)
inlinestatic

Double 2^x, but with single accuracy.

Parameters
xArgument.
Returns
2^x. Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::expandScalarsToTriplets ( float  scalar,
float *  triplets0,
float *  triplets1,
float *  triplets2 
)
inlinestatic

Copy single float to three variables.

Parameters
scalarFloating-point input.
[out]triplets0Copy 1.
[out]triplets1Copy 2.
[out]triplets2Copy 3.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::expandScalarsToTriplets ( double  scalar,
double *  triplets0,
double *  triplets1,
double *  triplets2 
)
inlinestatic

Copy single double to three variables.

Parameters
scalarFloating-point input.
[out]triplets0Copy 1.
[out]triplets1Copy 2.
[out]triplets2Copy 3.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::expSingleAccuracy ( double  x)
inlinestatic

Double exp(x), but with single accuracy.

Parameters
xArgument.
Returns
exp(x). Undefined if input argument caused overflow.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
GpuTasksOnRanks gmx::findAllGpuTasksOnThisNode ( ArrayRef< const GpuTask >  gpuTasksOnThisRank,
int  numRanksOnThisNode,
MPI_Comm  communicator 
)

Returns container of all tasks on all ranks of this node that are eligible for GPU execution.

Perform all necessary communication for preparing for task assignment. Separating this aspect makes it possible to unit test the logic of task assignment.

static float gmx::fma ( float  a,
float  b,
float  c 
)
inlinestatic

Float Fused-multiply-add. Result is a*b + c.

Parameters
afactor1
bfactor2
cterm
Returns
a*b + c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::fma ( double  a,
double  b,
double  c 
)
inlinestatic

double Fused-multiply-add. Result is a*b + c.

Parameters
afactor1
bfactor2
cterm
Returns
a*b + c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::fms ( float  a,
float  b,
float  c 
)
inlinestatic

Float Fused-multiply-subtract. Result is a*b - c.

Parameters
afactor1
bfactor2
cterm
Returns
a*b - c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::fms ( double  a,
double  b,
double  c 
)
inlinestatic

double Fused-multiply-subtract. Result is a*b - c.

Parameters
afactor1
bfactor2
cterm
Returns
a*b - c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::fnma ( float  a,
float  b,
float  c 
)
inlinestatic

Float Fused-negated-multiply-add. Result is -a*b + c.

Parameters
afactor1
bfactor2
cterm
Returns
-a*b + c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::fnma ( double  a,
double  b,
double  c 
)
inlinestatic

double Fused-negated-multiply-add. Result is - a*b + c.

Parameters
afactor1
bfactor2
cterm
Returns
-a*b + c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::fnms ( float  a,
float  b,
float  c 
)
inlinestatic

Float Fused-negated-multiply-subtract. Result is -a*b - c.

Parameters
afactor1
bfactor2
cterm
Returns
-a*b - c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::fnms ( double  a,
double  b,
double  c 
)
inlinestatic

double Fused-negated-multiply-subtract. Result is -a*b - c.

Parameters
afactor1
bfactor2
cterm
Returns
-a*b - c
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadBySimdIntTranspose ( const float *  base,
std::int32_t  offset,
float *  v0,
float *  v1,
float *  v2,
float *  v3 
)
inlinestatic

Load 4 floats from base/offsets and store into variables.

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First float, base[align*offset[0]].
[out]v1Second float, base[align*offset[0] + 1].
[out]v2Third float, base[align*offset[0] + 2].
[out]v3Fourth float, base[align*offset[0] + 3].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadBySimdIntTranspose ( const float *  base,
std::int32_t  offset,
float *  v0,
float *  v1 
)
inlinestatic

Load 2 floats from base/offsets and store into variables (aligned).

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First float, base[align*offset[0]].
[out]v1Second float, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadBySimdIntTranspose ( const double *  base,
std::int32_t  offset,
double *  v0,
double *  v1,
double *  v2,
double *  v3 
)
inlinestatic

Load 4 doubles from base/offsets and store into variables.

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First double, base[align*offset[0]].
[out]v1Second double, base[align*offset[0] + 1].
[out]v2Third double, base[align*offset[0] + 2].
[out]v3Fourth double, base[align*offset[0] + 3].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadBySimdIntTranspose ( const double *  base,
std::int32_t  offset,
double *  v0,
double *  v1 
)
inlinestatic

Load 2 doubles from base/offsets and store into variables (aligned).

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First double, base[align*offset[0]].
[out]v1Second double, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadTranspose ( const float *  base,
const std::int32_t  offset[],
float *  v0,
float *  v1,
float *  v2,
float *  v3 
)
inlinestatic

Load 4 consecutive floats from base/offset into four variables.

Template Parameters
alignAlignment of the memory from which we read.
Parameters
basePointer to the start of the memory area
offsetIndex to data.
[out]v01st float, base[align*offset[0]].
[out]v12nd float, base[align*offset[0] + 1].
[out]v23rd float, base[align*offset[0] + 2].
[out]v34th float, base[align*offset[0] + 3].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadTranspose ( const float *  base,
const std::int32_t  offset[],
float *  v0,
float *  v1 
)
inlinestatic

Load 2 consecutive floats from base/offset into four variables.

Template Parameters
alignAlignment of the memory from which we read.
Parameters
basePointer to the start of the memory area
offsetIndex to data.
[out]v01st float, base[align*offset[0]].
[out]v12nd float, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadTranspose ( const double *  base,
const std::int32_t  offset[],
double *  v0,
double *  v1,
double *  v2,
double *  v3 
)
inlinestatic

Load 4 consecutive doubles from base/offset into four variables.

Template Parameters
alignAlignment of the memory from which we read.
Parameters
basePointer to the start of the memory area
offsetIndex to data.
[out]v01st double, base[align*offset[0]].
[out]v12nd double, base[align*offset[0] + 1].
[out]v23rd double, base[align*offset[0] + 2].
[out]v34th double, base[align*offset[0] + 3].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadTranspose ( const double *  base,
const std::int32_t  offset[],
double *  v0,
double *  v1 
)
inlinestatic

Load 2 consecutive doubles from base/offset into four variables.

Template Parameters
alignAlignment of the memory from which we read.
Parameters
basePointer to the start of the memory area
offsetIndex to data.
[out]v01st double, base[align*offset[0]].
[out]v12nd double, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadUBySimdIntTranspose ( const float *  base,
std::int32_t  offset,
float *  v0,
float *  v1 
)
inlinestatic

Load 2 floats from base/offsets and store into variables (unaligned).

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First float, base[align*offset[0]].
[out]v1Second float, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadUBySimdIntTranspose ( const double *  base,
std::int32_t  offset,
double *  v0,
double *  v1 
)
inlinestatic

Load 2 doubles from base/offsets and store into variables (unaligned).

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
baseAligned pointer to the start of the memory.
offsetInteger type with offset to the start of each triplet.
[out]v0First double, base[align*offset[0]].
[out]v1Second double, base[align*offset[0] + 1].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadUTranspose ( const float *  base,
const std::int32_t  offset[],
float *  v0,
float *  v1,
float *  v2 
)
inlinestatic

Load 3 consecutive floats from base/offsets, store into three vars.

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
basePointer to the start of the memory area
offsetOffset to the start of data.
[out]v01st value, base[align*offset[0]].
[out]v12nd value, base[align*offset[0] + 1].
[out]v23rd value, base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::gatherLoadUTranspose ( const double *  base,
const std::int32_t  offset[],
double *  v0,
double *  v1,
double *  v2 
)
inlinestatic

Load 3 consecutive doubles from base/offsets, store into three vars.

Template Parameters
alignAlignment of the memory from which we read, i.e. distance (measured in elements, not bytes) between index points.
Parameters
basePointer to the start of the memory area
offsetOffset to the start of data.
[out]v01st double, base[align*offset[0]].
[out]v12nd double, base[align*offset[0] + 1].
[out]v23rd double, base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<class RealType = real, unsigned int Bits, class Rng >
RealType gmx::generateCanonical ( Rng &  g)

Generate a floating-point value with specified number of random bits.

Template Parameters
RealTypeFloating-point type to generate
BitsNumber of random bits to generate
RngRandom number generator class
Parameters
gRandom number generator to use

This implementation avoids the bug in libc++ and stdlibc++ (which is due to the C++ standard being unclear) where 1.0 can be returned occasionally.

static double gmx::get_pull_coord_period ( const pull_params_t *  pull_params,
int  coord_ind,
const matrix  box 
)
static

Gets the period of a pull coordinate.

Parameters
[in]pull_paramsPull parameters.
[in]coord_indPull coordinate index.
[in]boxBox vectors.
Returns
the period (or 0 if not periodic).
double gmx::getDeviationFromPointAlongGridAxis ( const Grid &  grid,
int  dimIndex,
int  pointIndex,
double  value 
)

Get the deviation along one dimension from the given value to a point in the grid.

Parameters
[in]gridThe grid.
[in]dimIndexDimensional index in [0, ndim -1].
[in]pointIndexGrid point index.
[in]valueValue along the given dimension.
Returns
the deviation of the given value to the given point.
static int gmx::getNearestIndexInGrid ( const awh_dvec  value,
const std::vector< GridAxis > &  axis 
)
static

Map a value to the nearest point in the grid.

Parameters
[in]valueValue.
[in]axisThe grid axes.
Returns
the point index nearest to the value.
static std::size_t gmx::getPageSize ( )
static

Return a page size, from a sysconf/WinAPI query if available, or a default guess (4096 bytes).

Todo:
Move this function into sysinfo.cpp where other OS-specific code/includes live
gmx_hw_info_t * gmx::gmx_detect_hardware ( const gmx::MDLogger &  mdlog,
const t_commrec *  cr 
)

Run detection, consistency checks, and make available on all ranks.

This routine constructs the global hwinfo structure and returns a pointer to it. It will run a preamble before executing cpu and hardware checks, and then run consistency checks afterwards. The results will also be made available on all nodes. Caller is responsible for calling gmx_hardware_info_free() when finished.

static bool gmx::gpuAccelerationOfNonbondedIsUseful ( const MDLogger &  mdlog,
const t_inputrec *  ir,
bool  issueWarning 
)
static

Return whether GPU acceleration of nonbondeds is supported with the given settings.

If not, and if a warning may be issued, logs a warning about falling back to CPU code. With thread-MPI, only the first call to this function should have issueWarning true.

std::int64_t gmx::greatestCommonDivisor ( std::int64_t  p,
std::int64_t  q 
)

Find greatest common divisor of two numbers.

Parameters
pFirst number, positive
qSecond number, positive
Returns
Greatest common divisor of p and q
static void gmx::hardwareTopologyDoubleCheckDetection ( const gmx::MDLogger &  mdlog,
const gmx::HardwareTopology &  hardwareTopology 
)
static

Sanity check hardware topology and print some notes to log.

Parameters
mdlogLogger.
hardwareTopologyReference to hardwareTopology object.
static void gmx::hardwareTopologyPrepareDetection ( )
static

Prepare the system before hardware topology detection.

This routine should perform any actions we want to put the system in a state where we want it to be before detecting the hardware topology. For most processors there is nothing to do, but some architectures (in particular ARM) have support for taking configured cores offline, which will make them disappear from the online processor count.

This routine checks if there is a mismatch between the number of cores configured and online, and in that case we issue a small workload that attempts to wake sleeping cores before doing the actual detection.

This type of mismatch can also occur for x86 or PowerPC on Linux, if SMT has only been disabled in the kernel (rather than bios). Since those cores will never come online automatically, we currently skip this test for x86 & PowerPC to avoid wasting 2 seconds. We also skip the test if there is no thread support.

Note
Cores will sleep relatively quickly again, so it's important to issue the real detection code directly after this routine.
bool gmx::haveBiasSharingWithinSimulation ( const AwhParams &  awhParams)

Returns if any bias is sharing within a simulation.

Parameters
[in]awhParamsThe AWH parameters.
int gmx::identifyAvx512FmaUnits ( )

Test whether machine has dual AVX512 FMA units.

Returns
1 or 2 for the number of AVX512 FMA units if AVX512 support is present, 0 if we know the hardware does not have AVX512 support, or -1 if the test cannot run because the compiler lacked AVX512 support.
void gmx::initCorrelationGridHistory ( CorrelationGridHistory *  correlationGridHistory,
int  numCorrelationTensors,
int  tensorSize,
int  blockDataListSize 
)

Initialize correlation grid history, sets all sizes.

Parameters
[in,out]correlationGridHistoryCorrelation grid history for master rank.
[in]numCorrelationTensorsNumber of correlation tensors in the grid.
[in]tensorSizeNumber of correlation elements in each tensor.
[in]blockDataListSizeThe number of blocks in the list of each tensor element.
CorrelationGridHistory gmx::initCorrelationGridHistoryFromState ( const CorrelationGrid &  corrGrid)

Allocate a correlation grid history with the same structure as the given correlation grid.

This function would be called at the start of a new simulation. Note that only sizes and memory are initialized here. History data is set by updateCorrelationGridHistory.

Parameters
[in,out]corrGridCorrelation grid state to initialize with.
Returns
the correlation grid history struct.
static bool gmx::intervalIsInPeriodicInterval ( double  origin,
double  end,
double  period 
)
static

Checks if the given interval is defined in the correct periodic interval.

Parameters
[in]originStart value of interval.
[in]endEnd value of interval.
[in]periodPeriod (or 0 if not periodic).
Returns
true if the end point values are in the correct periodic interval.
static float gmx::inv ( float  x)
inlinestatic

Calculate 1/x for float.

Parameters
xArgument that must be nonzero. This routine does not check arguments.
Returns
1/x. Result is undefined if your argument was invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::inv ( double  x)
inlinestatic

Calculate 1/x for double.

Parameters
xArgument that must be nonzero. This routine does not check arguments.
Returns
1/x. Result is undefined if your argument was invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::invcbrt ( float  x)
inlinestatic

Calculate inverse cube root of x in single precision.

Parameters
xArgument
Returns
x^(-1/3)

This routine is typically faster than using std::pow().

static double gmx::invcbrt ( double  x)
inlinestatic

Calculate inverse sixth root of x in double precision.

Parameters
xArgument
Returns
x^(-1/3)

This routine is typically faster than using std::pow().

static double gmx::invcbrt ( int  x)
inlinestatic

Calculate inverse sixth root of integer x in double precision.

Parameters
xArgument
Returns
x^(-1/3)

This routine is typically faster than using std::pow().

void gmx::invertBoxMatrix ( const matrix  src,
matrix  dest 
)

Invert a simulation-box matrix in src, return in dest.

This routine assumes that src is a simulation-box matrix, i.e. has zeroes in the upper-right triangle. A fatal error occurs if the product of the leading diagonal is too small. The inversion can be done "in place", i.e src and dest can be the same matrix.

void gmx::invertMatrix ( const matrix  src,
matrix  dest 
)

Invert a general 3x3 matrix in src, return in dest.

A fatal error occurs if the determinant is too small. src and dest cannot be the same matrix.

static double gmx::invSingleAccuracy ( double  x)
inlinestatic

Calculate 1/x for double, but with single accuracy.

Parameters
xArgument that must be nonzero. This routine does not check arguments.
Returns
1/x. Result is undefined if your argument was invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::invsixthroot ( float  x)
inlinestatic

Calculate inverse sixth root of x in single precision.

Parameters
xArgument, must be greater than zero.
Returns
x^(-1/6)

This routine is typically faster than using std::pow().

static double gmx::invsixthroot ( double  x)
inlinestatic

Calculate inverse sixth root of x in double precision.

Parameters
xArgument, must be greater than zero.
Returns
x^(-1/6)

This routine is typically faster than using std::pow().

static double gmx::invsixthroot ( int  x)
inlinestatic

Calculate inverse sixth root of integer x in double precision.

Parameters
xArgument, must be greater than zero.
Returns
x^(-1/6)

This routine is typically faster than using std::pow().

static float gmx::invsqrt ( float  x)
inlinestatic

Calculate 1.0/sqrt(x) in single precision.

Parameters
xPositive value to calculate inverse square root for

For now this is implemented with std::sqrt(x) since gcc seems to do a decent job optimizing it. However, we might decide to use instrinsics or compiler-specific functions in the future.

Returns
1.0/sqrt(x)
static double gmx::invsqrt ( double  x)
inlinestatic

Calculate 1.0/sqrt(x) in double precision, but single range.

Parameters
xPositive value to calculate inverse square root for, must be in the input domain valid for single precision.

For now this is implemented with std::sqrt(x). However, we might decide to use instrinsics or compiler-specific functions in the future, and then we want to have the freedom to do the first step in single precision.

Returns
1.0/sqrt(x)
static double gmx::invsqrt ( int  x)
inlinestatic

Calculate 1.0/sqrt(x) for integer x in double precision.

Parameters
xPositive value to calculate inverse square root for.
Returns
1.0/sqrt(x)
static void gmx::invsqrtPair ( float  x0,
float  x1,
float *  out0,
float *  out1 
)
inlinestatic

Calculate 1/sqrt(x) for two floats.

Parameters
x0First argument, x0 must be positive - no argument checking.
x1Second argument, x1 must be positive - no argument checking.
[out]out0Result 1/sqrt(x0)
[out]out1Result 1/sqrt(x1)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::invsqrtPair ( double  x0,
double  x1,
double *  out0,
double *  out1 
)
inlinestatic

Calculate 1/sqrt(x) for two doubles.

Parameters
x0First argument, x0 must be positive - no argument checking.
x1Second argument, x1 must be positive - no argument checking.
[out]out0Result 1/sqrt(x0)
[out]out1Result 1/sqrt(x1)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::invsqrtPairSingleAccuracy ( double  x0,
double  x1,
double *  out0,
double *  out1 
)
inlinestatic

Calculate 1/sqrt(x) for two doubles, but with single accuracy.

Parameters
x0First argument, x0 must be positive - no argument checking.
x1Second argument, x1 must be positive - no argument checking.
[out]out0Result 1/sqrt(x0)
[out]out1Result 1/sqrt(x1)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::invsqrtSingleAccuracy ( double  x)
inlinestatic

Calculate 1/sqrt(x) for double, but with single accuracy.

Parameters
xArgument that must be >0. This routine does not check arguments.
Returns
1/sqrt(x). Result is undefined if your argument was invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
void gmx::linearArrayIndexToMultiDim ( int  indexLinear,
int  ndim,
const awh_ivec  numPointsDim,
awh_ivec  indexMulti 
)

Convert a linear array index to a multidimensional one.

Parameters
[in]indexLinearLinear array index
[in]ndimNumber of dimensions of the array.
[in]numPointsDimNumber of points for each dimension.
[out]indexMultiThe multidimensional index.
void gmx::linearGridindexToMultiDim ( const Grid &  grid,
int  indexLinear,
awh_ivec  indexMulti 
)

Convert a linear grid point index to a multidimensional one.

Parameters
[in]gridThe grid.
[in]indexLinearLinear grid point index to convert to a multidimensional one.
[out]indexMultiThe multidimensional index.
static float gmx::log ( float  x)
inlinestatic

Float log(x). This is the natural logarithm.

Parameters
xArgument, should be >0.
Returns
The natural logarithm of x. Undefined if argument is invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::log ( double  x)
inlinestatic

Double log(x). This is the natural logarithm.

Parameters
xArgument, should be >0.
Returns
The natural logarithm of x. Undefined if argument is invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
unsigned int gmx::log2I ( std::uint32_t  x)

Compute floor of logarithm to base 2, 32 bit unsigned argument.

Parameters
x32-bit unsigned argument
Returns
log2(x)
Note
This version of the overloaded function uses unsigned arguments to be able to handle arguments using all 32 bits.
unsigned int gmx::log2I ( std::uint64_t  x)

Compute floor of logarithm to base 2, 64 bit unsigned argument.

Parameters
x64-bit unsigned argument
Returns
log2(x)
Note
This version of the overloaded function uses unsigned arguments to be able to handle arguments using all 64 bits.
unsigned int gmx::log2I ( std::int32_t  x)

Compute floor of logarithm to base 2, 32 bit signed argument.

Parameters
x32-bit signed argument
Returns
log2(x)
Note
This version of the overloaded function will assert that x is not negative.
unsigned int gmx::log2I ( std::int64_t  x)

Compute floor of logarithm to base 2, 64 bit signed argument.

Parameters
x64-bit signed argument
Returns
log2(x)
Note
This version of the overloaded function will assert that x is not negative.
static double gmx::logSingleAccuracy ( double  x)
inlinestatic

Double log(x), but with single accuracy. This is the natural logarithm.

Parameters
xArgument, should be >0.
Returns
The natural logarithm of x. Undefined if argument is invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<typename T >
ArrayRef<typename std::conditional<std::is_const<T>::value, const typename T::value_type, typename T::value_type>::type> gmx::makeArrayRef ( T &  c)

Create ArrayRef from container with type deduction.

See Also
ArrayRef
template<typename T >
ArrayRef<const typename T::value_type> gmx::makeConstArrayRef ( const T &  c)

Create ArrayRef to const T from container with type deduction.

See Also
ArrayRef
std::vector< int > gmx::makeGpuIds ( ArrayRef< const int >  compatibleGpus,
size_t  numGpuTasks 
)

Make a vector containing numGpuTasks IDs of the IDs found in compatibleGpus.

Exceptions
std::bad_allocIf out of memory
Returns
A sorted vector of IDs of compatible vectors, whose length matches that of the number of GPU tasks required.
std::string gmx::makeGpuIdString ( const std::vector< int > &  gpuIds,
int  totalNumberOfTasks 
)

Convert a container of GPU deviced IDs to a string that can be used by gmx tune_pme as input to mdrun -gputasks.

Produce a valid input for mdrun -gputasks that refers to the device IDs in gpuIds but produces a mapping for totalNumberOfTasks tasks. Note that gmx tune_pme does not currently support filling mdrun -gputasks.

Parameters
[in]gpuIdsContainer of device IDs
[in]totalNumberOfTasksTotal number of tasks for the output mapping produced by the returned string.
Returns
A string that is suitable to pass to mdrun -gputasks.
Exceptions
std::bad_allocIf out of memory.
std::unique_ptr< MDAtoms > gmx::makeMDAtoms ( FILE *  fp,
const gmx_mtop_t &  mtop,
const t_inputrec &  ir,
bool  useGpuForPme 
)

Builder function for MdAtomsWrapper.

Builder function.

gmx_uint64_t gmx::makeRandomSeed ( )

Return 64 random bits from the random device, suitable as seed.

If the internal random device output is smaller than 64 bits, this routine will use multiple calls internally until we have 64 bits of random data.

Returns
64-bit unsigned integer with random bits.
void gmx::mapGridToDataGrid ( std::vector< int > *  gridpointToDatapoint,
const double *const *  data,
int  numDataPoints,
const std::string &  dataFilename,
const Grid &  grid,
const std::string &  correctFormatMessage 
)

Maps each point in the grid to a point in the data grid.

This functions maps an AWH bias grid to a user provided input data grid. The value of data grid point i along dimension d is given by data[d][i]. The number of dimensions of the data should equal that of the grid. A fatal error is thrown if extracting the data fails or the data does not cover the whole grid.

Parameters
[out]gridpointToDatapointArray mapping each grid point to a data point index.
[in]data2D array in format ndim x ndatapoints with data grid point values.
[in]numDataPointsNumber of data points.
[in]dataFilenameThe data filename.
[in]gridThe grid.
[in]correctFormatMessageString to include in error message if extracting the data fails.
static float gmx::maskAdd ( float  a,
float  b,
float  m 
)
inlinestatic

Add two float variables, masked version.

Parameters
aterm1
bterm2
mmask
Returns
a+b where mask is true, a otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskAdd ( double  a,
double  b,
double  m 
)
inlinestatic

Add two double variables, masked version.

Parameters
aterm1
bterm2
mmask
Returns
a+b where mask is true, a otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::maskzFma ( float  a,
float  b,
float  c,
float  m 
)
inlinestatic

Float fused multiply-add, masked version.

Parameters
afactor1
bfactor2
cterm
mmask
Returns
a*b+c where mask is true, 0.0 otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzFma ( double  a,
double  b,
double  c,
double  m 
)
inlinestatic

double fused multiply-add, masked version.

Parameters
afactor1
bfactor2
cterm
mmask
Returns
a*b+c where mask is true, 0.0 otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::maskzInv ( float  x,
bool  m 
)
inlinestatic

Calculate 1/x for masked entry of float.

This routine only evaluates 1/x if mask is true. Illegal values for a masked-out float will not lead to floating-point exceptions.

Parameters
xArgument that must be nonzero if masked-in.
mMask
Returns
1/x. Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzInv ( double  x,
bool  m 
)
inlinestatic

Calculate 1/x for masked entry of double.

This routine only evaluates 1/x if mask is true. Illegal values for a masked-out double will not lead to floating-point exceptions.

Parameters
xArgument that must be nonzero if masked-in.
mMask
Returns
1/x. Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzInvSingleAccuracy ( double  x,
bool  m 
)
inlinestatic

Calculate 1/x for masked entry of double, but with single accuracy.

This routine only evaluates 1/x if mask is true. Illegal values for a masked-out double will not lead to floating-point exceptions.

Parameters
xArgument that must be nonzero if masked-in.
mMask
Returns
1/x. Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::maskzInvsqrt ( float  x,
bool  m 
)
inlinestatic

Calculate 1/sqrt(x) for masked entry of float.

This routine only evaluates 1/sqrt(x) if mask is true. Illegal values for a masked-out float will not lead to floating-point exceptions.

Parameters
xArgument that must be >0 if masked-in.
mMask
Returns
1/sqrt(x). Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzInvsqrt ( double  x,
bool  m 
)
inlinestatic

Calculate 1/sqrt(x) for masked entry of double.

This routine only evaluates 1/sqrt(x) if mask is true. Illegal values for a masked-out double will not lead to floating-point exceptions.

Parameters
xArgument that must be >0 if masked-in.
mMask
Returns
1/sqrt(x). Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzInvsqrtSingleAccuracy ( double  x,
bool  m 
)
inlinestatic

Calculate 1/sqrt(x) for masked entry of double, but with single accuracy.

This routine only evaluates 1/sqrt(x) if mask is true. Illegal values for a masked-out double will not lead to floating-point exceptions.

Parameters
xArgument that must be >0 if masked-in.
mMask
Returns
1/sqrt(x). Result is undefined if your argument was invalid or entry was not masked, and 0.0 for masked-out entries.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::maskzMul ( float  a,
float  b,
float  m 
)
inlinestatic

Multiply two float variables, masked version.

Parameters
afactor1
bfactor2
mmask
Returns
a*b where mask is true, 0.0 otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::maskzMul ( double  a,
double  b,
double  m 
)
inlinestatic

Multiply two double variables, masked version.

Parameters
afactor1
bfactor2
mmask
Returns
a*b where mask is true, 0.0 otherwise.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::max ( float  a,
float  b 
)
inlinestatic

Set each float element to the largest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
max(a,b) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::max ( double  a,
double  b 
)
inlinestatic

Set each double element to the largest from two variables.

Parameters
aAny doubleing-point value
bAny doubleing-point value
Returns
max(a,b) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::mdrunner_start_fn ( void *  arg)
static

The callback used for running on spawned threads.

Obtains the pointer to the master mdrunner object from the one argument permitted to the thread-launch API call, copies it to make a new runner for this thread, reinitializes necessary data, and proceeds to the simulation.

static float gmx::min ( float  a,
float  b 
)
inlinestatic

Set each float element to the smallest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
min(a,b) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::min ( double  a,
double  b 
)
inlinestatic

Set each double element to the smallest from two variables.

Parameters
aAny doubleing-point value
bAny doubleing-point value
Returns
min(a,b) for each element.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
int gmx::multiDimArrayIndexToLinear ( const awh_ivec  indexMulti,
int  numDim,
const awh_ivec  numPointsDim 
)

Convert multidimensional array index to a linear one.

Parameters
[in]indexMultiMultidimensional index to convert to a linear one.
[in]numDimNumber of dimensions of the array.
[in]numPointsDimNumber of points of the array.
Returns
the linear index.
Note
This function can be used without having an initialized grid.
int gmx::multiDimGridIndexToLinear ( const Grid &  grid,
const awh_ivec  indexMulti 
)

Convert a multidimensional grid point index to a linear one.

Parameters
[in]gridThe grid.
[in]indexMultiMultidimensional grid point index to convert to a linear one.
Returns
the linear index.
void gmx::niceHeader ( TextWriter *  writer,
const char *  fn,
char  commentChar 
)

Prints creation time stamp and user information into a string as comments, and returns it.

Parameters
[out]writerWhere to print the information.
[in]fnName of the file being written; if nullptr, described as "unknown".
[in]commentCharCharacter to use as the starting delimiter for comments.
Exceptions
std::bad_allocif out of memory.
static void gmx::normalizeBlock ( AwhEnergyBlock *  block,
const Bias &  bias 
)
static

Normalizes block data for output.

Parameters
[in,out]blockThe block to normalize.
[in]biasThe AWH bias.
static void gmx::normalizeFreeEnergyAndPmfSum ( std::vector< PointState > *  pointState)
static

Normalizes the free energy and PMF sum.

Parameters
[in]pointStateThe state of the points.
static size_t gmx::paddedRVecVectorSize ( size_t  numAtoms)
inlinestatic

Returns the padded size for PaddedRVecVector given the number of atoms.

Parameters
[in]numAtomsThe number of atoms for which data will be stored in a PaddedRVecVector
std::size_t gmx::pageSize ( )

Return the memory page size on this system.

Implements the "construct on first use" idiom to avoid the static initialization order fiasco where a possible static page-aligned container would be initialized before the alignment variable was.

Note that thread-safety is guaranteed by the C++11 language standard.

std::vector< int > gmx::parseUserGpuIds ( const std::string &  gpuIdString)

Parse a GPU ID string into a container describing the task types and associated device IDs.

Parameters
[in]gpuIdStringString like "013" or "0,1,3" typically supplied by the user to mdrun -gpu_id or -gputasks. Must contain only decimal digits, or only decimal digits separated by comma delimiters. A terminal comma is accceptable (and required to specify a single ID that is larger than 9).
Returns
A vector of GPU ID task mappings, like { 0, 1, 3 }
Exceptions
std::bad_allocIf out of memory. InvalidInputError If an invalid character is found (ie not a digit or ',').
void gmx::pinBuffer ( void *  pointer,
std::size_t  numBytes 
)
noexcept

Pin the allocation to physical memory.

Requires that pointer is not nullptr.

Does not throw.

static float gmx::pmeForceCorrection ( float  z2)
inlinestatic

Calculate the force correction due to PME analytically in float.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on force
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::pmeForceCorrection ( double  z2)
inlinestatic

Calculate the force correction due to PME analytically in double.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on force
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::pmeForceCorrectionSingleAccuracy ( double  z2)
inlinestatic

Force correction due to PME in double, but with single accuracy.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on force
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::pmePotentialCorrection ( float  z2)
inlinestatic

Calculate the potential correction due to PME analytically in float.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on potential.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::pmePotentialCorrection ( double  z2)
inlinestatic

Calculate the potential correction due to PME analytically in double.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on potential.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::pmePotentialCorrectionSingleAccuracy ( double  z2)
inlinestatic

Potential correction due to PME in double, but with single accuracy.

See the SIMD version of this function for details.

Parameters
z2input parameter
Returns
Correction to use on potential.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static int gmx::pointDistanceAlongAxis ( const GridAxis &  axis,
double  x,
double  x0 
)
static

Returns the point distance between from value x to value x0 along the given axis.

Note that the returned distance may be negative or larger than the number of points in the axis. For a periodic axis, the distance is chosen to be in [0, period), i.e. always positive but not the shortest one.

Parameters
[in]axisGrid axis.
[in]xFrom value.
[in]x0To value.
Returns
(x - x0) in number of points.
template<typename T >
T gmx::power12 ( x)

calculate x^12

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^12
template<typename T >
T gmx::power3 ( x)

calculate x^3

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^3
template<typename T >
T gmx::power4 ( x)

calculate x^4

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^4
template<typename T >
T gmx::power5 ( x)

calculate x^5

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^5
template<typename T >
T gmx::power6 ( x)

calculate x^6

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^6
void gmx::printBinaryInformation ( FILE *  fp,
const IProgramContext &  programContext 
)

Print basic information about the executable.

Parameters
fpWhere to print the information to.
[in]programContextProgram information object to use.
void gmx::printBinaryInformation ( FILE *  fp,
const IProgramContext &  programContext,
const BinaryInformationSettings &  settings 
)

Print basic information about the executable with custom settings.

Parameters
fpWhere to print the information to.
[in]programContextProgram information object to use.
[in]settingsSpecifies what to print.
See Also
BinaryInformationSettings
void gmx::printBinaryInformation ( TextWriter *  writer,
const IProgramContext &  programContext,
const BinaryInformationSettings &  settings 
)

Print basic information about the executable with custom settings.

Needed to read the members without otherwise unnecessary accessors.

Parameters
[out]writerWhere to print the information.
[in]programContextProgram information object to use.
[in]settingsSpecifies what to print.
Exceptions
std::bad_allocif out of memory.
See Also
BinaryInformationSettings
int gmx::processExceptionAtExitForCommandLine ( const std::exception &  ex)

Handles an exception and deinitializes after initForCommandLine.

Parameters
[in]exException that is the cause for terminating the program.
Returns
Return code to return from main().

This method should be called as the last thing before terminating the program because of an exception. See processExceptionAtExit() for details. Additionally this method undoes the work done by initForCommandLine.

Does not throw.

static void gmx::read_bias_params ( int *  ninp_p,
t_inpfile **  inp_p,
AwhBiasParams *  awhBiasParams,
const char *  prefix,
const t_inputrec *  ir,
warninp_t  wi,
bool  bComment 
)
static

Read parameters of an AWH bias.

Parameters
[in,out]ninp_pNumber of read input file entries.
[in,out]inp_pInput file entries.
[in,out]awhBiasParamsAWH dimensional parameters.
[in]prefixPrefix for bias parameters.
[in]irInput parameter struct.
[in,out]wiStruct for bookeeping warnings.
[in]bCommentTrue if comments should be printed.
AwhParams * gmx::readAndCheckAwhParams ( int *  ninp_p,
t_inpfile **  inp_p,
const t_inputrec *  inputrec,
warninp_t  wi 
)

Allocate, initialize and check the AWH parameters with values from the input file.

Parameters
[in,out]ninp_pNumber of read input file entries.
[in,out]inp_pInput file entries.
[in]inputrecInput parameter struct.
[in,out]wiStruct for bookeeping warnings.
Returns
AWH parameters.
static void gmx::readDimParams ( int *  ninp_p,
t_inpfile **  inp_p,
const char *  prefix,
AwhDimParams *  dimParams,
const pull_params_t *  pull_params,
warninp_t  wi,
bool  bComment 
)
static

Read parameters of an AWH bias dimension.

Parameters
[in,out]ninp_pNumber of read input file entries.
[in,out]inp_pInput file entries.
[in]prefixPrefix for dimension parameters.
[in,out]dimParamsAWH dimensional parameters.
[in]pull_paramsPull parameters.
[in,out]wiStruct for bookeeping warnings.
[in]bCommentTrue if comments should be printed.
static void gmx::readUserPmfAndTargetDistribution ( const std::vector< DimParams > &  dimParams,
const Grid &  grid,
const std::string &  filename,
int  numBias,
int  biasIndex,
std::vector< PointState > *  pointState 
)
static

Initializes the PMF and target with data read from an input table.

Parameters
[in]dimParamsThe dimension parameters.
[in]gridThe grid.
[in]filenameThe filename to read PMF and target from.
[in]numBiasNumber of biases.
[in]biasIndexThe index of the bias.
[in,out]pointStateThe state of the points in this bias.
static float gmx::reduce ( float  a)
inlinestatic

Return sum of all elements in float variable (i.e., the variable itself).

Parameters
avariable to reduce/sum.
Returns
The argument variable itself.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::reduce ( double  a)
inlinestatic

Return sum of all elements in double variable (i.e., the variable itself).

Parameters
avariable to reduce/sum.
Returns
The argument variable itself.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::reduceIncr4ReturnSum ( float *  m,
float  v0,
float  v1,
float  v2,
float  v3 
)
inlinestatic

Add each float to four consecutive memory locations, return sum.

Parameters
mPointer to memory where four floats should be incremented
v0float to be added to m[0]
v1float to be added to m[1]
v2float to be added to m[2]
v3float to be added to m[3]
Returns
v0+v1+v2+v3.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::reduceIncr4ReturnSum ( double *  m,
double  v0,
double  v1,
double  v2,
double  v3 
)
inlinestatic

Add each double to four consecutive memory locations, return sum.

Parameters
mPointer to memory where four floats should be incremented
v0double to be added to m[0]
v1double to be added to m[1]
v2double to be added to m[2]
v3double to be added to m[3]
Returns
v0+v1+v2+v3.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
void gmx::reportGpuUsage ( const MDLogger &  mdlog,
bool  userSetGpuIds,
const GpuTaskAssignments &  gpuTaskAssignmentOnRanksOfThisNode,
size_t  numGpuTasksOnThisNode,
size_t  numPpRanks,
bool  bPrintHostName 
)

Log a report on how GPUs are being used on the ranks of the physical node of rank 0 of the simulation.

Todo:
It could be useful to report also whether any nodes differed, and in what way.
Parameters
[in]mdlogLogging object.
[in]userSetGpuIdsWhether the user selected the GPU ids
[in]gpuTaskAssignmentOnRanksOfThisNodeThe selected GPU IDs.
[in]numGpuTasksOnThisNodeThe number of GPU tasks on this node.
[in]numPpRanksNumber of PP ranks on this node
[in]bPrintHostNamePrint the hostname in the usage information
Exceptions
std::bad_allocif out of memory
void gmx::restoreCorrelationGridStateFromHistory ( const CorrelationGridHistory &  corrGridHist,
CorrelationGrid *  corrGrid 
)

Restores the correlation grid state from the correlation grid history.

Parameters
[in]corrGridHistCorrelation grid history to read.
[in,out]corrGridCorrelation grid state to set.
static float gmx::round ( float  a)
inlinestatic

Float round to nearest integer value (in floating-point format).

Parameters
aAny floating-point value
Returns
The nearest integer, represented in floating-point format.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::round ( double  a)
inlinestatic

double round to nearest integer value (in doubleing-point format).

Parameters
aAny doubleing-point value
Returns
The nearest integer, represented in doubleing-point format.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
int gmx::runCommandLineModule ( int  argc,
char *  argv[],
ICommandLineModule *  module 
)

Implements a main() method that runs a single module.

Parameters
argcargc passed to main().
argvargv passed to main().
moduleModule to run.

This method allows for uniform behavior for binaries that only contain a single module without duplicating any of the implementation from CommandLineModuleManager (startup headers, common options etc.).

The signature assumes that module construction does not throw (because otherwise the caller would need to duplicate all the exception handling code). It is possible to move the construction inside the try/catch in this method using an indirection similar to TrajectoryAnalysisCommandLineRunner::runAsMain(), but until that is necessary, the current approach leads to simpler code.

Usage:

int main(int argc, char *argv[])
{
CustomCommandLineModule module;
return gmx::runCommandLineModule(argc, argv, &module);
}

Does not throw. All exceptions are caught and handled internally.

int gmx::runCommandLineModule ( int  argc,
char *  argv[],
const char *  name,
const char *  description,
std::function< std::unique_ptr< ICommandLineOptionsModule >()>  factory 
)

Implements a main() method that runs a single module.

Parameters
argcargc passed to main().
argvargv passed to main().
[in]nameName for the module.
[in]descriptionShort description for the module.
factoryFactory method that creates the module to run.

This method allows for uniform behavior for binaries that only contain a single module without duplicating any of the implementation from CommandLineModuleManager (startup headers, common options etc.).

Usage:

class CustomCommandLineOptionsModule : public ICommandLineOptionsModule
{
// <...>
};
static ICommandLineOptionsModule *create()
{
return new CustomCommandLineOptionsModule();
}
int main(int argc, char *argv[])
{
argc, argv, "mymodule", "short description", &create);
}

Does not throw. All exceptions are caught and handled internally.

GpuTaskAssignments::value_type gmx::runTaskAssignment ( const std::vector< int > &  gpuIdsToUse,
const std::vector< int > &  userGpuTaskAssignment,
const gmx_hw_info_t &  hardwareInfo,
const MDLogger &  mdlog,
const t_commrec *  cr,
const std::vector< GpuTask > &  gpuTasksOnThisRank 
)

Coordinate the final stages of task assignment and reporting, and return the assignment for this rank.

Communicates between ranks on a node to coordinate task assignment between them onto available hardware, e.g. accelerators.

Releases the taskAssigner once its work is complete.

Parameters
[in]gpuIdsToUseThe compatible GPUs that the user permitted us to use.
[in]userGpuTaskAssignmentThe user-specified assignment of GPU tasks to device IDs.
[in]hardwareInfoThe detected hardware
[in]mdlogLogging object to write to.
[in]crCommunication object.
[in]gpuTasksOnThisRankInformation about what GPU tasks exist on this rank.
Returns
A GPU task assignment for this rank.
Exceptions
std::bad_allocIf out of memory. InconsistentInputError If user and/or detected inputs are inconsistent.
static float gmx::selectByMask ( float  a,
bool  mask 
)
inlinestatic

Select from single precision variable where boolean is true.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
a is selected for true, 0 for false.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::selectByMask ( double  a,
bool  mask 
)
inlinestatic

Select from double precision variable where boolean is true.

Parameters
adouble variable to select from
maskBoolean selector
Returns
a is selected for true, 0 for false.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::selectByMask ( std::int32_t  a,
bool  mask 
)
inlinestatic

Select from integer variable where boolean is true.

Parameters
aInteger variable to select from
maskBoolean selector
Returns
a is selected for true, 0 for false.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::selectByNotMask ( float  a,
bool  mask 
)
inlinestatic

Select from single precision variable where boolean is false.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
a is selected for false, 0 for true.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::selectByNotMask ( double  a,
bool  mask 
)
inlinestatic

Select from double precision variable where boolean is false.

Parameters
adouble variable to select from
maskBoolean selector
Returns
a is selected for false, 0 for true.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static std::int32_t gmx::selectByNotMask ( std::int32_t  a,
bool  mask 
)
inlinestatic

Select from integer variable where boolean is false.

Parameters
aInteger variable to select from
maskBoolean selector
Returns
a is selected for false, 0 for true.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static real gmx::series_sinhx ( real  x)
inlinestatic

Maclaurin series for sinh(x)/x.

Used for NH chains and MTTK pressure control. Here, we compute it to 10th order, which might be an overkill. 8th is probably enough, but it's not very much more expensive.

void gmx::setLibraryFileFinder ( const DataFileFinder *  finder)

Sets a finder for location data files from share/top/.

Parameters
[in]finderfinder to set (can be NULL to restore the default finder).

The library does not take ownership of finder. The provided object must remain valid until the global instance is changed by another call to setLibraryFileFinder().

The global instance is used by gmxlibfn() and libopen().

This method is not thread-safe. See setProgramContext(); the same constraints apply here as well.

Does not throw.

void gmx::setStateDependentAwhParams ( AwhParams *  awhParams,
const pull_params_t *  pull_params,
pull_t *  pull_work,
const matrix  box,
int  ePBC,
const t_grpopts *  inputrecGroupOptions,
warninp_t  wi 
)

Sets AWH parameters that need state parameters such as the box vectors.

Parameters
[in,out]awhParamsAWH parameters.
[in]pull_paramsPull parameters.
[in,out]pull_workPull working struct to register AWH bias in.
[in]boxBox vectors.
[in]ePBCPeriodic boundary conditions enum.
[in]inputrecGroupOptionsParameters for atom groups.
[in,out]wiStruct for bookeeping warnings.
Note
This function currently relies on the function set_pull_init to have been called.
static void gmx::simdPrefetch ( void *  m)
inlinestatic

Prefetch memory at address m.

This typically prefetches one cache line of memory from address m, usually 64bytes or more, but the exact amount will depend on the implementation. On many platforms this is simply a no-op. Technically it might not be part of the SIMD instruction set, but since it is a hardware-specific function that is normally only used in tight loops where we also apply SIMD, it fits well here.

There are no guarantees about the level of cache or temporality, but usually we expect stuff to end up in level 2, and be used in a few hundred clock cycles, after which it stays in cache until evicted (normal caching).

Parameters
mPointer to location prefetch. There are no alignment requirements, but if the pointer is not aligned the prefetch might start at the lower cache line boundary (meaning fewer bytes are prefetched).
static float gmx::sin ( float  x)
inlinestatic

Float sin.

Parameters
xThe argument to evaluate sin for
Returns
Sin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::sin ( double  x)
inlinestatic

Double sin.

Parameters
xThe argument to evaluate sin for
Returns
Sin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::sincos ( float  x,
float *  sinval,
float *  cosval 
)
inlinestatic

Float sin & cos.

Parameters
xThe argument to evaluate sin/cos for
[out]sinvalSin(x)
[out]cosvalCos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::sincos ( double  x,
double *  sinval,
double *  cosval 
)
inlinestatic

Double sin & cos.

Parameters
xThe argument to evaluate sin/cos for
[out]sinvalSin(x)
[out]cosvalCos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::sincosSingleAccuracy ( double  x,
double *  sinval,
double *  cosval 
)
inlinestatic

Double sin & cos, but with single accuracy.

Parameters
xThe argument to evaluate sin/cos for
[out]sinvalSin(x)
[out]cosvalCos(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::sinSingleAccuracy ( double  x)
inlinestatic

Double sin, but with single accuracy.

Parameters
xThe argument to evaluate sin for
Returns
Sin(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::sixthroot ( float  x)
inlinestatic

Calculate sixth root of x in single precision.

Parameters
xArgument, must be greater than or equal to zero.
Returns
x^(1/6)

This routine is typically faster than using std::pow().

static double gmx::sixthroot ( double  x)
inlinestatic

Calculate sixth root of x in double precision.

Parameters
xArgument, must be greater than or equal to zero.
Returns
x^(1/6)

This routine is typically faster than using std::pow().

static double gmx::sixthroot ( int  x)
inlinestatic

Calculate sixth root of integer x, return double.

Parameters
xArgument, must be greater than or equal to zero.
Returns
x^(1/6)

This routine is typically faster than using std::pow().

static void gmx::spinUpCore ( )
staticnoexcept

Utility that does dummy computing for max 2 seconds to spin up cores.

This routine will check the number of cores configured and online (using sysconf), and the spins doing dummy compute operations for up to 2 seconds, or until all cores have come online. This can be used prior to hardware detection for platforms that take unused processors offline.

This routine will not throw exceptions.

template<MathOptimization opt = MathOptimization::Safe>
static float gmx::sqrt ( float  x)
inlinestatic

Float sqrt(x). This is the square root.

Parameters
xArgument, should be >= 0.
Returns
The square root of x. Undefined if argument is invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<MathOptimization opt = MathOptimization::Safe>
static double gmx::sqrt ( double  x)
inlinestatic

Double sqrt(x). This is the square root.

Parameters
xArgument, should be >= 0.
Returns
The square root of x. Undefined if argument is invalid.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::sqrtSingleAccuracy ( double  x)
inlinestatic

Calculate sqrt(x) for double, but with single accuracy.

Parameters
xArgument that must be >=0.
Returns
sqrt(x).
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<typename T >
T gmx::square ( x)

calculate x^2

Template Parameters
TType of argument and return value
Parameters
xargument
Returns
x^2
static void gmx::store ( float *  m,
float  a 
)
inlinestatic

Store contents of float variable to aligned memory m.

Parameters
[out]mPointer to memory.
afloat variable to store
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::store ( double *  m,
double  a 
)
inlinestatic

Store contents of double variable to aligned memory m.

Parameters
[out]mPointer to memory.
adouble variable to store
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::store ( std::int32_t *  m,
std::int32_t  a 
)
inlinestatic

Store contents of integer variable to aligned memory m.

Parameters
[out]mPointer to memory.
ainteger variable to store
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::storeU ( float *  m,
float  a 
)
inlinestatic

Store contents of float variable to unaligned memory m.

Parameters
[out]mPointer to memory, no alignment requirement.
afloat variable to store.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::storeU ( double *  m,
double  a 
)
inlinestatic

Store contents of double variable to unaligned memory m.

Parameters
[out]mPointer to memory, no alignment requirement.
adouble variable to store.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static void gmx::storeU ( std::int32_t *  m,
std::int32_t  a 
)
inlinestatic

Store contents of integer variable to unaligned memory m.

Parameters
[out]mPointer to memory, no alignment requirement.
ainteger variable to store.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::tan ( float  x)
inlinestatic

Float tan.

Parameters
xThe argument to evaluate tan for
Returns
Tan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::tan ( double  x)
inlinestatic

Double tan.

Parameters
xThe argument to evaluate tan for
Returns
Tan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::tanSingleAccuracy ( double  x)
inlinestatic

Double tan, but with single accuracy.

Parameters
xThe argument to evaluate tan for
Returns
Tan(x)
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static bool gmx::testBits ( float  a)
inlinestatic

Return true if any bits are set in the float variable.

This function is used to handle bitmasks, mainly for exclusions in the inner kernels. Note that it will return true even for -0.0f (sign bit set), so it is not identical to not-equal.

Parameters
avalue
Returns
True if any bit in a is nonzero.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static bool gmx::testBits ( double  a)
inlinestatic

Return true if any bits are set in the double variable.

This function is used to handle bitmasks, mainly for exclusions in the inner kernels. Note that it will return true even for -0.0 (sign bit set), so it is not identical to not-equal.

Parameters
avalue
Returns
True if any bit in a is nonzero.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static bool gmx::testBits ( std::int32_t  a)
inlinestatic

Return true if any bits are set in the integer variable.

This function is used to handle bitmasks, mainly for exclusions in the inner kernels.

Parameters
avalue
Returns
True if any bit in a is nonzero.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterDecrU ( float *  base,
const std::int32_t  offset[],
float  v0,
float  v1,
float  v2 
)
inlinestatic

Subtract 3 floats from base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, subtracted from base[align*offset[0]].
v12nd value, subtracted from base[align*offset[0] + 1].
v23rd value, subtracted from base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterDecrU ( double *  base,
const std::int32_t  offset[],
double  v0,
double  v1,
double  v2 
)
inlinestatic

Subtract 3 doubles from base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, subtracted from base[align*offset[0]].
v12nd value, subtracted from base[align*offset[0] + 1].
v23rd value, subtracted from base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterIncrU ( float *  base,
const std::int32_t  offset[],
float  v0,
float  v1,
float  v2 
)
inlinestatic

Add 3 floats to base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, added to base[align*offset[0]].
v12nd value, added to base[align*offset[0] + 1].
v23rd value, added to base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterIncrU ( double *  base,
const std::int32_t  offset[],
double  v0,
double  v1,
double  v2 
)
inlinestatic

Add 3 doubles to base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, added to base[align*offset[0]].
v12nd value, added to base[align*offset[0] + 1].
v23rd value, added to base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterStoreU ( float *  base,
const std::int32_t  offset[],
float  v0,
float  v1,
float  v2 
)
inlinestatic

Store 3 floats to 3 to base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, written to base[align*offset[0]].
v12nd value, written to base[align*offset[0] + 1].
v23rd value, written to base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
template<int align>
static void gmx::transposeScatterStoreU ( double *  base,
const std::int32_t  offset[],
double  v0,
double  v1,
double  v2 
)
inlinestatic

Store 3 doubles to 3 to base/offset.

Template Parameters
alignAlignment of the memory to which we write, i.e. distance (measured in elements, not bytes) between index points.
Parameters
[out]basePointer to the start of the memory area
offsetOffset to the start of triplet.
v01st value, written to base[align*offset[0]].
v12nd value, written to base[align*offset[0] + 1].
v23rd value, written to base[align*offset[0] + 2].
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static float gmx::trunc ( float  a)
inlinestatic

Truncate float, i.e. round towards zero - common hardware instruction.

Parameters
aAny floating-point value
Returns
Integer rounded towards zero, represented in floating-point format.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
static double gmx::trunc ( double  a)
inlinestatic

Truncate double, i.e. round towards zero - common hardware instruction.

Parameters
aAny doubleing-point value
Returns
Integer rounded towards zero, represented in doubleing-point format.
Note
This function might be superficially meaningless, but it helps us to write templated SIMD/non-SIMD code. For clarity it should not be used outside such code.
void gmx::unpinBuffer ( void *  pointer)
noexcept

Unpin the allocation.

Requries that pointer is not nullptr and was previously pinned with pinBuffer().

Does not throw.

void gmx::updateCorrelationGridHistory ( CorrelationGridHistory *  corrGridHist,
const CorrelationGrid &  corrGrid 
)

Update the correlation grid history for checkpointing.

Parameters
[in,out]corrGridHistCorrelation grid history to set.
[in]corrGridCorrelation grid state to read.
static bool gmx::valueIsInGrid ( const awh_dvec  value,
const std::vector< GridAxis > &  axis 
)
static

Query if a value is in range of the grid.

Parameters
[in]valueValue to check.
[in]axisThe grid axes.
Returns
true if the value is in the grid.
static bool gmx::valueIsInInterval ( double  origin,
double  end,
double  period,
double  value 
)
static

Checks if a value is within an interval.

Parameters
[in]originStart value of interval.
[in]endEnd value of interval.
[in]periodPeriod (or 0 if not periodic).
[in]valueValue to check.
Returns
true if the value is within the interval.
void gmx::writeKeyValueTreeAsMdp ( TextWriter *  writer,
const KeyValueTreeObject &  tree 
)

Write a flat key-value tree to writer in mdp style.

Sub-objects will output nothing, so they can be used to contain a special key-value pair to create a comment, as well as the normal key and value. The comment pair will have a key of "comment", and the value will be used as a comment (if non-empty).

Variable Documentation

const bool gmx::bGPUBinary = GMX_GPU != GMX_GPU_NONE
static

Convenience macro to help us avoid ifdefs each time we use sysconf.

Convenience macro to help us avoid ifdefs each time we use sysconf Constant used to help minimize preprocessed code

constexpr Architecture gmx::c_architecture
static
Initial value:
=
Architecture::Unknown

Constant that tells what the architecture is.

const char * gmx::eawhcoordprovider_names
Initial value:
= {
"pull", nullptr
}

String for AWH bias reaction coordinate provider.

const char * gmx::eawhgrowth_names
Initial value:
= {
"exp-linear", "linear", nullptr
}

String for weight histogram growth.

const char * gmx::eawhpotential_names
Initial value:
= {
"convolved", "umbrella", nullptr
}

String for AWH potential type.

const char * gmx::eawhtarget_names
Initial value:
= {
"constant", "cutoff", "boltzmann", "local-boltzmann", nullptr
}

String for target distribution.

std::unique_ptr<gmx_hw_info_t> gmx::hwinfo_g
static

The hwinfo structure (common to all threads in this process).

Todo:
This should become a shared_ptr owned by e.g. Mdrunner::runner() that is shared across any threads as needed (e.g. for thread-MPI). That offers about the same run time performance as we get here, and avoids a lot of custom code.