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

Merged
merged 109 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 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
f75efd1
Updated references files generated by Gromacs with double precision
Nov 14, 2024
e7597c0
Minor corrections in reference files.
Nov 14, 2024
1c4bf10
Squashed merge of master branch
giacomofiorin Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 31 additions & 14 deletions .github/workflows/backend-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Load compiler cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
id: compiler-cache-restore
with:
path: |
~/ccache_${{ inputs.container_name }}
Expand Down Expand Up @@ -141,6 +142,21 @@ jobs:
apptainer exec devel-tools/${{ inputs.container_name }}.sif \
bash ${{ inputs.path_compile_script }} ${{ inputs.backend_name }}-source

- name: Save compiler cache
uses: actions/cache/save@v4
id: compiler-cache-save
if: always() && steps.compiler-cache-restore.outputs.cache-hit != 'true'
with:
path: |
~/ccache_${{ inputs.container_name }}
key: ${{ runner.os }}-build-${{ inputs.backend_name }}-${{ github.sha }}

- name: Keep only one cache besides the one from this job
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-${{ inputs.backend_name }}-

# 2 types of tests can be performed with the MD engine: library & interface
# It depends on the working directory
Expand All @@ -158,10 +174,14 @@ jobs:

- name: Save failed library test artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: failed-library-test-diffs-${{ inputs.backend_name }}
path: ${{ github.workspace }}/${{ inputs.test_lib_directory }}/*/*.diff
name: failed-library-test-output-${{ inputs.backend_name }}
path: |
${{ github.workspace }}/${{ inputs.test_lib_directory }}/*/*.diff
${{ github.workspace }}/${{ inputs.test_lib_directory }}/*/*.err
${{ github.workspace }}/${{ inputs.test_lib_directory }}/*/*.log
${{ github.workspace }}/${{ inputs.test_lib_directory }}/*/*.out

- name: Run regression tests for ${{ inputs.backend_name }} interface code
if: ${{ inputs.test_interface_directory }}
Expand All @@ -175,10 +195,14 @@ jobs:

- name: Save failed interface test artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: failed-interface-test-diffs-${{ inputs.backend_name }}
path: ${{ github.workspace }}/${{ inputs.test_interface_directory }}/*/*.diff
name: failed-interface-test-output-${{ inputs.backend_name }}
path: |
${{ github.workspace }}/${{ inputs.test_interface_directory }}/*/*.diff
${{ github.workspace }}/${{ inputs.test_interface_directory }}/*/*.err
${{ github.workspace }}/${{ inputs.test_interface_directory }}/*/*.log
${{ github.workspace }}/${{ inputs.test_interface_directory }}/*/*.out

- name: Run regression tests for library code with ${{ inputs.backend_name }} (binary restarts)
# Skipping GROMACS, because its restarts are always binary anyway
Expand All @@ -190,10 +214,3 @@ jobs:
run: |
apptainer exec ${{github.workspace}}/devel-tools/${{ inputs.container_name }}.sif \
./run_tests.sh ${{github.workspace}}/${{ inputs.backend_name }}-source/${{ inputs.rpath_exe }} 0??_*

- name: Keep only one cache besides the one from this job
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-${{ inputs.backend_name }}-
16 changes: 2 additions & 14 deletions .github/workflows/test-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
test_lib_directory: namd/tests/library
test_interface_directory: namd/tests/interface
rpath_exe: Linux-x86_64-g++.mpi/namd3
container_name: CentOS7-devel
container_name: CentOS9-devel
secrets:
# Choice of license by UIUC prevents sharing the code, hence the secret
private_key: ${{ secrets.PULL_NAMD_KEY }}
Expand All @@ -56,7 +56,7 @@ jobs:
backend_name: VMD
backend_repo: Colvars/vmd
backend_repo_ref: master
container_name: CentOS7-devel
container_name: CentOS9-devel
# Special variable for VMD test case since it's the only one
# which needs to checkout 2 repos
vmd_plugins_repo: Colvars/vmd-plugins
Expand All @@ -68,18 +68,6 @@ jobs:
private_key: ${{ secrets.PULL_VMD_KEY }}
private_key_vmd_plugins: ${{ secrets.PULL_VMD_PLUGINS_KEY }}

