Gromacs  2019
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables

Description

Generic GROMACS namespace.

Functionality for testing whether calls to mdrun produce the same energy and force quantities when they should do so.

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

Namespaces

 compat
 Compatibility aliases for standard library features.
 
 test
 Testing utilities namespace.
 

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  AnalysisDataModuleManager
 Encapsulates handling of data modules attached to AbstractAnalysisData. More...
 
class  AnalysisDataStorageFrame
 Allows assigning values for a data frame in AnalysisDataStorage. More...
 
class  AnalysisDataStorage
 Helper class that implements storage of data. 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  AnalysisDataParallelOptions
 Parallelization options for analysis data objects. More...
 
class  Awh
 Coupling of the accelerated weight histogram method (AWH) with the system. More...
 
class  CommandLineHelpContext
 Context information for writing out command-line help. More...
 
class  GlobalCommandLineHelpContext
 Helper for passing CommandLineHelpContext into parse_common_args(). More...
 
class  ArrayRef
 STL-like interface to a C array of T (or part of a std container of 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  CommandLineModuleManager
 Implements a wrapper command-line interface for multiple modules. More...
 
class  CommandLineModuleGroup
 Handle to add content to a group added with CommandLineModuleManager::addModuleGroup(). 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...
 
class  IExecutableEnvironment
 Allows customization of the way various directories are found by CommandLineProgramContext. More...
 
class  CommandLineProgramContext
 Program context implementation for command line programs. More...
 
class  HashedMap
 Unordered key to value mapping. More...
 
class  LocalAtomSet
 A local atom set collects local, global and collective indices of the home atoms on a rank. The indices of the home atoms are automatically updated during domain decomposition, thus gmx::LocalAtomSet::localIndex enables iteration over local atoms properties like coordinates or forces. TODO: add a LocalAtomSet iterator. More...
 
class  LocalAtomSetManager
 Hands out handles to local atom set indices and triggers index recalculation for all sets upon domain decomposition if run in parallel. More...
 
class  ClfftInitializer
 Handle clFFT library init and tear down in RAII style. More...
 
class  HostAllocationPolicy
 Policy class for configuring gmx::Allocator, to manage allocations of memory that may be needed for e.g. GPU transfers. More...
 
struct  OpenClTraits
 Stub for OpenCL type traits. More...
 
struct  OpenClTraitsBase
 Implements common trait infrastructure for OpenCL types. More...
 
struct  OpenClTraits< cl_context >
 Implements traits for cl_context. More...
 
struct  OpenClTraits< cl_command_queue >
 Implements traits for cl_command_queue. More...
 
struct  OpenClTraits< cl_program >
 Implements traits for cl_program. More...
 
struct  OpenClTraits< cl_kernel >
 Implements traits for cl_kernel. More...
 
class  ClHandle
 Wrapper of OpenCL type cl_type to implement RAII. More...
 
class  CpuInfo
 Detect CPU capabilities and basic logical processor info. More...
 
class  HardwareTopology
 Information about sockets, cores, threads, numa, caches. More...
 
class  ArrayRefWithPadding
 Interface to a C array of T (or part of a std container of T), that includes padding that is suitable for the kinds of SIMD operations GROMACS uses. 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  PaddedVector
 PaddedVector is a container of elements in contiguous storage that allocates extra memory for safe SIMD-style loads for operations used in GROMACS. More...
 
class  BasicVector
 C++ class for 3D vectors. More...
 
class  CheckpointHandler
 Class handling the checkpoint signal. More...
 
class  Constraints
 Handles constraints. More...
 
class  MDAtoms
 Contains a C-style t_mdatoms while managing some of its memory with C++ vectors with allocators. More...
 
class  PpForceWorkload
 Manage what force calculation work is required each step. More...
 
class  ResetHandler
 Class handling the reset of counters. More...
 
class  SimulationSignal
 POD-style object used by mdrun ranks to set and receive signals within and between simulations. More...
 
class  SimulationSignaller
 Object used by mdrun ranks to signal to each other at this step. More...
 
class  StopHandler
 Class handling the stop signal. More...
 
class  StopConditionSignal
 Class setting the stop signal based on gmx_get_stop_condition() More...
 
class  StopConditionTime
 Class setting the stop signal based on maximal run time. More...
 
class  StopHandlerBuilder
 Class preparing the creation of a StopHandler. More...
 
class  UpdateGroupsCog
 Class for managing and computing centers of geometry of update groups. More...
 
class  LegacyMdrunOptions
 This class provides the same command-line option functionality to both CLI and API sessions. More...
 
class  Mdrunner
 Runner object for supporting setup and execution of mdrun. More...
 
class  MdrunnerBuilder
 Build a gmx::Mdrunner. More...
 
class  SimulationContext
 Simulation environment and configuration. More...
 
class  MDModules
 Manages the collection of all modules used for mdrun. More...
 
class  ForceWithVirial
 Container for force and virial for algorithms that provide their own virial tensor contribution. More...
 
class  ForceProviderInput
 Helper struct that bundles data for passing it over to the force providers. More...
 
class  ForceProviderOutput
 Helper struct bundling the output data of a force provider. More...
 
class  IForceProvider
 Interface for a component that provides forces during MD. More...
 
class  IMDModule
 Extension module for GROMACS simulations. More...
 
class  IMDOutputProvider
 Interface for handling additional output files during a simulation. More...
 
class  IMdpOptionProvider
 Interface for handling mdp/tpr input to a mdrun module. More...
 
class  TextTableFormatter
 Formats rows of a table for text output. More...
 
class  HelpManager
 Helper for providing interactive online help. More...
 
class  AbstractSimpleHelpTopic
 Abstract base class for help topics that have simple text and no subtopics. More...
 
class  AbstractCompositeHelpTopic
 Abstract base class for help topics that have simple text and subtopics. More...
 
class  SimpleHelpTopic
 Template for simple implementation of AbstractSimpleHelpTopic. More...
 
class  CompositeHelpTopic
 Template for simple implementation of AbstractCompositeHelpTopic. More...
 
class  HelpLinks
 Hyperlink data for writing out help. More...
 
class  HelpWriterContext
 Context information for writing out help. More...
 
class  IHelpTopic
 Provides a single online help topic. More...
 
class  OptionStorageTemplate
 Templated base class for constructing option value storage classes. 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  AbstractOptionStorage
 Abstract base class for converting, validating, and storing option values. 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  OptionsBehaviorCollection
 Container for IOptionsBehavior objects. 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  OptionManagerContainer
 Container to keep managers added with Options::addManager() and pass them to options. More...
 
class  IOptionManager
 Base class for option managers. More...
 
class  Options
 Collection of options. More...
 
class  OptionsAssigner
 Decorator class for assigning values to Options. More...
 
class  OptionSection
 Declares a simple option section. More...
 
class  OptionSectionHandle
 Allows adding options to an OptionSection. More...
 
class  OptionStorageTemplateSimple
 Simplified option storage template for options that have one-to-one value conversion. More...
 
class  OptionsVisitor
 Pure interface for visiting options in a Options object. More...
 
class  OptionsTypeVisitor
 Abstract base class for visiting options of a particular type. More...
 
class  OptionsIterator
 Decorator class for visiting options in a Options object. More...
 
class  OptionsModifyingVisitor
 Pure interface for visiting options in a Options object, allowing modifications. More...
 
class  OptionsModifyingTypeVisitor
 Abstract base class for visiting options of a particular type, allowing modifications. More...
 
class  OptionsModifyingIterator
 Decorator class for visiting options in a Options object, allowing changes. 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  OptionValueConverterSimple
 Helper for converting from Variant to a given type. 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  RestraintManager
 Manage the Restraint potentials available for Molecular Dynamics. More...
 
class  Site
 Abstraction for a restraint interaction site. More...
 
class  RestraintMDModule
 MDModule wrapper for Restraint implementations. More...
 
class  PotentialPointData
 Structure to hold the results of IRestraintPotential::evaluate(). More...
 
class  IRestraintPotential
 Interface for Restraint potentials. 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  SelectionFileOption
 Specifies a special option that provides selections from a file. More...
 
class  SelectionFileOptionInfo
 Wrapper class for accessing and modifying selection file option information. 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  Simd4Double
 SIMD4 double type. More...
 
class  Simd4DBool
 SIMD4 variable type to use for logical comparisons on doubles. More...
 
class  Simd4Float
 SIMD4 float type. More...
 
class  Simd4FBool
 SIMD4 variable type to use for logical comparisons on floats. More...
 
class  SimdDouble
 Double SIMD variable. Available if GMX_SIMD_HAVE_DOUBLE is 1. More...
 
class  SimdDInt32
 Integer SIMD variable type to use for conversions to/from double. More...
 
class  SimdDBool
 Boolean type for double SIMD data. More...
 
class  SimdDIBool
 Boolean type for integer datatypes corresponding to double SIMD. More...
 
class  SimdFloat
 Float SIMD variable. Available if GMX_SIMD_HAVE_FLOAT is 1. More...
 
class  SimdFInt32
 Integer SIMD variable type to use for conversions to/from float. More...
 
class  SimdFBool
 Boolean type for float SIMD data. More...
 
class  SimdFIBool
 Boolean type for integer datatypes corresponding to float SIMD. More...
 
struct  SimdFloatTag
 Tag type to select to load SimdFloat with simdLoad(U) More...
 
struct  SimdDoubleTag
 Tag type to select to load SimdDouble with simdLoad(U) More...
 
struct  SimdFInt32Tag
 Tag type to select to load SimdFInt32 with simdLoad(U) More...
 
struct  SimdDInt32Tag
 Tag type to select to load SimdDInt32 with simdLoad(U) More...
 
struct  AlignedArray< float, N >
 Identical to std::array with GMX_SIMD_FLOAT_WIDTH alignment. Should not be deleted through base pointer (destructor is non-virtual). More...
 
struct  AlignedArray< double, N >
 Identical to std::array with GMX_SIMD_DOUBLE_WIDTH alignment. Should not be deleted through base pointer (destructor is non-virtual). More...
 
class  SimdSetZeroProxy
 Proxy object to enable setZero() for SIMD and real types. More...
 
class  CubicSplineTable
 Cubic spline interpolation table. More...
 
class  QuadraticSplineTable
 Quadratic spline interpolation table. More...
 
struct  AnalyticalSplineTableInput
 Specification for analytical table function (name, function, derivative) More...
 
struct  NumericalSplineTableInput
 Specification for vector table function (name, function, derivative, spacing) More...
 
struct  GpuTaskMapping
 Specifies the GPU deviceID_ available for task_ to use. More...
 
class  RangePartitioning
 Division of a range of indices into consecutive blocks. 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  TrajectoryAnalysisCommandLineRunner
 Runner for command-line trajectory analysis tools. More...
 
class  UnionFinder
 Union-find data structure for keeping track of disjoint sets. More...
 
class  MappedUnionFinder
 Extension of UnionFind that supports non-consecutive integer indices as items. More...
 
class  TopologyInformation
 Topology information available to a trajectory analysis module. More...
 
class  AlignedAllocationPolicy
 Policy class for configuring gmx::Allocator, to manage allocations of aligned memory for SIMD code. More...
 
class  PageAlignedAllocationPolicy
 Policy class for configuring gmx::Allocator, to manage allocations of page-aligned memory that can be locked for asynchronous transfer to GPU devices. More...
 
class  Allocator
 Policy-based memory allocator. More...
 
struct  EmptyArrayRef
 Tag type to initialize empty array references. More...
 
class  BinaryInformationSettings
 Settings for printBinaryInformation(). 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  DirectoryEnumerator
 Lists files in a directory. 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  IFileInputRedirector
 Allows overriding file existence checks from code that supports it. More...
 
class  IFileOutputRedirector
 Allows capturing stdout and file output from code that supports it. More...
 
class  StandardInputStream
 Text input stream implementation for reading from stdin. More...
 
class  TextInputFile
 Text input stream implementation for reading from a file. More...
 
class  TextOutputFile
 Text output stream implementation for writing to a file. More...
 
class  FlagsTemplate
 Template class for typesafe handling of combination of flags. More...
 
class  Regex
 Represents a regular expression. More...
 
class  ISerializer
 Interface for types that convert standard data types into a form suitable for storage or transfer. More...
 
class  KeyValueTreePath
 Identifies an entry in a key-value tree. More...
 
class  KeyValueTreeBuilder
 Root builder for creating trees that have an object at the root. More...
 
class  KeyValueTreeValueBuilder
 Builder for KeyValueTreeValue objects. More...
 
class  KeyValueTreeUniformArrayBuilder
 Builder for KeyValueTreeArray objects where all elements are of type T. More...
 
class  KeyValueTreeObjectArrayBuilder
 Builder for KeyValueTreeArray objects where all elements are KeyValueTreeObject objects. More...
 
class  KeyValueTreeObjectBuilder
 Builder for KeyValueTreeObject objects. More...
 
class  IKeyValueTreeTransformRules
 Interface to declare rules for transforming key-value trees. More...
 
class  KeyValueTreeTransformRulesScoped
 Helper object returned from IKeyValueTreeTransformRules::scopedTransform(). More...
 
class  KeyValueTreeTransformRuleBuilder
 Provides methods to specify one transformation rule. More...
 
class  ILogTarget
 Target where log output can be written. More...
 
class  LogEntryWriter
 Helper class for creating log entries with GMX_LOG. More...
 
class  LogLevelHelper
 Represents a single logging level. More...
 
class  MDLogger
 Declares a logging interface. More...
 
class  LoggerBuilder
 Initializes loggers. More...
 
class  LoggerOwner
 Manages memory for a logger built with LoggerBuilder. More...
 
class  MessageStringCollector
 Helper class for collecting message strings, optionally with context. More...
 
class  MessageStringContext
 Convenience class for creating a message context. More...
 
struct  no_delete
 Deleter for std::shared_ptr that does nothing. More...
 
class  PhysicalNodeCommunicator
 Holds a communicator for the physical node of this rank. 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  StringCompare
 Compare object for std::string STL containers and algorithms that supports run-time decision on how to compare. More...
 
class  StringOutputStream
 Text output stream implementation for writing to an in-memory string. More...
 
class  StringInputStream
 Helper class to convert static string data to a stream. 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...
 
class  TextReader
 Reads text from a TextInputStream. More...
 
class  TextInputStream
 Interface for reading text. More...
 
class  TextOutputStream
 Interface for writing text. More...
 
class  TextWriter
 Writes text into a TextOutputStream. More...
 
struct  isIntegralConstant
 Is true if type is a std::integral_constant. More...
 
class  Variant
 Represents a dynamically typed value of an arbitrary type. 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 = PaddedVector< T, HostAllocator< T > >
 Convenience alias for PaddedVector that uses HostAllocator.
 
template<class T >
using HostStdVector = std::vector< T, HostAllocator< T > >
 Convenience alias for std::vector that uses HostAllocator.
 
typedef BasicVector< realRVec
 Shorthand for C++ rvec-equivalent type.
 
typedef BasicVector< double > DVec
 Shorthand for C++ dvec-equivalent type.
 
typedef BasicVector< int > IVec
 Shorthand for C++ ivec-equivalent type.
 
typedef std::array
< SimulationSignal, eglsNR > 
SimulationSignals
 Convenience typedef for the group of signals used.
 
using IntegratorFunctionType ) = void(
 Function type for integrator code.
 
using LogFilePtr = std::unique_ptr< t_fileio, functor_wrapper< t_fileio, closeLogFile >>
 Simple guard pointer See unique_cptr for details.
 
typedef std::unique_ptr
< AbstractCompositeHelpTopic
CompositeHelpTopicPointer
 Smart pointer type to manage a AbstractCompositeHelpTopic object.
 
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 FlagsTemplate< OptionFlagOptionFlags
 Holds a combination of OptionFlag values.
 
typedef std::random_device RandomDevice
 Random device. More...
 
typedef ThreeFry2x64Fast DefaultRandomEngine
 Default fast and accurate random engine in Gromacs. More...
 
using Vector = ::gmx::RVec
 Provide a vector type name with a more stable interface than RVec and a more stable implementation than vec3<>.
 
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.
 
using BoxMatrix = std::array< std::array< real, 3 >, 3 >
 A 3x3 matrix data type useful for simulation boxes. More...
 
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...
 
using index = std::ptrdiff_t
 Integer type for indexing into arrays or vectors. 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.
 
using FilePtr = std::unique_ptr< FILE, functor_wrapper< FILE, fclose_wrapper >>
 Simple guard pointer which calls fclose. See unique_cptr for details.
 
typedef tMPI::mutex Mutex
 C++11-compatible basic mutex.
 
using MPI_Comm_ptr = gmx::unique_cptr< MPI_Comm, MPI_Comm_free_wrapper >
 Make a smart pointer for MPI communicators.
 
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.
 
using ClContext = ClHandle< cl_context >
 Convenience declarations.
 
using ClCommandQueue = ClHandle< cl_command_queue >
 
using ClProgram = ClHandle< cl_program >
 
using ClKernel = ClHandle< cl_kernel >
 

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, PinnedIfSupported }
 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  CheckpointSignal { noSignal = 0, doCheckpoint = 1 }
 Checkpoint signals. More...
 
enum  ConstraintVariable : int {
  Positions, Velocities, Derivative, Deriv_FlexCon,
  Force, ForceDispl
}
 Describes supported flavours of constrained updates.
 
enum  FlexibleConstraintTreatment { FlexibleConstraintTreatment::Include, FlexibleConstraintTreatment::Exclude }
 Tells make_at2con how to treat flexible constraints. More...
 
enum  ResetSignal { noSignal = 0, doResetCounters = 1 }
 Reset signals. More...
 
enum  StopSignal { noSignal = 0, stopAtNextNSStep = 1, stopImmediately = -1 }
 Stop signals. 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  HelpOutputFormat { eHelpOutputFormat_Console, eHelpOutputFormat_Rst, eHelpOutputFormat_Other, eHelpOutputFormat_NR }
 Output format for help writing. More...
 
enum  OptionFileType {
  eftUnknown, eftTopology, eftTrajectory, eftEnergy,
  eftPDB, eftIndex, eftPlot, eftGenericData,
  eftOptionFileType_NR
}
 Purpose of file(s) provided through an option.
 
enum  OptionFlag {
  efOption_Set = 1<<0, efOption_HasDefaultValue = 1<<1, efOption_ExplicitDefaultValue = 1<<2, efOption_ClearOnNextSet = 1<<3,
  efOption_Required = 1<<4, efOption_MultipleTimes = 1<<5, efOption_Hidden = 1<<6, efOption_Vector = 1<<8,
  efOption_DefaultValueIfSetExists = 1<<11, efOption_NoDefaultValue = 1<<9, efOption_DontCheckMinimumCount = 1<<10
}
 Flags for options. More...
 
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  SimdType {
  SimdType::None, SimdType::Reference, SimdType::Generic, SimdType::X86_Sse2,
  SimdType::X86_Sse4_1, SimdType::X86_Avx128Fma, SimdType::X86_Avx, SimdType::X86_Avx2,
  SimdType::X86_Avx2_128, SimdType::X86_Avx512, SimdType::X86_Avx512Knl, SimdType::X86_Mic,
  SimdType::Arm_Neon, SimdType::Arm_NeonAsimd, SimdType::Ibm_Vmx, SimdType::Ibm_Vsx,
  SimdType::Fujitsu_HpcAce
}
 Enumerated options for SIMD architectures. 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...
 
enum  StringCompareType { StringCompareType::Exact, StringCompareType::CaseInsensitive, StringCompareType::CaseAndDashInsensitive }
 Specifies how strings should be compared in various contexts. 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< IMDModulecreateElectricFieldModule ()
 Creates a module for an external electric field. More...
 
std::unique_ptr< AwhprepareAwhModule (FILE *fplog, const t_inputrec &inputRecord, t_state *stateGlobal, const t_commrec *commRecord, const gmx_multisim_t *multiSimRecord, bool startingFromCheckpoint, bool usingShellParticles, const std::string &biasInitFilename, pull_t *pull_work)
 Makes an Awh and prepares to use it if the user input requests that. More...
 
