Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable use of CVs defined by PyTorch neural network models #570

Open
wants to merge 106 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
a6f8e84
In the process of implementing torchann colvar
zwpku May 13, 2022
12c4ac7
Merge branch 'master' of https://github.com/zwpku/colvars
zwpku May 13, 2022
6336c4b
Implementing torchann
zwpku May 14, 2022
0d6c2c6
Implemented calc_gradients and apply_forces
zwpku May 15, 2022
80a293e
Start working
zwpku May 16, 2022
6275dfb
Handling periodicity; test torchANN with phi angle
zwpku May 20, 2022
2d06095
Add output_index to specify the component of output layer that is used
zwpku May 24, 2022
eb5cfe5
update with upstream
Feb 8, 2023
70ef673
up
zwpku Feb 9, 2023
c4aa08b
Update gromacs-2021.6 patch
zwpku Feb 10, 2023
3363f39
modify patch files for namd to support LibTorch
zwpku Feb 11, 2023
56ee5d1
Merge branch 'Colvars:master' into torchann
zwpku Mar 13, 2023
3711f0d
updated with upstream:master
Jul 20, 2023
3f5eb82
Add test for torchann
Jul 21, 2023
45064d6
Merge pull request #1 from zwpku/torchann1
zwpku Jul 21, 2023
2edb0ff
minor changes
zwpku Jul 21, 2023
5a781d8
Modified test for torchann component
zwpku Aug 2, 2023
4776e5e
Add figures for AutoEncoder CV
Aug 2, 2023
41f5618
Convert unit of atom coordinates to angstrom before feeding to torch …
zwpku Aug 3, 2023
66b69b4
Bug fixed in gradient of torchann
zwpku Aug 3, 2023
53bbf6a
Add Torch in lammps' cmake
Aug 10, 2023
c049f84
Added test files for torchann in NAMD
Aug 14, 2023
c68df86
Merge branch 'Colvars:master' into torchann
zwpku Aug 14, 2023
2c5ae86
Minor changes in torchann component
zwpku Aug 14, 2023
1286028
Updated patches for Gromacs 2020.x and 2022.x
Aug 15, 2023
78789ed
Updated torchann in header file; Removed test for torchann component
Aug 15, 2023
13753ff
Add tests for Gromacs and NAMD
zwpku Aug 15, 2023
0ae580c
Add tests for Gromacs and NAMD
zwpku Aug 15, 2023
47f4a87
Updated torchann-namd test and references
zwpku Aug 15, 2023
b59830c
Reimplement torchann as a derived class of LinearCombination
zwpku Aug 24, 2023
ce24547
declare torchann cvc as scalar
zwpku Aug 24, 2023
57c8502
allocate memory of cv_force before use
zwpku Aug 25, 2023
388c6be
c++17 instead of c++14
Aug 25, 2023
7d3b23e
removed file to correct place
Aug 25, 2023
a08ed74
removed file to correct place
Aug 25, 2023
c3de09c
Minor correction in apply_force of torchann
zwpku Aug 26, 2023
2230af1
Add tests for gromacs and NAMD
zwpku Aug 26, 2023
bbe0360
merged with master
zwpku Aug 26, 2023
21ee264
Modified the definition of cv_force such that it contains the informa…
zwpku Aug 28, 2023
94034f8
Add option to set data type in torchann
zwpku Aug 30, 2023
d2e34ea
Add option to set data type in torchann
zwpku Aug 30, 2023
3acc188
Enable GPU support; Further tests are needed.
Aug 31, 2023
ce7329e
updated patch for gromacs-2021.x
Sep 1, 2023
257a58d
updated patch for gromacs-2022
Sep 1, 2023
1c29409
Updated patch for gromacs-2020.x
Sep 1, 2023
8d4dcb1
Update namd config to support GPU
Sep 1, 2023
14ace25
Do not require libtorch in lammps by default
zwpku Sep 1, 2023
39c1a4f
Minor changes (spaces/indent) in code; Removed tests for namd and gro…
zwpku Sep 2, 2023
7987232
update namd config patch to make namd3 work
zwpku Sep 2, 2023
8aec443
Merge branch 'master' into torchann
zwpku Sep 6, 2023
cbd7c3d
merge with master
zwpku Sep 6, 2023
566621e
Merge branch 'upmaster' into torchann
Sep 8, 2023
2118759
updated patch for gromacs 2023 to support torchann
Sep 8, 2023
4b6ba2f
Merge branch 'master' into torchann
zwpku Sep 14, 2023
b3d7247
merge torchann squash
Oct 16, 2023
f060d9e
conflicts resolved
Oct 16, 2023
5f4e6f7
Do not use GPU
Oct 18, 2023
ee5254f
Merge branch 'upmaster' (early part) into torchann
Oct 18, 2023
87f730f
Merge branch 'master' into torchann
zwpku Nov 3, 2023
d87ef94
Merge branch 'upmaster' into torchann
Nov 16, 2023
55e4128
merged with master and changed torchann class based on HanatoK's sugg…
Nov 16, 2023
2c9fba1
Merge branch 'github' into torchann
Nov 16, 2023
035eaff
Added torchann tests for gromacs and namd (only when libtorch is linked)
zwpku Nov 17, 2023
891b37e
Add torch option to library CMake file
jhenin Nov 20, 2023
7357ee7
Merge branch 'master' into torchann
zwpku Nov 27, 2023
ba18c36
Use the same code from distanceZ to handle nearest-image convection
zwpku Nov 27, 2023
bca42a3
Squash-merge of master branch
giacomofiorin Dec 1, 2023
9a72e53
Integrate libTorch CMake recipe into GROMACS main
giacomofiorin Dec 1, 2023
a244537
Fixed conflicts
zwpku Dec 11, 2023
eeee166
Fixed Conflicts
Dec 12, 2023
158f335
Fixed Conflicts
Dec 12, 2023
82ce569
Fix NAMD build dependencies
giacomofiorin Dec 20, 2023
7e07b4a
Merge branch 'master' into torchann
zwpku Feb 22, 2024
e163328
Merge branch 'master' into torchann
giacomofiorin Jul 5, 2024
2ea5b57
Restore componentDisabled and make it more generally usable
giacomofiorin Jul 6, 2024
86fefbf
Integrate cvc base class improvements with torchANN
giacomofiorin Jul 6, 2024
7ec36da
Merge branch 'master' into torchann
giacomofiorin Jul 6, 2024
bb3b4c2
Fix CMakeFile for Gromacs 2024
jhenin Sep 18, 2024
bb8a774
Set PRNG seed in Gromacs regtests
jhenin Sep 20, 2024
a607a7e
Update patches for GMX CMake files
jhenin Sep 20, 2024
9840ebe
Add patch for gmxManageColvars.cmake
jhenin Sep 20, 2024
5e41ea0
Merge branch 'master' into torchann
jhenin Sep 23, 2024
2ab80ae
Use Clang and ccache more often when available
giacomofiorin Sep 27, 2024
b768be2
Find PyTorch through CMake and switch to -DCOLVARS_TORCH as macro
giacomofiorin Sep 27, 2024
b2ffb3e
Update CentOS9-devel container recipe
giacomofiorin Sep 28, 2024
41f7060
Use libTorch from container when available
giacomofiorin Oct 3, 2024
be0a02f
Remove pre-C++11 stuff
giacomofiorin Oct 3, 2024
a0bdfb9
Add torchann test for standalone library
giacomofiorin Oct 3, 2024
c8a0531
Disable torchann test when not building with libTorch
giacomofiorin Oct 3, 2024
70b1858
Enable Torch interface only when the requested C++ standard supports it
giacomofiorin Oct 4, 2024
4f4b7bb
Raise the CMAKE_CXX_STANDARD to 17 if libtorch is used and
HanatoK Oct 4, 2024
4640193
Squash-merge of master branch
giacomofiorin Oct 4, 2024
c4d8c9d
Remove patch files for old and unsupported GROMACS versions
giacomofiorin Oct 4, 2024
48657cb
Merge branch 'master'
giacomofiorin Oct 10, 2024
2a7cbcb
- Isolated torch-related code
Oct 11, 2024
9f7cd27
minor fix
Oct 11, 2024
c471ae8
Add torch header file to dependence file of backends
Oct 11, 2024
d500a88
fixed bug when torch is not available
Oct 11, 2024
28d80b4
Merge branch 'master'
giacomofiorin Oct 11, 2024
871cfa0
Enable Torch in GROMACS builds when available from CI container
giacomofiorin Oct 11, 2024
3c08493
Do not duplicate libTorch C++ flags
giacomofiorin Oct 19, 2024
7830857
Document apptainer push
giacomofiorin Oct 22, 2024
fbcbd0d
Let GROMACS use the newer CMake when available
giacomofiorin Oct 22, 2024
1b6f9ad
Squash-merge of master branch
giacomofiorin Nov 7, 2024
b76d60e
Squash-merge of master branch
giacomofiorin Nov 8, 2024
1ade0dc
Set damping=0 in gromacs regtest for torchann class.
Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ option(COLVARS_OPENMP "Build Colvars with (still limited) OpenMP support" ${COLV
if(COLVARS_OPENMP)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(colvars OpenMP::OpenMP_CXX)
target_link_libraries(colvars PRIVATE OpenMP::OpenMP_CXX)
endif()
endif()

Expand Down Expand Up @@ -118,7 +118,23 @@ if(COLVARS_TCL)
else()
target_compile_options(colvars PRIVATE -DCOLVARS_TCL)
endif()
target_link_libraries(colvars ${TCL_LIBRARY})
target_link_libraries(colvars PRIVATE ${TCL_LIBRARY})
endif()

option(COLVARS_TORCH "Link against the Torch library" OFF)

if(COLVARS_TORCH)
find_package(Torch)
if (Torch_FOUND)
set_property(TARGET colvars PROPERTY CXX_STANDARD 17)
target_compile_definitions(colvars PRIVATE -DTORCH)
# target_compile_options(colvars PRIVATE ${TORCH_CXX_FLAGS})
target_compile_options(colvars PRIVATE ${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS})
target_include_directories(colvars PRIVATE ${TORCH_INCLUDE_DIRS})
target_link_libraries(colvars PRIVATE "${TORCH_LIBRARIES}")
else()
message(FATAL_ERROR "Torch package not found.")
endif()
endif()

option(BUILD_TOOLS "Build standalone tools" ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/buildColvarsLepton.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(COLVARS_LEPTON)
target_compile_options(colvars PRIVATE -DLEPTON)
endif()
target_include_directories(colvars PRIVATE ${LEPTON_DIR}/include)
target_link_libraries(colvars lepton)
target_link_libraries(colvars PRIVATE lepton)

# Silence warnings for Lepton
target_compile_options(lepton PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Wno-tautological-undefined-compare -Wno-unknown-warning-option>)
Expand Down
1 change: 1 addition & 0 deletions doc/colvars-code-refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,6 @@ @article{White2014
% coordNum pairlist
% Custom functions (Lepton)
% Scripted functions (Tcl)
% torchANN colvar component
% ABMD bias
% --- END ---
15 changes: 15 additions & 0 deletions gromacs/cmake/gmxManageColvars.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ gmx_option_multichoice(GMX_USE_COLVARS
INTERNAL NONE)
mark_as_advanced(GMX_USE_COLVARS)

function(gmx_set_colvars_torch)
find_package(Torch)
HubLot marked this conversation as resolved.
Show resolved Hide resolved
if (Torch_FOUND)
message(STATUS "Torch found, enabling for Colvars")
set_property(TARGET colvars_objlib PROPERTY CXX_STANDARD 17)
target_compile_definitions(colvars_objlib PRIVATE -DTORCH)
target_compile_options(colvars_objlib PRIVATE ${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS})
target_include_directories(colvars_objlib PRIVATE ${TORCH_INCLUDE_DIRS})
target_link_libraries(libgromacs PRIVATE "${TORCH_LIBRARIES}")
endif()
endfunction()


function(gmx_manage_colvars)
if(GMX_USE_COLVARS STREQUAL "INTERNAL")
# Create an object library for the colvars sources
Expand Down Expand Up @@ -68,5 +81,7 @@ function(gmx_manage_colvars)

set(GMX_HAVE_COLVARS 0 CACHE INTERNAL "Is colvars found?")
endif()

gmx_set_colvars_torch()
mark_as_advanced(GMX_HAVE_COLVARS)
endfunction()
78 changes: 40 additions & 38 deletions gromacs/gromacs-2020.x.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ index 0911eb2a45..5530c1576a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -200,6 +200,9 @@ option(GMX_USE_OPENCL "Enable OpenCL acceleration" OFF)

option(GMX_INSTALL_LEGACY_API "Install legacy headers" OFF)

+include(gmxManageColvars)
+include(gmxManageLepton)
+
# The earliest version of the CUDA toolkit that supports c++14 is 9.0
set(REQUIRED_CUDA_VERSION 9.0)
set(REQUIRED_CUDA_COMPUTE_CAPABILITY 3.0)
diff --git a/src/gromacs/CMakeLists.txt b/src/gromacs/CMakeLists.txt
index 9249a7a08f..18b45ff01f 100644
index 9249a7a08f..ab5a927fb7 100644
--- a/src/gromacs/CMakeLists.txt
+++ b/src/gromacs/CMakeLists.txt
@@ -137,6 +137,12 @@ if (WIN32)
endif()
list(APPEND libgromacs_object_library_dependencies thread_mpi)

+# Add Colvars and Lepton targets, embed their object code in libgromacs
+gmx_manage_colvars()
+gmx_manage_lepton()
Expand All @@ -29,11 +29,13 @@ index 9249a7a08f..18b45ff01f 100644
configure_file(version.h.cmakein version.h)
if(GMX_INSTALL_LEGACY_API)
install(FILES
@@ -195,6 +201,8 @@ else()
@@ -195,6 +201,10 @@ else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()

+gmx_include_colvars_headers()
+
+gmx_set_colvars_torch()
+
# Add these contents first because linking their tests can take a lot
# of time, so we want lots of parallel work still available after
Expand All @@ -58,8 +60,8 @@ index 9c6cfe4213..ec2e64f61f 100644
+/* COLVARS : add a value of 1000 for Colvars support and
+ * prevent regular GROMACS to read colvars .cpt files */
+static const int cpt_version = cptv_Count - 1 + 1000;


const char* est_names[estNR] = { "FE-lambda",
@@ -1178,6 +1181,15 @@ static void do_cpt_header(XDR* xd, gmx_bool bRead, FILE* list, CheckpointHeaderC
{
Expand All @@ -75,12 +77,12 @@ index 9c6cfe4213..ec2e64f61f 100644
+ }
+
}

static int do_cpt_footer(XDR* xd, int file_version)
@@ -1909,6 +1921,35 @@ static int do_cpt_EDstate(XDR* xd, gmx_bool bRead, int nED, edsamhistory_t* EDst
return 0;
}

+/* This function stores the last whole configuration of the colvars atoms in the .cpt file */
+static int do_cpt_colvars(XDR* xd, gmx_bool bRead, int ecolvars, colvarshistory_t* colvarsstate, FILE* list)
+{
Expand Down Expand Up @@ -116,7 +118,7 @@ index 9c6cfe4213..ec2e64f61f 100644
@@ -2330,6 +2371,10 @@ void write_checkpoint(const char* fn,
swaphistory_t* swaphist = observablesHistory->swapHistory.get();
int eSwapCoords = (swaphist ? swaphist->eSwapCoords : eswapNO);

+ /* COLVARS */
+ colvarshistory_t* colvarshist = observablesHistory->colvarsHistory.get();
+ int ecolvars = (colvarshist ? colvarshist->n_atoms : 0);
Expand Down Expand Up @@ -145,7 +147,7 @@ index 9c6cfe4213..ec2e64f61f 100644
@@ -2802,6 +2849,17 @@ static void read_checkpoint(const char* fn,
cp_error();
}

+ if (headerContents->ecolvars != 0 && observablesHistory->colvarsHistory == nullptr)
+ {
+ observablesHistory->colvarsHistory = std::make_unique<colvarshistory_t>(colvarshistory_t{});
Expand All @@ -163,7 +165,7 @@ index 9c6cfe4213..ec2e64f61f 100644
@@ -2957,6 +3015,13 @@ static CheckpointHeaderContents read_checkpoint_data(t_fileio*
cp_error();
}

+ colvarshistory_t colvarshist = {};
+ ret = do_cpt_colvars(gmx_fio_getxdr(fp), TRUE, headerContents.ecolvars, &colvarshist, nullptr);
+ if (ret)
Expand All @@ -172,12 +174,12 @@ index 9c6cfe4213..ec2e64f61f 100644
+ }
+
ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, outputfiles, nullptr, headerContents.file_version);

if (ret)
@@ -3065,6 +3130,12 @@ void list_checkpoint(const char* fn, FILE* out)
ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, headerContents.eSwapCoords, &swaphist, out);
}

+ if (ret == 0)
+ {
+ colvarshistory_t colvarshist = {};
Expand All @@ -198,7 +200,7 @@ index fb8f7268be..6feb181b30 100644
+ //! Colvars
+ int ecolvars;
};

/* Write a checkpoint to <fn>.cpt
diff --git a/src/gromacs/mdlib/energyoutput.cpp b/src/gromacs/mdlib/energyoutput.cpp
index f2532f3dfe..c761958854 100644
Expand All @@ -210,7 +212,7 @@ index f2532f3dfe..c761958854 100644
bEner_[F_ORIRESDEV] = (gmx_mtop_ftype_count(mtop, F_ORIRES) > 0);
- bEner_[F_COM_PULL] = ((ir->bPull && pull_have_potential(pull_work)) || ir->bRot);
+ bEner_[F_COM_PULL] = ((ir->bPull && pull_have_potential(pull_work)) || ir->bRot || ir->bColvars);

MdModulesEnergyOutputToDensityFittingRequestChecker mdModulesAddOutputToDensityFittingFieldRequest;
mdModulesNotifier.notifier_.notify(&mdModulesAddOutputToDensityFittingFieldRequest);
diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp
Expand All @@ -220,7 +222,7 @@ index f2528d78b4..7f91cac83d 100644
@@ -114,6 +114,8 @@
#include "gromacs/utility/strconvert.h"
#include "gromacs/utility/sysinfo.h"

+#include "colvarproxy_gromacs.h"
+
using gmx::AtomLocality;
Expand All @@ -242,7 +244,7 @@ index f2528d78b4..7f91cac83d 100644
+
gmx::ForceProviderInput forceProviderInput(x, *mdatoms, t, box, *cr);
gmx::ForceProviderOutput forceProviderOutput(forceWithVirial, enerd);

diff --git a/src/gromacs/mdrun/legacymdrunoptions.h b/src/gromacs/mdrun/legacymdrunoptions.h
index 796e479490..8b20073b3b 100644
--- a/src/gromacs/mdrun/legacymdrunoptions.h
Expand All @@ -255,7 +257,7 @@ index 796e479490..8b20073b3b 100644
+ { efXVG, "-swap", "swapions", ffOPTWR },
+ { efDAT, "-colvars", "colvars", ffOPTRDMULT }, /* COLVARS */
+ { efDAT, "-colvars_restart", "colvars", ffOPTRD }, /* COLVARS */}};

//! Print a warning if any force is larger than this (in kJ/mol nm).
real pforce = -1;
diff --git a/src/gromacs/mdrun/replicaexchange.cpp b/src/gromacs/mdrun/replicaexchange.cpp
Expand All @@ -268,10 +270,10 @@ index 9ff4b3817d..eb31f1fa89 100644
exchange_rvecs(ms, b, state->v.rvec_array(), state->natoms);
+ exchange_rvecs(ms, b, state->xa_old_whole_colvars, state->n_colvars_atoms);
}

static void copy_state_serial(const t_state* src, t_state* dest)
diff --git a/src/gromacs/mdrun/runner.cpp b/src/gromacs/mdrun/runner.cpp
index c2b3c088d7..bb38d44ab2 100644
index c2b3c088d7..7a5f2b05a4 100644
--- a/src/gromacs/mdrun/runner.cpp
+++ b/src/gromacs/mdrun/runner.cpp
@@ -115,6 +115,7 @@
Expand All @@ -285,7 +287,7 @@ index c2b3c088d7..bb38d44ab2 100644
@@ -156,6 +157,8 @@
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"

+#include "colvarproxy_gromacs.h"
+
#include "isimulator.h"
Expand All @@ -294,7 +296,7 @@ index c2b3c088d7..bb38d44ab2 100644
@@ -1536,6 +1539,51 @@ int Mdrunner::mdrunner()
MASTER(cr) ? globalState->x.rvec_array() : nullptr, filenames.size(),
filenames.data(), oenv, mdrunOptions.imdOptions, startingBehavior);

+ /* COLVARS */
+ if (opt2bSet("-colvars",filenames.size(), filenames.data()))
+ {
Expand Down Expand Up @@ -346,7 +348,7 @@ index c2b3c088d7..bb38d44ab2 100644
@@ -1654,6 +1702,16 @@ int Mdrunner::mdrunner()
free_membed(membed);
}

+ /* COLVARS */
+ if (inputrec->bColvars)
+ {
Expand Down Expand Up @@ -387,28 +389,28 @@ index 0000000000..ea69e03419
+
+#endif
diff --git a/src/gromacs/mdtypes/inputrec.h b/src/gromacs/mdtypes/inputrec.h
index 266670f3ef..f1d287d35d 100644
index 266670f3ef..86e4aa35d3 100644
--- a/src/gromacs/mdtypes/inputrec.h
+++ b/src/gromacs/mdtypes/inputrec.h
@@ -53,6 +53,8 @@ struct gmx_enfrot;
struct gmx_enfrotgrp;
struct pull_params_t;

+class colvarproxy_gromacs;
+
namespace gmx
{
class Awh;
@@ -587,6 +589,10 @@ struct t_inputrec // NOLINT (clang-analyzer-optin.performance.Padding)

//! KVT for storing simulation parameters that are not part of the mdp file.
std::unique_ptr<gmx::KeyValueTreeObject> internalParameters;
+
+ /* COLVARS */
+ gmx_bool bColvars = false; /* Do we do colvars calculations ? */
+ colvarproxy_gromacs *colvars_proxy = nullptr; /* The object for the colvars calculations */
};

int ir_optimal_nstcalcenergy(const t_inputrec* ir);
diff --git a/src/gromacs/mdtypes/observableshistory.cpp b/src/gromacs/mdtypes/observableshistory.cpp
index 0b5983a59c..57d851645a 100644
Expand All @@ -419,7 +421,7 @@ index 0b5983a59c..57d851645a 100644
#include "gromacs/mdtypes/pullhistory.h"
#include "gromacs/mdtypes/swaphistory.h"
+#include "gromacs/mdtypes/colvarshistory.h"

ObservablesHistory::ObservablesHistory() = default;
ObservablesHistory::~ObservablesHistory() = default;
diff --git a/src/gromacs/mdtypes/observableshistory.h b/src/gromacs/mdtypes/observableshistory.h
Expand All @@ -431,18 +433,18 @@ index d2ba1d820f..a5747139d7 100644
struct edsamhistory_t;
struct swaphistory_t;
+struct colvarshistory_t;

/*! \libinternal \brief Observables history, for writing/reading to/from checkpoint file
*/
@@ -76,6 +77,9 @@ struct ObservablesHistory
//! Ion/water position swapping history
std::unique_ptr<swaphistory_t> swapHistory;

+ //! Colvars
+ std::unique_ptr<colvarshistory_t> colvarsHistory;
+
ObservablesHistory();

~ObservablesHistory();
diff --git a/src/gromacs/mdtypes/state.cpp b/src/gromacs/mdtypes/state.cpp
index a949d589a3..957f7b7139 100644
Expand All @@ -456,7 +458,7 @@ index a949d589a3..957f7b7139 100644
+ ddp_count_cg_gl(0),
+ xa_old_whole_colvars(nullptr),
+ n_colvars_atoms(0)

{
// It would be nicer to initialize these with {} or {{0}} in the
diff --git a/src/gromacs/mdtypes/state.h b/src/gromacs/mdtypes/state.h
Expand All @@ -465,14 +467,14 @@ index a54bff29bb..8619c7935a 100644
+++ b/src/gromacs/mdtypes/state.h
@@ -257,6 +257,10 @@ public:
std::vector<int> cg_gl; //!< The global cg number of the local cgs

std::vector<double> pull_com_prev_step; //!< The COM of the previous step of each pull group
+
+ int n_colvars_atoms; //!< number of colvars atoms
+ rvec* xa_old_whole_colvars; //!< last whole positions of colvars atoms
+
};

#ifndef DOXYGEN
diff --git a/src/programs/mdrun/tests/refdata/MdrunTest_WritesHelp.xml b/src/programs/mdrun/tests/refdata/MdrunTest_WritesHelp.xml
index c2973bb1af..cb4d1da254 100644
Expand All @@ -496,6 +498,6 @@ index c2973bb1af..cb4d1da254 100644
+ Generic data file
+ -colvars_restart [&lt;.dat&gt;] (colvars.dat) (Opt.)
+ Generic data file

Options to specify output files:

Loading
Loading