gromacs-2023:
name: GROMACS (release-2023)
uses: ./.github/workflows/backend-template.yml
with:
backend_name: GROMACS-2023
backend_repo: gromacs/gromacs
backend_repo_ref: release-2023
container_name: CentOS9-devel
path_compile_script: devel-tools/compile-gromacs.sh
test_lib_directory: gromacs/tests/library
rpath_exe: install/bin/gmx_mpi_d

gromacs-main:
name: GROMACS (main)
uses: ./.github/workflows/backend-template.yml
Expand Down
107 changes: 97 additions & 10 deletions .github/workflows/test-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Load compiler cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-basic-${{ github.sha }}
Expand Down Expand Up @@ -51,7 +51,11 @@ jobs:
exit 1
fi

- name: Build and test library (GCC)
- name: Build and test library (Clang)
env:
CMAKE_BUILD_DIR: build
CXX: clang++
CC: clang
run: cmake -P devel-tools/build_test_library.cmake

- name: Check documentation of command-line scripting interface
Expand All @@ -64,11 +68,11 @@ jobs:
exit 1
fi

- name: Build and test library (Clang)
- name: Build and test library (GCC)
env:
CMAKE_BUILD_DIR: build-clang
CXX: clang++
CC: clang
CMAKE_BUILD_DIR: build-gcc
CXX: g++
CC: gcc
run: cmake -P devel-tools/build_test_library.cmake

- name: Build library with debug code enabled (GCC)
Expand Down Expand Up @@ -221,7 +225,7 @@ jobs:
fi

- name: Archive warnings artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: warnings_clang_static_analyser
Expand All @@ -240,7 +244,7 @@ jobs:
- uses: actions/checkout@v4

- name: Load compiler ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-asan-${{ github.sha }}
Expand Down Expand Up @@ -276,7 +280,7 @@ jobs:
cmake -P devel-tools/build_test_library.cmake

- name: Archive warnings artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Clang_address_sanitizer_output
Expand All @@ -303,7 +307,7 @@ jobs:
- uses: actions/checkout@v4

- name: Load compiler ccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-multiple-${{ github.sha }}
Expand Down Expand Up @@ -511,6 +515,89 @@ jobs:
cmake3 -D CMAKE_CXX_STANDARD=11 -P devel-tools/build_test_library.cmake


build-linux-x86_64-intel:
name: Linux x86_64 (Intel oneAPI)
runs-on: ubuntu-latest
needs: basicchecks
env:
CCACHE: ccache
CMAKE_GENERATOR: Ninja
CCACHE_DIR: ${{ github.workspace }}/ccache
steps:
- uses: actions/checkout@v4

- name: Load compiler ccache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-oneapi-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-oneapi-

- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'

- name: Install Apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer-suid

- name: Get container images for build dependencies
shell: bash
working-directory: devel-tools
run: |
apptainer pull CentOS9-devel-oneAPI.sif oras://ghcr.io/colvars/devel-containers:CentOS9-devel-oneAPI

- name: Intel oneAPI 2024.2, C++11
shell: bash
env:
CC: icx
CXX: icpx
CXX_STANDARD: 11
BASH_ENV: "/etc/profile.d/oneapi.sh"
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel-oneAPI.sif \
bash -c "cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake"

- name: Intel oneAPI 2024.2, C++14
shell: bash
env:
CC: icx
CXX: icpx
CXX_STANDARD: 14
BASH_ENV: "/etc/profile.d/oneapi.sh"
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel-oneAPI.sif \
bash -c "cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake"

