Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5763181
build: Generate VMD dependency file automatically
giacomofiorin Feb 13, 2026
b4050b1
refactor: Move coordNum classes' definitions to a dedicated header (w…
giacomofiorin Jan 20, 2026
fb30105
refactor: Move coordNum switching function to dedicated header (with …
giacomofiorin Jan 21, 2026
ac3c7fd
cleanup: Remove unused parameter
giacomofiorin Jan 21, 2026
a22b673
cleanup: Use vector cutoff for coordNum even in the isotropic case
giacomofiorin Jan 21, 2026
bcae74b
cleanup: Inherit selfCoordNum to coordNum to reuse its init function
giacomofiorin Jan 21, 2026
83804f2
cleanup: Remove redundant check
giacomofiorin Jan 21, 2026
a1a9200
cleanup: Derive groupCoord from coordNum
giacomofiorin Jan 22, 2026
a8feb7f
feat: Support group1CenterOnly, consolidate cases including groupCoord
giacomofiorin Jan 22, 2026
878be36
refactor: Make selfCoordNum use a template function rather than a macro
giacomofiorin Jan 23, 2026
1e69f9d
opt: Manage pairlist outside of switching function kernel
giacomofiorin Jan 23, 2026
1b9e2d6
cleanup: Condense initialization of cutoff-related fields
giacomofiorin Jan 23, 2026
4710fe5
build: Use spiff directly when available to support out-of-tree builds
giacomofiorin Jan 23, 2026
1880753
refactor: Split computation of scaled distance and switching function
giacomofiorin Jan 23, 2026
91131f0
opt: Skip computation of switching function if the distance is too hi…
giacomofiorin Jan 23, 2026
32a9da3
cleanup: Make pairlist buffer a C++ object
giacomofiorin Jan 24, 2026
88690d1
perf: inline compute_pair_coordnum and switching_function
HanatoK Jan 26, 2026
557014e
opt: Make pairlist a C array again
giacomofiorin Jan 28, 2026
3b900cb
opt: Make sequential-loop template functions explicitly inline
giacomofiorin Jan 28, 2026
afa4e94
opt: Make internal PBC distance computation callable directly
giacomofiorin Jan 30, 2026
87c002c
opt: Support internal PBC functions in coordNum kernels
giacomofiorin Jan 30, 2026
4c92cf9
opt: Use constexpr where possible
giacomofiorin Jan 30, 2026
e3b3c3c
doc: Document group1CenterOnly
giacomofiorin Jan 30, 2026
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
3 changes: 0 additions & 3 deletions .github/workflows/backend-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ jobs:
ref: 'master'
path: 'devel-tools/packages'

- name: Test build recipes
run: bash devel-tools/check_build_recipes

- name: Build and test standalone library
run: cmake -P devel-tools/build_test_library.cmake

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ jobs:
# run: |
# sudo apt -y install ccache

- name: Test build recipes
run: bash devel-tools/check_build_recipes

- name: Convert BibTeX references to code
shell: bash
working-directory: doc
Expand Down
26 changes: 0 additions & 26 deletions devel-tools/check_build_recipes

This file was deleted.

4 changes: 3 additions & 1 deletion devel-tools/generate-namd-makefile.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

set -e

# Generate a file suitable for inclusion by the NAMD Makefile

if [ -f "${2}" ] ; then
echo "Usage: ${0} <sources_var_name> <sources_path> <objs_var_name> <obj_path> [... source files ...]" >& 1
echo "Usage: ${0} <sources_var_name> <sources_path> <objs_var_name> <obj_path> [... source files ...]" >& 2
exit 1
fi

Expand Down
87 changes: 87 additions & 0 deletions devel-tools/generate-vmd-makefile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

set -e

# Generate the file colvars_files.pl used by VMD (i.e. a poor person's version of a dependency file)

if [ ! -f "${1}" ] ; then
echo "Usage: ${0} [... source files ...] [... header files ...]" >& 2
exit 1
fi

all_files=("${@}")


canonize_filename() {
local file=$1
if [ "${file%.cpp}" != "${file}" ] ; then
basename "${file%.cpp}.C"
else
basename "${file}"
fi
}

source_files=()
header_files=()
cuda_files=()
for file in "${all_files[@]}" ; do
if [ "${file%.cpp}" != "${file}" ] ; then
source_files+=($(canonize_filename "${file}"))
elif [ "${file%.C}" != "${file}" ] ; then
source_files+=($(canonize_filename "${file}"))
elif [ "${file%.h}" != "${file}" ] ; then
header_files+=($(canonize_filename "${file}"))
elif [ "${file%.cu}" != "${file}" ] ; then
echo "Error: building of Colvars CUDA files with VMD is not supported yet" >&2
# cuda_files+=($(canonize_filename "${file}"))
else
echo "Error: file ${file} has an unsupported extension" >&2
exit 1
fi
done

cat <<EOF
# List of files for the Colvars module

our ( \$colvars_defines );

our ( @colvars_cc );
our ( @colvars_cu );
our ( @colvars_ccpp );
our ( @colvars_h );

\$colvars_defines = " -DVMDCOLVARS";

@colvars_cc = ();
EOF


print_list() {
local var_name=$1
shift
local -a files=($(echo "${@}" | tr ' ' '\n' | sort | xargs))
echo "@${var_name} = ("
for file in "${files[@]:0:${#files[@]}-1}" ; do
echo " '${file}',"
done
echo " '${files[${#files[@]}-1]}'"
echo " );"
}

if [ -n "${cuda_files}" ] ; then
print_list "colvars_cu" "${cuda_files[@]}"
else
echo "@colvars_cu = ();"
fi

if [ -n "${source_files}" ] ; then
print_list "colvars_ccpp" "${source_files[@]}"
else
echo "@colvars_ccpp = ();"
fi

if [ -n "${header_files}" ] ; then
print_list "colvars_h" "${header_files[@]}"
else
echo "@colvars_h = ();"
fi
38 changes: 30 additions & 8 deletions doc/colvars-refman-main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,19 @@
12}{%
This number defines the $m$ exponent for the switching function.}

