Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
29 changes: 29 additions & 0 deletions .ci/install.itensor
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /usr/bin/env bash

set -e
set -x

# Directory containing this script (i.e. .ci/)
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Install ITensor v3 dependencies
sudo apt-get install -y libopenblas-dev libhdf5-dev

ITENSOR_VERSION=3.2.0
ITENSOR_INSTALL_DIR="$HOME/opt/itensor"

cd "$(mktemp -dt plumed.XXXXXX)"

wget https://github.com/ITensor/ITensor/archive/refs/tags/v${ITENSOR_VERSION}.tar.gz
tar xzf v${ITENSOR_VERSION}.tar.gz
cd ITensor-${ITENSOR_VERSION}

# Use the CI-specific options.mk (OpenBLAS + system HDF5)
cp "$CI_DIR/options.mk.itensor" options.mk

make

# Copy the built library and headers to the install directory
mkdir -p "$ITENSOR_INSTALL_DIR"
cp -r lib "$ITENSOR_INSTALL_DIR/"
cp -r itensor "$ITENSOR_INSTALL_DIR/"
79 changes: 79 additions & 0 deletions .ci/options.mk.itensor
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
### CI-specific options.mk for ITensor v3
### Uses OpenBLAS and system HDF5 (installed via apt on ubuntu-22.04).
### Copy this file to the ITensor source directory as options.mk before building.

## Compiler
CCCOM=g++ -m64 -std=c++17 -fconcepts -fPIC

## BLAS/LAPACK: use OpenBLAS (apt install libopenblas-dev)
PLATFORM=lapack
BLAS_LAPACK_LIBFLAGS=-lpthread -lopenblas

## HDF5
HDF5_CFLAGS := $(shell pkg-config --cflags hdf5-serial 2>/dev/null || pkg-config --cflags hdf5 2>/dev/null)
HDF5_LDFLAGS := $(shell pkg-config --libs-only-L hdf5-serial 2>/dev/null || pkg-config --libs-only-L hdf5 2>/dev/null)

## OpenMP multithreading
ITENSOR_USE_OMP=1

## Optimization flags
OPTIMIZATIONS=-O2 -DNDEBUG -Wall -Wno-unknown-pragmas

## Debug flags
DEBUGFLAGS=-DDEBUG -g -Wall -Wno-unknown-pragmas -pedantic

## Do not build dynamic libraries (static linking is simpler in CI)
ITENSOR_MAKE_DYLIB=0

###
### Remaining variables are derived; no need to modify below.
###

PREFIX=$(THIS_DIR)

ITENSOR_LIBDIR=$(PREFIX)/lib
ITENSOR_INCLUDEDIR=$(PREFIX)

ITENSOR_LIBNAMES=itensor
ITENSOR_LIBFLAGS=$(patsubst %,-l%, $(ITENSOR_LIBNAMES))
ITENSOR_LIBFLAGS+= $(BLAS_LAPACK_LIBFLAGS)
ITENSOR_LIBGFLAGS=$(patsubst %,-l%-g, $(ITENSOR_LIBNAMES))
ITENSOR_LIBGFLAGS+= $(BLAS_LAPACK_LIBFLAGS)
ITENSOR_LIBS=$(patsubst %,$(ITENSOR_LIBDIR)/lib%.a, $(ITENSOR_LIBNAMES))
ITENSOR_GLIBS=$(patsubst %,$(ITENSOR_LIBDIR)/lib%-g.a, $(ITENSOR_LIBNAMES))

ITENSOR_INCLUDEFLAGS=-I'$(ITENSOR_INCLUDEDIR)' $(BLAS_LAPACK_INCLUDEFLAGS)

ifneq ($(strip $(HDF5_CFLAGS)),)
ITENSOR_USE_HDF5 = 1
# -DH5_USE_110_API: use HDF5 1.10-compatible API on HDF5 >= 1.12, which changed
# H5Oget_info_by_name to a 5-argument form incompatible with ITensor's h5 utility code.
ITENSOR_INCLUDEFLAGS += $(HDF5_CFLAGS) -DITENSOR_USE_HDF5 -DH5_USE_110_API
ITENSOR_LIBFLAGS += $(HDF5_LDFLAGS) -lhdf5 -lhdf5_hl
ITENSOR_LIBGFLAGS += $(HDF5_LDFLAGS) -lhdf5 -lhdf5_hl
endif

ifndef CCCOM
$(error Makefile variable CCCOM not defined in options.mk; please define it.)
endif

ifdef ITENSOR_USE_OMP
ITENSOR_INCLUDEFLAGS += -DITENSOR_USE_OMP -fopenmp
ITENSOR_LIBFLAGS += -fopenmp
ITENSOR_LIBGFLAGS += -fopenmp
endif

CCFLAGS=-I. $(ITENSOR_INCLUDEFLAGS) $(OPTIMIZATIONS) -Wno-unused-variable
CCGFLAGS=-I. $(ITENSOR_INCLUDEFLAGS) $(DEBUGFLAGS)
LIBFLAGS=-L'$(ITENSOR_LIBDIR)' $(ITENSOR_LIBFLAGS)
LIBGFLAGS=-L'$(ITENSOR_LIBDIR)' $(ITENSOR_LIBGFLAGS)