- name: Intel oneAPI 2024.2, C++17
shell: bash
env:
CC: icx
CXX: icpx
CXX_STANDARD: 17
BASH_ENV: "/etc/profile.d/oneapi.sh"
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel-oneAPI.sif \
bash -c "cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake"

- name: Intel oneAPI 2024.2, C++20
shell: bash
env:
CC: icx
CXX: icpx
CXX_STANDARD: 20
BASH_ENV: "/etc/profile.d/oneapi.sh"
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel-oneAPI.sif \
bash -c "cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake"


build-windows-x86_64-msvc:
name: Windows x86_64 (MSVC)
runs-on: windows-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@
*.pmf
!**/AutoDiff/*.pmf

# macOS
.DS_Store
11 changes: 11 additions & 0 deletions README-versions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
[Versions included in GROMACS](#versions-included-in-GROMACS)

[Versions included in LAMMPS](#versions-included-in-LAMMPS)

[Versions included in NAMD](#versions-included-in-NAMD)

[Versions included in VMD](#versions-included-in-VMD)

### Versions included in GROMACS
GROMACS version | Colvars version
-------------- | ---------------
2024 | [2023-12-05](https://github.com/Colvars/colvars/tree/gromacs-2024)

### Versions included in LAMMPS
LAMMPS version | Colvars version
-------------- | ---------------
stable_29Aug2024 | [2024-06-04](https://github.com/Colvars/colvars/releases/tag/lammps-stable_29Aug2024)
stable_2Aug2023 | [2023-05-01](https://github.com/Colvars/colvars/releases/tag/lammps-stable_2Aug2023)
stable_23Jun2022 | [2022-05-24](https://github.com/Colvars/colvars/releases/tag/lammps-stable_23Jun2022)
stable_29Sep2021 | [2021-09-13](https://github.com/Colvars/colvars/releases/tag/lammps-stable_29Sep2021)
stable_29Oct2020 | [2020-09-17](https://github.com/Colvars/colvars/releases/tag/lammps-stable_29Oct2020)
Expand All @@ -27,6 +36,7 @@ stable_4Nov2016 | [2016-10-21](https://github.com/Colvars/colvars/releases/tag/l

NAMD version | Colvars version
-------------- | ---------------
3.0 | [2024-06-04](https://github.com/Colvars/colvars/tree/namd-3.0)
2.14 | [2020-07-07](https://github.com/Colvars/colvars/releases/tag/namd-2.14)
2.13b2 | [2018-10-12](https://github.com/Colvars/colvars/releases/tag/namd-2.13b2)
2.13b1 | [2018-09-07](https://github.com/Colvars/colvars/releases/tag/namd-2.13b1)
Expand All @@ -40,6 +50,7 @@ VMD version | Colvars version
-------------- | ---------------
1.9.4a58 | [2022-04-14](https://github.com/Colvars/colvars/releases/tag/vmd-1.9.4a58)
1.9.4a49 | [2020-10-22](https://github.com/Colvars/colvars/releases/tag/vmd-1.9.4a49)
1.9.4a12 | [2017-10-11](https://github.com/Colvars/colvars/releases/tag/vmd-1.9.4a12)
1.9.3 | [2016-10-26](https://github.com/Colvars/colvars/releases/tag/vmd-1.9.3)
1.9.2 | [2014-10-13](https://github.com/Colvars/colvars/releases/tag/vmd-1.9.2)

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ All of the above MD engine versions are automatically tested as part of GitHub A

## Legacy GROMACS-Colvars patched releases

Versions GROMACS prior to 2024 are supported through the use of a customized `mdrun` command line; source code of these patched releases is available [here](https://github.com/Colvars/gromacs). When posting a message to the [Gromacs forum](https://gromacs.bioexcel.eu/) regarding the use of these patched releases, please specify "GROMACS modification: **Yes**".
Versions of GROMACS prior to 2024 are no longer supported by the current version of Colvars: please use GROMACS 2024 or later.


## Which version of Colvars is recommended?
Expand Down
Loading
Loading