\item %
\labelkey{colvar|coordNum|group1CenterOnly}
\keydef
{group1CenterOnly}{%
\texttt{coordNum}}{%
Use only \texttt{group1}'s center of
mass}{%
boolean}{%
\texttt{off}}{%
If this option is \texttt{on}, only contacts between the center of mass of \texttt{group1} and atoms of \texttt{group2} are calculated (by default, the sum extends over all pairs of atoms in \texttt{group1} and \texttt{group2}).
If \texttt{group1} is a \texttt{dummyAtom}, this option is set to \texttt{yes} by default.
}

\item %
\labelkey{colvar|coordNum|group2CenterOnly}
\keydef
Expand All @@ -1976,7 +1989,7 @@
boolean}{%
\texttt{off}}{%
If this option is \texttt{on}, only contacts between each atoms in \texttt{group1} and the center of mass of \texttt{group2} are calculated (by default, the sum extends over all pairs of atoms in \texttt{group1} and \texttt{group2}).
If \texttt{group2} is a \texttt{dummyAtom}, this option is set to \texttt{yes} by default.
If \texttt{group2} is a \texttt{dummyAtom}, this option is set to \texttt{yes} by default.
}

\item %
Expand All @@ -1998,15 +2011,24 @@
positive integer}{%
100}{This controls the pairlist feature, dictating how many steps are taken between regenerating pair lists if the tolerance is greater than 0.
}

\item %
\labelkey{colvar|coordNum|useInternalPBC}%
\keydef{useInternalPBC}{%
\texttt{coordNum}}{%
Use the PBC functions from the Colvars library (as opposed to MD engine)}{%
boolean}{%
engine-dependent}{%
If this keyword is set to \texttt{yes}, Colvars will use internal code to compute mininum-image distances, instead of calling the function used by \MDENGINE{}: enabling this flag may speed up computation.
\cvvmdonly{In VMD, the default value of this flag is true.}
\cvlammpsonly{Please note that, unlike the LAMMPS function, the current internal code is not robust against large tilt factors: use this feature only for unit cells near an orthogonal shape.}
}

\end{cvcoptions}

This component returns a dimensionless number, which ranges from
approximately 0 (all interatomic distances are much larger than the
cutoff) to $N_{\mathtt{group1}} \times N_{\mathtt{group2}}$ (all distances
are less than the cutoff), or $N_{\mathtt{group1}}$ if
\texttt{group2CenterOnly} is used. For performance reasons, at least
one of \texttt{group1} and \texttt{group2} should be of limited size or \texttt{group2CenterOnly} should be used: the cost of the loop over all pairs grows as $N_{\mathtt{group1}} \times N_{\mathtt{group2}}$.
Setting $\mathtt{tolerance} > 0$ ameliorates this to some degree, although every pair is still checked to regenerate the pair list.
This component returns a dimensionless number, which ranges from 0 (all interatomic distances are much larger than the cutoff) to $N_{\mathtt{group1}} \times N_{\mathtt{group2}}$ (all possible pairwise distances are much smaller than the cutoff).
The computational cost also grows with the number of pairwise distances calculated, unless either \texttt{group1CenterOnly} or \texttt{group2CenterOnly} are used.
Setting $\mathtt{tolerance} > 0$ could mitigate this by looping over pairs less frequently than every step.



Expand Down
3 changes: 3 additions & 0 deletions misc_interfaces/stubs/colvarproxy_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
colvarproxy_stub::colvarproxy_stub()
{
version_int = get_version_from_string(COLVARPROXY_VERSION);

use_internal_pbc_ = true;

b_simulation_running = false;

// both fields are taken from data structures already available
Expand Down
1 change: 1 addition & 0 deletions src/colvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "colvarbias.h"
#include "colvars_memstream.h"
#include "colvarcomp_torchann.h"
#include "colvarcomp_coordnums.h"

std::map<std::string, std::function<colvar::cvc *()>> colvar::global_cvc_map =
std::map<std::string, std::function<colvar::cvc *()>>();
Expand Down
Loading
Loading