static 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 (std::vector< t_inpfile > *inp, const std::string &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 (std::vector< t_inpfile > *inp, AwhBiasParams *awhBiasParams, const std::string &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 (std::vector< t_inpfile > *inp, 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...
 
CommandLineProgramContextinitForCommandLine (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 writeCommandLineHelpCMain (const CommandLineHelpContext &context, const char *name, int(*mainFunction)(int argc, char *argv[]))
 Helper to implement ICommandLineModule::writeHelp() with a C-like main() function that calls parse_common_args(). More...
 
void writeKeyValueTreeAsMdp (TextWriter *writer, const KeyValueTreeObject &tree)
 Write a flat key-value tree to writer in mdp style. More...
 
std::unique_ptr< ClfftInitializerinitializeClfftLibrary ()
 This routine should be called during setup for running an FFT task on an OpenCL device. More...
 
static std::string makeOpenClInternalErrorString (const char *message, cl_int status)
 Make an error string following an OpenCL API call. More...
 
static bool isDeviceSane (const gmx_device_info_t *devInfo, std::string *errorMessage)
 Checks that device devInfo is sane (ie can run a kernel). More...
 
static int isDeviceSupported (const gmx_device_info_t *devInfo)
 Checks that device devInfo is compatible with GROMACS. More...
 
static int checkGpu (size_t deviceId, const gmx_device_info_t *deviceInfo)
 Check whether the ocl_gpu_device is suitable for use by mdrun. More...
 
template<class T1 , class T2 >
bool operator== (const Allocator< T1, HostAllocationPolicy > &a, const Allocator< T2, HostAllocationPolicy > &b)
 Return true if two allocators are identical. 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 PhysicalNodeCommunicator &physicalNodeComm)
 Detect GPUs, if that makes sense to attempt.
 
static void gmx_collect_hardware_mpi (const gmx::CpuInfo &cpuInfo, const PhysicalNodeCommunicator &physicalNodeComm)
 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 PhysicalNodeCommunicator &physicalNodeComm)
 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...
 
static bool someInteractionsCanRunOnGpu (const InteractionLists &ilists)
 Returns whether there are any interactions in ilists suitable for a GPU.
 
static bool bondedInteractionsCanRunOnGpu (const gmx_mtop_t &mtop)
 Returns whether there are any bonded interactions in the global topology suitable for a GPU.
 
static bool addMessageIfNotSupported (ArrayRef< const std::string > errorReasons, std::string *error)
 Help build a descriptive message in error if there are errorReasons why bondeds on a GPU are not supported. More...
 
bool buildSupportsGpuBondeds (std::string *error)
 Checks whether the GROMACS build allows to compute bonded interactions on a GPU. More...
 
bool inputSupportsGpuBondeds (const t_inputrec &ir, const gmx_mtop_t &mtop, std::string *error)
 Checks whether the input system allows to compute bonded interactions on a GPU. 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...
 
constexpr int32_t exactDiv (int32_t a, int32_t b)
 Exact integer division, 32bit. More...
 
constexpr int64_t exactDiv (int64_t a, int64_t b)
 Exact integer division, 64bit.
 
static int roundToInt (float x)
 Round float to int. More...
 
static int roundToInt (double x)
 Round double to int.
 
static int64_t roundToInt64 (float x)
 Round float to int64_t.
 
static int64_t roundToInt64 (double x)
 Round double to int64_t.
 
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...
 
template<typename ValueType >
BasicVector< ValueType > operator* (const BasicVector< ValueType > &basicVector, const ValueType &scalar)
 Allow vector scalar multiplication.
 
template<typename ValueType >
BasicVector< ValueType > operator* (const ValueType &scalar, const BasicVector< ValueType > &basicVector)
 Allow scalar vector multiplication.
 
template<typename VectorType >
static VectorType unitVector (const VectorType &v)
 unitv for gmx::BasicVector
 
template<typename ValueType >
static ValueType norm (BasicVector< ValueType > v)
 norm for gmx::BasicVector
 
template<typename ValueType >
static ValueType norm2 (BasicVector< ValueType > v)
 Square of the vector norm for gmx::BasicVector.
 
template<typename VectorType >
static VectorType cross (const VectorType &a, const VectorType &b)
 cross product for gmx::BasicVector
 
template<typename ValueType >
static ValueType dot (BasicVector< ValueType > a, BasicVector< ValueType > b)
 dot product for gmx::BasicVector
 
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.
 
static dvec * as_dvec_array (DVec *x)
 Casts a gmx::DVec array into an Dvec array.
 
static ivec * as_ivec_array (IVec *x)
 Casts a gmx::IVec array into an ivec array.
 
static const dvec * as_dvec_array (const DVec *x)
 Casts a gmx::DVec array into an dvec array.
 
static const ivec * as_ivec_array (const IVec *x)
 Casts a gmx::IVec array into an ivec array.
 
std::unique_ptr< BoxDeformation > prepareBoxDeformation (const matrix &initialBox, t_commrec *cr, const t_inputrec &inputrec)
 Factory function for box deformation module. More...
 
static CheckpointSignal convertToCheckpointSignal (signed char sig)
 Convert signed char (as used by SimulationSignal) to CheckpointSignal enum. More...
 
static void clear_constraint_quantity_nonlocal (gmx_domdec_t *dd, rvec *q)
 Clears constraint quantities for atoms in nonlocal region.
 
void too_many_constraint_warnings (int eConstrAlg, int warncount)
 Generate a fatal error because of too many LINCS/SETTLE warnings.
 
static void write_constr_pdb (const char *fn, const char *title, const gmx_mtop_t &mtop, int start, int homenr, const t_commrec *cr, const rvec x[], matrix box)
 Writes out coordinates.
 
static void dump_confs (FILE *log, int64_t step, const gmx_mtop_t &mtop, int start, int homenr, const t_commrec *cr, const rvec x[], rvec xprime[], matrix box)
 Writes out domain contents to help diagnose crashes.
 
FlexibleConstraintTreatment flexibleConstraintTreatment (bool haveDynamicsIntegrator)
 Returns the flexible constraint treatment depending on whether the integrator is dynamic.
 
template<typename T >
static t_blocka makeAtomsToConstraintsList (int numAtoms, const T *ilists, const t_iparams *iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a block struct to go from atoms to constraints. More...
 
t_blocka make_at2con (int numAtoms, const t_ilist *ilist, const t_iparams *iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a block struct to go from atoms to constraints. More...
 
t_blocka make_at2con (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a block struct to go from atoms to constraints. More...
 
template<typename T >
static int countFlexibleConstraintsTemplate (const T *ilist, const t_iparams *iparams)
 Return the number of flexible constraints in the ilist and iparams.
 
int countFlexibleConstraints (const t_ilist *ilist, const t_iparams *iparams)
 Return the number of flexible constraints in the ilist and iparams.
 
static std::vector< int > make_at2settle (int natoms, const InteractionList &ilist)
 Returns the index of the settle to which each atom belongs.
 
static std::vector< t_blocka > makeAtomToConstraintMappings (const gmx_mtop_t &mtop, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Makes a per-moleculetype container of mappings from atom indices to constraint indices. More...
 
bool inter_charge_group_constraints (const gmx_mtop_t &mtop)
 Returns whether there are inter charge group constraints.
 
bool inter_charge_group_settles (const gmx_mtop_t &mtop)
 Returns whether there are inter charge group settles.
 
static bool isConstraintFlexible (const t_iparams *iparams, int iparamsIndex)
 Returns whether constraint with parameter iparamsIndex is a flexible constraint.
 
const t_blocka * atom2constraints_moltype (const Constraints *constr)
 Returns an array of atom to constraints lists for the moltypes.
 
const int * constr_iatomptr (gmx::ArrayRef< const int > iatom_constr, gmx::ArrayRef< const int > iatom_constrnc, int con)
 Returns the constraint iatoms for a constraint number con which comes from a list where F_CONSTR and F_CONSTRNC constraints are concatenated.
 
static void constr_recur (const t_blocka *at2con, const InteractionLists &ilist, gmx::ArrayRef< const t_iparams > iparams, gmx_bool bTopB, int at, int depth, int nc, int *path, real r0, real r1, real *r2max, int *count)
 Recursing function to help find all adjacent constraints.
 
static real constr_r_max_moltype (const gmx_moltype_t *molt, gmx::ArrayRef< const t_iparams > iparams, const t_inputrec *ir)
 Find the interaction radius needed for constraints for this molecule type.
 
real constr_r_max (const MDLogger &mdlog, const gmx_mtop_t *mtop, const t_inputrec *ir)
 Returns an estimate of the maximum distance between atoms required for LINCS.
 
ArrayRef< reallincs_rmsdData (Lincs *lincsd)
 Return the data for determining constraint RMS relative deviations.
 
real lincs_rmsd (const Lincs *lincsd)
 Return the RMSD of the constraint.
 
static void lincs_matrix_expand (const Lincs *lincsd, const Task *li_task, const real *blcc, real *rhs1, real *rhs2, real *sol)
 Do a set of nrec LINCS matrix multiplications. More...
 
static void lincs_update_atoms_noind (int ncons, const int *bla, real prefac, const real *fac, rvec *r, const real *invmass, rvec *x)
 Update atomic coordinates when an index is not required.
 
static void lincs_update_atoms_ind (int ncons, const int *ind, const int *bla, real prefac, const real *fac, rvec *r, const real *invmass, rvec *x)
 Update atomic coordinates when an index is required.
 
static void lincs_update_atoms (Lincs *li, int th, real prefac, const real *fac, rvec *r, const real *invmass, rvec *x)
 Update coordinates for atoms.
 
template<int align>
static void gmx_simdcall gatherLoadUTransposeTSANSafe (const real *base, const std::int32_t *offset, SimdReal *v0, SimdReal *v1, SimdReal *v2)
 Helper function so that we can run TSAN with SIMD support (where implemented).
 
static void gmx_simdcall calc_dr_x_f_simd (int b0, int b1, const int *bla, const rvec *__restrict x, const rvec *__restrict f, const real *__restrict blc, const real *pbc_simd, rvec *__restrict r, real *__restrict rhs, real *__restrict sol)
 Calculate the constraint distance vectors r to project on from x. More...
 
static void do_lincsp (const rvec *x, rvec *f, rvec *fp, t_pbc *pbc, Lincs *lincsd, int th, real *invmass, ConstraintVariable econq, bool bCalcDHDL, bool bCalcVir, tensor rmdf)
 LINCS projection, works on derivatives of the coordinates.
 
static void gmx_simdcall calc_dr_x_xp_simd (int b0, int b1, const int *bla, const rvec *__restrict x, const rvec *__restrict xp, const real *__restrict bllen, const real *__restrict blc, const real *pbc_simd, rvec *__restrict r, real *__restrict rhs, real *__restrict sol)
 Calculate the constraint distance vectors r to project on from x. More...
 
static void calc_dist_iter (int b0, int b1, const int *bla, const rvec *__restrict xp, const real *__restrict bllen, const real *__restrict blc, const t_pbc *pbc, real wfac, real *__restrict rhs, real *__restrict sol, bool *bWarn)
 Determine the distances and right-hand side for the next iteration.
 
static void gmx_simdcall calc_dist_iter_simd (int b0, int b1, const int *bla, const rvec *__restrict x, const real *__restrict bllen, const real *__restrict blc, const real *pbc_simd, real wfac, real *__restrict rhs, real *__restrict sol, bool *bWarn)
 As calc_dist_iter(), but using SIMD intrinsics.
 
static void do_lincs (const rvec *x, rvec *xp, matrix box, t_pbc *pbc, Lincs *lincsd, int th, const real *invmass, const t_commrec *cr, bool bCalcDHDL, real wangle, bool *bWarn, real invdt, rvec *__restrict v, bool bCalcVir, tensor vir_r_m_dr)
 Implements LINCS constraining.
 
static void set_lincs_matrix_task (Lincs *li, Task *li_task, const real *invmass, int *ncc_triangle, int *nCrossTaskTriangles)
 Sets the elements in the LINCS matrix for task task.
 
static void set_lincs_matrix (Lincs *li, real *invmass, real lambda)
 Sets the elements in the LINCS matrix.
 
static int count_triangle_constraints (const InteractionLists &ilist, const t_blocka &at2con)
 Finds all triangles of atoms that share constraints to a central atom.
 
static bool more_than_two_sequential_constraints (const InteractionLists &ilist, const t_blocka &at2con)
 Finds sequences of sequential constraints.
 
Lincs * init_lincs (FILE *fplog, const gmx_mtop_t &mtop, int nflexcon_global, ArrayRef< const t_blocka > at2con, bool bPLINCS, int nIter, int nProjOrder)
 Initializes and returns the lincs data struct.
 
void done_lincs (Lincs *li)
 Destructs the lincs object when it is not nullptr.
 
static void lincs_thread_setup (Lincs *li, int natoms)
 Sets up the work division over the threads.
 
static void resize_real_aligned (real **ptr, int nelem)
 There is no realloc with alignment, so here we make one for reals. Note that this function does not preserve the contents of the memory.
 
static void assign_constraint (Lincs *li, int constraint_index, int a1, int a2, real lenA, real lenB, const t_blocka *at2con)
 Assign a constraint.
 
static void check_assign_connected (Lincs *li, const t_iatom *iatom, const t_idef &idef, bool bDynamics, int a1, int a2, const t_blocka *at2con)
 Check if constraint with topology index constraint_index is connected to other constraints, and if so add those connected constraints to our task.
 
static void check_assign_triangle (Lincs *li, const t_iatom *iatom, const t_idef &idef, bool bDynamics, int constraint_index, int a1, int a2, const t_blocka *at2con)
 Check if constraint with topology index constraint_index is involved in a constraint triangle, and if so add the other two constraints in the triangle to our task.
 
static void set_matrix_indices (Lincs *li, const Task *li_task, const t_blocka *at2con, bool bSortMatrix)
 Sets matrix indices.
 
void set_lincs (const t_idef &idef, const t_mdatoms &md, bool bDynamics, const t_commrec *cr, Lincs *li)
 Initialize lincs stuff.
 
static void lincs_warning (gmx_domdec_t *dd, const rvec *x, rvec *xprime, t_pbc *pbc, int ncons, const int *bla, real *bllen, real wangle, int maxwarn, int *warncount)
 Issues a warning when LINCS constraints cannot be satisfied.
 
static void cconerr (const Lincs *lincsd, rvec *x, t_pbc *pbc, real *ncons_loc, real *ssd, real *max, int *imax)
 Determine how well the constraints have been satisfied.
 
bool constrain_lincs (bool computeRmsd, const t_inputrec &ir, int64_t step, Lincs *lincsd, const t_mdatoms &md, const t_commrec *cr, const gmx_multisim_t *ms, const rvec *x, rvec *xprime, rvec *min_proj, matrix box, t_pbc *pbc, real lambda, real *dvdlambda, real invdt, rvec *v, bool bCalcVir, tensor vir_r_m_dr, ConstraintVariable econq, t_nrnb *nrnb, int maxwarn, int *warncount)
 Applies LINCS constraints. More...
 
template<typename... Args>
std::unique_ptr< ConstraintsmakeConstraints (const gmx_mtop_t &mtop, const t_inputrec &ir, bool doEssentialDynamics, Args &&...args)
 Factory function for Constraints. More...
 
std::unique_ptr< MDAtomsmakeMDAtoms (FILE *fp, const gmx_mtop_t &mtop, const t_inputrec &ir, bool useGpuForPme)
 Builder function for MdAtomsWrapper. More...
 
static ResetSignal convertToResetSignal (signed char sig)
 Convert signed char (as used by SimulationSignal) to ResetSignal enum. More...
 
static void init_proj_matrix (real invmO, real invmH, real dOH, real dHH, matrix inverseCouplingMatrix)
 Initializes a projection matrix.
 
static void settleparam_init (settleparam_t *p, real mO, real mH, real invmO, real invmH, real dOH, real dHH)
 Initializes settle parameters.
 
settledata * settle_init (const gmx_mtop_t &mtop)
 Initializes and returns a structure with SETTLE parameters.
 
void settle_free (settledata *settled)
 Cleans up.
 
void settle_set_constraints (settledata *settled, const t_ilist *il_settle, const t_mdatoms &mdatoms)
 Set up the indices for the settle constraints.
 
void settle_proj (settledata *settled, ConstraintVariable econq, int nsettle, const t_iatom iatoms[], const t_pbc *pbc,const rvec x[], rvec *der, rvec *derp, int CalcVirAtomEnd, tensor vir_r_m_dder)
 Analytical algorithm to subtract the components of derivatives of coordinates working on settle type constraint.
 
template<typename T , typename TypeBool , int packSize, typename TypePbc , bool bCorrectVelocity, bool bCalcVirial>
static void settleTemplate (const settledata *settled, int settleStart, int settleEnd, const TypePbc pbc, const real *x, real *xprime, real invdt, real *gmx_restrict v, tensor vir_r_m_dr, bool *bErrorHasOccurred)
 The actual settle code, templated for real/SimdReal and for optimization.
 
template<typename T , typename TypeBool , int packSize, typename TypePbc >
static void settleTemplateWrapper (settledata *settled, int nthread, int thread, TypePbc pbc, const real x[], real xprime[], real invdt, real *v, bool bCalcVirial, tensor vir_r_m_dr, bool *bErrorHasOccurred)
 Wrapper template function that divides the settles over threads and instantiates the core template with instantiated booleans.
 
void csettle (settledata *settled,int nthread,int thread,const t_pbc *pbc,const real x[],real xprime[],real invdt,real *v,bool bCalcVirial,tensor vir_r_m_dr,bool *bErrorHasOccurred)
 Constrain coordinates using SETTLE. Can be called on any number of threads.
 
shakedata * shake_init ()
 Initializes and return the SHAKE data structure.
 
static int pcomp (const void *p1, const void *p2)
 Compares sort blocks.
 
static void pr_sortblock (FILE *fp, const char *title, int nsb, t_sortblock sb[])
 Prints sortblocks.
 
static void resizeLagrangianData (shakedata *shaked, int ncons)
 Reallocates a vector.
 
void make_shake_sblock_serial (shakedata *shaked, const t_idef *idef, const t_mdatoms &md)
 Make SHAKE blocks when not using DD.
 
void make_shake_sblock_dd (shakedata *shaked, const t_ilist *ilcon, const t_block *cgs, const gmx_domdec_t *dd)
 Make SHAKE blocks when using DD.
 
void cshake (const int iatom[], int ncon, int *nnit, int maxnit, const real constraint_distance_squared[], real positions[], const real initial_displacements[], const real half_of_reduced_mass[], real omega, const real invmass[], const real distance_squared_tolerance[], real scaled_lagrange_multiplier[], int *nerror)
 Inner kernel for SHAKE constraints. More...
 
static void crattle (const int iatom[], int ncon, int *nnit, int maxnit, const real constraint_distance_squared[], real vp[], const real rij[], const real m2[], real omega, const real invmass[], const real distance_squared_tolerance[], real scaled_lagrange_multiplier[], int *nerror, real invdt)
 Implements RATTLE (ie. SHAKE for velocity verlet integrators)
 
static int vec_shakef (FILE *fplog, shakedata *shaked, const real invmass[], int ncon, t_iparams ip[], t_iatom *iatom, real tol, const rvec x[], rvec prime[], real omega, bool bFEP, real lambda, real scaled_lagrange_multiplier[], real invdt, rvec *v, bool bCalcVir, tensor vir_r_m_dr, ConstraintVariable econq)
 Applies SHAKE.
 
static void check_cons (FILE *log, int nc, const rvec x[], rvec prime[], rvec v[], t_iparams ip[], t_iatom *iatom, const real invmass[], ConstraintVariable econq)
 Check that constraints are satisfied.
 
static bool bshakef (FILE *log, shakedata *shaked, const real invmass[], const t_idef &idef, const t_inputrec &ir, const rvec x_s[], rvec prime[], t_nrnb *nrnb, real lambda, real *dvdlambda, real invdt, rvec *v, bool bCalcVir, tensor vir_r_m_dr, bool bDumpOnError, ConstraintVariable econq)
 Applies SHAKE.
 
bool constrain_shake (FILE *log,shakedata *shaked,const real invmass[],const t_idef &idef,const t_inputrec &ir,const rvec x_s[],rvec xprime[],rvec vprime[],t_nrnb *nrnb,real lambda,real *dvdlambda,real invdt,rvec *v,bool bCalcVir,tensor vir_r_m_dr,bool bDumpOnError,ConstraintVariable econq)
 Shake all the atoms blockwise. It is assumed that all the constraints in the idef->shakes field are sorted, to ascending block nr. The sblock array points into the idef->shakes.iatoms field, with block 0 starting at sblock[0] and running to ( < ) sblock[1], block n running from sblock[n] to sblock[n+1]. Array sblock should be large enough. Return TRUE when OK, FALSE when shake-error.
 
static StopSignal convertToStopSignal (signed char sig)
 Convert signed char (as used by SimulationSignal) to StopSignal enum. More...
 
static bool hasFlexibleConstraints (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams)
 Returns whether moltype contains flexible constraints.
 
static bool hasIncompatibleVsites (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams)
 Returns whether moltype has incompatible vsites. More...
 
static InteractionList jointConstraintList (const gmx_moltype_t &moltype)
 Returns a merged list with constraints of all types.
 
static AtomIndexExtremes vsiteConstructRange (int a, const gmx_moltype_t &moltype)
 Returns the range of constructing atom for vsite with atom index a.
 
static AtomIndexExtremes constraintAtomRange (int a, const t_blocka &at2con, const InteractionList &ilistConstraints)
 Returns the range of atoms constrained to atom a (including a itself)
 
static std::vector< bool > buildIsParticleVsite (const gmx_moltype_t &moltype)
 Returns a list that tells whether atoms in moltype are vsites.
 
static int detectGroup (int firstAtom, const gmx_moltype_t &moltype, const t_blocka &at2con, const InteractionList &ilistConstraints)
 Returns the size of the update group starting at firstAtom or 0 when criteria (see updategroups.h) are not met.
 
static RangePartitioning makeUpdateGroups (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams)
 Returns a list of update groups for moltype.
 
std::vector< RangePartitioningmakeUpdateGroups (const gmx_mtop_t &mtop)
 Returns a vector with update groups for each moleculetype in mtop or an empty vector when the criteria (see below) are not satisfied. More...
 
static std::unordered_multimap
< int, int > 
getAngleIndices (const gmx_moltype_t &moltype)
 Returns a map of angles ilist.iatoms indices with the middle atom as key.
 
template<int numPartnerAtoms>
static real constraintGroupRadius (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams, const int centralAtom, const t_blocka &at2con, const std::unordered_multimap< int, int > &angleIndices, const real constraintLength, const real temperature)
 When possible, computes the maximum radius of constrained atom in an update group. More...
 
static real computeMaxUpdateGroupRadius (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams, const RangePartitioning &updateGroups, real temperature)
 Returns the maximum update group radius for moltype.
 
real computeMaxUpdateGroupRadius (const gmx_mtop_t &mtop, gmx::ArrayRef< const RangePartitioning > updateGroups, real temperature)
 Returns the maximum update group radius. More...
 
static bool is_multisim_option_set (int argc, const char *const argv[])
 Return whether the command-line parameter that will trigger a multi-simulation is set.
 
static void prepareLogFile (BinaryInformationSettings settings, FILE *fplog)
 Implements aspects of logfile handling common to opening either for writing or appending.
 
LogFilePtr openLogFile (const char *lognm, bool appendFiles)
 Open the log file for writing/appending. More...
 
void prepareLogAppending (FILE *fplog)
 Prepare to use the open log file when appending. More...
 
void closeLogFile (t_fileio *logfio)
 Close the log file.
 
static void threadMpiMdrunnerAccessBarrier ()
 Barrier for safe simultaneous thread access to mdrunner data. More...
 
static void mdrunner_start_fn (const 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 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.
 
SimulationContext createSimulationContext (t_commrec *simulationCommunicator)
 Get ownership of a new SimulationContext object. More...
 
template<class T >
T & makeRefFromPointer (T *ptr)
 Take pointer, check if valid, return reference.
 
void assignOptionsFromKeyValueTree (Options *options, const KeyValueTreeObject &tree, IKeyValueTreeErrorHandler *errorHandler)
 Assigns option values from a given KeyValueTreeObject. More...
 
void checkForUnknownOptionsInKeyValueTree (const KeyValueTreeObject &tree, const Options &options)
 Checks that a given KeyValueTreeObject can be assigned to given Options. More...
 
KeyValueTreeObject adjustKeyValueTreeFromOptions (const KeyValueTreeObject &tree, const Options &options)
 Adjusts a KeyValueTreeObject to the structure of given Options. 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.
 
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...
 
HelpTopicPointer createSelectionHelpTopic ()
 */ More...
 
static void simdPrefetch (void *m)
 Prefetch memory at address m. More...
 
template<int align>
static void gmx_simdcall gatherLoadTranspose (const double *base, const std::int32_t offset[], SimdDouble *v0, SimdDouble *v1, SimdDouble *v2, SimdDouble *v3)
 Load 4 consecutive double from each of GMX_SIMD_DOUBLE_WIDTH offsets, and transpose into 4 SIMD double variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadTranspose (const double *base, const std::int32_t offset[], SimdDouble *v0, SimdDouble *v1)
 Load 2 consecutive double from each of GMX_SIMD_DOUBLE_WIDTH offsets, and transpose into 2 SIMD double variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadUTranspose (const double *base, const std::int32_t offset[], SimdDouble *v0, SimdDouble *v1, SimdDouble *v2)
 Load 3 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH offsets, and transpose into 3 SIMD double variables. More...
 
template<int align>
static void gmx_simdcall transposeScatterStoreU (double *base, const std::int32_t offset[], SimdDouble v0, SimdDouble v1, SimdDouble v2)
 Transpose and store 3 SIMD doubles to 3 consecutive addresses at GMX_SIMD_DOUBLE_WIDTH offsets. More...
 
template<int align>
static void gmx_simdcall transposeScatterIncrU (double *base, const std::int32_t offset[], SimdDouble v0, SimdDouble v1, SimdDouble v2)
 Transpose and add 3 SIMD doubles to 3 consecutive addresses at GMX_SIMD_DOUBLE_WIDTH offsets. More...
 
template<int align>
static void gmx_simdcall transposeScatterDecrU (double *base, const std::int32_t offset[], SimdDouble v0, SimdDouble v1, SimdDouble v2)
 Transpose and subtract 3 SIMD doubles to 3 consecutive addresses at GMX_SIMD_DOUBLE_WIDTH offsets. More...
 
static void gmx_simdcall expandScalarsToTriplets (SimdDouble scalar, SimdDouble *triplets0, SimdDouble *triplets1, SimdDouble *triplets2)
 Expand each element of double SIMD variable into three identical consecutive elements in three SIMD outputs. More...
 
template<int align>
static void gmx_simdcall gatherLoadBySimdIntTranspose (const double *base, SimdDInt32 offset, SimdDouble *v0, SimdDouble *v1, SimdDouble *v2, SimdDouble *v3)
 Load 4 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH offsets specified by a SIMD integer, transpose into 4 SIMD double variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadUBySimdIntTranspose (const double *base, SimdDInt32 offset, SimdDouble *v0, SimdDouble *v1)
 Load 2 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH offsets (unaligned) specified by SIMD integer, transpose into 2 SIMD doubles. More...
 
template<int align>
static void gmx_simdcall gatherLoadBySimdIntTranspose (const double *base, SimdDInt32 offset, SimdDouble *v0, SimdDouble *v1)
 Load 2 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH offsets specified by a SIMD integer, transpose into 2 SIMD double variables. More...
 
static double gmx_simdcall reduceIncr4ReturnSum (double *m, SimdDouble v0, SimdDouble v1, SimdDouble v2, SimdDouble v3)
 Reduce each of four SIMD doubles, add those values to four consecutive doubles in memory, return sum. More...
 
template<int align>
static void gmx_simdcall gatherLoadTranspose (const float *base, const std::int32_t offset[], SimdFloat *v0, SimdFloat *v1, SimdFloat *v2, SimdFloat *v3)
 Load 4 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets, and transpose into 4 SIMD float variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadTranspose (const float *base, const std::int32_t offset[], SimdFloat *v0, SimdFloat *v1)
 Load 2 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets, and transpose into 2 SIMD float variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadUTranspose (const float *base, const std::int32_t offset[], SimdFloat *v0, SimdFloat *v1, SimdFloat *v2)
 Load 3 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets, and transpose into 3 SIMD float variables. More...
 
template<int align>
static void gmx_simdcall transposeScatterStoreU (float *base, const std::int32_t offset[], SimdFloat v0, SimdFloat v1, SimdFloat v2)
 Transpose and store 3 SIMD floats to 3 consecutive addresses at GMX_SIMD_FLOAT_WIDTH offsets. More...
 
template<int align>
static void gmx_simdcall transposeScatterIncrU (float *base, const std::int32_t offset[], SimdFloat v0, SimdFloat v1, SimdFloat v2)
 Transpose and add 3 SIMD floats to 3 consecutive addresses at GMX_SIMD_FLOAT_WIDTH offsets. More...
 
template<int align>
static void gmx_simdcall transposeScatterDecrU (float *base, const std::int32_t offset[], SimdFloat v0, SimdFloat v1, SimdFloat v2)
 Transpose and subtract 3 SIMD floats to 3 consecutive addresses at GMX_SIMD_FLOAT_WIDTH offsets. More...
 
static void gmx_simdcall expandScalarsToTriplets (SimdFloat scalar, SimdFloat *triplets0, SimdFloat *triplets1, SimdFloat *triplets2)
 Expand each element of float SIMD variable into three identical consecutive elements in three SIMD outputs. More...
 
template<int align>
static void gmx_simdcall gatherLoadBySimdIntTranspose (const float *base, SimdFInt32 offset, SimdFloat *v0, SimdFloat *v1, SimdFloat *v2, SimdFloat *v3)
 Load 4 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets specified by a SIMD integer, transpose into 4 SIMD float variables. More...
 
template<int align>
static void gmx_simdcall gatherLoadUBySimdIntTranspose (const float *base, SimdFInt32 offset, SimdFloat *v0, SimdFloat *v1)
 Load 2 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets (unaligned) specified by SIMD integer, transpose into 2 SIMD floats. More...
 
template<int align>
static void gmx_simdcall gatherLoadBySimdIntTranspose (const float *base, SimdFInt32 offset, SimdFloat *v0, SimdFloat *v1)
 Load 2 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH offsets specified by a SIMD integer, transpose into 2 SIMD float variables. More...
 
static float gmx_simdcall reduceIncr4ReturnSum (float *m, SimdFloat v0, SimdFloat v1, SimdFloat v2, SimdFloat v3)
 Reduce each of four SIMD floats, add those values to four consecutive floats in memory, return sum. 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...
 
static SimdFloat gmx_simdcall invsqrtSingleAccuracy (SimdFloat x)
 Calculate 1/sqrt(x) for SIMD float, only targeting single accuracy. More...
 
static SimdFloat maskzInvsqrtSingleAccuracy (SimdFloat x, SimdFBool m)
 Calculate 1/sqrt(x) for masked SIMD floats, only targeting single accuracy. More...
 
static void gmx_simdcall invsqrtPairSingleAccuracy (SimdFloat x0, SimdFloat x1, SimdFloat *out0, SimdFloat *out1)
 Calculate 1/sqrt(x) for two SIMD floats, only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall invSingleAccuracy (SimdFloat x)
 Calculate 1/x for SIMD float, only targeting single accuracy. More...
 
static SimdFloat maskzInvSingleAccuracy (SimdFloat x, SimdFBool m)
 Calculate 1/x for masked SIMD floats, only targeting single accuracy. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall sqrtSingleAccuracy (SimdFloat x)
 Calculate sqrt(x) for SIMD float, always targeting single accuracy. More...
 
static SimdFloat gmx_simdcall logSingleAccuracy (SimdFloat x)
 SIMD float log(x), only targeting single accuracy. This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall exp2SingleAccuracy (SimdFloat x)
 SIMD float 2^x, only targeting single accuracy. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall expSingleAccuracy (SimdFloat x)
 SIMD float e^x, only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall erfSingleAccuracy (SimdFloat x)
 SIMD float erf(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall erfcSingleAccuracy (SimdFloat x)
 SIMD float erfc(x), only targeting single accuracy. More...
 
static void gmx_simdcall sinCosSingleAccuracy (SimdFloat x, SimdFloat *sinval, SimdFloat *cosval)
 SIMD float sin & cos, only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall sinSingleAccuracy (SimdFloat x)
 SIMD float sin(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall cosSingleAccuracy (SimdFloat x)
 SIMD float cos(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall tanSingleAccuracy (SimdFloat x)
 SIMD float tan(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall asinSingleAccuracy (SimdFloat x)
 SIMD float asin(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall acosSingleAccuracy (SimdFloat x)
 SIMD float acos(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall atanSingleAccuracy (SimdFloat x)
 SIMD float atan(x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall atan2SingleAccuracy (SimdFloat y, SimdFloat x)
 SIMD float atan2(y,x), only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall pmeForceCorrectionSingleAccuracy (SimdFloat z2)
 SIMD Analytic PME force correction, only targeting single accuracy. More...
 
static SimdFloat gmx_simdcall pmePotentialCorrectionSingleAccuracy (SimdFloat z2)
 SIMD Analytic PME potential correction, only targeting single accuracy. More...
 
static Simd4Float gmx_simdcall invsqrtSingleAccuracy (Simd4Float x)
 Calculate 1/sqrt(x) for SIMD4 float, only targeting single accuracy. More...
 
const std::string & simdString (SimdType s)
 Return a string with the name of a SIMD type. More...
 
SimdType simdSuggested (const CpuInfo &c)
 Return the SIMD type that would fit this hardware best.
 
SimdType simdCompiled ()
 Return the SIMD type the library was compiled with.
 
bool simdCheck (SimdType s, FILE *log, bool warnToStdErr)
 Check if binary was compiled with the provided SIMD type. More...
 
static SimdFloat gmx_simdcall iprod (SimdFloat ax, SimdFloat ay, SimdFloat az, SimdFloat bx, SimdFloat by, SimdFloat bz)
 SIMD float inner product of multiple float vectors. More...
 
static SimdFloat gmx_simdcall norm2 (SimdFloat ax, SimdFloat ay, SimdFloat az)
 SIMD float norm squared of multiple vectors. More...
 
static void gmx_simdcall cprod (SimdFloat ax, SimdFloat ay, SimdFloat az, SimdFloat bx, SimdFloat by, SimdFloat bz, SimdFloat *cx, SimdFloat *cy, SimdFloat *cz)
 SIMD float cross-product of multiple vectors. More...
 
static SimdDouble gmx_simdcall iprod (SimdDouble ax, SimdDouble ay, SimdDouble az, SimdDouble bx, SimdDouble by, SimdDouble bz)
 SIMD double inner product of multiple double vectors. More...
 
static SimdDouble gmx_simdcall norm2 (SimdDouble ax, SimdDouble ay, SimdDouble az)
 SIMD double norm squared of multiple vectors. More...
 
static void gmx_simdcall cprod (SimdDouble ax, SimdDouble ay, SimdDouble az, SimdDouble bx, SimdDouble by, SimdDouble bz, SimdDouble *cx, SimdDouble *cy, SimdDouble *cz)
 SIMD double cross-product of multiple vectors. More...
 
static Simd4Float gmx_simdcall norm2 (Simd4Float ax, Simd4Float ay, Simd4Float az)
 SIMD4 float norm squared of multiple vectors. More...
 
static Simd4Double gmx_simdcall norm2 (Simd4Double ax, Simd4Double ay, Simd4Double az)
 SIMD4 double norm squared of multiple vectors. More...
 
bool decideWhetherToUseGpusForNonbondedWithThreadMpi (TaskTarget nonbondedTarget, const std::vector< int > &gpuIdsToUse, const std::vector< int > &userGpuTaskAssignment, EmulateGpuNonbonded emulateGpuNonbonded, bool buildSupportsNonbondedOnGpu, bool usingVerletScheme, bool nonbondedOnGpuIsUseful, int numRanksPerSimulation)
 Decide whether this thread-MPI simulation will run nonbonded tasks on GPUs. More...
 
bool decideWhetherToUseGpusForPmeWithThreadMpi (bool useGpuForNonbonded, TaskTarget pmeTarget, const std::vector< int > &gpuIdsToUse, const std::vector< int > &userGpuTaskAssignment, bool canUseGpuForPme, int numRanksPerSimulation, int numPmeRanksPerSimulation)
 Decide whether this thread-MPI simulation will run PME tasks on GPUs. More...
 
bool decideWhetherToUseGpusForNonbonded (TaskTarget nonbondedTarget, const std::vector< int > &userGpuTaskAssignment, EmulateGpuNonbonded emulateGpuNonbonded, bool buildSupportsNonbondedOnGpu, bool usingVerletScheme, bool nonbondedOnGpuIsUseful, bool gpusWereDetected)
 Decide whether the simulation will try to run nonbonded tasks on GPUs. More...
 
bool decideWhetherToUseGpusForPme (bool useGpuForNonbonded, TaskTarget pmeTarget, const std::vector< int > &userGpuTaskAssignment, bool canUseGpuForPme, int numRanksPerSimulation, int numPmeRanksPerSimulation, bool gpusWereDetected)
 Decide whether the simulation will try to run tasks of different types on GPUs. More...
 
bool decideWhetherToUseGpusForBonded (bool useGpuForNonbonded, bool useGpuForPme, bool usingVerletScheme, TaskTarget bondedTarget, bool canUseGpuForBonded, bool usingLJPme, bool usingElecPmeOrEwald, int numPmeRanksPerSimulation, bool gpusWereDetected)
 Decide whether the simulation will try to run bonded tasks on GPUs. More...
 
GpuTasksOnRanks findAllGpuTasksOnThisNode (ArrayRef< const GpuTask > gpuTasksOnThisRank, const PhysicalNodeCommunicator &physicalNodeComm)
 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, bool useGpuForBonded, PmeRunMode pmeRunMode)
 Log a report on how GPUs are being used on the ranks of the physical node of rank 0 of the simulation. More...
 
void checkHardwareOversubscription (int numThreadsOnThisRank, int rank, const HardwareTopology &hwTop, const PhysicalNodeCommunicator &comm, const MDLogger &mdlog)
 Warns for oversubscribing the hardware threads, when that is the case.
 
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 gmx_multisim_t *ms, const PhysicalNodeCommunicator &physicalNodeComm, const std::vector< GpuTask > &gpuTasksOnThisRank, bool useGpuForBonded, PmeRunMode pmeRunMode)
 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...
 
void writeHeader (TextWriter *writer, const std::string &text, const std::string &section, bool writeFormattedText)
 Write appropiate Header to output stream. More...
 
void writeSystemInformation (TextWriter *writer, const gmx_mtop_t &top, bool writeFormattedText)
 Write information about the molecules in the system. More...
 
void writeParameterInformation (TextWriter *writer, const t_inputrec &ir, bool writeFormattedText)
 Write information about system parameters. More...
 
void writeInformation (TextOutputFile *outputStream, const t_inputrec &ir, const gmx_mtop_t &top, bool writeFormattedText, bool notStdout)
 Wrapper for writing out information. More...
 
void initExclusionBlocks (ExclusionBlocks *b2, int natom)
 Initialize the content of the pre-allocated blocks.
 
void doneExclusionBlocks (ExclusionBlocks *b2)
 Deallocate the content of the blocks.
 
void blockaToExclusionBlocks (t_blocka *b, ExclusionBlocks *b2)
 Convert the exclusions expressed in b into ExclusionBlock form.
 
void exclusionBlocksToBlocka (ExclusionBlocks *b2, t_blocka *b)
 Convert the exclusions expressed in b into t_blocka form.
 
void mergeExclusions (t_blocka *excl, ExclusionBlocks *b2)
 Merge the contents of b2 into excl. More...
 
void registerTrajectoryAnalysisModules (CommandLineModuleManager *manager)
 Registers all trajectory analysis command-line modules. More...
 
gmx_rmpbc_t gmx_rmpbc_init (const gmx::TopologyInformation &topInfo)
 Convenience overload useful for implementing legacy tools.
 
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...
 
template<typename T >
std::vector< T > copyOf (const ArrayRef< const T > &arrayRef)
 Return a vector that is a copy of an ArrayRef. 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::string getCudaDriverVersionString ()
 Returns a string of the CUDA driver version.
 
std::string getCudaRuntimeVersionString ()
 Returns a string 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, Exception >::type 
operator<< (Exception ex, const ExceptionInfo< Tag, T > &item)
 Associates extra information with an exception. More...
 
void fclose_wrapper (FILE *fp)
 fclose wrapper to be used as unique_ptr deleter
 
IFileInputRedirectordefaultFileInputRedirector ()
 Returns default implementation for IFileInputRedirector. More...
 
IFileOutputRedirectordefaultFileOutputRedirector ()
 Returns default implementation for IFileOutputRedirector. 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...
 
std::string findLibraryFile (const std::string &filename, bool bAddCWD=true, bool bFatal=true)
 Finds full path for a library file. More...
 
std::string findLibraryFile (const char *filename, bool bAddCWD=true, bool bFatal=true)
 Finds full path for a library file. More...
 
FilePtr openLibraryFile (const std::string &filename, bool bAddCWD=true, bool bFatal=true)
 Opens a library file for reading in an RAII-style FILE handle. More...
 
FilePtr openLibraryFile (const char *filename, bool bAddCWD=true, bool bFatal=true)
 Opens a library file for reading in an RAII-style FILE handle. More...
 
bool regexMatch (const char *str, const Regex &regex)
 Matches a string with a regular expression. More...
 
bool regexMatch (const std::string &str, const Regex &regex)
 Matches a string with a regular expression. More...
 
IKeyValueTreeErrorHandler * defaultKeyValueTreeErrorHandler ()
 Returns a default IKeyValueTreeErrorHandler that throws on first exception.
 
void init (int *argc, char ***argv)
 Initializes the GROMACS library. More...
 
void finalize ()
 Deinitializes the GROMACS library. More...
 
void dumpKeyValueTree (TextWriter *writer, const KeyValueTreeObject &tree)
 Writes a human-readable representation of the tree with given writer. More...
 
void compareKeyValueTrees (TextWriter *writer, const KeyValueTreeObject &tree1, const KeyValueTreeObject &tree2, real ftol, real abstol)
 Compares two KeyValueTrees and prints any differences.
 
KeyValueTreePath operator+ (const KeyValueTreePath &a, const KeyValueTreePath &b)
 Combines two paths as with KeyValueTreePath::append().
 
KeyValueTreePath operator+ (const KeyValueTreePath &a, const std::string &b)
 Combines an element to a path as with KeyValueTreePath::append().
 
static std::string simpleValueToString (const KeyValueTreeValue &value)
 Helper function to format a simple KeyValueTreeValue.
 
void serializeKeyValueTree (const KeyValueTreeObject &root, ISerializer *serializer)
 Serializes a KeyValueTreeObject with given serializer.
 
KeyValueTreeObject deserializeKeyValueTree (ISerializer *serializer)
 Deserializes a KeyValueTreeObject from a given serializer.
 
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...
 
void MPI_Comm_free_wrapper (MPI_Comm *comm)
 Wrapper function for RAII-style cleanup. More...
 
const IProgramContextgetProgramContext ()
 Returns the global IProgramContext instance. More...
 
void setProgramContext (const IProgramContext *context)
 Sets the global IProgramContext instance. More...
 
bool boolFromString (const char *str)
 Parses a boolean from a string. More...
 
int intFromString (const char *str)
 Parses an integer from a string. More...
 
int64_t int64FromString (const char *str)
 Parses a 64-bit integer from a string. More...
 
float floatFromString (const char *str)
 Parses a float value from a string. More...
 
double doubleFromString (const char *str)
 Parses a double value from a string. More...
 
template<typename T >
static T fromString (const char *str)
 Parses a value from a string to a given type. More...
 
template<typename T >
static T fromString (const std::string &str)
 Parses a value from a string to a given type. More...
 
template<typename T >
static T fromStdString (const std::string &str)
 Parses a value from a string to a given type. More...
 
template<>
bool fromString< bool > (const char *str)
 Implementation for boolean values.
 
template<>
int fromString< int > (const char *str)
 Implementation for integer values.
 
template<>
int64_t fromString< int64_t > (const char *str)
 Implementation for 64-bit integer values.
 
template<>
float fromString< float > (const char *str)
 Implementation for float values.
 
template<>
double fromString< double > (const char *str)
 Implementation for double values.
 
static const char * boolToString (bool value)
 Converts a boolean to a "true"/"false" string. More...
 
static std::string intToString (int t)
 Returns a string containing the value of t. More...
 
static std::string int64ToString (int64_t t)
 Returns a string containing the value of t. More...
 
static std::string doubleToString (double t)
 Returns a string containing the value of t. 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.
 
std::string simpleValueToString (const Variant &value)
 Converts a Variant value to a string. More...
 
int gmx_mdrun (int argc, char *argv[])
 Implements C-style main function for mdrun.
 
template<typename T >
norm (T *v)
 Forward operations on C Array style vectors to C implementations. More...
 
template<typename T >
norm2 (T *v)
 
Constant width-4 double precision SIMD types and instructions
static Simd4Double gmx_simdcall load4 (const double *m)
 Load 4 double values from aligned memory into SIMD4 variable. More...
 
static void gmx_simdcall store4 (double *m, Simd4Double a)
 Store the contents of SIMD4 double to aligned memory m. More...
 
static Simd4Double gmx_simdcall load4U (const double *m)
 Load SIMD4 double from unaligned memory. More...
 
static void gmx_simdcall store4U (double *m, Simd4Double a)
 Store SIMD4 double to unaligned memory. More...
 
static Simd4Double gmx_simdcall simd4SetZeroD ()
 Set all SIMD4 double elements to 0. More...
 
static Simd4Double gmx_simdcall operator& (Simd4Double a, Simd4Double b)
 Bitwise and for two SIMD4 double variables. More...
 
static Simd4Double gmx_simdcall andNot (Simd4Double a, Simd4Double b)
 Bitwise andnot for two SIMD4 double variables. c=(~a) & b. More...
 
static Simd4Double gmx_simdcall operator| (Simd4Double a, Simd4Double b)
 Bitwise or for two SIMD4 doubles. More...
 
static Simd4Double gmx_simdcall operator^ (Simd4Double a, Simd4Double b)
 Bitwise xor for two SIMD4 double variables. More...
 
static Simd4Double gmx_simdcall operator+ (Simd4Double a, Simd4Double b)
 Add two double SIMD4 variables. More...
 
static Simd4Double gmx_simdcall operator- (Simd4Double a, Simd4Double b)
 Subtract two SIMD4 variables. More...
 
static Simd4Double gmx_simdcall operator- (Simd4Double a)
 SIMD4 floating-point negate. More...
 
static Simd4Double gmx_simdcall operator* (Simd4Double a, Simd4Double b)
 Multiply two SIMD4 variables. More...
 
static Simd4Double gmx_simdcall fma (Simd4Double a, Simd4Double b, Simd4Double c)
 SIMD4 Fused-multiply-add. Result is a*b+c. More...
 
static Simd4Double gmx_simdcall fms (Simd4Double a, Simd4Double b, Simd4Double c)
 SIMD4 Fused-multiply-subtract. Result is a*b-c. More...
 
static Simd4Double gmx_simdcall fnma (Simd4Double a, Simd4Double b, Simd4Double c)
 SIMD4 Fused-negated-multiply-add. Result is -a*b+c. More...
 
static Simd4Double gmx_simdcall fnms (Simd4Double a, Simd4Double b, Simd4Double c)
 SIMD4 Fused-negated-multiply-subtract. Result is -a*b-c. More...
 
static Simd4Double gmx_simdcall rsqrt (Simd4Double x)
 SIMD4 1.0/sqrt(x) lookup. More...
 
static Simd4Double gmx_simdcall abs (Simd4Double a)
 SIMD4 Floating-point abs(). More...
 
static Simd4Double gmx_simdcall max (Simd4Double a, Simd4Double b)
 Set each SIMD4 element to the largest from two variables. More...
 
static Simd4Double gmx_simdcall min (Simd4Double a, Simd4Double b)
 Set each SIMD4 element to the largest from two variables. More...
 
static Simd4Double gmx_simdcall round (Simd4Double a)
 SIMD4 Round to nearest integer value (in floating-point format). More...
 
static Simd4Double gmx_simdcall trunc (Simd4Double a)
 Truncate SIMD4, i.e. round towards zero - common hardware instruction. More...
 
static double gmx_simdcall dotProduct (Simd4Double a, Simd4Double b)
 Return dot product of two double precision SIMD4 variables. More...
 
static void gmx_simdcall transpose (Simd4Double *v0, Simd4Double *v1, Simd4Double *v2, Simd4Double *v3)
 SIMD4 double transpose. More...
 
static Simd4DBool gmx_simdcall operator== (Simd4Double a, Simd4Double b)
 a==b for SIMD4 double More...
 
static Simd4DBool gmx_simdcall operator!= (Simd4Double a, Simd4Double b)
 a!=b for SIMD4 double More...
 
static Simd4DBool gmx_simdcall operator< (Simd4Double a, Simd4Double b)
 a<b for SIMD4 double More...
 
static Simd4DBool gmx_simdcall operator<= (Simd4Double a, Simd4Double b)
 a<=b for SIMD4 double. More...
 
static Simd4DBool gmx_simdcall operator&& (Simd4DBool a, Simd4DBool b)
 Logical and on single precision SIMD4 booleans. More...
 
static Simd4DBool gmx_simdcall operator|| (Simd4DBool a, Simd4DBool b)
 Logical or on single precision SIMD4 booleans. More...
 
static bool gmx_simdcall anyTrue (Simd4DBool a)
 Returns non-zero if any of the boolean in SIMD4 a is True, otherwise 0. More...
 
static Simd4Double gmx_simdcall selectByMask (Simd4Double a, Simd4DBool mask)
 Select from single precision SIMD4 variable where boolean is true. More...
 
static Simd4Double gmx_simdcall selectByNotMask (Simd4Double a, Simd4DBool mask)
 Select from single precision SIMD4 variable where boolean is false. More...
 
static Simd4Double gmx_simdcall blend (Simd4Double a, Simd4Double b, Simd4DBool sel)
 Vector-blend SIMD4 selection. More...
 
static double gmx_simdcall reduce (Simd4Double a)
 Return sum of all elements in SIMD4 double variable. More...
 
Constant width-4 single precision SIMD types and instructions
static Simd4Float gmx_simdcall load4 (const float *m)
 Load 4 float values from aligned memory into SIMD4 variable. More...
 
static void gmx_simdcall store4 (float *m, Simd4Float a)
 Store the contents of SIMD4 float to aligned memory m. More...
 
static Simd4Float gmx_simdcall load4U (const float *m)
 Load SIMD4 float from unaligned memory. More...
 
static void gmx_simdcall store4U (float *m, Simd4Float a)
 Store SIMD4 float to unaligned memory. More...
 
static Simd4Float gmx_simdcall simd4SetZeroF ()
 Set all SIMD4 float elements to 0. More...
 
static Simd4Float gmx_simdcall operator& (Simd4Float a, Simd4Float b)
 Bitwise and for two SIMD4 float variables. More...
 
static Simd4Float gmx_simdcall andNot (Simd4Float a, Simd4Float b)
 Bitwise andnot for two SIMD4 float variables. c=(~a) & b. More...
 
static Simd4Float gmx_simdcall operator| (Simd4Float a, Simd4Float b)
 Bitwise or for two SIMD4 floats. More...
 
static Simd4Float gmx_simdcall operator^ (Simd4Float a, Simd4Float b)
 Bitwise xor for two SIMD4 float variables. More...
 
static Simd4Float gmx_simdcall operator+ (Simd4Float a, Simd4Float b)
 Add two float SIMD4 variables. More...
 
static Simd4Float gmx_simdcall operator- (Simd4Float a, Simd4Float b)
 Subtract two SIMD4 variables. More...
 
static Simd4Float gmx_simdcall operator- (Simd4Float a)
 SIMD4 floating-point negate. More...
 
static Simd4Float gmx_simdcall operator* (Simd4Float a, Simd4Float b)
 Multiply two SIMD4 variables. More...
 
static Simd4Float gmx_simdcall fma (Simd4Float a, Simd4Float b, Simd4Float c)
 SIMD4 Fused-multiply-add. Result is a*b+c. More...
 
static Simd4Float gmx_simdcall fms (Simd4Float a, Simd4Float b, Simd4Float c)
 SIMD4 Fused-multiply-subtract. Result is a*b-c. More...
 
static Simd4Float gmx_simdcall fnma (Simd4Float a, Simd4Float b, Simd4Float c)
 SIMD4 Fused-negated-multiply-add. Result is -a*b+c. More...
 
static Simd4Float gmx_simdcall fnms (Simd4Float a, Simd4Float b, Simd4Float c)
 SIMD4 Fused-negated-multiply-subtract. Result is -a*b-c. More...
 
static Simd4Float gmx_simdcall rsqrt (Simd4Float x)
 SIMD4 1.0/sqrt(x) lookup. More...
 
static Simd4Float gmx_simdcall abs (Simd4Float a)
 SIMD4 Floating-point fabs(). More...
 
static Simd4Float gmx_simdcall max (Simd4Float a, Simd4Float b)
 Set each SIMD4 element to the largest from two variables. More...
 
static Simd4Float gmx_simdcall min (Simd4Float a, Simd4Float b)
 Set each SIMD4 element to the largest from two variables. More...
 
static Simd4Float gmx_simdcall round (Simd4Float a)
 SIMD4 Round to nearest integer value (in floating-point format). More...
 
static Simd4Float gmx_simdcall trunc (Simd4Float a)
 Truncate SIMD4, i.e. round towards zero - common hardware instruction. More...
 
static float gmx_simdcall dotProduct (Simd4Float a, Simd4Float b)
 Return dot product of two single precision SIMD4 variables. More...
 
static void gmx_simdcall transpose (Simd4Float *v0, Simd4Float *v1, Simd4Float *v2, Simd4Float *v3)
 SIMD4 float transpose. More...
 
static Simd4FBool gmx_simdcall operator== (Simd4Float a, Simd4Float b)
 a==b for SIMD4 float More...
 
static Simd4FBool gmx_simdcall operator!= (Simd4Float a, Simd4Float b)
 a!=b for SIMD4 float More...
 
static Simd4FBool gmx_simdcall operator< (Simd4Float a, Simd4Float b)
 a<b for SIMD4 float More...
 
static Simd4FBool gmx_simdcall operator<= (Simd4Float a, Simd4Float b)
 a<=b for SIMD4 float. More...
 
static Simd4FBool gmx_simdcall operator&& (Simd4FBool a, Simd4FBool b)
 Logical and on single precision SIMD4 booleans. More...
 
static Simd4FBool gmx_simdcall operator|| (Simd4FBool a, Simd4FBool b)
 Logical or on single precision SIMD4 booleans. More...
 
static bool gmx_simdcall anyTrue (Simd4FBool a)
 Returns non-zero if any of the boolean in SIMD4 a is True, otherwise 0. More...
 
static Simd4Float gmx_simdcall selectByMask (Simd4Float a, Simd4FBool mask)
 Select from single precision SIMD4 variable where boolean is true. More...
 
static Simd4Float gmx_simdcall selectByNotMask (Simd4Float a, Simd4FBool mask)
 Select from single precision SIMD4 variable where boolean is false. More...
 
static Simd4Float gmx_simdcall blend (Simd4Float a, Simd4Float b, Simd4FBool sel)
 Vector-blend SIMD4 selection. More...
 
static float gmx_simdcall reduce (Simd4Float a)
 Return sum of all elements in SIMD4 float variable. More...
 
SIMD implementation load/store operations for double precision floating point
static SimdDouble gmx_simdcall simdLoad (const double *m, SimdDoubleTag={})
 Load GMX_SIMD_DOUBLE_WIDTH numbers from aligned memory. More...
 
static void gmx_simdcall store (double *m, SimdDouble a)
 Store the contents of SIMD double variable to aligned memory m. More...
 
static SimdDouble gmx_simdcall simdLoadU (const double *m, SimdDoubleTag={})
 Load SIMD double from unaligned memory. More...
 
static void gmx_simdcall storeU (double *m, SimdDouble a)
 Store SIMD double to unaligned memory. More...
 
static SimdDouble gmx_simdcall setZeroD ()
 Set all SIMD double variable elements to 0.0. More...
 
SIMD implementation load/store operations for integers (corresponding to double)
static SimdDInt32 gmx_simdcall simdLoad (const std::int32_t *m, SimdDInt32Tag)
 Load aligned SIMD integer data, width corresponds to gmx::SimdDouble. More...
 
static void gmx_simdcall store (std::int32_t *m, SimdDInt32 a)
 Store aligned SIMD integer data, width corresponds to gmx::SimdDouble. More...
 
static SimdDInt32 gmx_simdcall simdLoadU (const std::int32_t *m, SimdDInt32Tag)
 Load unaligned integer SIMD data, width corresponds to gmx::SimdDouble. More...
 
static void gmx_simdcall storeU (std::int32_t *m, SimdDInt32 a)
 Store unaligned SIMD integer data, width corresponds to gmx::SimdDouble. More...
 
static SimdDInt32 gmx_simdcall setZeroDI ()
 Set all SIMD (double) integer variable elements to 0. More...
 
template<int index>
static std::int32_t gmx_simdcall extract (SimdDInt32 a)
 Extract element with index i from gmx::SimdDInt32. More...
 
SIMD implementation double precision floating-point bitwise logical operations
static SimdDouble gmx_simdcall operator& (SimdDouble a, SimdDouble b)
 Bitwise and for two SIMD double variables. More...
 
static SimdDouble gmx_simdcall andNot (SimdDouble a, SimdDouble b)
 Bitwise andnot for SIMD double. More...
 
static SimdDouble gmx_simdcall operator| (SimdDouble a, SimdDouble b)
 Bitwise or for SIMD double. More...
 
static SimdDouble gmx_simdcall operator^ (SimdDouble a, SimdDouble b)
 Bitwise xor for SIMD double. More...
 
SIMD implementation double precision floating-point arithmetics
static SimdDouble gmx_simdcall operator+ (SimdDouble a, SimdDouble b)
 Add two double SIMD variables. More...
 
static SimdDouble gmx_simdcall operator- (SimdDouble a, SimdDouble b)
 Subtract two double SIMD variables. More...
 
static SimdDouble gmx_simdcall operator- (SimdDouble a)
 SIMD double precision negate. More...
 
static SimdDouble gmx_simdcall operator* (SimdDouble a, SimdDouble b)
 Multiply two double SIMD variables. More...
 
static SimdDouble gmx_simdcall fma (SimdDouble a, SimdDouble b, SimdDouble c)
 SIMD double Fused-multiply-add. Result is a*b+c. More...
 
static SimdDouble gmx_simdcall fms (SimdDouble a, SimdDouble b, SimdDouble c)
 SIMD double Fused-multiply-subtract. Result is a*b-c. More...
 
static SimdDouble gmx_simdcall fnma (SimdDouble a, SimdDouble b, SimdDouble c)
 SIMD double Fused-negated-multiply-add. Result is -a*b+c. More...
 
static SimdDouble gmx_simdcall fnms (SimdDouble a, SimdDouble b, SimdDouble c)
 SIMD double Fused-negated-multiply-subtract. Result is -a*b-c. More...
 
static SimdDouble gmx_simdcall rsqrt (SimdDouble x)
 double SIMD 1.0/sqrt(x) lookup. More...
 
static SimdDouble gmx_simdcall rcp (SimdDouble x)
 SIMD double 1.0/x lookup. More...
 
static SimdDouble gmx_simdcall maskAdd (SimdDouble a, SimdDouble b, SimdDBool m)
 Add two double SIMD variables, masked version. More...
 
static SimdDouble gmx_simdcall maskzMul (SimdDouble a, SimdDouble b, SimdDBool m)
 Multiply two double SIMD variables, masked version. More...
 
static SimdDouble gmx_simdcall maskzFma (SimdDouble a, SimdDouble b, SimdDouble c, SimdDBool m)
 SIMD double fused multiply-add, masked version. More...
 
static SimdDouble gmx_simdcall maskzRsqrt (SimdDouble x, SimdDBool m)
 SIMD double 1.0/sqrt(x) lookup, masked version. More...
 
static SimdDouble gmx_simdcall maskzRcp (SimdDouble x, SimdDBool m)
 SIMD double 1.0/x lookup, masked version. More...
 
static SimdDouble gmx_simdcall abs (SimdDouble a)
 SIMD double floating-point fabs(). More...
 
static SimdDouble gmx_simdcall max (SimdDouble a, SimdDouble b)
 Set each SIMD double element to the largest from two variables. More...
 
static SimdDouble gmx_simdcall min (SimdDouble a, SimdDouble b)
 Set each SIMD double element to the smallest from two variables. More...
 
static SimdDouble gmx_simdcall round (SimdDouble a)
 SIMD double round to nearest integer value (in floating-point format). More...
 
static SimdDouble gmx_simdcall trunc (SimdDouble a)
 Truncate SIMD double, i.e. round towards zero - common hardware instruction. More...
 
static SimdDouble gmx_simdcall frexp (SimdDouble value, SimdDInt32 *exponent)
 Extract (integer) exponent and fraction from double precision SIMD. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall ldexp (SimdDouble value, SimdDInt32 exponent)
 Multiply a SIMD double value by the number 2 raised to an exp power. More...
 
static double gmx_simdcall reduce (SimdDouble a)
 Return sum of all elements in SIMD double variable. More...
 
SIMD implementation double precision floating-point comparison, boolean, selection.
static SimdDBool gmx_simdcall operator== (SimdDouble a, SimdDouble b)
 SIMD a==b for double SIMD. More...
 
static SimdDBool gmx_simdcall operator!= (SimdDouble a, SimdDouble b)
 SIMD a!=b for double SIMD. More...
 
static SimdDBool gmx_simdcall operator< (SimdDouble a, SimdDouble b)
 SIMD a<b for double SIMD. More...
 
static SimdDBool gmx_simdcall operator<= (SimdDouble a, SimdDouble b)
 SIMD a<=b for double SIMD. More...
 
static SimdDBool gmx_simdcall testBits (SimdDouble a)
 Return true if any bits are set in the single precision SIMD. More...
 
static SimdDBool gmx_simdcall operator&& (SimdDBool a, SimdDBool b)
 Logical and on double precision SIMD booleans. More...
 
static SimdDBool gmx_simdcall operator|| (SimdDBool a, SimdDBool b)
 Logical or on double precision SIMD booleans. More...
 
static bool gmx_simdcall anyTrue (SimdDBool a)
 Returns non-zero if any of the boolean in SIMD a is True, otherwise 0. More...
 
static SimdDouble gmx_simdcall selectByMask (SimdDouble a, SimdDBool mask)
 Select from double precision SIMD variable where boolean is true. More...
 
static SimdDouble gmx_simdcall selectByNotMask (SimdDouble a, SimdDBool mask)
 Select from double precision SIMD variable where boolean is false. More...
 
static SimdDouble gmx_simdcall blend (SimdDouble a, SimdDouble b, SimdDBool sel)
 Vector-blend SIMD double selection. More...
 
SIMD implementation integer (corresponding to double) bitwise logical operations
static SimdDInt32 gmx_simdcall operator& (SimdDInt32 a, SimdDInt32 b)
 Integer SIMD bitwise and. More...
 
static SimdDInt32 gmx_simdcall andNot (SimdDInt32 a, SimdDInt32 b)
 Integer SIMD bitwise not/complement. More...
 
static SimdDInt32 gmx_simdcall operator| (SimdDInt32 a, SimdDInt32 b)
 Integer SIMD bitwise or. More...
 
static SimdDInt32 gmx_simdcall operator^ (SimdDInt32 a, SimdDInt32 b)
 Integer SIMD bitwise xor. More...
 
SIMD implementation integer (corresponding to double) arithmetics
static SimdDInt32 gmx_simdcall operator+ (SimdDInt32 a, SimdDInt32 b)
 Add SIMD integers. More...
 
static SimdDInt32 gmx_simdcall operator- (SimdDInt32 a, SimdDInt32 b)
 Subtract SIMD integers. More...
 
static SimdDInt32 gmx_simdcall operator* (SimdDInt32 a, SimdDInt32 b)
 Multiply SIMD integers. More...
 
SIMD implementation integer (corresponding to double) comparisons, boolean selection
static SimdDIBool gmx_simdcall operator== (SimdDInt32 a, SimdDInt32 b)
 Equality comparison of two integers corresponding to double values. More...
 
static SimdDIBool gmx_simdcall operator< (SimdDInt32 a, SimdDInt32 b)
 Less-than comparison of two SIMD integers corresponding to double values. More...
 
static SimdDIBool gmx_simdcall testBits (SimdDInt32 a)
 Check if any bit is set in each element. More...
 
static SimdDIBool gmx_simdcall operator&& (SimdDIBool a, SimdDIBool b)
 Logical AND on SimdDIBool. More...
 
static SimdDIBool gmx_simdcall operator|| (SimdDIBool a, SimdDIBool b)
 Logical OR on SimdDIBool. More...
 
static bool gmx_simdcall anyTrue (SimdDIBool a)
 Returns true if any of the boolean in x is True, otherwise 0. More...
 
static SimdDInt32 gmx_simdcall selectByMask (SimdDInt32 a, SimdDIBool mask)
 Select from gmx::SimdDInt32 variable where boolean is true. More...
 
static SimdDInt32 gmx_simdcall selectByNotMask (SimdDInt32 a, SimdDIBool mask)
 Select from gmx::SimdDInt32 variable where boolean is false. More...
 
static SimdDInt32 gmx_simdcall blend (SimdDInt32 a, SimdDInt32 b, SimdDIBool sel)
 Vector-blend SIMD integer selection. More...
 
SIMD implementation conversion operations
static SimdDInt32 gmx_simdcall cvtR2I (SimdDouble a)
 Round double precision floating point to integer. More...
 
static SimdDInt32 gmx_simdcall cvttR2I (SimdDouble a)
 Truncate double precision floating point to integer. More...
 
static SimdDouble gmx_simdcall cvtI2R (SimdDInt32 a)
 Convert integer to double precision floating point. More...
 
static SimdDIBool gmx_simdcall cvtB2IB (SimdDBool a)
 Convert from double precision boolean to corresponding integer boolean. More...
 
static SimdDBool gmx_simdcall cvtIB2B (SimdDIBool a)
 Convert from integer boolean to corresponding double precision boolean. More...
 
static SimdDouble gmx_simdcall cvtF2D (SimdFloat f)
 Convert SIMD float to double. More...
 
static SimdFloat gmx_simdcall cvtD2F (SimdDouble d)
 Convert SIMD double to float. More...
 
static void gmx_simdcall cvtF2DD (SimdFloat f, SimdDouble *d0, SimdDouble *d1)
 Convert SIMD float to double. More...
 
static SimdFloat gmx_simdcall cvtDD2F (SimdDouble d0, SimdDouble d1)
 Convert SIMD double to float. More...
 
static SimdFInt32 gmx_simdcall cvtR2I (SimdFloat a)
 Round single precision floating point to integer. More...
 
static SimdFInt32 gmx_simdcall cvttR2I (SimdFloat a)
 Truncate single precision floating point to integer. More...
 
static SimdFloat gmx_simdcall cvtI2R (SimdFInt32 a)
 Convert integer to single precision floating point. More...
 
static SimdFIBool gmx_simdcall cvtB2IB (SimdFBool a)
 Convert from single precision boolean to corresponding integer boolean. More...
 
static SimdFBool gmx_simdcall cvtIB2B (SimdFIBool a)
 Convert from integer boolean to corresponding single precision boolean. More...
 
SIMD implementation load/store operations for single precision floating point
static SimdFloat gmx_simdcall simdLoad (const float *m, SimdFloatTag={})
 Load GMX_SIMD_FLOAT_WIDTH float numbers from aligned memory. More...
 
static void gmx_simdcall store (float *m, SimdFloat a)
 Store the contents of SIMD float variable to aligned memory m. More...
 
static SimdFloat gmx_simdcall simdLoadU (const float *m, SimdFloatTag={})
 Load SIMD float from unaligned memory. More...
 
static void gmx_simdcall storeU (float *m, SimdFloat a)
 Store SIMD float to unaligned memory. More...
 
static SimdFloat gmx_simdcall setZeroF ()
 Set all SIMD float variable elements to 0.0. More...
 
SIMD implementation load/store operations for integers (corresponding to float)
static SimdFInt32 gmx_simdcall simdLoad (const std::int32_t *m, SimdFInt32Tag)
 Load aligned SIMD integer data, width corresponds to gmx::SimdFloat. More...
 
static void gmx_simdcall store (std::int32_t *m, SimdFInt32 a)
 Store aligned SIMD integer data, width corresponds to gmx::SimdFloat. More...
 
static SimdFInt32 gmx_simdcall simdLoadU (const std::int32_t *m, SimdFInt32Tag)
 Load unaligned integer SIMD data, width corresponds to gmx::SimdFloat. More...
 
static void gmx_simdcall storeU (std::int32_t *m, SimdFInt32 a)
 Store unaligned SIMD integer data, width corresponds to gmx::SimdFloat. More...
 
static SimdFInt32 gmx_simdcall setZeroFI ()
 Set all SIMD (float) integer variable elements to 0. More...
 
template<int index>
static std::int32_t gmx_simdcall extract (SimdFInt32 a)
 Extract element with index i from gmx::SimdFInt32. More...
 
SIMD implementation single precision floating-point bitwise logical operations
static SimdFloat gmx_simdcall operator& (SimdFloat a, SimdFloat b)
 Bitwise and for two SIMD float variables. More...
 
static SimdFloat gmx_simdcall andNot (SimdFloat a, SimdFloat b)
 Bitwise andnot for SIMD float. More...
 
static SimdFloat gmx_simdcall operator| (SimdFloat a, SimdFloat b)
 Bitwise or for SIMD float. More...
 
static SimdFloat gmx_simdcall operator^ (SimdFloat a, SimdFloat b)
 Bitwise xor for SIMD float. More...
 
SIMD implementation single precision floating-point arithmetics
static SimdFloat gmx_simdcall operator+ (SimdFloat a, SimdFloat b)
 Add two float SIMD variables. More...
 
static SimdFloat gmx_simdcall operator- (SimdFloat a, SimdFloat b)
 Subtract two float SIMD variables. More...
 
static SimdFloat gmx_simdcall operator- (SimdFloat a)
 SIMD single precision negate. More...
 
static SimdFloat gmx_simdcall operator* (SimdFloat a, SimdFloat b)
 Multiply two float SIMD variables. More...
 
static SimdFloat gmx_simdcall fma (SimdFloat a, SimdFloat b, SimdFloat c)
 SIMD float Fused-multiply-add. Result is a*b+c. More...
 
static SimdFloat gmx_simdcall fms (SimdFloat a, SimdFloat b, SimdFloat c)
 SIMD float Fused-multiply-subtract. Result is a*b-c. More...
 
static SimdFloat gmx_simdcall fnma (SimdFloat a, SimdFloat b, SimdFloat c)
 SIMD float Fused-negated-multiply-add. Result is -a*b+c. More...
 
static SimdFloat gmx_simdcall fnms (SimdFloat a, SimdFloat b, SimdFloat c)
 SIMD float Fused-negated-multiply-subtract. Result is -a*b-c. More...
 
static SimdFloat gmx_simdcall rsqrt (SimdFloat x)
 SIMD float 1.0/sqrt(x) lookup. More...
 
static SimdFloat gmx_simdcall rcp (SimdFloat x)
 SIMD float 1.0/x lookup. More...
 
static SimdFloat gmx_simdcall maskAdd (SimdFloat a, SimdFloat b, SimdFBool m)
 Add two float SIMD variables, masked version. More...
 
static SimdFloat gmx_simdcall maskzMul (SimdFloat a, SimdFloat b, SimdFBool m)
 Multiply two float SIMD variables, masked version. More...
 
static SimdFloat gmx_simdcall maskzFma (SimdFloat a, SimdFloat b, SimdFloat c, SimdFBool m)
 SIMD float fused multiply-add, masked version. More...
 
static SimdFloat gmx_simdcall maskzRsqrt (SimdFloat x, SimdFBool m)
 SIMD float 1.0/sqrt(x) lookup, masked version. More...
 
static SimdFloat gmx_simdcall maskzRcp (SimdFloat x, SimdFBool m)
 SIMD float 1.0/x lookup, masked version. More...
 
static SimdFloat gmx_simdcall abs (SimdFloat a)
 SIMD float Floating-point abs(). More...
 
static SimdFloat gmx_simdcall max (SimdFloat a, SimdFloat b)
 Set each SIMD float element to the largest from two variables. More...
 
static SimdFloat gmx_simdcall min (SimdFloat a, SimdFloat b)
 Set each SIMD float element to the smallest from two variables. More...
 
static SimdFloat gmx_simdcall round (SimdFloat a)
 SIMD float round to nearest integer value (in floating-point format). More...
 
static SimdFloat gmx_simdcall trunc (SimdFloat a)
 Truncate SIMD float, i.e. round towards zero - common hardware instruction. More...
 
static SimdFloat gmx_simdcall frexp (SimdFloat value, SimdFInt32 *exponent)
 Extract (integer) exponent and fraction from single precision SIMD. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall ldexp (SimdFloat value, SimdFInt32 exponent)
 Multiply a SIMD float value by the number 2 raised to an exp power. More...
 
static float gmx_simdcall reduce (SimdFloat a)
 Return sum of all elements in SIMD float variable. More...
 
SIMD implementation single precision floating-point comparisons, boolean, selection.
static SimdFBool gmx_simdcall operator== (SimdFloat a, SimdFloat b)
 SIMD a==b for single SIMD. More...
 
static SimdFBool gmx_simdcall operator!= (SimdFloat a, SimdFloat b)
 SIMD a!=b for single SIMD. More...
 
static SimdFBool gmx_simdcall operator< (SimdFloat a, SimdFloat b)
 SIMD a<b for single SIMD. More...
 
static SimdFBool gmx_simdcall operator<= (SimdFloat a, SimdFloat b)
 SIMD a<=b for single SIMD. More...
 
static SimdFBool gmx_simdcall testBits (SimdFloat a)
 Return true if any bits are set in the single precision SIMD. More...
 
static SimdFBool gmx_simdcall operator&& (SimdFBool a, SimdFBool b)
 Logical and on single precision SIMD booleans. More...
 
static SimdFBool gmx_simdcall operator|| (SimdFBool a, SimdFBool b)
 Logical or on single precision SIMD booleans. More...
 
static bool gmx_simdcall anyTrue (SimdFBool a)
 Returns non-zero if any of the boolean in SIMD a is True, otherwise 0. More...
 
static SimdFloat gmx_simdcall selectByMask (SimdFloat a, SimdFBool mask)
 Select from single precision SIMD variable where boolean is true. More...
 
static SimdFloat gmx_simdcall selectByNotMask (SimdFloat a, SimdFBool mask)
 Select from single precision SIMD variable where boolean is false. More...
 
static SimdFloat gmx_simdcall blend (SimdFloat a, SimdFloat b, SimdFBool sel)
 Vector-blend SIMD float selection. More...
 
SIMD implementation integer (corresponding to float) bitwise logical operations
static SimdFInt32 gmx_simdcall operator& (SimdFInt32 a, SimdFInt32 b)
 Integer SIMD bitwise and. More...
 
static SimdFInt32 gmx_simdcall andNot (SimdFInt32 a, SimdFInt32 b)
 Integer SIMD bitwise not/complement. More...
 
static SimdFInt32 gmx_simdcall operator| (SimdFInt32 a, SimdFInt32 b)
 Integer SIMD bitwise or. More...
 
static SimdFInt32 gmx_simdcall operator^ (SimdFInt32 a, SimdFInt32 b)
 Integer SIMD bitwise xor. More...
 
SIMD implementation integer (corresponding to float) arithmetics
static SimdFInt32 gmx_simdcall operator+ (SimdFInt32 a, SimdFInt32 b)
 Add SIMD integers. More...
 
static SimdFInt32 gmx_simdcall operator- (SimdFInt32 a, SimdFInt32 b)
 Subtract SIMD integers. More...
 
static SimdFInt32 gmx_simdcall operator* (SimdFInt32 a, SimdFInt32 b)
 Multiply SIMD integers. More...
 
SIMD implementation integer (corresponding to float) comparisons, boolean, selection
static SimdFIBool gmx_simdcall operator== (SimdFInt32 a, SimdFInt32 b)
 Equality comparison of two integers corresponding to float values. More...
 
static SimdFIBool gmx_simdcall operator< (SimdFInt32 a, SimdFInt32 b)
 Less-than comparison of two SIMD integers corresponding to float values. More...
 
static SimdFIBool gmx_simdcall testBits (SimdFInt32 a)
 Check if any bit is set in each element. More...
 
static SimdFIBool gmx_simdcall operator&& (SimdFIBool a, SimdFIBool b)
 Logical AND on SimdFIBool. More...
 
static SimdFIBool gmx_simdcall operator|| (SimdFIBool a, SimdFIBool b)
 Logical OR on SimdFIBool. More...
 
static bool gmx_simdcall anyTrue (SimdFIBool a)
 Returns true if any of the boolean in x is True, otherwise 0. More...
 
static SimdFInt32 gmx_simdcall selectByMask (SimdFInt32 a, SimdFIBool mask)
 Select from gmx::SimdFInt32 variable where boolean is true. More...
 
static SimdFInt32 gmx_simdcall selectByNotMask (SimdFInt32 a, SimdFIBool mask)
 Select from gmx::SimdFInt32 variable where boolean is false. More...
 
static SimdFInt32 gmx_simdcall blend (SimdFInt32 a, SimdFInt32 b, SimdFIBool sel)
 Vector-blend SIMD integer selection. More...
 
Higher-level SIMD utilities accessing partial (half-width) SIMD doubles.

See the single-precision versions for documentation. Since double precision is typically half the width of single, this double version is likely only useful with 512-bit and larger implementations.

static SimdDouble gmx_simdcall loadDualHsimd (const double *m0, const double *m1)
 Load low & high parts of SIMD double from different locations. More...
 
static SimdDouble gmx_simdcall loadDuplicateHsimd (const double *m)
 Load half-SIMD-width double data, spread to both halves. More...
 
static SimdDouble gmx_simdcall loadU1DualHsimd (const double *m)
 Load two doubles, spread 1st in low half, 2nd in high half. More...
 
static void gmx_simdcall storeDualHsimd (double *m0, double *m1, SimdDouble a)
 Store low & high parts of SIMD double to different locations. More...
 
static void gmx_simdcall incrDualHsimd (double *m0, double *m1, SimdDouble a)
 Add each half of SIMD variable to separate memory adresses. More...
 
static void gmx_simdcall decrHsimd (double *m, SimdDouble a)
 Add the two halves of a SIMD double, subtract the sum from half-SIMD-width consecutive doubles in memory. More...
 
template<int align>
static void gmx_simdcall gatherLoadTransposeHsimd (const double *base0, const double *base1, std::int32_t offset[], SimdDouble *v0, SimdDouble *v1)
 Load 2 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH/2 offsets, transpose into SIMD double (low half from base0, high from base1). More...
 
static double gmx_simdcall reduceIncr4ReturnSumHsimd (double *m, SimdDouble v0, SimdDouble v1)
 Reduce the 4 half-SIMD-with doubles in 2 SIMD variables (sum halves), increment four consecutive doubles in memory, return sum. More...
 
static SimdDouble gmx_simdcall loadUNDuplicate4 (const double *m)
 Load N doubles and duplicate them 4 times each. More...
 
static SimdDouble gmx_simdcall load4DuplicateN (const double *m)
 Load 4 doubles and duplicate them N times each. More...
 
static SimdDouble gmx_simdcall loadU4NOffset (const double *m, int offset)
 Load doubles in blocks of 4 at fixed offsets. More...
 
Higher-level SIMD utilities accessing partial (half-width) SIMD floats.

These functions are optional. The are only useful for SIMD implementation where the width is 8 or larger, and where it would be inefficient to process 4*8, 8*8, or more, interactions in parallel.

Currently, only Intel provides very wide SIMD implementations, but these also come with excellent support for loading, storing, accessing and shuffling parts of the register in so-called 'lanes' of 4 bytes each. We can use this to load separate parts into the low/high halves of the register in the inner loop of the nonbonded kernel, which e.g. makes it possible to process 4*4 nonbonded interactions as a pattern of 2*8. We can also use implementations with width 16 or greater.

To make this more generic, when GMX_SIMD_HAVE_HSIMD_UTIL_REAL is 1, the SIMD implementation provides seven special routines that:

  • Load the low/high parts of a SIMD variable from different pointers
  • Load half the SIMD width from one pointer, and duplicate in low/high parts
  • Load two reals, put 1st one in all low elements, and 2nd in all high ones.
  • Store the low/high parts of a SIMD variable to different pointers
  • Subtract both SIMD halves from a single half-SIMD-width memory location.
  • Load aligned pairs (LJ parameters) from two base pointers, with a common offset list, and put these in the low/high SIMD halves.
  • Reduce each half of two SIMD registers (i.e., 4 parts in total), increment four adjacent memory positions, and return the total sum.

Remember: this is ONLY used when the native SIMD width is large. You will just waste time if you implement it for normal 16-byte SIMD architectures.

This is part of the new C++ SIMD interface, so these functions are only available when using C++. Since some Gromacs code reliying on the SIMD module is still C (not C++), we have kept the C-style naming for now - this will change once we are entirely C++.

static SimdFloat gmx_simdcall loadDualHsimd (const float *m0, const float *m1)
 Load low & high parts of SIMD float from different locations. More...
 
static SimdFloat gmx_simdcall loadDuplicateHsimd (const float *m)
 Load half-SIMD-width float data, spread to both halves. More...
 
static SimdFloat gmx_simdcall loadU1DualHsimd (const float *m)
 Load two floats, spread 1st in low half, 2nd in high half. More...
 
static void gmx_simdcall storeDualHsimd (float *m0, float *m1, SimdFloat a)
 Store low & high parts of SIMD float to different locations. More...
 
static void gmx_simdcall incrDualHsimd (float *m0, float *m1, SimdFloat a)
 Add each half of SIMD variable to separate memory adresses. More...
 
static void gmx_simdcall decrHsimd (float *m, SimdFloat a)
 Add the two halves of a SIMD float, subtract the sum from half-SIMD-width consecutive floats in memory. More...
 
template<int align>
static void gmx_simdcall gatherLoadTransposeHsimd (const float *base0, const float *base1, const std::int32_t offset[], SimdFloat *v0, SimdFloat *v1)
 Load 2 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH/2 offsets, transpose into SIMD float (low half from base0, high from base1). More...
 
static float gmx_simdcall reduceIncr4ReturnSumHsimd (float *m, SimdFloat v0, SimdFloat v1)
 Reduce the 4 half-SIMD-with floats in 2 SIMD variables (sum halves), increment four consecutive floats in memory, return sum. More...
 
static SimdFloat gmx_simdcall loadUNDuplicate4 (const float *m)
 Load N floats and duplicate them 4 times each. More...
 
static SimdFloat gmx_simdcall load4DuplicateN (const float *m)
 Load 4 floats and duplicate them N times each. More...
 
static SimdFloat gmx_simdcall loadU4NOffset (const float *m, int offset)
 Load floats in blocks of 4 at fixed offsets. More...
 
Single precision SIMD math functions
Note
In most cases you should use the real-precision functions instead.
static SimdFloat gmx_simdcall copysign (SimdFloat x, SimdFloat y)
 Composes floating point value with the magnitude of x and the sign of y. More...
 
static SimdFloat gmx_simdcall rsqrtIter (SimdFloat lu, SimdFloat x)
 Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD float. More...
 
static SimdFloat gmx_simdcall invsqrt (SimdFloat x)
 Calculate 1/sqrt(x) for SIMD float. More...
 
static void gmx_simdcall invsqrtPair (SimdFloat x0, SimdFloat x1, SimdFloat *out0, SimdFloat *out1)
 Calculate 1/sqrt(x) for two SIMD floats. More...
 
static SimdFloat gmx_simdcall rcpIter (SimdFloat lu, SimdFloat x)
 Perform one Newton-Raphson iteration to improve 1/x for SIMD float. More...
 
static SimdFloat gmx_simdcall inv (SimdFloat x)
 Calculate 1/x for SIMD float. More...
 
static SimdFloat gmx_simdcall operator/ (SimdFloat nom, SimdFloat denom)
 Division for SIMD floats. More...
 
static SimdFloat maskzInvsqrt (SimdFloat x, SimdFBool m)
 Calculate 1/sqrt(x) for masked entries of SIMD float. More...
 
static SimdFloat gmx_simdcall maskzInv (SimdFloat x, SimdFBool m)
 Calculate 1/x for SIMD float, masked version. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall sqrt (SimdFloat x)
 Calculate sqrt(x) for SIMD floats. More...
 
static SimdFloat gmx_simdcall log (SimdFloat x)
 SIMD float log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall exp2 (SimdFloat x)
 SIMD float 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall exp (SimdFloat x)
 SIMD float exp(x). More...
 
static SimdFloat gmx_simdcall erf (SimdFloat x)
 SIMD float erf(x). More...
 
static SimdFloat gmx_simdcall erfc (SimdFloat x)
 SIMD float erfc(x). More...
 
static void gmx_simdcall sincos (SimdFloat x, SimdFloat *sinval, SimdFloat *cosval)
 SIMD float sin & cos. More...
 
static SimdFloat gmx_simdcall sin (SimdFloat x)
 SIMD float sin(x). More...
 
static SimdFloat gmx_simdcall cos (SimdFloat x)
 SIMD float cos(x). More...
 
static SimdFloat gmx_simdcall tan (SimdFloat x)
 SIMD float tan(x). More...
 
static SimdFloat gmx_simdcall asin (SimdFloat x)
 SIMD float asin(x). More...
 
static SimdFloat gmx_simdcall acos (SimdFloat x)
 SIMD float acos(x). More...
 
static SimdFloat gmx_simdcall atan (SimdFloat x)
 SIMD float asin(x). More...
 
static SimdFloat gmx_simdcall atan2 (SimdFloat y, SimdFloat x)
 SIMD float atan2(y,x). More...
 
static SimdFloat gmx_simdcall pmeForceCorrection (SimdFloat z2)
 Calculate the force correction due to PME analytically in SIMD float. More...
 
static SimdFloat gmx_simdcall pmePotentialCorrection (SimdFloat z2)
 Calculate the potential correction due to PME analytically in SIMD float. More...
 
Double precision SIMD math functions
Note
In most cases you should use the real-precision functions instead.
static SimdDouble gmx_simdcall copysign (SimdDouble x, SimdDouble y)
 Composes floating point value with the magnitude of x and the sign of y. More...
 
static SimdDouble gmx_simdcall rsqrtIter (SimdDouble lu, SimdDouble x)
 Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD double. More...
 
static SimdDouble gmx_simdcall invsqrt (SimdDouble x)
 Calculate 1/sqrt(x) for SIMD double. More...
 
static void gmx_simdcall invsqrtPair (SimdDouble x0, SimdDouble x1, SimdDouble *out0, SimdDouble *out1)
 Calculate 1/sqrt(x) for two SIMD doubles. More...
 
static SimdDouble gmx_simdcall rcpIter (SimdDouble lu, SimdDouble x)
 Perform one Newton-Raphson iteration to improve 1/x for SIMD double. More...
 
static SimdDouble gmx_simdcall inv (SimdDouble x)
 Calculate 1/x for SIMD double. More...
 
static SimdDouble gmx_simdcall operator/ (SimdDouble nom, SimdDouble denom)
 Division for SIMD doubles. More...
 
static SimdDouble maskzInvsqrt (SimdDouble x, SimdDBool m)
 Calculate 1/sqrt(x) for masked entries of SIMD double. More...
 
static SimdDouble gmx_simdcall maskzInv (SimdDouble x, SimdDBool m)
 Calculate 1/x for SIMD double, masked version. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall sqrt (SimdDouble x)
 Calculate sqrt(x) for SIMD doubles. More...
 
static SimdDouble gmx_simdcall log (SimdDouble x)
 SIMD double log(x). This is the natural logarithm. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall exp2 (SimdDouble x)
 SIMD double 2^x. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall exp (SimdDouble x)
 SIMD double exp(x). More...
 
static SimdDouble gmx_simdcall erf (SimdDouble x)
 SIMD double erf(x). More...
 
static SimdDouble gmx_simdcall erfc (SimdDouble x)
 SIMD double erfc(x). More...
 
static void gmx_simdcall sincos (SimdDouble x, SimdDouble *sinval, SimdDouble *cosval)
 SIMD double sin & cos. More...
 
static SimdDouble gmx_simdcall sin (SimdDouble x)
 SIMD double sin(x). More...
 
static SimdDouble gmx_simdcall cos (SimdDouble x)
 SIMD double cos(x). More...
 
static SimdDouble gmx_simdcall tan (SimdDouble x)
 SIMD double tan(x). More...
 
static SimdDouble gmx_simdcall asin (SimdDouble x)
 SIMD double asin(x). More...
 
static SimdDouble gmx_simdcall acos (SimdDouble x)
 SIMD double acos(x). More...
 
static SimdDouble gmx_simdcall atan (SimdDouble x)
 SIMD double asin(x). More...
 
static SimdDouble gmx_simdcall atan2 (SimdDouble y, SimdDouble x)
 SIMD double atan2(y,x). More...
 
static SimdDouble gmx_simdcall pmeForceCorrection (SimdDouble z2)
 Calculate the force correction due to PME analytically in SIMD double. More...
 
static SimdDouble gmx_simdcall pmePotentialCorrection (SimdDouble z2)
 Calculate the potential correction due to PME analytically in SIMD double. More...
 
SIMD math functions for double prec. data, single prec. accuracy
Note
In some cases we do not need full double accuracy of individual SIMD math functions, although the data is stored in double precision SIMD registers. This might be the case for special algorithms, or if the architecture does not support single precision. Since the full double precision evaluation of math functions typically require much more expensive polynomial approximations these functions implement the algorithms used in the single precision SIMD math functions, but they operate on double precision SIMD variables.
static SimdDouble gmx_simdcall invsqrtSingleAccuracy (SimdDouble x)
 Calculate 1/sqrt(x) for SIMD double, but in single accuracy. More...
 
static SimdDouble maskzInvsqrtSingleAccuracy (SimdDouble x, SimdDBool m)
 1/sqrt(x) for masked-in entries of SIMD double, but in single accuracy. More...
 
static void gmx_simdcall invsqrtPairSingleAccuracy (SimdDouble x0, SimdDouble x1, SimdDouble *out0, SimdDouble *out1)
 Calculate 1/sqrt(x) for two SIMD doubles, but single accuracy. More...
 
static SimdDouble gmx_simdcall invSingleAccuracy (SimdDouble x)
 Calculate 1/x for SIMD double, but in single accuracy. More...
 
static SimdDouble gmx_simdcall maskzInvSingleAccuracy (SimdDouble x, SimdDBool m)
 1/x for masked entries of SIMD double, single accuracy. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall sqrtSingleAccuracy (SimdDouble x)
 Calculate sqrt(x) (correct for 0.0) for SIMD double, with single accuracy. More...
 
static SimdDouble gmx_simdcall logSingleAccuracy (SimdDouble x)
 SIMD log(x). Double precision SIMD data, single accuracy. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall exp2SingleAccuracy (SimdDouble x)
 SIMD 2^x. Double precision SIMD, single accuracy. More...
 
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall expSingleAccuracy (SimdDouble x)
 SIMD exp(x). Double precision SIMD, single accuracy. More...
 
static SimdDouble gmx_simdcall erfSingleAccuracy (SimdDouble x)
 SIMD erf(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall erfcSingleAccuracy (SimdDouble x)
 SIMD erfc(x). Double precision SIMD data, single accuracy. More...
 
static void gmx_simdcall sinCosSingleAccuracy (SimdDouble x, SimdDouble *sinval, SimdDouble *cosval)
 SIMD sin & cos. Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall sinSingleAccuracy (SimdDouble x)
 SIMD sin(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall cosSingleAccuracy (SimdDouble x)
 SIMD cos(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall tanSingleAccuracy (SimdDouble x)
 SIMD tan(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall asinSingleAccuracy (SimdDouble x)
 SIMD asin(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall acosSingleAccuracy (SimdDouble x)
 SIMD acos(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall atanSingleAccuracy (SimdDouble x)
 SIMD asin(x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall atan2SingleAccuracy (SimdDouble y, SimdDouble x)
 SIMD atan2(y,x). Double precision SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall pmeForceCorrectionSingleAccuracy (SimdDouble z2)
 Analytical PME force correction, double SIMD data, single accuracy. More...
 
static SimdDouble gmx_simdcall pmePotentialCorrectionSingleAccuracy (SimdDouble z2)
 Analytical PME potential correction, double SIMD data, single accuracy. More...
 
SIMD4 math functions
Note
Only a subset of the math functions are implemented for SIMD4.
static Simd4Float gmx_simdcall rsqrtIter (Simd4Float lu, Simd4Float x)
 Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD4 float. More...
 
static Simd4Float gmx_simdcall invsqrt (Simd4Float x)
 Calculate 1/sqrt(x) for SIMD4 float. More...
 
static Simd4Double gmx_simdcall rsqrtIter (Simd4Double lu, Simd4Double x)
 Perform one Newton-Raphson iteration to improve 1/sqrt(x) for SIMD4 double. More...
 
static Simd4Double gmx_simdcall invsqrt (Simd4Double x)
 Calculate 1/sqrt(x) for SIMD4 double. More...
 
static Simd4Double gmx_simdcall invsqrtSingleAccuracy (Simd4Double x)
 Calculate 1/sqrt(x) for SIMD4 double, but in single accuracy. More...
 

Overloads for converting a value of a given type to a string.

Exceptions
std::bad_allocif out of memory.
static std::string toString (bool t)
 
static std::string toString (int t)
 
static std::string toString (int64_t t)
 
static std::string toString (float t)
 
static std::string toString (double t)
 
static std::string toString (std::string t)
 

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.
 
constexpr int c_numFtypesOnGpu = 8
 The number on bonded function types supported on GPUs.
 
constexpr std::array< int,
c_numFtypesOnGpu
ftypesOnGpu
 List of all bonded function types supported on GPUs. More...
 
static const int simd_width = 4
 Define simd_width for memory allocation used for SIMD code.
 
static const int align_bytes = 128
 Align to 128 bytes, consistent with the current implementation of AlignedAllocator, which currently forces 128 byte alignment.
 
integrator_t do_md
 MD simulations.
 
integrator_t do_mimic
 MD simulations.
 
integrator_t do_rerun
 MD simulations.
 
constexpr bool BUGFREE_NOEXCEPT_STRING = std::is_nothrow_move_assignable<std::string>::value
 Work-around for GCC bug 58265.
 
integrator_t do_tpi
 Test particle insertion.
 
static const int c_simdBestPairAlignmentDouble = 2
 Best alignment to use for aligned pairs of double data. More...
 
static const int c_simdBestPairAlignmentFloat = 2
 Best alignment to use for aligned pairs of float data. More...
 

SIMD data types

The actual storage of these types is implementation dependent. The documentation is generated from the reference implementation, but for normal usage this will likely not be what you are using.

typedef SimdFloat SimdReal
 Real precision floating-point SIMD datatype. More...
 
typedef SimdFBool SimdBool
 Boolean SIMD type for usage with SimdReal. More...
 
typedef SimdFInt32 SimdInt32
 32-bit integer SIMD type. More...
 
typedef SimdFIBool SimdIBool
 Boolean SIMD type for usage with SimdInt32. More...
 
typedef Simd4Float Simd4Real
 Real precision floating-point SIMD4 datatype. More...
 
typedef Simd4FBool Simd4Bool
 Boolean SIMD4 type for usage with SimdReal. More...
 
const int c_simdBestPairAlignment = c_simdBestPairAlignmentFloat
 

High-level SIMD proxy objects to disambiguate load/set operations

using Simd4NFloat = SimdFloat
 
using Simd4NDouble = SimdDouble
 
using Simd4NReal = Simd4NFloat
 
template<typename T >
static T load (const typename internal::SimdTraits< T >::type *m)
 Load function that returns SIMD or scalar. More...
 
template<typename T >
static T load (const typename std::enable_if< std::is_arithmetic< T >::value, T >::type *m)
 
template<typename T , size_t N>
static T gmx_simdcall load (const AlignedArray< typename internal::SimdTraits< T >::type, N > &m)
 
template<typename T >
static T loadU (const typename internal::SimdTraits< T >::type *m)
 Load function that returns SIMD or scalar based on template argument. More...
 
template<typename T >
static T loadU (const typename std::enable_if< std::is_arithmetic< T >::value, T >::type *m)
 
template<typename T , size_t N>
static T gmx_simdcall loadU (const AlignedArray< typename internal::SimdTraits< T >::type, N > &m)
 
static const SimdSetZeroProxy
gmx_simdcall 
setZero ()
 Helper function to set any SIMD or scalar variable to zero. More...
 
template<typename T >
load (const typename internal::Simd4Traits< T >::type *m)
 
template<typename T >
loadU (const typename internal::Simd4Traits< T >::type *m)
 
static Simd4NFloat gmx_simdcall loadUNDuplicate4 (const float *f)
 
static Simd4NFloat gmx_simdcall load4DuplicateN (const float *f)
 
static Simd4NFloat gmx_simdcall loadU4NOffset (const float *f, int)
 
static Simd4NDouble gmx_simdcall loadUNDuplicate4 (const double *f)
 
static Simd4NDouble gmx_simdcall load4DuplicateN (const double *f)
 
static Simd4NDouble gmx_simdcall loadU4NOffset (const double *f, int)
 

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.

using gmx::BoxMatrix = typedef std::array <std::array<real, 3 >, 3 >

A 3x3 matrix data type useful for simulation boxes.

Todo:
Implement a full replacement for C-style real[DIM][DIM]

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.

using gmx::index = typedef std::ptrdiff_t

Integer type for indexing into arrays or vectors.

Same as ptrdiff_t.

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.

Boolean SIMD4 type for usage with SimdReal.

This type is only available if GMX_SIMD4_HAVE_REAL is 1.

If GMX_DOUBLE is 1, this will be set to Simd4DBool internally, otherwise Simd4FBool. This is necessary since some SIMD implementations use bitpatterns for marking truth, so single- vs. double precision booleans are not necessarily exchangable. As long as you just use this type you will not have to worry about precision.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

Real precision floating-point SIMD4 datatype.

This type is only available if GMX_SIMD4_HAVE_REAL is 1.

Simd4Double if GMX_DOUBLE is 1, otherwise Simd4Float.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

Boolean SIMD type for usage with SimdReal.

This type is only available if GMX_SIMD_HAVE_REAL is 1.

If GMX_DOUBLE is 1, this will be set to SimdDBool internally, otherwise SimdFBool. This is necessary since some SIMD implementations use bitpatterns for marking truth, so single- vs. double precision booleans are not necessarily exchangable. As long as you just use this type you will not have to worry about precision.

See SimdIBool for an explanation of real vs. integer booleans.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

Boolean SIMD type for usage with SimdInt32.

This type is only available if GMX_SIMD_HAVE_INT32_ARITHMETICS is 1.

If GMX_DOUBLE is 1, this will be set to SimdDIBool internally, otherwise SimdFIBool. This is necessary since some SIMD implementations use bitpatterns for marking truth, so single- vs. double precision booleans are not necessarily exchangable, and while a double-precision boolean might be represented with a 64-bit mask, the corresponding integer might only use a 32-bit mask.

We provide conversion routines for these cases, so the only thing you need to keep in mind is to use SimdBool when working with SimdReal while you pick SimdIBool when working with SimdInt32 .

To convert between them, use cvtB2IB and cvtIB2B.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

32-bit integer SIMD type.

If GMX_DOUBLE is 1, this will be set to SimdDInt32 internally, otherwise SimdFInt32. This might seem a strange implementation detail, but it is because some SIMD implementations use different types/widths of integers registers when converting from double vs. single precision floating point. As long as you just use this type you will not have to worry about precision.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

Real precision floating-point SIMD datatype.

This type is only available if GMX_SIMD_HAVE_REAL is 1.

SimdDouble if GMX_DOUBLE is 1, otherwise SimdFloat.

Note
This variable cannot be placed inside other structures or classes, since some compilers (including at least clang-3.7) appear to lose the alignment. This is likely particularly severe when allocating such memory on the heap, but it occurs for stack structures too.

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::CheckpointSignal
strong

Checkpoint signals.

Signals set and read by CheckpointHandler. Possible signals include

  • nothing to signal
  • do checkpoint (at next NS step)

Tells make_at2con how to treat flexible constraints.

Enumerator
Include 

Include all flexible constraints.

Exclude 

Exclude all flexible constraints.

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.

Output format for help writing.

Enumerator
eHelpOutputFormat_Console 

Plain text directly on the console.

eHelpOutputFormat_Rst 

reStructuredText for online manual and man pages.

eHelpOutputFormat_Other 

Used for extensions in other modules.

eHelpOutputFormat_NR 

Used for the number of output formats.

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.

Flags for options.

These flags are not part of the public interface, even though they are in an installed header. They are needed in a few template class implementations.

Todo:
The flags related to default values are confusing, consider reorganizing them.
Enumerator
efOption_Set 

Option has been set.

efOption_HasDefaultValue 

The current value of the option is a programmatic default value.

efOption_ExplicitDefaultValue 

An explicit default value has been provided for the option.

efOption_ClearOnNextSet 

Next assignment to the option clears old values.

This flag is set when a new option source starts, such that values from the new source will overwrite old ones.

efOption_Required 

Option is required to be set.

efOption_MultipleTimes 

Option can be specified multiple times.

efOption_Hidden 

Option is hidden from standard help.

efOption_Vector 

Option value is a vector, but a single value is also accepted.

See Also
AbstractOption::setVector()
efOption_DefaultValueIfSetExists 

Option has a defaultValueIfSet() specified.

efOption_NoDefaultValue 

Option does not support default values.

efOption_DontCheckMinimumCount 

Storage object does its custom checking for minimum value count.

If this flag is set, the class derived from OptionStorageTemplate should implement processSetValues(), processAll(), and possible other functions it provides such that it always fails if not enough values are provided. This is useful to override the default check, which is done in OptionStorageTemplate::processSet().

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.

enum gmx::ResetSignal
strong

Reset signals.

Signals set and read by ResetHandler. Possible signals include

  • nothing to signal
  • reset counters (as soon as signal is received)
enum gmx::SimdType
strong

Enumerated options for SIMD architectures.

Enumerator
None 

Disable all SIMD support.

Reference 

Gromacs reference software SIMD.

Generic 

Placeholder for future support for gcc generic SIMD.

X86_Sse2 

SSE2.

X86_Sse4_1 

SSE4.1.

X86_Avx128Fma 

128-bit Avx with FMA (Amd)

X86_Avx 

256-bit Avx

X86_Avx2 

AVX2.

X86_Avx2_128 

128-bit AVX2, better than 256-bit for AMD Ryzen

X86_Avx512 

AVX_512.

X86_Avx512Knl 

AVX_512_KNL.

X86_Mic 

Knight's corner.

Arm_Neon 

32-bit ARM NEON

Arm_NeonAsimd 

64-bit ARM AArch64 Advanced SIMD

Ibm_Vmx 

IBM VMX SIMD (Altivec on Power6 and later)

Ibm_Vsx 

IBM VSX SIMD (Power7 and later)

Fujitsu_HpcAce 

Fujitsu K-computer.

enum gmx::StopSignal
strong

Stop signals.

Signals that stop conditions can send to all ranks. Possible signals include

  • nothing to signal
  • stop at the next neighbor-searching step
  • stop as soon as signal is received

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 SimdFloat gmx_simdcall gmx::abs ( SimdFloat  a)
inlinestatic

SIMD float Floating-point abs().

Parameters
aany floating point values
Returns
abs(a) for each element.
static SimdDouble gmx_simdcall gmx::abs ( SimdDouble  a)
inlinestatic

SIMD double floating-point fabs().

Parameters
aany floating point values
Returns
fabs(a) for each element.
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.
static bool gmx::addMessageIfNotSupported ( ArrayRef< const std::string >  errorReasons,
std::string *  error 
)
static

Help build a descriptive message in error if there are errorReasons why bondeds on a GPU are not supported.

Returns
Whether the lack of errorReasons indicate there is support.
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 SimdFloat gmx_simdcall gmx::andNot ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Bitwise andnot for SIMD float.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
(~data1) & data2
static SimdDouble gmx_simdcall gmx::andNot ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Bitwise andnot for SIMD double.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
(~data1) & data2
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 SimdFInt32 gmx_simdcall gmx::andNot ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Integer SIMD bitwise not/complement.

Available if GMX_SIMD_HAVE_FINT32_LOGICAL is 1.

Note
You can not use this operation directly to select based on a boolean SIMD variable, since booleans are separate from integer SIMD. If that is what you need, have a look at gmx::selectByMask instead.
Parameters
ainteger SIMD
binteger SIMD
Returns
(~a) & b
static SimdDInt32 gmx_simdcall gmx::andNot ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Integer SIMD bitwise not/complement.

Available if GMX_SIMD_HAVE_DINT32_LOGICAL is 1.

Note
You can not use this operation directly to select based on a boolean SIMD variable, since booleans are separate from integer SIMD. If that is what you need, have a look at gmx::selectByMask instead.
Parameters
ainteger SIMD
binteger SIMD
Returns
(~a) & b
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 bool gmx_simdcall gmx::anyTrue ( SimdFBool  a)
inlinestatic

Returns non-zero if any of the boolean in SIMD a is True, otherwise 0.

Parameters
aLogical variable.
Returns
true if any element in a is true, otherwise false.

The actual return value for truth will depend on the architecture, so any non-zero value is considered truth.

static bool gmx_simdcall gmx::anyTrue ( SimdDBool  a)
inlinestatic

Returns non-zero if any of the boolean in SIMD a is True, otherwise 0.

Parameters
aLogical variable.
Returns
true if any element in a is true, otherwise false.

The actual return value for truth will depend on the architecture, so any non-zero value is considered truth.

static bool gmx_simdcall gmx::anyTrue ( SimdFIBool  a)
inlinestatic

Returns true if any of the boolean in x is True, otherwise 0.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

The actual return value for "any true" will depend on the architecture. Any non-zero value should be considered truth.

Parameters
aSIMD boolean
Returns
True if any of the elements in a is true, otherwise 0.
static bool gmx_simdcall gmx::anyTrue ( SimdDIBool  a)
inlinestatic

Returns true if any of the boolean in x is True, otherwise 0.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

The actual return value for "any true" will depend on the architecture. Any non-zero value should be considered truth.

Parameters
aSIMD boolean
Returns
True if any of the elements in a is true, otherwise 0.
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.
static SimdFloat gmx_simdcall gmx::blend ( SimdFloat  a,
SimdFloat  b,
SimdFBool  sel 
)
inlinestatic

Vector-blend SIMD float selection.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
For each element, select b if sel is true, a otherwise.
static SimdDouble gmx_simdcall gmx::blend ( SimdDouble  a,
SimdDouble  b,
SimdDBool  sel 
)
inlinestatic

Vector-blend SIMD double selection.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
For each element, select b if sel is true, a otherwise.
static SimdFInt32 gmx_simdcall gmx::blend ( SimdFInt32  a,
SimdFInt32  b,
SimdFIBool  sel 
)
inlinestatic

Vector-blend SIMD integer selection.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
For each element, select b if sel is true, a otherwise.
static SimdDInt32 gmx_simdcall gmx::blend ( SimdDInt32  a,
SimdDInt32  b,
SimdDIBool  sel 
)
inlinestatic

Vector-blend SIMD integer selection.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aFirst source
bSecond source
selBoolean selector
Returns
For each element, select b if sel is true, a otherwise.
bool gmx::buildSupportsGpuBondeds ( std::string *  error)

Checks whether the GROMACS build allows to compute bonded interactions on a GPU.

Parameters
[out]errorIf non-null, the diagnostic message when bondeds cannot run on a GPU.
Returns
true when this build can run bonded interactions on a GPU, false otherwise.
Exceptions
std::bad_allocwhen out of memory.
static void gmx_simdcall gmx::calc_dr_x_f_simd ( int  b0,
int  b1,
const int *  bla,
const rvec *__restrict  x,
const rvec *__restrict  f,
const real *__restrict  blc,
const real pbc_simd,
rvec *__restrict  r,
real *__restrict  rhs,
real *__restrict  sol 
)
static

Calculate the constraint distance vectors r to project on from x.

Determine the right-hand side of the matrix equation using quantity f. This function only differs from calc_dr_x_xp_simd below in that no constraint length is subtracted and no PBC is used for f.

static void gmx_simdcall gmx::calc_dr_x_xp_simd ( int  b0,
int  b1,
const int *  bla,
const rvec *__restrict  x,
const rvec *__restrict  xp,
const real *__restrict  bllen,
const real *__restrict  blc,
const real pbc_simd,
rvec *__restrict  r,
real *__restrict  rhs,
real *__restrict  sol 
)
static

Calculate the constraint distance vectors r to project on from x.

Determine the right-hand side of the matrix equation using coordinates xp.

template<class T >
void gmx::changePinningPolicy ( HostVector< T > *  v,
PinningPolicy  pinningPolicy 
)

Helper function for changing the pinning policy of a HostVector.

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 int gmx::checkGpu ( size_t  deviceId,
const gmx_device_info_t *  deviceInfo 
)
static

Check whether the ocl_gpu_device is suitable for use by mdrun.

Runs sanity checks: checking that the runtime can compile a dummy kernel and this can be executed; Runs compatibility checks verifying the device OpenCL version requirement and vendor/OS support.

Parameters
[in]deviceIdThe runtime-reported numeric ID of the device.
[in]deviceInfoThe device info pointer.
Returns
An e_gpu_detect_res_t to indicate how the GPU coped with the sanity and compatibility check.
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
real gmx::computeMaxUpdateGroupRadius ( const gmx_mtop_t &  mtop,
gmx::ArrayRef< const RangePartitioning >  updateGroups,
real  temperature 
)

Returns the maximum update group radius.

Note
When updateGroups is empty, 0 is returned.
Parameters
[in]mtopThe system topology
[in]updateGroupsList of update group, size should match the number of moltypes in mtop or be 0
[in]temperatureThe maximum reference temperature, pass -1 when unknown or not applicable
bool gmx::constrain_lincs ( bool  computeRmsd,
const t_inputrec &  ir,
int64_t  step,
Lincs *  lincsd,
const t_mdatoms md,
const t_commrec *  cr,
const gmx_multisim_t *  ms,
const rvec *  x,
rvec *  xprime,
rvec *  min_proj,
matrix  box,
t_pbc pbc,
real  lambda,
real dvdlambda,
real  invdt,
rvec *  v,
bool  bCalcVir,
tensor  vir_r_m_dr,
ConstraintVariable  econq,
t_nrnb *  nrnb,
int  maxwarn,
int *  warncount 
)

Applies LINCS constraints.

Returns
true if the constraining succeeded.
template<int numPartnerAtoms>
static real gmx::constraintGroupRadius ( const gmx_moltype_t moltype,
gmx::ArrayRef< const t_iparams >  iparams,
const int  centralAtom,
const t_blocka &  at2con,
const std::unordered_multimap< int, int > &  angleIndices,
const real  constraintLength,
const real  temperature 
)
static

When possible, computes the maximum radius of constrained atom in an update group.

Supports groups with 2 or 3 atoms where all partner atoms are connected to each other by angle potentials. The temperature is used to compute a radius that is not exceeded with a chance of 10^-9. Note that this computation assumes there are no other strong forces working on these angular degrees of freedom. The return value is -1 when all partners are not connected to each other by one angle potential, when a potential is perturbed or when an angle could reach more than 180 degrees.

static CheckpointSignal gmx::convertToCheckpointSignal ( signed char  sig)
inlinestatic

Convert signed char (as used by SimulationSignal) to CheckpointSignal enum.

Expected values are sig == 0 – no signal sig >= 1 – signal received

static ResetSignal gmx::convertToResetSignal ( signed char  sig)
inlinestatic

Convert signed char (as used by SimulationSignal) to ResetSignal enum.

Expected values are sig == 0 – no signal sig >= 1 – signal received

static StopSignal gmx::convertToStopSignal ( signed char  sig)
inlinestatic

Convert signed char (as used by SimulationSignal) to StopSignal enum.

  • Expected values are sig == 0 – no signal sig >= 1 – stop at next NS sig <= -1 – stop asap
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 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.

void gmx::cshake ( const int  iatom[],
int  ncon,
int *  nnit,
int  maxnit,
const real  constraint_distance_squared[],
real  positions[],
const real  initial_displacements[],
const real  half_of_reduced_mass[],
real  omega,
const real  invmass[],
const real  distance_squared_tolerance[],
real  scaled_lagrange_multiplier[],
int *  nerror 
)

Inner kernel for SHAKE constraints.

Regular iterative shake.

Original implementation from R.C. van Schaik and W.F. van Gunsteren (ETH Zuerich, June 1992), adapted for GROMACS by David van der Spoel November 1992.

The algorithm here is based section five of Ryckaert, Ciccotti and Berendsen, J Comp Phys, 23, 327, 1977.

Parameters
[in]iatomMini-topology of triples of constraint type (unused in this function) and indices of the two atoms involved
[in]nconNumber of constraints
[out]nnitNumber of iterations performed
[in]maxnitMaximum number of iterations permitted
[in]constraint_distance_squaredThe objective value for each constraint
[in,out]positionsThe initial (and final) values of the positions of all atoms
[in]initial_displacementsThe initial displacements of each constraint
[in]half_of_reduced_massHalf of the reduced mass for each constraint
[in]omegaSHAKE over-relaxation factor (set non-1.0 by using shake-sor=yes in the .mdp, but there is no documentation anywhere)
[in]invmassInverse mass of each atom
[in]distance_squared_toleranceMultiplicative tolerance on the difference in the square of the constrained distance (see code)
[out]scaled_lagrange_multiplierScaled Lagrange multiplier for each constraint (-2 * eta from p. 336 of the paper, divided by the constraint distance)
[out]nerrorZero upon success, returns one more than the index of the problematic constraint if the input was malformed
Todo:
Make SHAKE use better data structures, in particular for iatom.
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 SimdFIBool gmx_simdcall gmx::cvtB2IB ( SimdFBool  a)
inlinestatic

Convert from single precision boolean to corresponding integer boolean.

Parameters
aSIMD floating-point boolean
Returns
SIMD integer boolean
static SimdDIBool gmx_simdcall gmx::cvtB2IB ( SimdDBool  a)
inlinestatic

Convert from double precision boolean to corresponding integer boolean.

Parameters
aSIMD floating-point boolean
Returns
SIMD integer boolean
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 SimdFloat gmx_simdcall gmx::cvtD2F ( SimdDouble  d)
inlinestatic

Convert SIMD double to float.

This version is available if GMX_SIMD_FLOAT_WIDTH is identical to GMX_SIMD_DOUBLE_WIDTH.

Float/double conversions are complex since the SIMD width could either be different (e.g. on x86) or identical (e.g. IBM QPX). This means you will need to check for the width in the code, and have different code paths.

Parameters
dDouble-precision SIMD variable
Returns
Single-precision SIMD variable of the same width
static SimdFloat gmx_simdcall gmx::cvtDD2F ( SimdDouble  d0,
SimdDouble  d1 
)
inlinestatic

Convert SIMD double to float.

This version is available if GMX_SIMD_FLOAT_WIDTH is twice as large as GMX_SIMD_DOUBLE_WIDTH.

Float/double conversions are complex since the SIMD width could either be different (e.g. on x86) or identical (e.g. IBM QPX). This means you will need to check for the width in the code, and have different code paths.

Parameters
d0Double-precision SIMD variable, first half of values to put in f.
d1Double-precision SIMD variable, second half of values to put in f.
Returns
Single-precision SIMD variable with all values.
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 SimdDouble gmx_simdcall gmx::cvtF2D ( SimdFloat  f)
inlinestatic

Convert SIMD float to double.

This version is available if GMX_SIMD_FLOAT_WIDTH is identical to GMX_SIMD_DOUBLE_WIDTH.

Float/double conversions are complex since the SIMD width could either be different (e.g. on x86) or identical (e.g. IBM QPX). This means you will need to check for the width in the code, and have different code paths.

Parameters
fSingle-precision SIMD variable
Returns
Double-precision SIMD variable of the same width
static void gmx_simdcall gmx::cvtF2DD ( SimdFloat  f,
SimdDouble *  d0,
SimdDouble *  d1 
)
inlinestatic

Convert SIMD float to double.

This version is available if GMX_SIMD_FLOAT_WIDTH is twice as large as GMX_SIMD_DOUBLE_WIDTH.

Float/double conversions are complex since the SIMD width could either be different (e.g. on x86) or identical (e.g. IBM QPX). This means you will need to check for the width in the code, and have different code paths.

Parameters
fSingle-precision SIMD variable
[out]d0Double-precision SIMD variable, first half of values from f.
[out]d1Double-precision SIMD variable, second half of values from f.
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 SimdFloat gmx_simdcall gmx::cvtI2R ( SimdFInt32  a)
inlinestatic

Convert integer to single precision floating point.

Parameters
aSIMD integer
Returns
SIMD floating-point
static SimdDouble gmx_simdcall gmx::cvtI2R ( SimdDInt32  a)
inlinestatic

Convert integer to double precision floating point.

Parameters
aSIMD integer
Returns
SIMD floating-point
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 SimdFBool gmx_simdcall gmx::cvtIB2B ( SimdFIBool  a)
inlinestatic

Convert from integer boolean to corresponding single precision boolean.

Parameters
aSIMD integer boolean
Returns
SIMD floating-point boolean
static SimdDBool gmx_simdcall gmx::cvtIB2B ( SimdDIBool  a)
inlinestatic

Convert from integer boolean to corresponding double precision boolean.

Parameters
aSIMD integer boolean
Returns
SIMD floating-point boolean
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 SimdFInt32 gmx_simdcall gmx::cvtR2I ( SimdFloat  a)
inlinestatic

Round single precision floating point to integer.

Parameters
aSIMD floating-point
Returns
SIMD integer, rounded to nearest integer.
Note
Round mode is implementation defined. The only guarantee is that it is consistent between rounding functions (round, cvtR2I).
static SimdDInt32 gmx_simdcall gmx::cvtR2I ( SimdDouble  a)
inlinestatic

Round double precision floating point to integer.

Parameters
aSIMD floating-point
Returns
SIMD integer, rounded to nearest integer.
Note
Round mode is implementation defined. The only guarantee is that it is consistent between rounding functions (round, cvtR2I).
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.
static SimdFInt32 gmx_simdcall gmx::cvttR2I ( SimdFloat  a)
inlinestatic

Truncate single precision floating point to integer.

Parameters
aSIMD floating-point
Returns
SIMD integer, truncated to nearest integer.
static SimdDInt32 gmx_simdcall gmx::cvttR2I ( SimdDouble  a)
inlinestatic

Truncate double precision floating point to integer.

Parameters
aSIMD floating-point
Returns
SIMD integer, truncated to nearest integer.
bool gmx::decideWhetherToUseGpusForBonded ( bool  useGpuForNonbonded,
bool  useGpuForPme,
bool  usingVerletScheme,
TaskTarget  bondedTarget,
bool  canUseGpuForBonded,
bool  usingLJPme,
bool  usingElecPmeOrEwald,
int  numPmeRanksPerSimulation,
bool  gpusWereDetected 
)

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

Parameters
[in]useGpuForNonbondedWhether GPUs will be used for nonbonded interactions.
[in]useGpuForPmeWhether GPUs will be used for PME interactions.
[in]usingVerletSchemeWhether the nonbondeds are using the Verlet scheme.
[in]bondedTargetThe user's choice for mdrun -bonded for where to assign tasks.
[in]canUseGpuForBondedWhether the bonded interactions can run on a GPU
[in]usingLJPmeWhether Vdw interactions use LJ-PME.
[in]usingElecPmeOrEwaldWhether a PME or Ewald type method is used for electrostatics.
[in]numPmeRanksPerSimulationThe number of PME ranks in each simulation, can be -1 for auto.
[in]gpusWereDetectedWhether compatible GPUs were detected on any node.
Returns
Whether the simulation will run bondeded tasks on GPUs.
Exceptions
std::bad_allocIf out of memory InconsistentInputError If the user requirements are inconsistent.
bool gmx::decideWhetherToUseGpusForNonbonded ( TaskTarget  nonbondedTarget,
const std::vector< int > &  userGpuTaskAssignment,
EmulateGpuNonbonded  emulateGpuNonbonded,
bool  buildSupportsNonbondedOnGpu,
bool  usingVerletScheme,
bool  nonbondedOnGpuIsUseful,
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]buildSupportsNonbondedOnGpuWhether GROMACS was build with GPU support.
[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 ( TaskTarget  nonbondedTarget,
const std::vector< int > &  gpuIdsToUse,
const std::vector< int > &  userGpuTaskAssignment,
EmulateGpuNonbonded  emulateGpuNonbonded,
bool  buildSupportsNonbondedOnGpu,
bool  usingVerletScheme,
bool  nonbondedOnGpuIsUseful,
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]buildSupportsNonbondedOnGpuWhether GROMACS was built with GPU support.
[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 ( bool  useGpuForNonbonded,
TaskTarget  pmeTarget,
const std::vector< int > &  userGpuTaskAssignment,
bool  canUseGpuForPme,
int  numRanksPerSimulation,
int  numPmeRanksPerSimulation,
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 ( bool  useGpuForNonbonded,
TaskTarget  pmeTarget,
const std::vector< int > &  gpuIdsToUse,
const std::vector< int > &  userGpuTaskAssignment,
bool  canUseGpuForPme,
int  numRanksPerSimulation,
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.
static void gmx_simdcall gmx::decrHsimd ( double *  m,
SimdDouble  a 
)
inlinestatic

Add the two halves of a SIMD double, subtract the sum from half-SIMD-width consecutive doubles in memory.

Parameters
mhalf-width aligned memory, from which sum of the halves will be subtracted.
aSIMD variable. Upper & lower halves will first be added.

If the SIMD width is 8 and contains [a b c d e f g h], the memory will be modified to [m[0]-(a+e) m[1]-(b+f) m[2]-(c+g) m[3]-(d+h)].

The memory must be aligned to half SIMD width.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static void gmx_simdcall gmx::decrHsimd ( float *  m,
SimdFloat  a 
)
inlinestatic

Add the two halves of a SIMD float, subtract the sum from half-SIMD-width consecutive floats in memory.

Parameters
mhalf-width aligned memory, from which sum of the halves will be subtracted.
aSIMD variable. Upper & lower halves will first be added.

If the SIMD width is 8 and contains [a b c d e f g h], the memory will be modified to [m[0]-(a+e) m[1]-(b+f) m[2]-(c+g) m[3]-(d+h)].

The memory must be aligned to half SIMD width.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

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.
constexpr int32_t gmx::exactDiv ( int32_t  a,
int32_t  b 
)

Exact integer division, 32bit.

Parameters
adividend. Function asserts that it is a multiple of divisor
bdivisor
Returns
quotient of division
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.
template<int index>
static std::int32_t gmx_simdcall gmx::extract ( SimdFInt32  a)
inlinestatic

Extract element with index i from gmx::SimdFInt32.

Available if GMX_SIMD_HAVE_FINT32_EXTRACT is 1.

Template Parameters
indexCompile-time constant, position to extract (first position is 0)
Parameters
aSIMD variable from which to extract value.
Returns
Single integer from position index in SIMD variable.
template<int index>
static std::int32_t gmx_simdcall gmx::extract ( SimdDInt32  a)
inlinestatic

Extract element with index i from gmx::SimdDInt32.

Available if GMX_SIMD_HAVE_DINT32_EXTRACT is 1.

Template Parameters
indexCompile-time constant, position to extract (first position is 0)
Parameters
aSIMD variable from which to extract value.
Returns
Single integer from position index in SIMD variable.
GpuTasksOnRanks gmx::findAllGpuTasksOnThisNode ( ArrayRef< const GpuTask >  gpuTasksOnThisRank,
const PhysicalNodeCommunicator &  physicalNodeComm 
)

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.

std::string gmx::findLibraryFile ( const std::string &  filename,
bool  bAddCWD = true,
bool  bFatal = true 
)

Finds full path for a library file.

Searches in the configured library directories for filename. If bAddCWD is true, searches first in the current directory. Fatal error results if the file is not found in any location and bFatal is true.

std::string gmx::findLibraryFile ( const char *  filename,
bool  bAddCWD = true,
bool  bFatal = true 
)

Finds full path for a library file.

Searches in the configured library directories for filename. If bAddCWD is true, searches first in the current directory. Fatal error results if the file is not found in any location and bFatal is true.

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 SimdFloat gmx_simdcall gmx::fma ( SimdFloat  a,
SimdFloat  b,
SimdFloat  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
a*b+c
static SimdDouble gmx_simdcall gmx::fma ( SimdDouble  a,
SimdDouble  b,
SimdDouble  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
a*b+c
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 SimdFloat gmx_simdcall gmx::fms ( SimdFloat  a,
SimdFloat  b,
SimdFloat  c 
)
inlinestatic

SIMD float Fused-multiply-subtract. Result is a*b-c.

Parameters
afactor1
bfactor2
cterm
Returns
a*b-c
static SimdDouble gmx_simdcall gmx::fms ( SimdDouble  a,
SimdDouble  b,
SimdDouble  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
a*b-c
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 SimdFloat gmx_simdcall gmx::fnma ( SimdFloat  a,
SimdFloat  b,
SimdFloat  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
-a*b+c
static SimdDouble gmx_simdcall gmx::fnma ( SimdDouble  a,
SimdDouble  b,
SimdDouble  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
-a*b+c
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.
static SimdFloat gmx_simdcall gmx::fnms ( SimdFloat  a,
SimdFloat  b,
SimdFloat  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
-a*b-c
static SimdDouble gmx_simdcall gmx::fnms ( SimdDouble  a,
SimdDouble  b,
SimdDouble  c 
)
inlinestatic

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

Parameters
afactor1
bfactor2
cterm
Returns
-a*b-c
static SimdFloat gmx_simdcall gmx::frexp ( SimdFloat  value,
SimdFInt32 *  exponent 
)
inlinestatic

Extract (integer) exponent and fraction from single precision SIMD.

Parameters
valueFloating-point value to extract from
[out]exponentReturned exponent of value, integer SIMD format.
Returns
Fraction of value, floating-point SIMD format.
static SimdDouble gmx_simdcall gmx::frexp ( SimdDouble  value,
SimdDInt32 *  exponent 
)
inlinestatic

Extract (integer) exponent and fraction from double precision SIMD.

Parameters
valueFloating-point value to extract from
[out]exponentReturned exponent of value, integer SIMD format.
Returns
Fraction of value, floating-point SIMD format.
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_simdcall gmx::gatherLoadTransposeHsimd ( const double *  base0,
const double *  base1,
std::int32_t  offset[],
SimdDouble *  v0,
SimdDouble *  v1 
)
inlinestatic

Load 2 consecutive doubles from each of GMX_SIMD_DOUBLE_WIDTH/2 offsets, transpose into SIMD double (low half from base0, high from base1).

Template Parameters
alignAlignment of the storage, i.e. the distance (measured in elements, not bytes) between index points. When this is identical to the number of output components the data is packed without padding. This must be a multiple of the alignment to keep all data aligned.
Parameters
base0Pointer to base of first aligned memory
base1Pointer to base of second aligned memory
offsetOffset to the start of each pair
[out]v01st element in each pair, base0 in low and base1 in high half.
[out]v12nd element in each pair, base0 in low and base1 in high half.

The offset array should be of half the SIMD width length, so it corresponds to the half-SIMD-register operations. This also means it must be aligned to half the integer SIMD width (i.e., GMX_SIMD_DINT32_WIDTH/2).

The floating-point memory locations must be aligned, but only to the smaller of two elements and the floating-point SIMD width.

This routine is primarily designed to load nonbonded parameters in the kernels. It is the equivalent of the full-width routine gatherLoadTranspose(), but just as the other hsimd routines it will pick half-SIMD-width data from base0 and put in the lower half, while the upper half comes from base1.

For an example, assume the SIMD width is 8, align is 2, that base0 is [A0 A1 B0 B1 C0 C1 D0 D1 ...], and base1 [E0 E1 F0 F1 G0 G1 H0 H1...].

Then we will get v0 as [A0 B0 C0 D0 E0 F0 G0 H0] and v1 as [A1 B1 C1 D1 E1 F1 G1 H1].

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

template<int align>
static void gmx_simdcall gmx::gatherLoadTransposeHsimd ( const float *  base0,
const float *  base1,
const std::int32_t  offset[],
SimdFloat *  v0,
SimdFloat *  v1 
)
inlinestatic

Load 2 consecutive floats from each of GMX_SIMD_FLOAT_WIDTH/2 offsets, transpose into SIMD float (low half from base0, high from base1).

Template Parameters
alignAlignment of the storage, i.e. the distance (measured in elements, not bytes) between index points. When this is identical to the number of output components the data is packed without padding. This must be a multiple of the alignment to keep all data aligned.
Parameters
base0Pointer to base of first aligned memory
base1Pointer to base of second aligned memory
offsetOffset to the start of each pair
[out]v01st element in each pair, base0 in low and base1 in high half.
[out]v12nd element in each pair, base0 in low and base1 in high half.

The offset array should be of half the SIMD width length, so it corresponds to the half-SIMD-register operations. This also means it must be aligned to half the integer SIMD width (i.e., GMX_SIMD_FINT32_WIDTH/2).

The floating-point memory locations must be aligned, but only to the smaller of two elements and the floating-point SIMD width.

This routine is primarily designed to load nonbonded parameters in the kernels. It is the equivalent of the full-width routine gatherLoadTranspose(), but just as the other hsimd routines it will pick half-SIMD-width data from base0 and put in the lower half, while the upper half comes from base1.

For an example, assume the SIMD width is 8, align is 2, that base0 is [A0 A1 B0 B1 C0 C1 D0 D1 ...], and base1 [E0 E1 F0 F1 G0 G1 H0 H1...].

Then we will get v0 as [A0 B0 C0 D0 E0 F0 G0 H0] and v1 as [A1 B1 C1 D1 E1 F1 G1 H1].

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

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 PhysicalNodeCommunicator &  physicalNodeComm 
)

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.

May do communication on MPI_COMM_WORLD when compiled with real MPI.

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.
static bool gmx::hasIncompatibleVsites ( const gmx_moltype_t moltype,
gmx::ArrayRef< const t_iparams >  iparams 
)
static

Returns whether moltype has incompatible vsites.

For simplicity the only compatible vsites are linear 2 or 3 atom sites that are constructed in between the 2 or 3 contructing atoms,

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.
static void gmx_simdcall gmx::incrDualHsimd ( double *  m0,
double *  m1,
SimdDouble  a 
)
inlinestatic

Add each half of SIMD variable to separate memory adresses.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
aSIMD variable. Lower half will be added to m0, upper half to m1.

The memory must be aligned to half SIMD width.

Note
The updated m0 value is written before m1 is read from memory, so the result will be correct even if the memory regions overlap.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static void gmx_simdcall gmx::incrDualHsimd ( float *  m0,
float *  m1,
SimdFloat  a 
)
inlinestatic

Add each half of SIMD variable to separate memory adresses.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
aSIMD variable. Lower half will be added to m0, upper half to m1.

The memory must be aligned to half SIMD width.

Note
The updated m0 value is written before m1 is read from memory, so the result will be correct even if the memory regions overlap.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

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.
std::unique_ptr< ClfftInitializer > gmx::initializeClfftLibrary ( )

This routine should be called during setup for running an FFT task on an OpenCL device.

It should be called once per process with such a task.

It implements lazy initialization, so that we can have a lifetime that begins when we know that PME on an OpenCL device will run an FFT task on the device, and should continue until we know that the last such task has completed. Any time required for this initialization or tear down should not be accrued to per-MD-step counters.

Todo:
Consider making a composite object that also handles on-demand compilation, managing lifetime of PME FFT kernel programs to avoid exhausting resources and/or recompiling kernels previously used. See Redmine #2535.
Todo:
Consider implementing an appropriate flavor of the nifty counter idiom so that both static initialization and deinitialization can work in a fast, leak-free, and thread-safe way without imposing constraints on the calling code. See Redmine #2535.
bool gmx::inputSupportsGpuBondeds ( const t_inputrec &  ir,
const gmx_mtop_t &  mtop,
std::string *  error 
)

Checks whether the input system allows to compute bonded interactions on a GPU.

Parameters
[in]irInput system.
[in]mtopComplete system topology to search for supported interactions.
[out]errorIf non-null, the error message if the input is not supported on GPU.
Returns
true if PME can run on GPU with this input, false otherwise.
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.
static bool gmx::isDeviceSane ( const gmx_device_info_t *  devInfo,
std::string *  errorMessage 
)
static

Checks that device devInfo is sane (ie can run a kernel).

Compiles and runs a dummy kernel to determine whether the given OpenCL device functions properly.

Parameters
[in]devInfoThe device info pointer.
[out]errorMessageAn error message related to a failing OpenCL API call.
Exceptions
std::bad_allocWhen out of memory.
Returns
Whether the device passed sanity checks
static int gmx::isDeviceSupported ( const gmx_device_info_t *  devInfo)
static

Checks that device devInfo is compatible with GROMACS.

Vendor and OpenCL version support checks are executed an the result of these returned.

Parameters
[in]devInfoThe device info pointer.
Returns
The result of the compatibility checks.
template<MathOptimization opt = MathOptimization::Safe>
static SimdFloat gmx_simdcall gmx::ldexp ( SimdFloat  value,
SimdFInt32  exponent 
)
inlinestatic

Multiply a SIMD float value by the number 2 raised to an exp power.

Template Parameters
optBy default, this routine will return zero for input arguments that are so small they cannot be reproduced in the current precision. If the unsafe math optimization template parameter setting is used, these tests are skipped, and the result will be undefined (possible even NaN). This might happen below -127 in single precision or -1023 in double, although some might use denormal support to extend the range.
Parameters
valueFloating-point number to multiply with new exponent
exponentInteger that will not overflow as 2^exponent.
Returns
value*2^exponent
template<MathOptimization opt = MathOptimization::Safe>
static SimdDouble gmx_simdcall gmx::ldexp ( SimdDouble  value,
SimdDInt32  exponent 
)
inlinestatic

Multiply a SIMD double value by the number 2 raised to an exp power.

Template Parameters
optBy default, this routine will return zero for input arguments that are so small they cannot be reproduced in the current precision. If the unsafe math optimization template parameter setting is used, these tests are skipped, and the result will be undefined (possible even NaN). This might happen below -127 in single precision or -1023 in double, although some might use denormal support to extend the range.
Parameters
valueFloating-point number to multiply with new exponent
exponentInteger that will not overflow as 2^exponent.
Returns
value*2^exponent
static void gmx::lincs_matrix_expand ( const Lincs *  lincsd,
const Task *  li_task,
const real blcc,
real rhs1,
real rhs2,
real sol 
)
static

Do a set of nrec LINCS matrix multiplications.

This function will return with up to date thread-local constraint data, without an OpenMP barrier.

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.
template<typename T >
static T gmx::load ( const typename internal::SimdTraits< T >::type *  m)
inlinestatic

Load function that returns SIMD or scalar.

Template Parameters
TType to load (type is always mandatory)
Parameters
mPointer to aligned memory
Returns
Loaded value
static SimdDouble gmx_simdcall gmx::load4DuplicateN ( const double *  m)
inlinestatic

Load 4 doubles and duplicate them N times each.

Parameters
mPointer to memory aligned to 4 doubles
Returns
SIMD variable with 4 doubles from m duplicated Nx.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_DOUBLE is 1. N is GMX_SIMD_DOUBLE_WIDTH/4. Different values are contigous and same values are 4 positions in SIMD apart.

static SimdFloat gmx_simdcall gmx::load4DuplicateN ( const float *  m)
inlinestatic

Load 4 floats and duplicate them N times each.

Parameters
mPointer to memory aligned to 4 floats
Returns
SIMD variable with 4 floats from m duplicated Nx.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_FLOAT is 1. N is GMX_SIMD_FLOAT_WIDTH/4. Different values are contigous and same values are 4 positions in SIMD apart.

static SimdDouble gmx_simdcall gmx::loadDualHsimd ( const double *  m0,
const double *  m1 
)
inlinestatic

Load low & high parts of SIMD double from different locations.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
Returns
SIMD variable with low part loaded from m0, high from m1.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static SimdFloat gmx_simdcall gmx::loadDualHsimd ( const float *  m0,
const float *  m1 
)
inlinestatic

Load low & high parts of SIMD float from different locations.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
Returns
SIMD variable with low part loaded from m0, high from m1.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

static SimdDouble gmx_simdcall gmx::loadDuplicateHsimd ( const double *  m)
inlinestatic

Load half-SIMD-width double data, spread to both halves.

Parameters
mPointer to memory aligned to half SIMD width.
Returns
SIMD variable with both halves loaded from m..

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static SimdFloat gmx_simdcall gmx::loadDuplicateHsimd ( const float *  m)
inlinestatic

Load half-SIMD-width float data, spread to both halves.

Parameters
mPointer to memory aligned to half SIMD width.
Returns
SIMD variable with both halves loaded from m..

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

template<typename T >
static T gmx::loadU ( const typename internal::SimdTraits< T >::type *  m)
inlinestatic

Load function that returns SIMD or scalar based on template argument.

Template Parameters
TType to load (type is always mandatory)
Parameters
mPointer to unaligned memory
Returns
Loaded SimdFloat/Double/Int or basic scalar type
static SimdDouble gmx_simdcall gmx::loadU1DualHsimd ( const double *  m)
inlinestatic

Load two doubles, spread 1st in low half, 2nd in high half.

Parameters
mPointer to two adjacent double values.
Returns
SIMD variable where all elements in the low half have been set to m[0], and all elements in high half to m[1].
Note
This routine always loads two values and sets the halves separately. If you want to set all elements to the same value, simply use the standard (non-half-SIMD) operations.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static SimdFloat gmx_simdcall gmx::loadU1DualHsimd ( const float *  m)
inlinestatic

Load two floats, spread 1st in low half, 2nd in high half.

Parameters
mPointer to two adjacent float values.
Returns
SIMD variable where all elements in the low half have been set to m[0], and all elements in high half to m[1].
Note
This routine always loads two values and sets the halves separately. If you want to set all elements to the same value, simply use the standard (non-half-SIMD) operations.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

static SimdDouble gmx_simdcall gmx::loadU4NOffset ( const double *  m,
int  offset 
)
inlinestatic

Load doubles in blocks of 4 at fixed offsets.

Parameters
mPointer to unaligned memory
offsetOffset in memory between input blocks of 4
Returns
SIMD variable with doubles from m.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_DOUBLE is 1. Blocks of 4 doubles are loaded from m+n*offset where n is the n-th block of 4 doubles.

static SimdFloat gmx_simdcall gmx::loadU4NOffset ( const float *  m,
int  offset 
)
inlinestatic

Load floats in blocks of 4 at fixed offsets.

Parameters
mPointer to unaligned memory
offsetOffset in memory between input blocks of 4
Returns
SIMD variable with floats from m.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_FLOAT is 1. Blocks of 4 floats are loaded from m+n*offset where n is the n-th block of 4 floats.

static SimdDouble gmx_simdcall gmx::loadUNDuplicate4 ( const double *  m)
inlinestatic

Load N doubles and duplicate them 4 times each.

Parameters
mPointer to unaligned memory
Returns
SIMD variable with N doubles from m duplicated 4x.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_DOUBLE is 1. N is GMX_SIMD_DOUBLE_WIDTH/4. Duplicated values are contigous and different values are 4 positions in SIMD apart.

static SimdFloat gmx_simdcall gmx::loadUNDuplicate4 ( const float *  m)
inlinestatic

Load N floats and duplicate them 4 times each.

Parameters
mPointer to unaligned memory
Returns
SIMD variable with N floats from m duplicated 4x.

Available if GMX_SIMD_HAVE_4NSIMD_UTIL_FLOAT is 1. N is GMX_SIMD_FLOAT_WIDTH/4. Duplicated values are contigous and different values are 4 positions in SIMD apart.

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.
t_blocka gmx::make_at2con ( int  numAtoms,
const t_ilist *  ilist,
const t_iparams *  iparams,
FlexibleConstraintTreatment  flexibleConstraintTreatment 
)

Returns a block struct to go from atoms to constraints.

The block struct will contain constraint indices with lower indices directly matching the order in F_CONSTR and higher indices matching the order in F_CONSTRNC offset by the number of constraints in F_CONSTR.

Parameters
[in]numAtomsThe number of atoms to construct the list for
[in]ilistInteraction list, size F_NRE
[in]iparamsInteraction parameters, can be null when flexibleConstraintTreatment=Include
[in]flexibleConstraintTreatmentThe flexible constraint treatment, see enum above
Returns
a block struct with all constraints for each atom
t_blocka gmx::make_at2con ( const gmx_moltype_t moltype,
gmx::ArrayRef< const t_iparams >  iparams,
FlexibleConstraintTreatment  flexibleConstraintTreatment 
)

Returns a block struct to go from atoms to constraints.

The block struct will contain constraint indices with lower indices directly matching the order in F_CONSTR and higher indices matching the order in F_CONSTRNC offset by the number of constraints in F_CONSTR.

Parameters
[in]moltypeThe molecule data
[in]iparamsInteraction parameters, can be null when flexibleConstraintTreatment=Include
[in]flexibleConstraintTreatmentThe flexible constraint treatment, see enum above
Returns
a block struct with all constraints for each atom
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 >
static t_blocka gmx::makeAtomsToConstraintsList ( int  numAtoms,
const T *  ilists,
const t_iparams *  iparams,
FlexibleConstraintTreatment  flexibleConstraintTreatment 
)
static

Returns a block struct to go from atoms to constraints.

The block struct will contain constraint indices with lower indices directly matching the order in F_CONSTR and higher indices matching the order in F_CONSTRNC offset by the number of constraints in F_CONSTR.

Parameters
[in]numAtomsThe number of atoms to construct the list for
[in]ilistsThe interaction lists, size F_NRE
[in]iparamsInteraction parameters, can be null when flexibleConstraintTreatment=Include
[in]flexibleConstraintTreatmentThe flexible constraint treatment, see enum above
Returns
a block struct with all constraints for each atom
static std::vector<t_blocka> gmx::makeAtomToConstraintMappings ( const gmx_mtop_t &  mtop,
FlexibleConstraintTreatment  flexibleConstraintTreatment 
)
static

Makes a per-moleculetype container of mappings from atom indices to constraint indices.

Note that flexible constraints are only enabled with a dynamical integrator.

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
template<typename... Args>
std::unique_ptr<Constraints> gmx::makeConstraints ( const gmx_mtop_t &  mtop,
const t_inputrec &  ir,
bool  doEssentialDynamics,
Args &&...  args 
)

Factory function for Constraints.

We only want an object to manage computing constraints when the simulation requires one. Checking for whether the object was made adds overhead to simulations that use constraints, while avoiding overhead on those that do not, so is a design trade-off we might reconsider some time.

Using a private constructor and a factory function ensures that we can only make a Constraints object when the prerequisites are satisfied, ie. that something needs them and if necessary has already been initialized.

Using the parameter pack insulates the factory function from changes to the type signature of the constructor that don't affect the logic here.

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,
const bool  rankHasPmeGpuTask 
)

Builder function for MdAtomsWrapper.

Builder function.

static std::string gmx::makeOpenClInternalErrorString ( const char *  message,
cl_int  status 
)
static

Make an error string following an OpenCL API call.

It is meant to be called with status != CL_SUCCESS, but it will work correctly even if it is called with no OpenCL failure.

Parameters
[in]messageSupplies context, e.g. the name of the API call that returned the error.
[in]statusOpenCL API status code
Returns
A string describing the OpenCL error.
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.
std::vector< RangePartitioning > gmx::makeUpdateGroups ( const gmx_mtop_t &  mtop)

Returns a vector with update groups for each moleculetype in mtop or an empty vector when the criteria (see below) are not satisfied.

An empty vector is returned when at least one moleculetype does not obey the restrictions of update groups, e.g. more than two constraints in a row.

Currently valid update groups are: a single atom which is not a virtual site and does not have constraints; or a group of atoms where all virtual sites are constructed from atoms within the group and at least one non-vsite atom is constrained to all other non-vsite atoms. To have update groups, all virtual sites should be linear 2 or 3 atom constructions with coefficients >= 0 and sum of coefficients <= 1.

Parameters
[in]mtopThe system topology
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 SimdFloat gmx_simdcall gmx::maskAdd ( SimdFloat  a,
SimdFloat  b,
SimdFBool  m 
)
inlinestatic

Add two float SIMD variables, masked version.

Parameters
aterm1
bterm2
mmask
Returns
a+b where mask is true, a otherwise.
static SimdDouble gmx_simdcall gmx::maskAdd ( SimdDouble  a,
SimdDouble  b,
SimdDBool  m 
)
inlinestatic

Add two double SIMD variables, masked version.

Parameters
aterm1
bterm2
mmask
Returns
a+b where mask is true, 0.0 otherwise.
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 SimdFloat gmx_simdcall gmx::maskzFma ( SimdFloat  a,
SimdFloat  b,
SimdFloat  c,
SimdFBool  m 
)
inlinestatic

SIMD float fused multiply-add, masked version.

Parameters
afactor1
bfactor2
cterm
mmask
Returns
a*b+c where mask is true, 0.0 otherwise.
static SimdDouble gmx_simdcall gmx::maskzFma ( SimdDouble  a,
SimdDouble  b,
SimdDouble  c,
SimdDBool  m 
)
inlinestatic

SIMD double fused multiply-add, masked version.

Parameters
afactor1
bfactor2
cterm
mmask
Returns
a*b+c where mask is true, 0.0 otherwise.
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 SimdFloat gmx_simdcall gmx::maskzMul ( SimdFloat  a,
SimdFloat  b,
SimdFBool  m 
)
inlinestatic

Multiply two float SIMD variables, masked version.

Parameters
afactor1
bfactor2
mmask
Returns
a*b where mask is true, 0.0 otherwise.
static SimdDouble gmx_simdcall gmx::maskzMul ( SimdDouble  a,
SimdDouble  b,
SimdDBool  m 
)
inlinestatic

Multiply two double SIMD variables, masked version.

Parameters
afactor1
bfactor2
mmask
Returns
a*b where mask is true, 0.0 otherwise.
static SimdFloat gmx_simdcall gmx::maskzRcp ( SimdFloat  x,
SimdFBool  m 
)
inlinestatic

SIMD float 1.0/x lookup, masked version.

This is a low-level instruction that should only be called from routines implementing the reciprocal in simd_math.h.

Parameters
xArgument, x>0 for entries where mask is true.
mMask
Returns
Approximation of 1/x, accuracy is GMX_SIMD_RCP_BITS. The result for masked-out entries will be 0.0.
static SimdDouble gmx_simdcall gmx::maskzRcp ( SimdDouble  x,
SimdDBool  m 
)
inlinestatic

SIMD double 1.0/x lookup, masked version.

This is a low-level instruction that should only be called from routines implementing the reciprocal in simd_math.h.

Parameters
xArgument, x>0 for entries where mask is true.
mMask
Returns
Approximation of 1/x, accuracy is GMX_SIMD_RCP_BITS. The result for masked-out entries will be 0.0.
static SimdFloat gmx_simdcall gmx::maskzRsqrt ( SimdFloat  x,
SimdFBool  m 
)
inlinestatic

SIMD float 1.0/sqrt(x) lookup, masked version.

This is a low-level instruction that should only be called from routines implementing the inverse square root in simd_math.h.

Parameters
xArgument, x>0 for entries where mask is true.
mMask
Returns
Approximation of 1/sqrt(x), accuracy is GMX_SIMD_RSQRT_BITS. The result for masked-out entries will be 0.0.
static SimdDouble gmx_simdcall gmx::maskzRsqrt ( SimdDouble  x,
SimdDBool  m 
)
inlinestatic

SIMD double 1.0/sqrt(x) lookup, masked version.

This is a low-level instruction that should only be called from routines implementing the inverse square root in simd_math.h.

Parameters
xArgument, x>0 for entries where mask is true.
mMask
Returns
Approximation of 1/sqrt(x), accuracy is GMX_SIMD_RSQRT_BITS. The result for masked-out entries will be 0.0.
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 SimdFloat gmx_simdcall gmx::max ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Set each SIMD float element to the largest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
max(a,b) for each element.
static SimdDouble gmx_simdcall gmx::max ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Set each SIMD double element to the largest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
max(a,b) for each element.
static void gmx::mdrunner_start_fn ( const 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.

void gmx::mergeExclusions ( t_blocka *  excl,
ExclusionBlocks *  b2 
)

Merge the contents of b2 into excl.

Requires that b2 and excl describe the same number of particles, if b2 describes a non-zero number.

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.
static SimdFloat gmx_simdcall gmx::min ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Set each SIMD float element to the smallest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
min(a,b) for each element.
static SimdDouble gmx_simdcall gmx::min ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Set each SIMD double element to the smallest from two variables.

Parameters
aAny floating-point value
bAny floating-point value
Returns
min(a,b) for each element.
void gmx::MPI_Comm_free_wrapper ( MPI_Comm *  comm)

Wrapper function for RAII-style cleanup.

This is needed to discard the return value so it can be used as a deleter by a smart pointer.

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.
template<typename T >
T gmx::norm ( T *  v)

Forward operations on C Array style vectors to C implementations.

Since vec.h and vectypes.h independently declare norm and norm2 in different namespaces, code that includes both headers but does not specify the namespace from which to use norm and norm2 cannot properly resolve overloads without the following helper templates.

Template Parameters
Tarray element type (e.g. real, int, etc.)
Parameters
vaddress of first vector element
Returns
magnitude or squared magnitude of vector
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.
FilePtr gmx::openLibraryFile ( const std::string &  filename,
bool  bAddCWD = true,
bool  bFatal = true 
)

Opens a library file for reading in an RAII-style FILE handle.

Works as findLibraryFile(), except that it opens the file and returns a file handle.

FilePtr gmx::openLibraryFile ( const char *  filename,
bool  bAddCWD = true,
bool  bFatal = true 
)

Opens a library file for reading in an RAII-style FILE handle.

Works as findLibraryFile(), except that it opens the file and returns a file handle.

LogFilePtr gmx::openLogFile ( const char *  lognm,
bool  appendFiles 
)

Open the log file for writing/appending.

Exceptions
FileIOErrorwhen the log file cannot be opened.
static SimdFBool gmx_simdcall gmx::operator!= ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

SIMD a!=b for single SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a!=b.

Beware that exact floating-point comparisons are difficult.

static SimdDBool gmx_simdcall gmx::operator!= ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

SIMD a!=b for double SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a!=b.

Beware that exact floating-point comparisons are difficult.

static SimdFloat gmx_simdcall gmx::operator& ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Bitwise and for two SIMD float variables.

Supported if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 & data2
static SimdDouble gmx_simdcall gmx::operator& ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Bitwise and for two SIMD double variables.

Supported if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 & data2
static SimdFInt32 gmx_simdcall gmx::operator& ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Integer SIMD bitwise and.

Available if GMX_SIMD_HAVE_FINT32_LOGICAL is 1.

Note
You can not use this operation directly to select based on a boolean SIMD variable, since booleans are separate from integer SIMD. If that is what you need, have a look at gmx::selectByMask instead.
Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a & b (bitwise and)
static SimdDInt32 gmx_simdcall gmx::operator& ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Integer SIMD bitwise and.

Available if GMX_SIMD_HAVE_DINT32_LOGICAL is 1.

Note
You can not use this operation directly to select based on a boolean SIMD variable, since booleans are separate from integer SIMD. If that is what you need, have a look at gmx::selectByMask instead.
Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a & b (bitwise and)
static SimdFBool gmx_simdcall gmx::operator&& ( SimdFBool  a,
SimdFBool  b 
)
inlinestatic

Logical and on single precision SIMD booleans.

Parameters
alogical vars 1
blogical vars 2
Returns
For each element, the result boolean is true if a & b are true.
Note
This is not necessarily a bitwise operation - the storage format of booleans is implementation-dependent.
static SimdDBool gmx_simdcall gmx::operator&& ( SimdDBool  a,
SimdDBool  b 
)
inlinestatic

Logical and on double precision SIMD booleans.

Parameters
alogical vars 1
blogical vars 2
Returns
For each element, the result boolean is true if a & b are true.
Note
This is not necessarily a bitwise operation - the storage format of booleans is implementation-dependent.
static SimdFIBool gmx_simdcall gmx::operator&& ( SimdFIBool  a,
SimdFIBool  b 
)
inlinestatic

Logical AND on SimdFIBool.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD boolean 1
bSIMD boolean 2
Returns
True for elements where both a and b are true.
static SimdDIBool gmx_simdcall gmx::operator&& ( SimdDIBool  a,
SimdDIBool  b 
)
inlinestatic

Logical AND on SimdDIBool.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD boolean 1
bSIMD boolean 2
Returns
True for elements where both a and b are true.
static SimdFloat gmx_simdcall gmx::operator* ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Multiply two float SIMD variables.

Parameters
afactor1
bfactor2
Returns
a*b.
static SimdDouble gmx_simdcall gmx::operator* ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Multiply two double SIMD variables.

Parameters
afactor1
bfactor2
Returns
a*b.
static SimdFInt32 gmx_simdcall gmx::operator* ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Multiply SIMD integers.

This routine is only available if GMX_SIMD_HAVE_FINT32_ARITHMETICS (single) or GMX_SIMD_HAVE_DINT32_ARITHMETICS (double) is 1.

Parameters
afactor1
bfactor2
Returns
a*b.
Note
Only the low 32 bits are retained, so this can overflow.
static SimdDInt32 gmx_simdcall gmx::operator* ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Multiply SIMD integers.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
afactor1
bfactor2
Returns
a*b.
Note
Only the low 32 bits are retained, so this can overflow.
static SimdFloat gmx_simdcall gmx::operator+ ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Add two float SIMD variables.

Parameters
aterm1
bterm2
Returns
a+b
static SimdDouble gmx_simdcall gmx::operator+ ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Add two double SIMD variables.

Parameters
aterm1
bterm2
Returns
a+b
static SimdFInt32 gmx_simdcall gmx::operator+ ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Add SIMD integers.

This routine is only available if GMX_SIMD_HAVE_FINT32_ARITHMETICS (single) or GMX_SIMD_HAVE_DINT32_ARITHMETICS (double) is 1.

Parameters
aterm1
bterm2
Returns
a+b
static SimdDInt32 gmx_simdcall gmx::operator+ ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Add SIMD integers.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aterm1
bterm2
Returns
a+b
static SimdFloat gmx_simdcall gmx::operator- ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Subtract two float SIMD variables.

Parameters
aterm1
bterm2
Returns
a-b
static SimdDouble gmx_simdcall gmx::operator- ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Subtract two double SIMD variables.

Parameters
aterm1
bterm2
Returns
a-b
static SimdFloat gmx_simdcall gmx::operator- ( SimdFloat  a)
inlinestatic

SIMD single precision negate.

Parameters
aSIMD double precision value
Returns
-a
static SimdDouble gmx_simdcall gmx::operator- ( SimdDouble  a)
inlinestatic

SIMD double precision negate.

Parameters
aSIMD double precision value
Returns
-a
static SimdFInt32 gmx_simdcall gmx::operator- ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Subtract SIMD integers.

This routine is only available if GMX_SIMD_HAVE_FINT32_ARITHMETICS (single) or GMX_SIMD_HAVE_DINT32_ARITHMETICS (double) is 1.

Parameters
aterm1
bterm2
Returns
a-b
static SimdDInt32 gmx_simdcall gmx::operator- ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Subtract SIMD integers.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aterm1
bterm2
Returns
a-b
static SimdFBool gmx_simdcall gmx::operator< ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

SIMD a<b for single SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a<b.
static SimdDBool gmx_simdcall gmx::operator< ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

SIMD a<b for double SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a<b.
static SimdFIBool gmx_simdcall gmx::operator< ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Less-than comparison of two SIMD integers corresponding to float values.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD integer1
bSIMD integer2
Returns
SIMD integer boolean with true for elements where a<b
static SimdDIBool gmx_simdcall gmx::operator< ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Less-than comparison of two SIMD integers corresponding to double values.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD integer1
bSIMD integer2
Returns
SIMD integer boolean with true for elements where a<b
static SimdFBool gmx_simdcall gmx::operator<= ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

SIMD a<=b for single SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a<=b.
static SimdDBool gmx_simdcall gmx::operator<= ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

SIMD a<=b for double SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a<=b.
template<class T1 , class T2 >
bool gmx::operator== ( const Allocator< T1, HostAllocationPolicy > &  a,
const Allocator< T2, HostAllocationPolicy > &  b 
)

Return true if two allocators are identical.

True if pinning policy is the same.

static SimdFBool gmx_simdcall gmx::operator== ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

SIMD a==b for single SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a==b.

Beware that exact floating-point comparisons are difficult.

static SimdDBool gmx_simdcall gmx::operator== ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

SIMD a==b for double SIMD.

Parameters
avalue1
bvalue2
Returns
Each element of the boolean will be set to true if a==b.

Beware that exact floating-point comparisons are difficult.

static SimdFIBool gmx_simdcall gmx::operator== ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Equality comparison of two integers corresponding to float values.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD integer1
bSIMD integer2
Returns
SIMD integer boolean with true for elements where a==b
static SimdDIBool gmx_simdcall gmx::operator== ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Equality comparison of two integers corresponding to double values.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD integer1
bSIMD integer2
Returns
SIMD integer boolean with true for elements where a==b
static SimdFloat gmx_simdcall gmx::operator^ ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Bitwise xor for SIMD float.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 ^ data2
static SimdDouble gmx_simdcall gmx::operator^ ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Bitwise xor for SIMD double.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 ^ data2
static SimdFInt32 gmx_simdcall gmx::operator^ ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Integer SIMD bitwise xor.

Available if GMX_SIMD_HAVE_FINT32_LOGICAL is 1.

Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a ^ b (bitwise xor)
static SimdDInt32 gmx_simdcall gmx::operator^ ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Integer SIMD bitwise xor.

Available if GMX_SIMD_HAVE_DINT32_LOGICAL is 1.

Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a ^ b (bitwise xor)
static SimdFloat gmx_simdcall gmx::operator| ( SimdFloat  a,
SimdFloat  b 
)
inlinestatic

Bitwise or for SIMD float.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 | data2
static SimdDouble gmx_simdcall gmx::operator| ( SimdDouble  a,
SimdDouble  b 
)
inlinestatic

Bitwise or for SIMD double.

Available if GMX_SIMD_HAVE_LOGICAL is 1.

Parameters
adata1
bdata2
Returns
data1 | data2
static SimdFInt32 gmx_simdcall gmx::operator| ( SimdFInt32  a,
SimdFInt32  b 
)
inlinestatic

Integer SIMD bitwise or.

Available if GMX_SIMD_HAVE_FINT32_LOGICAL is 1.

Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a | b (bitwise or)
static SimdDInt32 gmx_simdcall gmx::operator| ( SimdDInt32  a,
SimdDInt32  b 
)
inlinestatic

Integer SIMD bitwise or.

Available if GMX_SIMD_HAVE_DINT32_LOGICAL is 1.

Parameters
afirst integer SIMD
bsecond integer SIMD
Returns
a | b (bitwise or)
static SimdFBool gmx_simdcall gmx::operator|| ( SimdFBool  a,
SimdFBool  b 
)
inlinestatic

Logical or on single precision SIMD booleans.

Parameters
alogical vars 1
blogical vars 2
Returns
For each element, the result boolean is true if a or b is true.

Note that this is not necessarily a bitwise operation - the storage format of booleans is implementation-dependent.

\

static SimdDBool gmx_simdcall gmx::operator|| ( SimdDBool  a,
SimdDBool  b 
)
inlinestatic

Logical or on double precision SIMD booleans.

Parameters
alogical vars 1
blogical vars 2
Returns
For each element, the result boolean is true if a or b is true.

Note that this is not necessarily a bitwise operation - the storage format of booleans is implementation-dependent.

\

static SimdFIBool gmx_simdcall gmx::operator|| ( SimdFIBool  a,
SimdFIBool  b 
)
inlinestatic

Logical OR on SimdFIBool.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD boolean 1
bSIMD boolean 2
Returns
True for elements where both a and b are true.
static SimdDIBool gmx_simdcall gmx::operator|| ( SimdDIBool  a,
SimdDIBool  b 
)
inlinestatic

Logical OR on SimdDIBool.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD boolean 1
bSIMD boolean 2
Returns
True for elements where both a and b are true.
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
std::unique_ptr< Awh > gmx::prepareAwhModule ( FILE *  fplog,
const t_inputrec &  inputRecord,
t_state stateGlobal,
const t_commrec *  commRecord,
const gmx_multisim_t *  multiSimRecord,
bool  startingFromCheckpoint,
bool  usingShellParticles,
const std::string &  biasInitFilename,
pull_t *  pull_work 
)

Makes an Awh and prepares to use it if the user input requests that.

Restores state from history in checkpoint if needed.

Parameters
[in,out]fplogGeneral output file, normally md.log, can be nullptr.
[in]inputRecordGeneral input parameters (as set up by grompp).
[in]stateGlobalA pointer to the global state structure.
[in]commRecordStruct for communication, can be nullptr.
[in]multiSimRecordMulti-sim handler
[in]startingFromCheckpointWhether the simulation is starting from a checkpoint
[in]usingShellParticlesWhether the user requested shell particles (which is unsupported)
[in]biasInitFilenameName of file to read PMF and target from.
[in,out]pull_workPointer to a pull struct which AWH will couple to, has to be initialized, is assumed not to change during the lifetime of the Awh object.
Returns
An initialized Awh module, or nullptr if none was requested.
Exceptions
InvalidInputErrorIf another active module is not supported.
std::unique_ptr< BoxDeformation > gmx::prepareBoxDeformation ( const matrix &  initialBox,
t_commrec *  cr,
const t_inputrec &  inputrec 
)

Factory function for box deformation module.

If the inputrec specifies the use of box deformation during the update phase, communicates the initialBox from SIMMASTER to other ranks, and constructs and returns an object to manage that update.

Exceptions
NotImplementedErrorif the inputrec specifies an unsupported combination.
void gmx::prepareLogAppending ( FILE *  fplog)

Prepare to use the open log file when appending.

Does not throw.

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 SimdFloat gmx_simdcall gmx::rcp ( SimdFloat  x)
inlinestatic

SIMD float 1.0/x lookup.

This is a low-level instruction that should only be called from routines implementing the reciprocal in simd_math.h.

Parameters
xArgument, x!=0
Returns
Approximation of 1/x, accuracy is GMX_SIMD_RCP_BITS.
static SimdDouble gmx_simdcall gmx::rcp ( SimdDouble  x)
inlinestatic

SIMD double 1.0/x lookup.

This is a low-level instruction that should only be called from routines implementing the reciprocal in simd_math.h.

Parameters
xArgument, x!=0
Returns
Approximation of 1/x, accuracy is GMX_SIMD_RCP_BITS.
static void gmx::read_bias_params ( std::vector< t_inpfile > *  inp,
AwhBiasParams *  awhBiasParams,
const std::string &  prefix,
const t_inputrec *  ir,
warninp_t  wi,
bool  bComment 
)
static

Read parameters of an AWH bias.

Parameters
[in,out]inpInput 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 ( std::vector< t_inpfile > *  inp,
const t_inputrec *  inputrec,
warninp_t  wi 
)

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

Parameters
[in,out]inpInput file entries.
[in]inputrecInput parameter struct.
[in,out]wiStruct for bookeeping warnings.
Returns
AWH parameters.
static void gmx::readDimParams ( std::vector< t_inpfile > *  inp,
const std::string &  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]inpInput 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_simdcall gmx::reduce ( SimdFloat  a)
inlinestatic

Return sum of all elements in SIMD float variable.

Parameters
aSIMD variable to reduce/sum.
Returns
The sum of all elements in the argument variable.
static double gmx_simdcall gmx::reduce ( SimdDouble  a)
inlinestatic

Return sum of all elements in SIMD double variable.

Parameters
aSIMD variable to reduce/sum.
Returns
The sum of all elements in the argument variable.
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.
static double gmx_simdcall gmx::reduceIncr4ReturnSumHsimd ( double *  m,
SimdDouble  v0,
SimdDouble  v1 
)
inlinestatic

Reduce the 4 half-SIMD-with doubles in 2 SIMD variables (sum halves), increment four consecutive doubles in memory, return sum.

Parameters
mPointer to memory where the four values should be incremented
v0Variable whose half-SIMD sums should be added to m[0]/m[1], respectively.
v1Variable whose half-SIMD sums should be added to m[2]/m[3], respectively.
Returns
Sum of all elements in the four SIMD variables.

The pointer m must be aligned, but only to the smaller of four elements and the floating-point SIMD width.

Note
This is the half-SIMD-width version of reduceIncr4ReturnSum(). The only difference is that the four half-SIMD inputs needed are present in the low/high halves of the two SIMD arguments.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static float gmx_simdcall gmx::reduceIncr4ReturnSumHsimd ( float *  m,
SimdFloat  v0,
SimdFloat  v1 
)
inlinestatic

Reduce the 4 half-SIMD-with floats in 2 SIMD variables (sum halves), increment four consecutive floats in memory, return sum.

Parameters
mPointer to memory where the four values should be incremented
v0Variable whose half-SIMD sums should be added to m[0]/m[1], respectively.
v1Variable whose half-SIMD sums should be added to m[2]/m[3], respectively.
Returns
Sum of all elements in the four SIMD variables.

The pointer m must be aligned, but only to the smaller of four elements and the floating-point SIMD width.

Note
This is the half-SIMD-width version of reduceIncr4ReturnSum(). The only difference is that the four half-SIMD inputs needed are present in the low/high halves of the two SIMD arguments.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

bool gmx::regexMatch ( const std::string &  str,
const Regex &  regex 
)

Matches a string with a regular expression.

Parameters
[in]strString to match.
[in]regexRegular expression to match.
Returns
true if regex matches the whole str.

Does not throw currently, but this is subject to change if/when better error handling is implemented (currently, it returns false if the matching fails, e.g., because of out-of-memory).

void gmx::reportGpuUsage ( const MDLogger &  mdlog,
bool  userSetGpuIds,
const GpuTaskAssignments &  gpuTaskAssignmentOnRanksOfThisNode,
size_t  numGpuTasksOnThisNode,
size_t  numPpRanks,
bool  bPrintHostName,
bool  useGpuForBonded,
PmeRunMode  pmeRunMode 
)

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
[in]useGpuForBondedWhether GPU PP tasks will do bonded work on the GPU
[in]pmeRunModeDescribes the execution of PME tasks
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.
static SimdFloat gmx_simdcall gmx::round ( SimdFloat  a)
inlinestatic

SIMD 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
Round mode is implementation defined. The only guarantee is that it is consistent between rounding functions (round, cvtR2I).
static SimdDouble gmx_simdcall gmx::round ( SimdDouble  a)
inlinestatic

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

Parameters
aAny floating-point value
Returns
The nearest integer, represented in floating-point format.
Note
Round mode is implementation defined. The only guarantee is that it is consistent between rounding functions (round, cvtR2I).
static int gmx::roundToInt ( float  x)
inlinestatic

Round float to int.

Rounding behavior is round to nearest. Rounding of halfway cases is implemention defined (either halway to even or halway away from zero).

static SimdFloat gmx_simdcall gmx::rsqrt ( SimdFloat  x)
inlinestatic

SIMD float 1.0/sqrt(x) lookup.

This is a low-level instruction that should only be called from routines implementing the inverse square root in simd_math.h.

Parameters
xArgument, x>0
Returns
Approximation of 1/sqrt(x), accuracy is GMX_SIMD_RSQRT_BITS.
static SimdDouble gmx_simdcall gmx::rsqrt ( SimdDouble  x)
inlinestatic

double SIMD 1.0/sqrt(x) lookup.

This is a low-level instruction that should only be called from routines implementing the inverse square root in simd_math.h.

Parameters
xArgument, x>0
Returns
Approximation of 1/sqrt(x), accuracy is GMX_SIMD_RSQRT_BITS.
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 gmx_multisim_t *  ms,
const PhysicalNodeCommunicator &  physicalNodeComm,
const std::vector< GpuTask > &  gpuTasksOnThisRank,
bool  useGpuForBonded,
PmeRunMode  pmeRunMode 
)

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]msMulti-simulation handler.
[in]physicalNodeCommCommunication object for this physical node.
[in]gpuTasksOnThisRankInformation about what GPU tasks exist on this rank.
[in]useGpuForBondedWhether GPU PP tasks will do bonded work on the GPU
[in]pmeRunModeDescribes the execution of PME tasks
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 SimdFloat gmx_simdcall gmx::selectByMask ( SimdFloat  a,
SimdFBool  mask 
)
inlinestatic

Select from single precision SIMD variable where boolean is true.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
For each element, a is selected for true, 0 for false.
static SimdDouble gmx_simdcall gmx::selectByMask ( SimdDouble  a,
SimdDBool  mask 
)
inlinestatic

Select from double precision SIMD variable where boolean is true.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
For each element, a is selected for true, 0 for false.
static SimdFInt32 gmx_simdcall gmx::selectByMask ( SimdFInt32  a,
SimdFIBool  mask 
)
inlinestatic

Select from gmx::SimdFInt32 variable where boolean is true.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD integer to select from
maskBoolean selector
Returns
Elements from a where sel is true, 0 otherwise.
static SimdDInt32 gmx_simdcall gmx::selectByMask ( SimdDInt32  a,
SimdDIBool  mask 
)
inlinestatic

Select from gmx::SimdDInt32 variable where boolean is true.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD integer to select from
maskBoolean selector
Returns
Elements from a where sel is true, 0 otherwise.
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 SimdFloat gmx_simdcall gmx::selectByNotMask ( SimdFloat  a,
SimdFBool  mask 
)
inlinestatic

Select from single precision SIMD variable where boolean is false.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
For each element, a is selected for false, 0 for true (sic).
static SimdDouble gmx_simdcall gmx::selectByNotMask ( SimdDouble  a,
SimdDBool  mask 
)
inlinestatic

Select from double precision SIMD variable where boolean is false.

Parameters
aFloating-point variable to select from
maskBoolean selector
Returns
For each element, a is selected for false, 0 for true (sic).
static SimdFInt32 gmx_simdcall gmx::selectByNotMask ( SimdFInt32  a,
SimdFIBool  mask 
)
inlinestatic

Select from gmx::SimdFInt32 variable where boolean is false.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD integer to select from
maskBoolean selector
Returns
Elements from a where sel is false, 0 otherwise (sic).
static SimdDInt32 gmx_simdcall gmx::selectByNotMask ( SimdDInt32  a,
SimdDIBool  mask 
)
inlinestatic

Select from gmx::SimdDInt32 variable where boolean is false.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD integer to select from
maskBoolean selector
Returns
Elements from a where sel is false, 0 otherwise (sic).
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 findLibraryFile() and openLibraryFile().

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 const SimdSetZeroProxy gmx_simdcall gmx::setZero ( )
inlinestatic

Helper function to set any SIMD or scalar variable to zero.

Returns
Proxy object that will call the actual function to set a SIMD/scalar variable to zero based on the conversion function called when you assign the result.
static SimdDouble gmx_simdcall gmx::setZeroD ( )
inlinestatic

Set all SIMD double variable elements to 0.0.

You should typically just call gmx::setZero(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Returns
SIMD 0.0
static SimdDInt32 gmx_simdcall gmx::setZeroDI ( )
inlinestatic

Set all SIMD (double) integer variable elements to 0.

You should typically just call gmx::setZero(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Returns
SIMD 0
static SimdFloat gmx_simdcall gmx::setZeroF ( )
inlinestatic

Set all SIMD float variable elements to 0.0.

You should typically just call gmx::setZero(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Returns
SIMD 0.0f
static SimdFInt32 gmx_simdcall gmx::setZeroFI ( )
inlinestatic

Set all SIMD (float) integer variable elements to 0.

You should typically just call gmx::setZero(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Returns
SIMD 0
bool gmx::simdCheck ( SimdType  s,
FILE *  log,
bool  warnToStdErr 
)

Check if binary was compiled with the provided SIMD type.

Parameters
sSIMD type to query. If this matches the suggested type for this cpu, the routine returns quietly.
logIf not nullptr, statistics will be printed to the file. If we do not have a match there will also be a warning.
warnToStdErrIf true, warnings will also be printed to stderr.
static SimdFloat gmx_simdcall gmx::simdLoad ( const float *  m,
SimdFloatTag  = {} 
)
inlinestatic

Load GMX_SIMD_FLOAT_WIDTH float numbers from aligned memory.

Parameters
mPointer to memory aligned to the SIMD width.
Returns
SIMD variable with data loaded.
static SimdDouble gmx_simdcall gmx::simdLoad ( const double *  m,
SimdDoubleTag  = {} 
)
inlinestatic

Load GMX_SIMD_DOUBLE_WIDTH numbers from aligned memory.

Parameters
mPointer to memory aligned to the SIMD width.
Returns
SIMD variable with data loaded.
static SimdFInt32 gmx_simdcall gmx::simdLoad ( const std::int32_t *  m,
SimdFInt32Tag   
)
inlinestatic

Load aligned SIMD integer data, width corresponds to gmx::SimdFloat.

You should typically just call gmx::load(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Parameters
mPointer to memory, aligned to (float) integer SIMD width.
Returns
SIMD integer variable.
static SimdDInt32 gmx_simdcall gmx::simdLoad ( const std::int32_t *  m,
SimdDInt32Tag   
)
inlinestatic

Load aligned SIMD integer data, width corresponds to gmx::SimdDouble.

You should typically just call gmx::load(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Parameters
mPointer to memory, aligned to (double) integer SIMD width.
Returns
SIMD integer variable.
static SimdFloat gmx_simdcall gmx::simdLoadU ( const float *  m,
SimdFloatTag  = {} 
)
inlinestatic

Load SIMD float from unaligned memory.

Available if GMX_SIMD_HAVE_LOADU is 1.

Parameters
mPointer to memory, no alignment requirement.
Returns
SIMD variable with data loaded.
static SimdDouble gmx_simdcall gmx::simdLoadU ( const double *  m,
SimdDoubleTag  = {} 
)
inlinestatic

Load SIMD double from unaligned memory.

Available if GMX_SIMD_HAVE_LOADU is 1.

Parameters
mPointer to memory, no alignment requirement.
Returns
SIMD variable with data loaded.
static SimdFInt32 gmx_simdcall gmx::simdLoadU ( const std::int32_t *  m,
SimdFInt32Tag   
)
inlinestatic

Load unaligned integer SIMD data, width corresponds to gmx::SimdFloat.

You should typically just call gmx::loadU(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Available if GMX_SIMD_HAVE_LOADU is 1.

Parameters
mPointer to memory, no alignment requirements.
Returns
SIMD integer variable.
static SimdDInt32 gmx_simdcall gmx::simdLoadU ( const std::int32_t *  m,
SimdDInt32Tag   
)
inlinestatic

Load unaligned integer SIMD data, width corresponds to gmx::SimdDouble.

You should typically just call gmx::loadU(), which uses proxy objects internally to handle all types rather than adding the suffix used here.

Available if GMX_SIMD_HAVE_LOADU is 1.

Parameters
mPointer to memory, no alignment requirements.
Returns
SIMD integer variable.
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).
const std::string & gmx::simdString ( SimdType  s)

Return a string with the name of a SIMD type.

Parameters
sSIMD type to turn into string
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_simdcall gmx::store ( float *  m,
SimdFloat  a 
)
inlinestatic

Store the contents of SIMD float variable to aligned memory m.

Parameters
[out]mPointer to memory, aligned to SIMD width.
aSIMD variable to store
static void gmx_simdcall gmx::store ( double *  m,
SimdDouble  a 
)
inlinestatic

Store the contents of SIMD double variable to aligned memory m.

Parameters
[out]mPointer to memory, aligned to SIMD width.
aSIMD variable to store
Examples:
template.cpp.
static void gmx_simdcall gmx::store ( std::int32_t *  m,
SimdFInt32  a 
)
inlinestatic

Store aligned SIMD integer data, width corresponds to gmx::SimdFloat.

Parameters
mMemory aligned to (float) integer SIMD width.
aSIMD variable to store.
static void gmx_simdcall gmx::store ( std::int32_t *  m,
SimdDInt32  a 
)
inlinestatic

Store aligned SIMD integer data, width corresponds to gmx::SimdDouble.

Parameters
mMemory aligned to (double) integer SIMD width.
aSIMD (double) integer variable to store.
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_simdcall gmx::storeDualHsimd ( double *  m0,
double *  m1,
SimdDouble  a 
)
inlinestatic

Store low & high parts of SIMD double to different locations.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
aSIMD variable. Low half should be stored to m0, high to m1.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE is 1.

static void gmx_simdcall gmx::storeDualHsimd ( float *  m0,
float *  m1,
SimdFloat  a 
)
inlinestatic

Store low & high parts of SIMD float to different locations.

Parameters
m0Pointer to memory aligned to half SIMD width.
m1Pointer to memory aligned to half SIMD width.
aSIMD variable. Low half should be stored to m0, high to m1.

Available if GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT is 1.

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_simdcall gmx::storeU ( float *  m,
SimdFloat  a 
)
inlinestatic

Store SIMD float to unaligned memory.

Available if GMX_SIMD_HAVE_STOREU is 1.

Parameters
[out]mPointer to memory, no alignment requirement.
aSIMD variable to store.
static void gmx_simdcall gmx::storeU ( double *  m,
SimdDouble  a 
)
inlinestatic

Store SIMD double to unaligned memory.

Available if GMX_SIMD_HAVE_STOREU is 1.

Parameters
[out]mPointer to memory, no alignment requirement.
aSIMD variable to store.
static void gmx_simdcall gmx::storeU ( std::int32_t *  m,
SimdFInt32  a 
)
inlinestatic

Store unaligned SIMD integer data, width corresponds to gmx::SimdFloat.

Available if GMX_SIMD_HAVE_STOREU is 1.

Parameters
mMemory pointer, no alignment requirements.
aSIMD variable to store.
static void gmx_simdcall gmx::storeU ( std::int32_t *  m,
SimdDInt32  a 
)
inlinestatic

Store unaligned SIMD integer data, width corresponds to gmx::SimdDouble.

Available if GMX_SIMD_HAVE_STOREU is 1.

Parameters
mMemory pointer, no alignment requirements.
aSIMD (double) integer variable to store.
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.
static SimdFBool gmx_simdcall gmx::testBits ( SimdFloat  a)
inlinestatic

Return true if any bits are set in the single precision SIMD.

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
Each element of the boolean will be true if any bit in a is nonzero.
static SimdDBool gmx_simdcall gmx::testBits ( SimdDouble  a)
inlinestatic

Return true if any bits are set in the single precision SIMD.

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
Each element of the boolean will be true if any bit in a is nonzero.
static SimdFIBool gmx_simdcall gmx::testBits ( SimdFInt32  a)
inlinestatic

Check if any bit is set in each element.

Available if GMX_SIMD_HAVE_FINT32_ARITHMETICS is 1.

Parameters
aSIMD integer
Returns
SIMD integer boolean with true for elements where any bit is set
static SimdDIBool gmx_simdcall gmx::testBits ( SimdDInt32  a)
inlinestatic

Check if any bit is set in each element.

Available if GMX_SIMD_HAVE_DINT32_ARITHMETICS is 1.

Parameters
aSIMD integer
Returns
SIMD integer boolean with true for elements where any bit is set
static void gmx::threadMpiMdrunnerAccessBarrier ( )
static

Barrier for safe simultaneous thread access to mdrunner data.

Used to ensure that the master thread does not modify mdrunner during copy on the spawned threads.

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.
static SimdFloat gmx_simdcall gmx::trunc ( SimdFloat  a)
inlinestatic

Truncate SIMD 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 is truncation towards zero, not floor(). The reason for this is that truncation is virtually always present as a dedicated hardware instruction, but floor() frequently isn't.
static SimdDouble gmx_simdcall gmx::trunc ( SimdDouble  a)
inlinestatic

Truncate SIMD double, 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 is truncation towards zero, not floor(). The reason for this is that truncation is virtually always present as a dedicated hardware instruction, but floor() frequently isn't.
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::writeHeader ( TextWriter *  writer,
const std::string &  text,
const std::string &  section,
bool  writeFormattedText 
)

Write appropiate Header to output stream.

Parameters
[in]writerTextWriter object for writing information.
[in]textString with the header before writing.
[in]sectionString with section text for header.
[in]writeFormattedTextIf we need to format the text for LaTeX output or not
void gmx::writeInformation ( TextOutputFile *  outputStream,
const t_inputrec &  ir,
const gmx_mtop_t &  top,
bool  writeFormattedText,
bool  notStdout 
)

Wrapper for writing out information.

This function is actual called from within the run method to write the information to the terminal or to file. New write out methods should be added to it instead of adding them in run.

Parameters
[in]outputStreamThe filestream used to write the information to.
[in]irReference to inputrec of the run input.
[in]topLocal topology used to derive the information to write out.
[in]writeFormattedTextDecide if we want formatted text output or not.
[in]notStdoutBool to see if we can close the file after writing or not in case of stdout.
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).

void gmx::writeParameterInformation ( TextWriter *  writer,
const t_inputrec &  ir,
bool  writeFormattedText 
)

Write information about system parameters.

This method writes the basic information for the system parameters and simulation settings as reported in the ir.

Parameters
[in]writerTextWriter object for writing information.
[in]irReference to inputrec of the run input.
[in]writeFormattedTextDecide if we want formatted text output or not.
void gmx::writeSystemInformation ( TextWriter *  writer,
const gmx_mtop_t &  top,
bool  writeFormattedText 
)

Write information about the molecules in the system.

This method should write all possible information about the molecular composition of the system.

Parameters
[in]writerTextWriter object for writing information.
[in]topLocal topology used to derive the information to write out.
[in]writeFormattedTextDecide if we want formatted text output or not.

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.

constexpr std::array<int, c_numFtypesOnGpu> gmx::ftypesOnGpu
Initial value:
=
{
F_BONDS,
F_ANGLES,
F_UREY_BRADLEY,
F_PDIHS,
F_RBDIHS,
F_IDIHS,
F_PIDIHS,
F_LJ14
}

List of all bonded function types supported on GPUs.

Note
This list should be in sync with the actual GPU code.
Perturbed interactions are not supported on GPUs.
The function types in the list are ordered on increasing value.
Currently bonded are only supported with CUDA, not with OpenCL.
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.