### Get NBNxM Kernel Setup Configuration Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx Returns the kernel setup configuration for NBNxM benchmarks. This function determines the appropriate settings based on provided options. ```cpp static NbnxmKernelSetup | getKernelSetup (const NbnxmKernelBenchOptions &options) ``` -------------------------------- ### Get Kernel Setup Configuration Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Retrieves the kernel setup configuration based on provided benchmarking options. This function is crucial for correctly initializing and running kernel benchmarks. ```c++ static NbnxmKernelSetup getKernelSetup (const NbnxmKernelBenchOptions &options) | Returns the kernel setup. ``` -------------------------------- ### Set up Python Virtual Environment Source: https://manual.gromacs.org/current/gmxapi/userguide/install This snippet demonstrates how to create and activate a Python virtual environment using the `venv` module. It also ensures pip, setuptools, and wheel are up-to-date and installs the `mpi4py` package, which might require additional compiler hints depending on your MPI setup. ```bash python3 -m venv $HOME/myvenv . $HOME/myvenv/bin/activate python -m ensurepip --default-pip pip install --upgrade pip setuptools wheel pip install mpi4py ``` -------------------------------- ### Setup and Run Benchmark Instance Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx Sets up and runs a requested benchmark instance and prints the results. This function orchestrates the execution of a single benchmark case, including potential warm-up runs. ```cpp static void | setupAndRunInstance (const BenchmarkSystem &system, const NbnxmKernelBenchOptions &options, const bool doWarmup) ``` -------------------------------- ### Verify GROMACS Installation Source: https://manual.gromacs.org/current/user-guide/getting-started This command checks if GROMACS is installed and accessible in your system's PATH. It should output the installed GROMACS version. If it fails, it indicates that GROMACS is not found. ```bash gmx -version ``` ```bash gmx: command not found. ``` -------------------------------- ### Setup Force Output Buffers Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx The `setupForceOutputs` function initializes and prepares the necessary buffers for storing force data. It also performs clearing operations on these buffers. This function is essential for managing force data during the simulation and is part of the force calculation infrastructure. ```cpp static ForceOutputs setupForceOutputs (ForceHelperBuffers *forceHelperBuffers, ArrayRefWithPadding< RVec > force, const DomainLifetimeWorkload &domainWork, const StepWorkload &stepWork, const bool havePpDomainDecomposition, gmx_wallcycle *wcycle) ``` -------------------------------- ### Get Subblock Start (C++) Source: https://manual.gromacs.org/current/doxygen/html-full/structBiasOutputSetup Retrieves the starting subblock index. This function returns an integer representing the starting subblock for the bias output setup. It's a member of the BiasOutputSetup class. ```C++ int subblockStart () const ``` -------------------------------- ### Setup NBNxM for Benchmarking Instance Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx Sets up and returns a Nbnxm object for a given benchmark instance. This function initializes the NBNxM computational structure based on benchmark options and system parameters. ```cpp static std::unique_ptr< nonbonded_verlet_t > | setupNbnxmForBenchInstance (const NbnxmKernelBenchOptions &options, const BenchmarkSystem &system) ``` -------------------------------- ### Start mdrun using external MPI Source: https://manual.gromacs.org/current/user-guide/mdrun-performance Starts mdrun using an external MPI implementation (e.g., `mpirun`) with two ranks. The number of OpenMP threads will be determined by the hardware and MPI setup. This example assumes a GROMACS build compiled with external MPI support. ```bash mpirun -np 2 gmx_mpi mdrun ``` -------------------------------- ### SimulationRunner Constructor and Setup Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1test_1_1SimulationRunner Details on initializing the SimulationRunner and configuring input files for grompp. ```APIDOC ## SimulationRunner Class ### Description Helper object for running grompp and mdrun in integration tests of mdrun functionality. Objects of this class must be owned by objects descended from MdrunTestFixtureBase, which sets up necessary infrastructure for it. Such an object may own more than one SimulationRunner. The setup phase creates various temporary files for input and output that are common for mdrun tests, using the file manager object of the fixture that owns this object. Individual tests should create any extra filenames similarly, so that the test users's current working directory does not get littered with files left over from tests. Any method in this class may throw std::bad_alloc if out of memory. By default, the convenience methods callGrompp() and callMdrun() just prepare and run a default call to mdrun. If there is a need to customize the command-line for grompp or mdrun (e.g. to invoke -maxwarn n, or -reprod), then make a CommandLine object with the appropriate flags and pass that into the routines that accept such. ### Constructor #### SimulationRunner(TestFileManager *fileManager) ##### Description Initializes a runner with given manager for temporary files. ##### Method Constructor ##### Parameters - **fileManager** (*TestFileManager**) - Required - Manager for temporary files. ### Input File Configuration #### useEmptyMdpFile () ##### Description Use an empty .mdp file as input to grompp. ##### Method void #### useStringAsMdpFile (const char *mdpString) ##### Description Use a given string as input to grompp. ##### Method void ##### Parameters - **mdpString** (*const char**) - Required - MDP file content as a string. #### useStringAsMdpFile (const std::string &mdpString) ##### Description Use a given string as input to grompp. ##### Method void ##### Parameters - **mdpString** (*const std::string&**) - Required - MDP file content as a string. #### useStringAsNdxFile (const char *ndxString) const ##### Description Use a string as -n input to grompp. ##### Method void ##### Parameters - **ndxString** (*const char**) - Required - Index file content as a string. #### useTopG96AndNdxFromDatabase (const std::string &name) ##### Description Use a standard .top and .g96 file as input to grompp. ##### Method void ##### Parameters - **name** (*const std::string&**) - Required - Name of the topology and index files. #### useTopGroAndNdxFromDatabase (const std::string &name) ##### Description Use a standard .top and .gro file as input to grompp. ##### Method void ##### Parameters - **name** (*const std::string&**) - Required - Name of the topology, gro, and index files. #### useGroFromDatabase (const char *name) ##### Description Use a standard .gro file as input to grompp. ##### Method void ##### Parameters - **name** (*const char**) - Required - Name of the gro file. #### useNdxFromDatabase (const std::string &name) ##### Description Use a standard .ndx as input to grompp. ##### Method void ##### Parameters - **name** (*const std::string&**) - Required - Name of the index file. #### useTopGroAndMdpFromFepTestDatabase (const std::string &name) ##### Description Use .top, .gro, and .mdp from FEP test database. ##### Method void ##### Parameters - **name** (*const std::string&**) - Required - Name of the FEP test files. #### setMaxWarn (int maxwarn) ##### Description Set a maximum number of acceptable warnings. ##### Method void ##### Parameters - **maxwarn** (*int**) - Required - Maximum number of warnings. ``` -------------------------------- ### CMake Command-Line Configuration for GROMACS Source: https://manual.gromacs.org/current/install-guide/index This example shows how to configure GROMACS using CMake with specific options passed directly on the command line. Options like `-DGMX_GPU=CUDA`, `-DGMX_MPI=ON`, and `-DCMAKE_INSTALL_PREFIX` allow for pre-defining build features and installation paths, which can be useful for scripting or when the desired configuration is known in advance. ```shell cmake .. -DGMX_GPU=CUDA -DGMX_MPI=ON \ -DCMAKE_INSTALL_PREFIX=/home/marydoe/programs ``` -------------------------------- ### Setup Nbnxm for Benchmark Instance Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Sets up and returns a Nbnxm object tailored for a specific benchmark instance, considering the provided options and system characteristics. This function manages the initialization of NBNxM for benchmarking. ```c++ static std::unique_ptr< nonbonded_verlet_t > setupNbnxmForBenchInstance (const NbnxmKernelBenchOptions &options, const BenchmarkSystem &system) | Sets up and returns a Nbnxm object for the given benchmark options and system. ``` -------------------------------- ### Get Installation Prefix Source: https://manual.gromacs.org/current/doxygen/html-user/group__module__commandline Retrieves the installation prefix of the GROMACS installation. This path is crucial for locating GROMACS data files, configuration files, and other resources. ```cpp InstallationPrefixInfo prefixInfo = context.installationPrefix(); ``` -------------------------------- ### Simulation Setup and Data Source: https://manual.gromacs.org/current/doxygen/html-user/hierarchy Helper structures for FFT plan setup, potential evaluation results, and profiling information. ```APIDOC ## gmx::PlanSetupData ### Description Helper struct to reduce repetitive code setting up a 3D FFT plan. ### Method N/A (Struct definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## gmx::PotentialPointData ### Description Structure to hold the results of IRestraintPotential::evaluate(). ### Method N/A (Struct definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## gmx::Profiling ### Description Collection of profiling information. ### Method N/A (Class definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### C++: Managing Data Frames with AnalysisDataHandle Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1AnalysisDataHandle Demonstrates the core functionality of AnalysisDataHandle for adding data to an AnalysisData object. It includes starting and finishing frames, selecting data sets, and setting point values. This example assumes basic setup and data structures are already defined. ```cpp #include // Assuming analysisData is an instance of AnalysisData // and handle is obtained via AnalysisData::startData() void manageDataFrame(AnalysisDataHandle& handle) { // Start a new frame handle.startFrame(0, 1.0, 0.1); // Select a data set handle.selectDataSet(0); // Set a single point value handle.setPoint(0, 5.5); // Set a point value with an error handle.setPoint(1, 6.0, 0.2); // Set multiple consecutive point values const real values[] = {7.0, 8.0, 9.0}; handle.setPoints(2, 3, values); // Finish the current frame handle.finishFrame(); // Finish all data for this handle handle.finishData(); } ``` -------------------------------- ### Run GROMACS Regression Tests with Specific Options (Perl Script) Source: https://manual.gromacs.org/current/install-guide/index This demonstrates running the GROMACS regression tests using the `gmxtest.pl` script with various options. The example shows how to specify a suffix, enable double-precision tests, disable cross-compiling checks, and configure MPI execution commands. ```bash ./gmxtest.pl -suffix ./gmxtest.pl -double ./gmxtest.pl -crosscompiling ./gmxtest.pl -mpirun srun ``` -------------------------------- ### Kernel Setup Checking Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Checks the kernel setup configuration for benchmarking. It returns an optional string describing any issues found. ```c++ static std::optional< std::string > checkKernelSetup (const NbnxmKernelBenchOptions &options) | Checks the kernel setup. More... ``` -------------------------------- ### PME Load Balance Helper Setup Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1PmeLoadBalanceHelper-members The setup function is a member of PmeLoadBalanceHelper responsible for initializing and preparing the necessary structures and resources for PME load balancing at the beginning of a simulation phase. ```C++ void setup() ``` -------------------------------- ### Check CMake Version Source: https://manual.gromacs.org/current/install-guide/index Checks the installed version of CMake, which is required for building GROMACS (version 3.28 or higher recommended). ```bash cmake --version ``` -------------------------------- ### Installation Prefix Information Source: https://manual.gromacs.org/current/doxygen/html-full/hierarchy Provides information about the installation prefix, as accessible through `IProgramContext::installationPrefix()`. ```APIDOC ## gmx::InstallationPrefixInfo ### Description Provides information about the installation prefix. ### Method N/A (Class definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### StatePropagatorData::Element::elementSetup Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1StatePropagatorData_1_1Element Performs setup actions for the element, such as backing up initial velocities. This is called once at the beginning of the simulation setup. ```APIDOC ## gmx::StatePropagatorData::Element::elementSetup ### Description Performs initial setup for the `StatePropagatorData::Element`. This includes backing up starting velocities, preparing the element for the simulation run. ### Method void ### Endpoint N/A (Member function) ### Parameters None ### Request Example (No request body for this method) ### Response #### Success Response (void) This function does not return a value. #### Response Example N/A ``` -------------------------------- ### Simulation Setup Functions Source: https://manual.gromacs.org/current/doxygen/html-lib/functions_func_0x73 Functions for configuring and initializing simulation parameters. ```APIDOC ## SetBox() ### Description Sets the simulation box dimensions. ### Method POST ### Endpoint /websites/manual_gromacs_current/simulation/setBox ### Parameters #### Request Body - **box_vectors** (array) - An array of three vectors defining the box dimensions (e.g., [[x,y,z], [x,y,z], [x,y,z]] for triclinic). - **box_type** (string) - The type of the box (e.g., 'triclinic', 'cubic'). ### Request Example { "box_vectors": [[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]], "box_type": "cubic" } #### Success Response (200) - **status** (string) - Operation status. #### Response Example { "status": "success" } ## SetForces() ### Description Sets the forces acting on particles. ### Method POST ### Endpoint /websites/manual_gromacs_current/simulation/setForces ### Parameters #### Request Body - **forces** (array) - An array of force vectors for each particle. ### Request Example { "forces": [[0.1, 0.2, 0.3], [-0.1, -0.2, -0.3]] } #### Success Response (200) - **status** (string) - Operation status. #### Response Example { "status": "success" } ## setConstraints() ### Description Configures constraints for the simulation. ### Method PUT ### Endpoint /websites/manual_gromacs_current/simulation/constraints ### Parameters #### Request Body - **constraint_type** (string) - The type of constraint to apply (e.g., 'settle', 'none'). - **parameters** (object) - Specific parameters for the chosen constraint type. ### Request Example { "constraint_type": "settle", "parameters": { "tolerance": 0.001, "group": "all" } } #### Success Response (200) - **status** (string) - Operation status. #### Response Example { "status": "success" } ``` -------------------------------- ### GROMACS Quick Installation Commands Source: https://manual.gromacs.org/current/install-guide/index This snippet outlines the sequence of commands for a quick and dirty installation of GROMACS. It includes unpacking the tarball, creating a build directory, configuring with CMake, compiling, running checks, installing, and sourcing the GMXRC script. It assumes the user has necessary compilers and CMake installed. ```bash tar xfz gromacs-2025.4.tar.gz cd gromacs-2025.4 mkdir build cd build cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON make make check sudo make install source /usr/local/gromacs/bin/GMXRC ``` -------------------------------- ### Enable CUDA GPU Acceleration in CMake Source: https://manual.gromacs.org/current/install-guide/index Configures GROMACS to utilize CUDA for GPU acceleration. It requires the CUDA Toolkit to be installed and allows specifying the root directory of the CUDA installation. Advanced options can also target specific CUDA architectures. ```bash cmake .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda # Targeting specific CUDA architectures came .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -GMX_CUDA_TARGET_SM="60;75;86" ``` -------------------------------- ### ListedForces::setup Source: https://manual.gromacs.org/current/doxygen/html-lib/classListedForces Copies the listed interactions from `idef` and sets up the thread parallelization. It configures the class based on interaction definitions and parallelization strategy. ```APIDOC ## void ListedForces::setup ### Description Copy the listed interactions from `idef` and set up the thread parallelization. ### Method void ### Endpoint N/A (Class member function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "_domainIdef_": "const InteractionDefinitions &", "_numAtomsForce_": "int", "_useGpu_": "bool", "_restraintComIndices_": "gmx::ArrayRef< const unsigned short >", "_numComGroups_": "int" } ``` ### Response #### Success Response (void) This function returns void. #### Response Example None ``` -------------------------------- ### BenchmarkSystem Constructor Source: https://manual.gromacs.org/current/doxygen/html-lib/structgmx_1_1BenchmarkSystem Initializes a BenchmarkSystem. It generates a benchmark system by scaling a base system (1000 water molecules) by a given multiplication factor. Results can be output to a specified CSV file. ```APIDOC ## gmx::BenchmarkSystem::BenchmarkSystem ### Description Constructor for the BenchmarkSystem. Generates a benchmark system of size `multiplicationFactor` times the base size by stacking cubic boxes of 1000 water molecules with 3000 atoms total. ### Method CONSTRUCTOR ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "multiplicationFactor": 4, "outputFile": "benchmark_results.csv" } ``` ### Response #### Success Response (200) None (Constructor does not return a value) #### Response Example N/A ``` -------------------------------- ### Get Installation Prefix - C++ Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1IProgramContext Retrieves the installation prefix for GROMACS. This information, provided by the gmx::IProgramContext interface, is vital for locating GROMACS data files and resources. ```cpp virtual InstallationPrefixInfo installationPrefix () const =0; ``` -------------------------------- ### ITrajectoryWriterClient Setup and Teardown (C++) Source: https://manual.gromacs.org/current/doxygen/html-full/group__module__modularsimulator Defines the interface for trajectory writers, including methods for setup and teardown with a provided output file pointer. These methods manage the lifecycle of trajectory writing operations. ```cpp virtual void | gmx::ITrajectoryWriterClient::trajectoryWriterSetup(gmx_mdoutf *outf) = 0; virtual void | gmx::ITrajectoryWriterClient::trajectoryWriterTeardown(gmx_mdoutf *outf) = 0; virtual | gmx::ITrajectoryWriterClient::~ITrajectoryWriterClient() = default; ``` -------------------------------- ### Specify GROMACS Installation Directory with CMake Source: https://manual.gromacs.org/current/api/gmxlibs This snippet demonstrates how to hint the location of a GROMACS installation using CMake variables. 'GROMACS_DIR' or 'CMAKE_PREFIX_PATH' can be set to guide 'find_package'. 'GROMACS_DIR' can also be set via the 'GMXRC' environment variable. ```cmake set(GROMACS_DIR "/path/to/gromacs/installation") find_package(GROMACS REQUIRED) ``` -------------------------------- ### Use External VkFFT Library in GROMACS Build Source: https://manual.gromacs.org/current/install-guide/index This configuration allows GROMACS to use an externally installed VkFFT library instead of the bundled version. This is useful for leveraging newer VkFFT releases or specific configurations. It requires specifying the include directory for the external VkFFT installation. ```cmake cmake -DGMX_GPU_FFT_LIBRARY=VKFFT \ -DGMX_EXTERNAL_VKFFT=ON -DVKFFT_INCLUDE_DIR= ``` -------------------------------- ### PP-PME Setup Parameters Source: https://manual.gromacs.org/current/doxygen/html-full/structpme__setup__t This section details the public attributes of the PP-PME setup structure, including parameters for Coulomb cutoff, pair-list cutoffs, PME grid settings, Ewald coefficients, and timing information. ```APIDOC ## PP-PME Setup Parameters ### Description Parameters and settings for one PP-PME setup. ### Method N/A (Structure definition) ### Endpoint N/A (Structure definition) ### Parameters #### Public Attributes - **rcut_coulomb** (real) - Description: Coulomb cut-off. - **rlistOuter** (real) - Description: cut-off for the outer pair-list. - **rlistInner** (real) - Description: cut-off for the inner pair-list. - **spacing** (real) - Description: (largest) PME grid spacing. - **grid** (ivec) - Description: the PME grid dimensions. - **grid_efficiency** (real) - Description: ineffiency factor for non-uniform grids <= 1. - **ewaldcoeff_q** (real) - Description: Electrostatic Ewald coefficient. - **ewaldcoeff_lj** (real) - Description: LJ Ewald coefficient, only for the call to send_switchgrid. - **pmedata** (struct gmx_pme_t *) - Description: the data structure used in the PME code. - **count** (int) - Description: number of times this setup has been timed. - **cycles** (double) - Description: the fastest time for this setup in cycles. ### Request Example N/A (Structure definition) ### Response #### Success Response (N/A) N/A #### Response Example N/A (Structure definition) ``` -------------------------------- ### DomainCommForward Constructor and Setup Source: https://manual.gromacs.org/current/doxygen/html-user/classgmx_1_1DomainCommForward Details on how to construct a DomainCommForward object and set up the forward communication. ```APIDOC ## DomainCommForward Constructor ### Description Constructor for the DomainCommForward class. ### Method Constructor ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` // Example usage: int rank = 1; int zone = 0; MPI_Comm mpiCommAll = MPI_COMM_WORLD; DomainCommForward comm(rank, zone, mpiCommAll); ``` ### Response #### Success Response (Constructor) N/A #### Response Example N/A --- ## void DomainCommForward::setup ### Description Sets up the forward communication, receiving the count from a remote `send` object. ### Method `void` ### Endpoint N/A (Class Member Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **send** (const DomainCommBackward&) - Required - The send data needed to send forward. - **offsetInCoordinateBuffer** (int) - Required - The offset in the coordinate buffer for receiving coordinates. ### Request Example ```cpp // Assuming 'sendData' is a DomainCommBackward object and 'offset' is an integer: comm.setup(sendData, offset); ``` ### Response #### Success Response (200) N/A (void function) #### Response Example N/A ``` -------------------------------- ### Specify Library and Header Paths with CMake Source: https://manual.gromacs.org/current/install-guide/index Demonstrates how to inform CMake about the locations of libraries, header files, and binaries when they are installed in non-default directories. This is crucial for successful compilation when dependencies are not in standard system paths. ```bash # Environment variable setting (Unix shell) export CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda # CMake command-line option came .. -DCMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda ``` -------------------------------- ### LINCS Initialization and Setup Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Functions for initializing, setting up, and destructing the LINCS data structures. ```APIDOC ## LINCS Initialization and Setup ### init_lincs Initializes and returns the lincs data struct. ### Method [Function Signature - C++] ### Parameters - **fplog** (FILE *) - File pointer for logging. - **mtop** (const gmx_mtop_t &) - Molecular topology information. - **nflexcon_global** (int) - Global number of flexible constraints. - **atomsToConstraintsPerMolType** (ArrayRef< const ListOfLists< int >>) - Atom to constraint mapping per molecule type. - **bPLINCS** (bool) - Flag to enable PLINCS. - **nIter** (int) - Number of iterations. - **nProjOrder** (int) - Projection order. - **observablesReducerBuilder** (ObservablesReducerBuilder *) - Builder for observables reducer. ### done_lincs Destructs the lincs object when it is not nullptr. ### Method [Function Signature - C++] ### Parameters - **li** (Lincs *) - Pointer to the LINCS data struct to be destructed. ### set_lincs Initialize lincs stuff. ### Method [Function Signature - C++] ### Parameters - **idef** (const InteractionDefinitions &) - Interaction definitions. - **numAtoms** (int) - Total number of atoms. - **invmass** (ArrayRef< const real >) - Array of inverse masses. - **lambda** (real) - Scaling factor. - **bDynamics** (bool) - Flag indicating dynamic simulation. - **cr** (const t_commrec *) - Communicator record. - **li** (Lincs *) - Pointer to the LINCS data struct. ``` -------------------------------- ### Configure GROMACS Build with CMake Source: https://manual.gromacs.org/current/install-guide/index Specifies paths for libraries and headers, selects compilers, and enables CUDA GPU acceleration during the CMake configuration process. It can be used to point to custom installations of libraries or toolkits. ```bash CMAKE_PREFIX_PATH=/opt/fftw:/opt/cuda cmake .. cmake .. -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda ``` -------------------------------- ### Enable hwloc for Hardware Detection in GROMACS Build Source: https://manual.gromacs.org/current/install-guide/index This CMake option enables the hwloc library, which can improve run-time detection of hardware capabilities in GROMACS. By default, this feature is turned off but can be enabled if hwloc is installed on the system. ```cmake cmake -DGMX_HWLOC=ON ``` -------------------------------- ### Setup Logging Signaller (C++) Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1LoggingSignaller The setup function is responsible for verifying that the necessary registrations for the logging signaller have been completed before simulation begins. This ensures that the signaller operates correctly. ```cpp #include void gmx::LoggingSignaller::setup() override { // Check that necessary registration was done. } ``` -------------------------------- ### Get GROMACS Configuration using gmxapi.utility.config Source: https://manual.gromacs.org/current/gmxapi/userguide/pythonreference Retrieves the GROMACS configuration detected during installation. It returns a read-only dictionary proxy containing information about the GROMACS installation used to configure the Python package. The exact keys are not formally specified and are primarily for internal use. ```python import gmxapi config = gmxapi.utility.config() print(config) ``` -------------------------------- ### Configure GROMACS with BBFFT Library Source: https://manual.gromacs.org/current/install-guide/index Enables the double-batched FFT (BBFFT) library for GROMACS, which is beneficial for very large FFT sizes on Intel GPUs. Requires BBFFT to be installed separately. Note that in GROMACS 2023, the option was DBFFT. ```cmake cmake -DGMX_GPU_FFT_LIBRARY=BBFFT \ -DCMAKE_PREFIX_PATH=$PATH_TO_BBFFT_INSTALL ``` -------------------------------- ### Energy Minimization Setup and Run Source: https://manual.gromacs.org/current/how-to/special Sets up and executes an energy minimization simulation for the CNT system. `gmx grompp` creates the run input file (`.tpr`) from the provided topology, structure, and MDP file, while `gmx mdrun` performs the actual minimization process. ```bash gmx grompp -f em.mdp -c boxed.gro -p cnt.top -o em.tpr gmx mdrun -v -deffnm em ``` -------------------------------- ### Start mdrun with GPU offload for non-bonded forces and CPU for PME Source: https://manual.gromacs.org/current/user-guide/mdrun-performance Starts mdrun with four thread-MPI ranks, where non-bonded force calculations are offloaded to GPUs, and the long-range PME component is calculated on CPUs. This setup is beneficial when CPUs are relatively powerful compared to GPUs. ```bash gmx mdrun -ntmpi 4 -nb gpu -pme cpu ``` -------------------------------- ### Prepare All OpenCL Kernel Arguments (Wrapper) Source: https://manual.gromacs.org/current/doxygen/html-full/oclutils_8h A wrapper function to set up all OpenCL kernel arguments by calling the recursive preparation functions. It takes the kernel handle, configuration, and a pack of argument pointers. It returns a handle for the prepared arguments, which is currently always nullptr for OpenCL. ```c++ template void* prepareGpuKernelArguments( cl_kernel _kernel, const KernelLaunchConfig & _config, const Args *... _argsPtrs ) { // Implementation details for preparing all kernel arguments return nullptr; // Always nullptr for OpenCL } ``` -------------------------------- ### Prepare Log File for Writing/Appending Source: https://manual.gromacs.org/current/doxygen/html-lib/namespacegmx Implements common aspects of log file handling, preparing it for either writing new content or appending to existing content. It takes binary information settings and a file pointer. ```cpp static void prepareLogFile (BinaryInformationSettings settings, FILE *fplog) ``` -------------------------------- ### Setup Bonded Threading Configuration (C++) Source: https://manual.gromacs.org/current/doxygen/html-full/manage__threading_8cpp Divides listed interactions among threads and the GPU. This function should be called whenever the bonded setup changes, such as at the start of a simulation or when domain decomposition is applied. It sets up the thread-force buffer reduction. ```cpp #include "gromacs/topology/idef.h" #include "gromacs/mdtypes/threaded_force_buffer.h" void setup_bonded_threading(bonded_threading_t *bt, int numAtomsForce, bool useGpuForBondeds, const InteractionDefinitions &idef) { // Implementation for setting up bonded threading } ``` -------------------------------- ### Get Number of Search Grids Source: https://manual.gromacs.org/current/doxygen/html-lib/namespacegmx Returns the total number of search grids configured. This is a simple accessor function providing information about the simulation setup. ```cpp static int | numGrids (const GridSet::DomainSetup &domainSetup) | Returns the number of search grids. ``` -------------------------------- ### Replica Exchange Setup Source: https://manual.gromacs.org/current/doxygen/html-full/replicaexchange_8h Initializes the replica exchange algorithm with specified parameters. This function should typically be called on the main simulation ranks. ```APIDOC ## init_replica_exchange ### Description Setup function for replica exchange. Should only be called on the main ranks. ### Method Not applicable (this is a library function call). ### Endpoint Not applicable (this is a library function call). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c // Assuming necessary variables like fplog, ms, numAtomsInSystem, ir, replExParams are defined gmx_repl_ex_t re = init_replica_exchange(fplog, ms, numAtomsInSystem, ir, replExParams); ``` ### Response #### Success Response (200) - **gmx_repl_ex_t** - An abstract type representing the initialized replica exchange context. #### Response Example ```json // The return value is a pointer to an opaque structure, not directly representable as JSON. { "status": "initialized", "context_pointer": "" } ``` ``` -------------------------------- ### Run Nbnxm Kernel Benchmarks Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Sets up and runs one or more Nbnxm kernel benchmarks based on provided size factors and options. This is the main entry point for running NBNxM benchmarks. ```c++ void bench (int sizeFactor, const NbnxmKernelBenchOptions &options) | Sets up and runs one or more Nbnxm kernel benchmarks. More... ``` -------------------------------- ### Get Number of Grids Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx Returns the total number of search grids configured based on the domain setup. This is a utility function for understanding grid configurations. ```c++ int numGrids (const GridSet::DomainSetup &domainSetup) ``` -------------------------------- ### Build GROMACS with HIP Acceleration Source: https://manual.gromacs.org/current/install-guide/index This CMake command configures GROMACS to use the HIP device backend for AMD GPUs. It specifies the ROCm AMD Clang++ compiler, sets the ROCm installation path, and enables HIP GPU acceleration. ```cmake cmake .. -DCMAKE_HIP_COMPILER=${ROCM_PATH}/bin/amdclang++ \ -DCMAKE_PREFIX_PATH=${ROCM_PATH} \ -DGMX_GPU=HIP ``` -------------------------------- ### Run NBNxM Kernel Benchmarks Source: https://manual.gromacs.org/current/doxygen/html-full/namespacegmx Sets up and runs one or more NBNxM kernel benchmarks. This is the main entry point for executing benchmark suites, controlling parameters like system size factor. ```cpp void | bench (int sizeFactor, const NbnxmKernelBenchOptions &options) ``` -------------------------------- ### Get GPU Atom Range Source: https://manual.gromacs.org/current/doxygen/html-user/namespacegmx Calculates and returns the atom range (start index and length) for GPU processing. This is determined based on atom data and locality. ```cpp static Range< int > getGpuAtomRange (const NBAtomDataGpu *atomData, const AtomLocality atomLocality) ``` -------------------------------- ### QMMM Simulation Parameter Setup API Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1anonymous__namespace_02qmmm_8cpp_03_1_1QMMMSimulationParameterSetup This section details the methods available for configuring QMMM simulation parameters. These include setting and retrieving atom sets for QM and MM regions, configuring periodic boundary conditions, and managing the simulation logger. ```APIDOC ## QMMM Simulation Parameter Setup API ### Description This API provides methods to configure and retrieve simulation parameters for Quantum Mechanics/Molecular Mechanics (QMMM) simulations. ### Methods for Atom Sets #### `setLocalQMAtomSet` - **Description**: Sets the local atom set for the QM atoms. - **Method**: `void` - **Parameters**: - `localAtomSet` (LocalAtomSet) - Required - The set of local atoms for the QM region. #### `localQMAtomSet` - **Description**: Returns the local atom set for QM atoms. - **Method**: `const LocalAtomSet&` - **Exceptions**: `InternalError` if the local atom set is not set. #### `setLocalMMAtomSet` - **Description**: Sets the local atom set for the MM atoms. - **Method**: `void` - **Parameters**: - `localAtomSet` (LocalAtomSet) - Required - The set of local atoms for the MM region. #### `localMMAtomSet` - **Description**: Returns the local atom set for MM atoms. - **Method**: `const LocalAtomSet&` - **Exceptions**: `InternalError` if the local atom set is not set. ### Methods for Periodic Boundary Conditions #### `setPeriodicBoundaryConditionType` - **Description**: Sets the periodic boundary condition type. - **Method**: `void` - **Parameters**: - `pbc` (PbcType) - Required - The type of periodic boundary condition to set. #### `periodicBoundaryConditionType` - **Description**: Gets the current periodic boundary condition settings. - **Method**: `PbcType` ### Methods for Logging #### `setLogger` - **Description**: Sets the logger for QMMM simulations during `mdrun`. - **Method**: `void` - **Parameters**: - `logger` (MDLogger) - Required - The logger instance to be used for output. #### `logger` - **Description**: Gets the logger instance. - **Method**: `const MDLogger&` ### Example Usage (Conceptual) ```cpp // Assuming QMMMSimulationParameterSetup instance `params` is available // Setting QM atom set LocalAtomSet qmAtoms = ...; // Initialize your LocalAtomSet params.setLocalQMAtomSet(qmAtoms); // Retrieving QM atom set const LocalAtomSet& retrievedQmAtoms = params.localQMAtomSet(); // Setting MM atom set LocalAtomSet mmAtoms = ...; // Initialize your LocalAtomSet params.setLocalMMAtomSet(mmAtoms); // Retrieving MM atom set const LocalAtomSet& retrievedMmAtoms = params.localMMAtomSet(); // Setting periodic boundary conditions PbcType pbcType = ...; // Initialize your PbcType params.setPeriodicBoundaryConditionType(pbcType); // Retrieving periodic boundary conditions PbcType currentPbc = params.periodicBoundaryConditionType(); // Setting the logger MDLogger simulationLogger = ...; // Initialize your MDLogger params.setLogger(simulationLogger); // Retrieving the logger const MDLogger& loggerInstance = params.logger(); ``` ### Error Handling - The `localQMAtomSet` and `localMMAtomSet` methods may throw an `InternalError` if the respective atom sets have not been set prior to retrieval. ``` -------------------------------- ### elementSetup Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1ComputeGlobalsElement Performs the initial setup for the ComputeGlobalsElement, which includes the first call to compute_globals. ```APIDOC ## elementSetup ### Description This method is responsible for the initial setup of the element. It involves the first invocation of the `compute_globals` function, preparing the element for the simulation step. ### Method void ### Endpoint N/A (Member function) ### Parameters None ### Request Example None (member function call) ### Response #### Success Response (200) This method does not return a value. #### Response Example N/A ``` -------------------------------- ### Get Kernel Setup Source: https://manual.gromacs.org/current/doxygen/html-lib/structgmx_1_1nonbonded__verlet__t Provides access to the NbnxmKernelSetup object. This object contains configuration details and parameters for the NBNxM kernels. ```cpp const NbnxmKernelSetup & kernelSetup () const ``` -------------------------------- ### C++ Enumeration Wrapper Usage Example Source: https://manual.gromacs.org/current/doxygen/html-lib/enumerationhelpers_8h Demonstrates how to use EnumerationWrapper for iterating over a C++ enum class. This requires the enum to have monotonically increasing values starting from zero. The example shows basic iteration and usage with EnumerationArray for name lookups. ```cpp #include #include #include #include "gromacs/utility/enumerationhelpers.h" enum class Foo : int { Bar, Baz, Fooz, Count }; int main() { const EnumerationArray fooStrings = { { "Bar", "Baz", "Fooz" } }; std::cout << "Iterating through Foo enum:" << std::endl; for (Foo c : EnumerationWrapper{}) { std::cout << static_cast(c) << std::endl; } std::cout << "Accessing names:" << std::endl; std::cout << fooStrings[Foo::Baz] << std::endl; // std::cout << fooStrings[Foo::Count]; // This would trigger an assertion std::cout << "Iterating through keysOf:" << std::endl; for (Foo c : keysOf(fooStrings)) { std::cout << fooStrings[c] << std::endl; } ArrayRef namesRef(fooStrings); std::cout << "ArrayRef access: " << namesRef[static_cast(Foo::Bar)] << std::endl; return 0; } ``` -------------------------------- ### Sample MiMiC CPMD Input Configuration Source: https://manual.gromacs.org/current/reference-manual/special/mimic-qmmm Example output generated by the prepare-qmmm.py script, illustrating the structure of the MiMiC and ATOMS sections within a CPMD input file. This configuration defines paths, box size, atom overlaps, and QM atom details for the QM/MM simulation. ```cpmd &MIMIC PATHS 1 BOX 35.77988547402689 35.77988547402689 35.77988547402689 OVERLAPS 3 2 13 1 1 2 14 1 2 2 15 1 3 &END &ATOMS O 1 17.23430225802002 17.76342557295923 18.576007806615877 H 2 18.557110545368047 19.086233860307257 18.727185896598506 17.57445296048094 16.705178943080806 17.06422690678956 &END Suggested QM box size [12.661165036045407, 13.71941166592383, 13.00131573850633] ``` -------------------------------- ### gmx::StatePropagatorData::Element::elementSetup Source: https://manual.gromacs.org/current/doxygen/html-full/classgmx_1_1StatePropagatorData_1_1Element Backs up starting velocities, primarily for vv integration where initial velocities are used for constraint virial calculation and then reset. ```APIDOC ## void gmx::StatePropagatorData::Element::elementSetup ### Description Backup starting velocities. This is only needed for vv, where the first (velocity) half step is only used to compute the constraint virial, but the velocities need to be reset after. TODO: There must be a more elegant solution to this! Implements gmx::ISimulatorElement. ### Method `void` ### Endpoint N/A (Member function) ### Parameters None ### Request Example N/A ### Response N/A (void function) ### Response Example N/A ``` -------------------------------- ### Compile CP2K for GROMACS QM/MM Source: https://manual.gromacs.org/current/install-guide/index This command compiles the CP2K library, which is necessary for enabling QM/MM support in GROMACS. Ensure you specify the correct architecture and version for your system. The resulting 'libcp2k.a' library should be placed in the CP2K installation's lib directory. ```bash make ARCH= VERSION= libcp2k ``` -------------------------------- ### Setup Essential Dynamics Parameters (C++) Source: https://manual.gromacs.org/current/doxygen/html-full/namespaceanonymous__namespace_02edsam_8cpp_03 Sets up the essential dynamics working parameters. It takes a pointer to the t_edpar structure which will be populated with the necessary working data. ```C++ void anonymous_namespace{edsam.cpp}::setup_edi( t_edpar * _edi_ ); ```