## Determine shared library extension
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
DYLIB_EXT ?= dylib
DYLIB_FLAGS ?= -dynamiclib
else
DYLIB_EXT ?= so
DYLIB_FLAGS ?= -shared
endif
17 changes: 17 additions & 0 deletions .github/workflows/linuxWF.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ jobs:

# the flags above enable the use of both libmetatomic and libtorch
echo "PLUMED_CONFIG=$PLUMED_CONFIG --enable-libmetatomic --enable-libtorch" >> $GITHUB_ENV
- name: Install ITensor
if: ${{ contains( matrix.variant, '-mpi-' ) }}
run: |
.ci/install.itensor
- name: Configure ITensor
if: ${{ contains( matrix.variant, '-mpi-' ) }}
run: |
ITENSOR_DIR="$HOME/opt/itensor"
HDF5_CFLAGS=$(pkg-config --cflags hdf5-serial 2>/dev/null || pkg-config --cflags hdf5 2>/dev/null || echo "-I/usr/include/hdf5/serial")
HDF5_LIBDIR=$(pkg-config hdf5-serial --libs-only-L 2>/dev/null || pkg-config hdf5 --libs-only-L 2>/dev/null || echo "-L/usr/lib/x86_64-linux-gnu/hdf5/serial")
echo "LDFLAGS=$LDFLAGS -L${ITENSOR_DIR}/lib ${HDF5_LIBDIR}" >> $GITHUB_ENV
echo "CPPFLAGS=$CPPFLAGS -I${ITENSOR_DIR} ${HDF5_CFLAGS} -DITENSOR_USE_HDF5 -DITENSOR_USE_OMP -D__ITENSOR_LAPACK_WRAP_h -DH5_USE_110_API" >> $GITHUB_ENV
# temporary until configure.ac is updated to detect ITensor
echo "CXXFLAGS=-O3 -fconcepts" >> $GITHUB_ENV
echo "LIBS=-litensor -lopenblas -lhdf5 -lhdf5_hl" >> $GITHUB_ENV
# this will be uncommented after the configure.ac modifications
#echo "PLUMED_CONFIG=$PLUMED_CONFIG --enable-libitensor" >> $GITHUB_ENV
- name: Install tools for setting up the manuals
if: contains( matrix.variant, '-doc-' )
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ makefile.dep
__pycache__
#to not export personal pyenv settings
.python-version

.vscode
.claude
1 change: 1 addition & 0 deletions regtest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
!/wham
!/metatomic
!/sizeshape
!/ttsketch
!/xsprint

# These files we just want to ignore completely
Expand Down
1 change: 1 addition & 0 deletions regtest/ttsketch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../scripts/module.make
24 changes: 24 additions & 0 deletions regtest/ttsketch/rt-ttmetad/COLVAR.reference
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! FIELDS time phi psi tt.bias
#! SET min_phi -pi
#! SET max_phi pi
0.000000 -1.2379 1.9470 0.0000
1.000000 -1.4839 1.9381 0.0000
2.000000 -1.3243 1.9663 0.8644
3.000000 -1.3340 1.9885 2.0694
4.000000 -1.4613 1.8901 2.9094
5.000000 -1.2202 2.0306 2.8990
6.000000 -1.3883 1.8776 4.7976
7.000000 -1.5481 1.9488 4.5938
8.000000 -1.8429 1.9025 1.0045
9.000000 -2.2424 1.9813 0.1537
10.000000 -1.1482 1.9684 3.9692
11.000000 -1.7580 1.9807 2.4606
12.000000 -1.3186 1.9486 3.4383
13.000000 -2.9911 1.9547 -0.1836
14.000000 -1.4112 2.0415 4.1799
15.000000 -2.5995 1.9166 0.7751
16.000000 -1.4608 1.9433 5.2919
17.000000 -1.3791 2.0625 6.2402
18.000000 -1.6771 1.9433 5.3378
19.000000 -1.5241 1.9642 7.8989
20.000000 -1.1997 1.9296 6.6496
4 changes: 4 additions & 0 deletions regtest/ttsketch/rt-ttmetad/HILLS.reference
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! FIELDS time phi psi sigma_phi sigma_psi height biasf
#! SET min_phi -pi
#! SET max_phi pi
20.000000 -1.199652 1.929639 0.200000 0.200000 1.200000 -1.000000
1 change: 1 addition & 0 deletions regtest/ttsketch/rt-ttmetad/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../scripts/test.make
3 changes: 3 additions & 0 deletions regtest/ttsketch/rt-ttmetad/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plumed_modules=ttsketch
type=driver
arg="--plumed plumed.dat --trajectory-stride 500 --timestep 0.002 --igro traj.gro"
22 changes: 22 additions & 0 deletions regtest/ttsketch/rt-ttmetad/plumed.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
phi: TORSION ATOMS=5,7,9,15 NOPBC
psi: ANGLE ATOMS=7,9,15

tt: TTMETAD ...
ARG=phi,psi
SIGMA=0.20,0.20
HEIGHT=1.20
PACE=500
TEMP=300.0
FILE=HILLS
FMT=%12.6f
SKETCH_RANK=2
SKETCH_INITRANK=4
SKETCH_PACE=5000
INTERVAL_MIN=-3.14159,0.0
INTERVAL_MAX=3.14159,3.14159
SKETCH_NBASIS=5
SKETCH_ALPHA=1.0
DETERMINISTIC
...

PRINT STRIDE=500 FILE=COLVAR ARG=phi,psi,tt.bias FMT=%8.4f
Loading
Loading