From 5bc572d2a88b8e930c60e4aa35bfd7af1d209f0d Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Fri, 13 Sep 2024 09:35:58 +0100 Subject: [PATCH] FunctionOfMatrix and QuaternionBondProductMatrix are now parallelized over matrix elements rather than over the rows of the matrix These clases now inherit from ActionWithVector rather than ActionWithMatrix Changes to regtests revert changes that were made in an earlier commit when I started reworking the derivatives. In other words, the forces in these actions are back to the values that we had when we were using the chains derivatives. I had introduced an error in an earlier commit --- regtest/clusters/rt-dfg2/plumed.dat | 2 +- regtest/contour/rt-dfg-wcsurf/plumed.dat | 2 +- .../rt-quaternion-bond-product-only/Makefile | 1 + .../colvar.reference | 10 + .../rt-quaternion-bond-product-only/config | 3 + .../forces.reference | 261 ++++++++++++ .../plumed.dat | 17 + .../rt-quaternion-bond-product-only/small.xyz | 261 ++++++++++++ .../crystdistrib/rt-rops-forces/plumed.dat | 5 +- .../rt-rops-forces/sdot.reference | 10 + regtest/crystdistrib/rt-rops/plumed.dat | 6 +- regtest/crystdistrib/rt-rops2/plumed.dat | 4 +- .../rt-kldiv/KLPOShack350insphere_coord.dat | 12 +- ...{forces.reference_sav => forces.reference} | 0 regtest/symfunc/rt-hexactic/plumed.dat | 4 +- regtest/symfunc/rt-nbonds-one-q6/plumed.dat | 2 +- regtest/symfunc/rt-nbonds-q6/plumed.dat | 4 +- regtest/symfunc/rt-ntwo-lq6/plumed.dat | 2 +- .../rt-two-coord-stack-mult-q1-av/plumed.dat | 1 - .../plumed.dat | 1 - regtest/symfunc/rt-two-lq1/plumed.dat | 2 +- regtest/symfunc/rt-two-lq6/plumed.dat | 2 +- regtest/symfunc/rt-urea/plumed.dat | 16 +- .../volumes/rt-q3-insphere/forces.reference | 12 +- regtest/volumes/rt-q3-insphere/plumed.dat | 2 +- .../forces_bias_lambdav.out.0.reference | 96 ++--- src/clusters/ClusterDiameter.cpp | 2 +- src/clusters/ClusterWithSurface.cpp | 2 +- src/clusters/ClusteringBase.cpp | 1 + src/core/ActionShortcut.cpp | 23 -- src/core/ActionShortcut.h | 1 - src/core/ActionWithMatrix.cpp | 4 +- src/core/ActionWithVector.cpp | 8 +- .../QuaternionBondProductMatrix.cpp | 119 ++---- src/crystdistrib/QuaternionProductMatrix.cpp | 21 +- src/crystdistrib/RopsShortcut.cpp | 4 +- src/function/Custom.cpp | 8 +- src/function/FunctionOfMatrix.h | 389 ++++++------------ src/gridtools/KDE.cpp | 1 + src/matrixtools/OuterProduct.cpp | 7 +- src/symfunc/LocalSteinhardt.cpp | 6 +- src/symfunc/RadialTetra.cpp | 2 +- src/symfunc/SMAC.cpp | 6 +- src/valtools/Flatten.cpp | 1 + 44 files changed, 851 insertions(+), 492 deletions(-) create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/Makefile create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/colvar.reference create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/config create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/forces.reference create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/plumed.dat create mode 100644 regtest/crystdistrib/rt-quaternion-bond-product-only/small.xyz create mode 100644 regtest/crystdistrib/rt-rops-forces/sdot.reference rename regtest/symfunc/rt-hexactic/{forces.reference_sav => forces.reference} (100%) diff --git a/regtest/clusters/rt-dfg2/plumed.dat b/regtest/clusters/rt-dfg2/plumed.dat index c771d78872..4405ad63be 100644 --- a/regtest/clusters/rt-dfg2/plumed.dat +++ b/regtest/clusters/rt-dfg2/plumed.dat @@ -5,7 +5,7 @@ cf: LESS_THAN ARG=c1 SWITCH={CUBIC D_0=13 D_MAX=13.5} cf2: CUSTOM ARG=cf FUNC=x*x PERIODIC=NO cmat2: CONTACT_MATRIX GROUP=1-1996 SWITCH={CUBIC D_0=0.34 D_MAX=0.38} -dmat: OUTER_PRODUCT ARG=cf,cf +dmat: OUTER_PRODUCT ARG=cf,cf MASK=cmat2 mat: CUSTOM ARG=cmat2,dmat FUNC=x*y PERIODIC=NO dfs: DFSCLUSTERING ARG=mat diff --git a/regtest/contour/rt-dfg-wcsurf/plumed.dat b/regtest/contour/rt-dfg-wcsurf/plumed.dat index c9bd138726..4945953c2c 100644 --- a/regtest/contour/rt-dfg-wcsurf/plumed.dat +++ b/regtest/contour/rt-dfg-wcsurf/plumed.dat @@ -4,7 +4,7 @@ c1: COORDINATIONNUMBER SPECIES=1-512 SWITCH={EXP D_0=4.0 R_0=0.5 D_MAX=6.0} cf: MORE_THAN ARG=c1 SWITCH={RATIONAL D_0=2.0 R_0=0.1} # Build a dot product matrix c1_mat2: CONTACT_MATRIX GROUP=1-512 SWITCH={EXP D_0=4.0 R_0=0.5 D_MAX=6.0} -dp_mat: OUTER_PRODUCT ARG=cf,cf +dp_mat: OUTER_PRODUCT ARG=cf,cf MASK=c1_mat2 # Build the final matrix mat: CUSTOM ARG=c1_mat2,dp_mat FUNC=x*y PERIODIC=NO # Find largest cluster diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/Makefile b/regtest/crystdistrib/rt-quaternion-bond-product-only/Makefile new file mode 100644 index 0000000000..3703b27cea --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/Makefile @@ -0,0 +1 @@ +include ../../scripts/test.make diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/colvar.reference b/regtest/crystdistrib/rt-quaternion-bond-product-only/colvar.reference new file mode 100644 index 0000000000..30e868747b --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/colvar.reference @@ -0,0 +1,10 @@ +#! FIELDS time sdot.w.1 sdot.w.2 sdot.w.3 sdot.i.1 sdot.i.2 sdot.i.3 sdot.j.1 sdot.j.2 sdot.j.3 sdot.k.1 sdot.k.2 sdot.k.3 sw si sj sk + 0.000000 0.0000 0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.025000 0.0000 0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.050000 -0.0000 0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.075000 -0.0000 0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.100000 0.0000 -0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.125000 0.0000 0.0000 -0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.150000 -0.0000 0.0000 -0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 -0.0000 2.1009 1.3289 -0.6203 + 0.175000 -0.0000 0.0000 0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 0.0000 2.1009 1.3289 -0.6203 + 0.200000 -0.0000 -0.0000 -0.0000 1.3017 -0.7406 1.5398 -0.0286 1.7870 -0.4294 0.2724 -0.1193 -0.7734 -0.0000 2.1009 1.3289 -0.6203 diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/config b/regtest/crystdistrib/rt-quaternion-bond-product-only/config new file mode 100644 index 0000000000..360432dd1c --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/config @@ -0,0 +1,3 @@ +type=driver +plumed_modules="adjmat crystdistrib" +arg="--plumed plumed.dat --ixyz small.xyz --timestep=0.001 --trajectory-stride=25 --dump-forces forces --dump-forces-fmt=%8.4f" # --debug-forces=forces.num" diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/forces.reference b/regtest/crystdistrib/rt-quaternion-bond-product-only/forces.reference new file mode 100644 index 0000000000..83aabfaa69 --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/forces.reference @@ -0,0 +1,261 @@ +27 + -1.9496 2.3316 -0.3820 +X 0.5366 -0.0525 -0.5279 +X -0.3843 0.1926 -0.1942 +X 0.0096 -0.0198 0.0487 +X 0.6874 -0.7149 0.6953 +X -0.6632 0.5038 -0.6923 +X -0.1546 0.1376 0.1885 +X 0.1306 0.2850 0.2301 +X -0.1570 -0.3128 0.1777 +X -0.0050 -0.0189 0.0741 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -2.5933 2.9753 -0.3820 +X -0.4033 0.3579 -0.5279 +X 0.1977 -0.3817 -0.1942 +X 0.0039 0.0216 0.0487 +X -0.1359 0.9824 0.6953 +X 0.2405 -0.7974 -0.6923 +X 0.0442 -0.2022 0.1885 +X -0.2732 -0.1538 0.2301 +X 0.3109 0.1608 0.1777 +X 0.0152 0.0124 0.0741 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + 0.6108 -0.2288 -0.3820 +X -0.1159 0.5266 -0.5279 +X -0.0644 -0.4250 -0.1942 +X 0.0159 0.0152 0.0487 +X 0.4675 0.8746 0.6953 +X -0.2742 -0.7864 -0.6923 +X -0.0831 -0.1895 0.1885 +X -0.3115 0.0361 0.2301 +X 0.3460 -0.0527 0.1777 +X 0.0196 0.0011 0.0741 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -0.0956 -1.4652 1.5609 +X 0.3815 0.6145 0.2150 +X 0.0480 -0.0518 -0.4664 +X -0.0237 -0.0301 0.0372 +X -0.0972 -0.2861 1.1729 +X 0.2335 0.1915 -1.0401 +X -0.2185 -0.1334 -0.1133 +X -0.3713 0.1102 0.0353 +X 0.0896 -0.3618 0.1232 +X -0.0419 -0.0530 0.0361 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -0.3820 2.3316 -1.9496 +X -0.5279 -0.0525 -0.5366 +X -0.1942 0.1926 0.3843 +X 0.0487 -0.0198 -0.0096 +X 0.6953 -0.7149 -0.6874 +X -0.6923 0.5038 0.6632 +X 0.1885 0.1376 0.1546 +X 0.2301 0.2850 -0.1306 +X 0.1777 -0.3128 0.1570 +X 0.0741 -0.0189 0.0050 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -2.8828 -0.2115 3.0943 +X 0.2937 -0.6949 -0.0134 +X -0.3087 0.0401 -0.3544 +X 0.0139 0.0332 0.0394 +X 0.4982 0.1329 1.0960 +X -0.5634 -0.1964 -0.9039 +X -0.0239 0.2646 -0.0883 +X 0.2956 0.2227 -0.1194 +X -0.2144 0.1362 0.2993 +X 0.0088 0.0616 0.0447 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -0.1396 -1.5128 1.6524 +X 0.5875 0.0895 -0.4650 +X 0.1159 0.1709 0.4241 +X -0.0455 -0.0202 -0.0194 +X -0.6650 -0.2677 -0.9763 +X 0.5705 0.3926 0.8327 +X -0.1405 -0.1274 0.2059 +X -0.0055 -0.3839 0.0619 +X -0.3468 0.1749 -0.0568 +X -0.0707 -0.0288 -0.0070 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + -0.8683 2.3316 -1.4633 +X -0.7443 0.0525 0.1125 +X 0.0752 -0.1926 -0.4240 +X 0.0332 0.0198 0.0368 +X 0.1439 0.7149 0.9671 +X -0.1559 -0.5038 -0.9460 +X 0.2436 -0.1376 -0.0105 +X 0.1057 -0.2850 0.2426 +X 0.2364 0.3128 -0.0190 +X 0.0623 0.0189 0.0404 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +27 + 0.2169 -0.5340 0.3171 +X -0.3338 0.6767 -0.0080 +X 0.4670 0.0619 -0.0242 +X -0.0302 -0.0437 0.0058 +X -1.0713 -0.4666 0.3190 +X 0.9745 0.4543 -0.1301 +X 0.1283 -0.2185 -0.1191 +X -0.0848 -0.1440 -0.3512 +X -0.0251 -0.2477 0.3035 +X -0.0246 -0.0724 0.0044 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/plumed.dat b/regtest/crystdistrib/rt-quaternion-bond-product-only/plumed.dat new file mode 100644 index 0000000000..4c0d100b62 --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/plumed.dat @@ -0,0 +1,17 @@ +quat: QUATERNION ATOMS1=1,2,3 ATOMS2=4,5,6 ATOMS3=7,8,9 +c1: DISTANCE_MATRIX GROUP=1,4,7 CUTOFF=100.0 COMPONENTS +qp: QUATERNION_BOND_PRODUCT_MATRIX ARG=quat.*,c1.* + +ones: ONES SIZE=3 + +sdot: MATRIX_VECTOR_PRODUCT ARG=qp.*,ones +sw: SUM ARG=sdot.w PERIODIC=NO +si: SUM ARG=sdot.i PERIODIC=NO +sj: SUM ARG=sdot.j PERIODIC=NO +sk: SUM ARG=sdot.k PERIODIC=NO + +BIASVALUE ARG=sw +BIASVALUE ARG=si +BIASVALUE ARG=sj +BIASVALUE ARG=sk +PRINT ARG=sdot.*,sw,si,sj,sk FILE=colvar FMT=%8.4f diff --git a/regtest/crystdistrib/rt-quaternion-bond-product-only/small.xyz b/regtest/crystdistrib/rt-quaternion-bond-product-only/small.xyz new file mode 100644 index 0000000000..22e0d1a44a --- /dev/null +++ b/regtest/crystdistrib/rt-quaternion-bond-product-only/small.xyz @@ -0,0 +1,261 @@ +27 +36. 36. 36. +N 11.938 15.838 13.512 +H 10.809 12.395 12.332 +H 5.653 14.012 14.003 +H 7.596 15.030 9.623 +H 6.104 13.210 9.728 +H 13.480 14.967 14.493 +H 13.077 12.583 13.518 +H 7.211 15.762 13.931 +H 4.316 12.385 12.871 +H 10.326 17.405 13.207 +H 4.421 12.000 11.150 +S 8.704 16.916 11.702 +O 9.052 17.197 10.344 +O 7.847 17.900 12.288 +N 10.469 14.398 12.255 +C 7.569 15.556 11.703 +N 4.580 12.623 11.920 +N 9.945 16.579 12.691 +C 6.965 15.265 12.969 +C 10.893 15.600 12.687 +C 5.610 13.576 11.853 +C 11.217 13.343 12.589 +C 7.253 14.746 10.547 +C 12.744 14.759 13.739 +C 6.249 13.760 10.661 +C 6.016 14.211 13.045 +C 12.373 13.462 13.365 +27 +36. 36. 36. +N 7.515975628317081 19.992801518276305 13.512 +H 10.453099312512519 22.114639038855632 12.332 +H 13.673944485232102 17.775839507491114 14.003 +H 11.50365890930114 18.094325800612207 9.623 +H 13.780481108072317 18.689762342304753 9.728 +H 6.780431522741224 21.603819789045637 14.493 +H 8.507744515060583 23.29563976367791 13.518 +H 11.384872081848883 17.275827975554726 13.931 +H 15.71192653069723 18.30624235661786 12.871 +H 7.899052708574498 17.77756226470087 13.207 +H 15.853276870362341 18.679431425960143 11.15 +S 9.498705557844454 17.219784744696245 11.702 +O 9.052 17.197 10.344 +O 9.613653123597665 15.919980122021201 12.288 +N 9.550832196328463 20.294330534493554 12.255 +C 11.216327559709345 17.652912507267118 11.703 +N 15.358453173970007 18.268871430967174 11.92 +N 8.69279856602585 18.22186454218639 12.691 +C 11.87601939620182 17.53331451035586 12.969 +C 8.501291501282584 19.571112497216678 12.687 +C 13.96500641220258 18.103296305661853 11.853 +C 9.565800239392674 21.587506840217884 12.589 +C 11.948082735082778 18.122476521342083 10.547 +C 7.4981275033649375 21.339485759082475 13.739 +C 13.33989194604258 18.330031623152312 10.661 +C 13.263302023273269 17.828210954257344 13.045 +C 8.560629839354288 22.170713036075462 13.365 +27 +36. 36. 36. +N 9.452659400749145 20.361703626659427 13.512 +H 13.076027183399834 20.35191017736784 12.332 +H 13.131466154834047 14.948582358287613 14.003 +H 11.562868973651296 16.481904204210878 9.623 +H 13.754846098103934 15.625341138303678 9.728 +H 9.80452357879963 22.097386950369387 14.493 +H 12.196375787245568 22.450810227690358 13.518 +H 10.98566777530713 15.889546392892363 13.931 +H 15.091991644347814 14.17979252682077 12.871 +H 8.460491375917032 18.344369839082184 13.207 +H 15.42570138643524 14.398625358077746 11.15 +S 9.426785054253688 16.952866505558827 11.702 +O 9.052 17.197 10.344 +O 8.75577419428179 15.833737636393273 12.288 +N 11.276127759561701 19.409588011616044 12.255 +C 11.07095690471347 16.29368221709644 11.703 +N 14.784059518514983 14.357325075611335 11.92 +N 9.363799646917734 18.237266302531218 12.691 +C 11.53436112983833 15.809168518490893 12.969 +C 10.001934587596882 19.441396194812125 12.687 +C 13.559414427095739 15.042418791874118 11.853 +C 12.04834657132317 20.446992034531757 12.589 +C 11.938962106450564 16.24345304472275 10.547 +C 10.229780516805745 21.461685340588772 13.739 +C 13.186957583983105 15.59328438348297 10.661 +C 12.830032437962469 15.232321171869724 13.045 +C 11.57794607245379 21.50963984573895 13.365 +27 +36. 36. 36. +N 7.366207933521835 16.710027101867325 14.48321049296645 +H 10.627771357967022 14.81642567414036 15.028891408183192 +H 8.743765318763447 11.318545742065272 11.00314635601821 +H 11.151110288949333 15.497244788987357 10.143415310997039 +H 12.409761609420434 13.50770683387648 10.059602551529418 +H 7.089626664873265 16.758418782628496 16.488186065652027 +H 9.433412727334813 15.784483532968146 17.083674959654275 +H 7.50172336443648 13.298103443259546 11.186806616646601 +H 10.77816581153122 10.19823223290966 10.435489526384597 +H 6.684054977401092 16.610216678973565 12.321784291603677 +H 12.301771097802817 10.9964783739187 10.032350555297175 +S 8.261268895225207 16.08866781946481 10.780546787334128 +O 9.052 17.197 10.344 +O 7.243398660836353 15.71049146761866 9.849405641830659 +N 9.379847234945164 15.665724701386793 13.666938932691338 +C 9.260917642104172 14.630328866923824 10.672030049616026 +N 11.302771957669727 11.009185024301757 10.122623801884336 +N 7.64844240621318 16.208071362425123 12.277863550178155 +C 8.566484318000064 13.395965029096018 10.887346733216559 +C 8.22382802070879 16.335881595523063 13.506585218802487 +C 10.631803293192009 12.223037499272195 10.346143868762312 +C 9.77194715655021 15.439062290398724 14.923508390748628 +C 10.683759419605304 14.624493274375933 10.411685619952104 +C 7.848769734159871 16.567228438026053 15.752914651489261 +C 11.339672036093711 13.385592390567249 10.244021552157623 +C 9.291240347131836 12.179041880007322 10.781896520086399 +C 9.020592760648508 15.852061076220604 16.02694464838603 +27 +36. 36. 36. +N 12.22 15.838007658264928 7.457996393781631 +H 11.040000000000001 12.395004662374173 8.586987257467998 +H 12.711000000000002 14.011990980459506 13.742991548304541 +H 8.331 15.02999613638089 11.79999424966579 +H 8.436 13.209992177231328 13.291989420127114 +H 13.201 14.967011750103456 5.915994082510348 +H 12.226 12.583010680715162 6.318987756350864 +H 12.639000000000001 15.761995114746243 12.184996192092164 +H 11.579000000000002 12.38498743261568 15.079987230909243 +H 11.915000000000001 17.405003380672664 9.07000055195116 +H 9.858000000000002 11.999987711243964 14.974986209277539 +S 10.41 16.915999076551742 10.691999254340042 +O 9.052 17.197 10.344 +O 10.996 17.89999680242182 11.549001865469382 +N 10.963000000000001 14.39800376014659 8.926992572607157 +C 10.411 15.555996064732113 11.826995645453927 +N 10.628000000000002 12.622988133162547 14.81598786246454 +N 11.399000000000001 16.57900236965786 9.45099836008465 +C 11.677 15.264994461964903 12.430994873257172 +C 11.395 15.600004885264433 8.50299576222358 +C 10.561000000000002 13.57599086635668 13.78599039133924 +C 11.297 13.343005745035471 8.178989773072557 +C 9.255 14.745995226200591 12.142993496045083 +C 12.447000000000001 14.7590097970621 6.651993530561081 +C 9.369 13.75999256199991 13.146990879602011 +C 11.753000000000002 14.2109919437119 13.379992076370188 +C 12.073 13.462008812584854 7.022990088853814 +27 +36. 36. 36. +N 11.890264359444366 18.409047821534724 13.613143084085003 +H 9.161387982710433 16.928102173286646 15.82251487430922 +H 5.8332458111537004 20.93670357800139 13.621185624963589 +H 6.6948424921079495 16.590504722244816 11.532123714538516 +H 4.683209023000802 16.811221315754064 12.737986049681963 +H 13.145588117454707 18.397729847282065 15.201475595253115 +H 11.539436774319464 17.078787338428878 16.775374741095984 +H 7.882600961591964 20.69895408935738 12.508231606137262 +H 3.6849572786482714 20.066803756049904 14.207916126023868 +H 11.052121791509975 19.22376164866663 11.668710926436802 +H 3.130092279921417 18.420948601663913 13.884842382168207 +S 9.019518922984117 18.449061144888784 11.033577311906122 +O 9.052 17.197 10.344 +O 8.84791837763023 19.574516764958133 10.167549656407427 +N 9.669160478443395 17.534302724264833 13.949488984319746 +C 7.47696971123614 18.554741985068794 11.897984327931873 +N 3.742246265506113 19.1926174579928 13.69483008229044 +N 10.23606047747434 18.71077397102741 12.074396240842873 +C 7.192541780166204 19.829278580745726 12.486975175320467 +C 10.65338660903918 18.056512619291947 13.19463817164997 +C 5.007681455378117 18.964219948698613 13.12905065708852 +C 9.97768230281472 17.236711661319053 15.214533980808564 +C 6.542541301698518 17.461410370930516 12.05213207840126 +C 12.208853133402988 17.98793383142084 14.872734367175633 +C 5.299363852812824 17.71128975586328 12.67283983859738 +C 5.958270862713409 20.005295966059403 13.167332568458495 +C 11.247880947397762 17.469173489018637 15.748603172919443 +27 +36. 36. 36. +N 6.839885954243835 14.851987023126915 7.2103812314091 +H 5.767238251343143 18.335914521235477 6.09999116778962 +H 3.402924800444553 18.74724713935214 11.221718745782548 +H 8.101804378453407 19.731484673972034 10.248178717423826 +H 6.635928098375635 21.570466341497276 10.385445457792462 +H 6.164808395519636 14.112173591058475 5.450917570108278 +H 5.680719621650357 16.43724543547753 4.375655287079844 +H 4.831619377890597 16.903298838380135 10.98991178359478 +H 3.083132409699953 21.113288422655053 11.347032242773722 +H 7.274846643437666 14.772210252806012 9.435578495872006 +H 4.328654109291286 22.326916309138145 11.035786280554598 +S 7.699498500761386 16.748193355206972 10.460367049231865 +O 9.052 17.197 10.344 +O 7.397240726360324 16.167251160135404 11.732077473738775 +N 6.664538691387691 17.23187894674027 7.552401361414306 +C 6.659842229225946 18.177465724070334 10.579200262858159 +N 4.056894259524991 21.39095617141645 11.273347229893897 +N 7.167884847180369 15.79730700299696 9.25829672329125 +C 5.288568888025428 17.91101691092272 10.896796631988844 +C 7.033111170049231 15.989613534029 7.915905106036815 +C 4.92013084840028 20.316792689039 11.000229297941944 +C 6.151078139047405 17.370364269847702 6.327140133563592 +C 7.100717963872707 19.537361558947534 10.358737329730362 +C 6.421616478266651 15.041492263219856 5.924090280868327 +C 6.192748040828361 20.593134079572533 10.59142382168892 +C 4.398008220314218 19.007477231584428 11.045017623552756 +C 5.979257319364865 16.286641082413016 5.461868696995842 +27 +36. 36. 36. +N 9.85479567255015 18.555984683460572 14.553605769933132 +H 9.588184708969022 21.99899067521784 12.942420388041304 +H 14.018589857951088 20.382018039058558 9.82021352273188 +H 9.348793099592799 19.36400772722296 8.746609200542935 +H 10.327987304140082 21.18401564550927 7.616016927813224 +H 9.714392899031129 19.426976499777382 16.375809467958494 +H 9.176185307638043 21.810978638537183 15.468419589815943 +H 13.026195430502819 18.632009770497408 11.023406092662906 +H 13.91518467707108 22.009025134734753 8.071420430571894 +H 10.578000662346778 16.988993238656132 13.080999116870963 +H 12.475383451113483 22.394024577475474 7.122822065182024 +S 10.347199105206581 17.478001846894536 10.880401193057892 +O 9.052 17.197 10.344 +O 11.330202238558167 16.494006395161303 10.546397015255778 +N 9.730591087134576 19.995992479687107 12.624211883820566 +C 11.028994774538447 18.838007870524216 9.97300696728207 +N 12.995985434938554 21.771023733642693 7.712019420081928 +N 10.393798032105355 17.814995260679922 12.466602623859528 +C 12.404193847899787 19.129011076056585 10.249408202800282 +C 9.821794914676074 18.79399022945989 13.2226067804319 +C 12.324388469592545 20.81801826726114 8.495815373876606 +C 9.548987727696217 21.050988509901917 13.42301636307171 +C 10.2937921952465 19.648009547581555 9.026610406338003 +C 9.552792236688898 19.63498040585863 15.33461035108147 +C 10.98738905551057 20.63401487597598 8.291814592652571 +C 13.034390491631399 20.183016112555173 9.5358126778248 +C 9.476188106638608 20.93198237480399 14.813415857815187 +27 +36. 36. 36. +N 5.058230075990464 15.146684719083321 10.10293975251728 +H 5.200854659093644 15.554033939221902 13.889100715966553 +H 9.83034871133947 12.316636687293471 13.609261738290567 +H 9.795196571942933 17.170287477220413 12.948344696191159 +H 10.442553681625732 16.390814464251374 15.075041570359195 +H 3.088726391380563 14.701986341226283 10.251481292294356 +H 2.8999646837283883 15.264795175549335 12.79000551588021 +H 9.089875620681628 13.082657140011413 11.521209950611576 +H 10.783070276735133 12.76099789583737 15.75658256554751 +H 7.130499779543152 14.99621426261731 9.19183332763127 +H 11.075400381326897 14.368844491085948 16.42774829478055 +S 8.849847030594889 15.784831102834948 10.43961476266947 +O 9.052 17.197 10.344 +O 9.77824895666933 15.020569333458868 9.664969804297307 +N 6.231623383472541 15.676943684961135 12.140973995375447 +C 9.374835666666193 15.267461139739925 12.050372737438817 +N 10.921201851338516 13.760610689819044 15.645070547335386 +N 7.33275907672529 15.272129411430349 10.180091900758196 +C 9.423675251193337 13.849882625042657 12.251218075079256 +C 6.149332388611258 15.52658068755091 10.806124505292555 +C 10.36562356021581 14.267691083738288 14.458562967698459 +C 5.096135556308479 15.539407115338975 12.830782727111139 +C 9.718963773191136 16.16404436313054 13.132041064530835 +C 3.895321554815057 15.127260470616632 10.81895125378603 +C 10.225652572798312 15.619518649509018 14.332026984263903 +C 9.869190061687029 13.354356385747014 13.505516006114897 +C 3.8796204303091466 15.234154983721725 12.21467795975582 diff --git a/regtest/crystdistrib/rt-rops-forces/plumed.dat b/regtest/crystdistrib/rt-rops-forces/plumed.dat index c96356e230..49fa8e3cd5 100644 --- a/regtest/crystdistrib/rt-rops-forces/plumed.dat +++ b/regtest/crystdistrib/rt-rops-forces/plumed.dat @@ -1,8 +1,9 @@ q: QUATERNION ATOMS1=1,2,3 ATOMS2=4,5,6 ATOMS3=7,8,9 c1: DISTANCE_MATRIX GROUP=1,4,7 ones: ONES SIZE=3 -qp: QUATERNION_PRODUCT_MATRIX ARG=q.*,q.* -ops: CUSTOM ARG=c1,qp.w,qp.i,qp.j,qp.k VAR=x,w,i,j,k FUNC=x*(w+i+j+k) PERIODIC=NO +qp: QUATERNION_PRODUCT_MATRIX ARG=q.*,q.* MASK=c1 +ops: CUSTOM ARG=c1,qp.w,qp.i,qp.j,qp.k VAR=x,w,i,j,k FUNC=x*(w+i+j+k) PERIODIC=NO MASK=c1 sdot: MATRIX_VECTOR_PRODUCT ARG=ops,ones s: SUM ARG=sdot PERIODIC=NO +PRINT ARG=sdot FILE=sdot FMT=%8.4f BIASVALUE ARG=s diff --git a/regtest/crystdistrib/rt-rops-forces/sdot.reference b/regtest/crystdistrib/rt-rops-forces/sdot.reference new file mode 100644 index 0000000000..9f351419f1 --- /dev/null +++ b/regtest/crystdistrib/rt-rops-forces/sdot.reference @@ -0,0 +1,10 @@ +#! FIELDS time sdot.1 sdot.2 sdot.3 + 0.000000 -3.6636 -3.2269 -7.8621 + 0.025000 -5.8014 3.2269 18.8302 + 0.050000 -5.8014 3.2269 18.8302 + 0.075000 5.8014 -11.5039 7.8621 + 0.100000 3.6636 11.5039 -18.8302 + 0.125000 3.6636 11.5039 -18.8302 + 0.150000 -5.8014 3.2269 18.8302 + 0.175000 5.8014 -11.5039 7.8621 + 0.200000 5.8014 -11.5039 7.8621 diff --git a/regtest/crystdistrib/rt-rops/plumed.dat b/regtest/crystdistrib/rt-rops/plumed.dat index 601f06a9e6..c17309b786 100644 --- a/regtest/crystdistrib/rt-rops/plumed.dat +++ b/regtest/crystdistrib/rt-rops/plumed.dat @@ -11,10 +11,10 @@ quat: QUATERNION ATOMS1=13,19,17 ATOMS2=40,46,44 ATOMS3=67,73,71 ATOMS4=94,100,9 PRINT ARG=quat.* FILE=quat c1: CONTACT_MATRIX GROUP=13,40,67,94,121,148,175,202,229,256,283,310,337,364,391,418,445,472,499,526,553,580,607,634,661,688,715,742,769,796,823,850,877,904,931,958,985,1012,1039,1066,1093,1120,1147,1174,1201,1228,1255,1282,1309,1336,1363,1390,1417,1444,1471,1498,1525,1552,1579,1606,1633,1660,1687,1714,1741,1768,1795,1822,1849,1876,1903,1930,1957,1984,2011,2038,2065,2092,2119,2146,2173,2200,2227,2254,2281,2308,2335,2362,2389,2416,2443,2470,2497,2524,2551,2578,2605,2632,2659,2686,2713,2740,2767,2794,2821,2848,2875,2902,2929,2956,2983,3010,3037,3064,3091,3118,3145,3172,3199,3226,3253,3280,3307,3334,3361,3388,3415,3442,3469,3496,3523,3550,3577,3604,3631,3658,3685,3712,3739,3766,3793,3820,3847,3874,3901,3928,3955,3982,4009,4036,4063,4090,4117,4144,4171,4198,4225,4252,4279,4306,4333,4360,4387,4414,4441,4468,4495,4522,4549,4576,4603,4630,4657,4684,4711,4738,4765,4792,4819,4846,4873,4900,4927,4954,4981,5008,5035,5062,5089,5116,5143,5170,5197,5224,5251,5278,5305,5332,5359,5386,5413,5440,5467,5494,5521,5548,5575,5602,5629,5656,5683,5710,5737,5764,5791,5818,5845,5872,5899,5926,5953,5980,6007,6034,6061,6088,6115,6142,6169,6196,6223,6250,6277,6304,6331,6358,6385,6412,6439,6466,6493,6520,6547,6574,6601,6628,6655,6682,6709,6736,6763,6790 SWITCH={EXP D_0=0.74 R_0=0.01 D_MAX=1.0} -qp: QUATERNION_PRODUCT_MATRIX ARG=quat.*,quat.* +qp: QUATERNION_PRODUCT_MATRIX ARG=quat.*,quat.* MASK=c1 ones: ONES SIZE=252 -ops: CUSTOM ARG=qp.w,qp.i,qp.j,qp.k VAR=w,i,j,k FUNC=((2.81566426485e-24*exp(60.9517091737*((0.999999935213*w)+(0.000323260605362*i)+(-3.54954971419e-05*j)+(0.000154325371938*k))^2))+(2.74313783032e-24*exp(60.9784690136*((-0.999999975104*w)+(-9.33618007376e-07*i)+(-0.000174903361291*j)+(0.000138561169562*k))^2))+(0.0130950591427*exp(7.87597632012*((-0.00314335246277*w)+(0.331888328739*i)+(-0.504016340713*j)+(0.797375560746*k))^2))+(0.0107350493097*exp(8.12722630497*((-0.0032553078902*w)+(0.272414440723*i)+(-0.417230695312*j)+(0.867005376192*k))^2))+(0.0775451781009*exp(5.47161569795*((0.00999289453389*w)+(0.0115376130044*i)+(-0.00353037871082*j)+(0.999877273455*k))^2))+(8.41766101819e-25*exp(62.1895764963*((-0.999999978371*w)+(-6.76320959659e-05*i)+(0.000135881297839*j)+(0.000142199691495*k))^2))+(8.90283264343e-25*exp(62.1321413047*((0.999999916445*w)+(-0.000387459116169*i)+(6.61150331893e-06*j)+(0.000130162625944*k))^2))+(0.0133120880032*exp(7.85508401972*((-0.0033041458338*w)+(-0.332424752605*i)+(0.504900401912*j)+(0.796591771628*k))^2))+(0.0099761880464*exp(8.2193276117*((-0.00312375550685*w)+(-0.271447650829*i)+(0.41694219092*j)+(0.867447764676*k))^2))+(0.0794224100073*exp(5.43643088621*((0.0107636888243*w)+(-0.0116508635888*i)+(0.0021743879902*j)+(0.999871827995*k))^2))) PERIODIC=NO +ops: CUSTOM ARG=qp.w,qp.i,qp.j,qp.k VAR=w,i,j,k FUNC=((2.81566426485e-24*exp(60.9517091737*((0.999999935213*w)+(0.000323260605362*i)+(-3.54954971419e-05*j)+(0.000154325371938*k))^2))+(2.74313783032e-24*exp(60.9784690136*((-0.999999975104*w)+(-9.33618007376e-07*i)+(-0.000174903361291*j)+(0.000138561169562*k))^2))+(0.0130950591427*exp(7.87597632012*((-0.00314335246277*w)+(0.331888328739*i)+(-0.504016340713*j)+(0.797375560746*k))^2))+(0.0107350493097*exp(8.12722630497*((-0.0032553078902*w)+(0.272414440723*i)+(-0.417230695312*j)+(0.867005376192*k))^2))+(0.0775451781009*exp(5.47161569795*((0.00999289453389*w)+(0.0115376130044*i)+(-0.00353037871082*j)+(0.999877273455*k))^2))+(8.41766101819e-25*exp(62.1895764963*((-0.999999978371*w)+(-6.76320959659e-05*i)+(0.000135881297839*j)+(0.000142199691495*k))^2))+(8.90283264343e-25*exp(62.1321413047*((0.999999916445*w)+(-0.000387459116169*i)+(6.61150331893e-06*j)+(0.000130162625944*k))^2))+(0.0133120880032*exp(7.85508401972*((-0.0033041458338*w)+(-0.332424752605*i)+(0.504900401912*j)+(0.796591771628*k))^2))+(0.0099761880464*exp(8.2193276117*((-0.00312375550685*w)+(-0.271447650829*i)+(0.41694219092*j)+(0.867447764676*k))^2))+(0.0794224100073*exp(5.43643088621*((0.0107636888243*w)+(-0.0116508635888*i)+(0.0021743879902*j)+(0.999871827995*k))^2))) PERIODIC=NO MASK=c1 rops: CUSTOM ARG=c1,ops FUNC=x*y PERIODIC=NO sdot: MATRIX_VECTOR_PRODUCT ARG=rops,ones @@ -52,6 +52,6 @@ opf5: CUSTOM ARG=sa5,sra5 FUNC=(y*(1/x)) PERIODIC=NO opf6: CUSTOM ARG=sa6,sra6 FUNC=(y*(1/x)) PERIODIC=NO opf7: CUSTOM ARG=sa7,sra7 FUNC=(y*(1/x)) PERIODIC=NO -#restraint: RESTRAINT ARG=opf0,opf1,opf2,opf3,opf4,opf5,opf6,opf7 AT=245.8669,847.8311,261.2707,1441.5044,178.1364,1018.4381,104.6864,1684.0187 KAPPA=0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321 +restraint: RESTRAINT ARG=opf0,opf1,opf2,opf3,opf4,opf5,opf6,opf7 AT=245.8669,847.8311,261.2707,1441.5044,178.1364,1018.4381,104.6864,1684.0187 KAPPA=0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321,0.000305321 PRINT ARG=opf2,opf3,opf6,opf7 FILE=colvar FMT=%8.2f diff --git a/regtest/crystdistrib/rt-rops2/plumed.dat b/regtest/crystdistrib/rt-rops2/plumed.dat index 98667d8cc1..98103a5513 100644 --- a/regtest/crystdistrib/rt-rops2/plumed.dat +++ b/regtest/crystdistrib/rt-rops2/plumed.dat @@ -254,8 +254,8 @@ com251: COM ATOMS=6778,6779,6780,6781,6782,6783,6784,6785,6786,6787,6788,6789,67 quat: QUATERNION ATOMS1=13,19,17 ATOMS2=40,46,44 ATOMS3=67,73,71 ATOMS4=94,100,98 ATOMS5=121,127,125 ATOMS6=148,154,152 ATOMS7=175,181,179 ATOMS8=202,208,206 ATOMS9=229,235,233 ATOMS10=256,262,260 ATOMS11=283,289,287 ATOMS12=310,316,314 ATOMS13=337,343,341 ATOMS14=364,370,368 ATOMS15=391,397,395 ATOMS16=418,424,422 ATOMS17=445,451,449 ATOMS18=472,478,476 ATOMS19=499,505,503 ATOMS20=526,532,530 ATOMS21=553,559,557 ATOMS22=580,586,584 ATOMS23=607,613,611 ATOMS24=634,640,638 ATOMS25=661,667,665 ATOMS26=688,694,692 ATOMS27=715,721,719 ATOMS28=742,748,746 ATOMS29=769,775,773 ATOMS30=796,802,800 ATOMS31=823,829,827 ATOMS32=850,856,854 ATOMS33=877,883,881 ATOMS34=904,910,908 ATOMS35=931,937,935 ATOMS36=958,964,962 ATOMS37=985,991,989 ATOMS38=1012,1018,1016 ATOMS39=1039,1045,1043 ATOMS40=1066,1072,1070 ATOMS41=1093,1099,1097 ATOMS42=1120,1126,1124 ATOMS43=1147,1153,1151 ATOMS44=1174,1180,1178 ATOMS45=1201,1207,1205 ATOMS46=1228,1234,1232 ATOMS47=1255,1261,1259 ATOMS48=1282,1288,1286 ATOMS49=1309,1315,1313 ATOMS50=1336,1342,1340 ATOMS51=1363,1369,1367 ATOMS52=1390,1396,1394 ATOMS53=1417,1423,1421 ATOMS54=1444,1450,1448 ATOMS55=1471,1477,1475 ATOMS56=1498,1504,1502 ATOMS57=1525,1531,1529 ATOMS58=1552,1558,1556 ATOMS59=1579,1585,1583 ATOMS60=1606,1612,1610 ATOMS61=1633,1639,1637 ATOMS62=1660,1666,1664 ATOMS63=1687,1693,1691 ATOMS64=1714,1720,1718 ATOMS65=1741,1747,1745 ATOMS66=1768,1774,1772 ATOMS67=1795,1801,1799 ATOMS68=1822,1828,1826 ATOMS69=1849,1855,1853 ATOMS70=1876,1882,1880 ATOMS71=1903,1909,1907 ATOMS72=1930,1936,1934 ATOMS73=1957,1963,1961 ATOMS74=1984,1990,1988 ATOMS75=2011,2017,2015 ATOMS76=2038,2044,2042 ATOMS77=2065,2071,2069 ATOMS78=2092,2098,2096 ATOMS79=2119,2125,2123 ATOMS80=2146,2152,2150 ATOMS81=2173,2179,2177 ATOMS82=2200,2206,2204 ATOMS83=2227,2233,2231 ATOMS84=2254,2260,2258 ATOMS85=2281,2287,2285 ATOMS86=2308,2314,2312 ATOMS87=2335,2341,2339 ATOMS88=2362,2368,2366 ATOMS89=2389,2395,2393 ATOMS90=2416,2422,2420 ATOMS91=2443,2449,2447 ATOMS92=2470,2476,2474 ATOMS93=2497,2503,2501 ATOMS94=2524,2530,2528 ATOMS95=2551,2557,2555 ATOMS96=2578,2584,2582 ATOMS97=2605,2611,2609 ATOMS98=2632,2638,2636 ATOMS99=2659,2665,2663 ATOMS100=2686,2692,2690 ATOMS101=2713,2719,2717 ATOMS102=2740,2746,2744 ATOMS103=2767,2773,2771 ATOMS104=2794,2800,2798 ATOMS105=2821,2827,2825 ATOMS106=2848,2854,2852 ATOMS107=2875,2881,2879 ATOMS108=2902,2908,2906 ATOMS109=2929,2935,2933 ATOMS110=2956,2962,2960 ATOMS111=2983,2989,2987 ATOMS112=3010,3016,3014 ATOMS113=3037,3043,3041 ATOMS114=3064,3070,3068 ATOMS115=3091,3097,3095 ATOMS116=3118,3124,3122 ATOMS117=3145,3151,3149 ATOMS118=3172,3178,3176 ATOMS119=3199,3205,3203 ATOMS120=3226,3232,3230 ATOMS121=3253,3259,3257 ATOMS122=3280,3286,3284 ATOMS123=3307,3313,3311 ATOMS124=3334,3340,3338 ATOMS125=3361,3367,3365 ATOMS126=3388,3394,3392 ATOMS127=3415,3421,3419 ATOMS128=3442,3448,3446 ATOMS129=3469,3475,3473 ATOMS130=3496,3502,3500 ATOMS131=3523,3529,3527 ATOMS132=3550,3556,3554 ATOMS133=3577,3583,3581 ATOMS134=3604,3610,3608 ATOMS135=3631,3637,3635 ATOMS136=3658,3664,3662 ATOMS137=3685,3691,3689 ATOMS138=3712,3718,3716 ATOMS139=3739,3745,3743 ATOMS140=3766,3772,3770 ATOMS141=3793,3799,3797 ATOMS142=3820,3826,3824 ATOMS143=3847,3853,3851 ATOMS144=3874,3880,3878 ATOMS145=3901,3907,3905 ATOMS146=3928,3934,3932 ATOMS147=3955,3961,3959 ATOMS148=3982,3988,3986 ATOMS149=4009,4015,4013 ATOMS150=4036,4042,4040 ATOMS151=4063,4069,4067 ATOMS152=4090,4096,4094 ATOMS153=4117,4123,4121 ATOMS154=4144,4150,4148 ATOMS155=4171,4177,4175 ATOMS156=4198,4204,4202 ATOMS157=4225,4231,4229 ATOMS158=4252,4258,4256 ATOMS159=4279,4285,4283 ATOMS160=4306,4312,4310 ATOMS161=4333,4339,4337 ATOMS162=4360,4366,4364 ATOMS163=4387,4393,4391 ATOMS164=4414,4420,4418 ATOMS165=4441,4447,4445 ATOMS166=4468,4474,4472 ATOMS167=4495,4501,4499 ATOMS168=4522,4528,4526 ATOMS169=4549,4555,4553 ATOMS170=4576,4582,4580 ATOMS171=4603,4609,4607 ATOMS172=4630,4636,4634 ATOMS173=4657,4663,4661 ATOMS174=4684,4690,4688 ATOMS175=4711,4717,4715 ATOMS176=4738,4744,4742 ATOMS177=4765,4771,4769 ATOMS178=4792,4798,4796 ATOMS179=4819,4825,4823 ATOMS180=4846,4852,4850 ATOMS181=4873,4879,4877 ATOMS182=4900,4906,4904 ATOMS183=4927,4933,4931 ATOMS184=4954,4960,4958 ATOMS185=4981,4987,4985 ATOMS186=5008,5014,5012 ATOMS187=5035,5041,5039 ATOMS188=5062,5068,5066 ATOMS189=5089,5095,5093 ATOMS190=5116,5122,5120 ATOMS191=5143,5149,5147 ATOMS192=5170,5176,5174 ATOMS193=5197,5203,5201 ATOMS194=5224,5230,5228 ATOMS195=5251,5257,5255 ATOMS196=5278,5284,5282 ATOMS197=5305,5311,5309 ATOMS198=5332,5338,5336 ATOMS199=5359,5365,5363 ATOMS200=5386,5392,5390 ATOMS201=5413,5419,5417 ATOMS202=5440,5446,5444 ATOMS203=5467,5473,5471 ATOMS204=5494,5500,5498 ATOMS205=5521,5527,5525 ATOMS206=5548,5554,5552 ATOMS207=5575,5581,5579 ATOMS208=5602,5608,5606 ATOMS209=5629,5635,5633 ATOMS210=5656,5662,5660 ATOMS211=5683,5689,5687 ATOMS212=5710,5716,5714 ATOMS213=5737,5743,5741 ATOMS214=5764,5770,5768 ATOMS215=5791,5797,5795 ATOMS216=5818,5824,5822 ATOMS217=5845,5851,5849 ATOMS218=5872,5878,5876 ATOMS219=5899,5905,5903 ATOMS220=5926,5932,5930 ATOMS221=5953,5959,5957 ATOMS222=5980,5986,5984 ATOMS223=6007,6013,6011 ATOMS224=6034,6040,6038 ATOMS225=6061,6067,6065 ATOMS226=6088,6094,6092 ATOMS227=6115,6121,6119 ATOMS228=6142,6148,6146 ATOMS229=6169,6175,6173 ATOMS230=6196,6202,6200 ATOMS231=6223,6229,6227 ATOMS232=6250,6256,6254 ATOMS233=6277,6283,6281 ATOMS234=6304,6310,6308 ATOMS235=6331,6337,6335 ATOMS236=6358,6364,6362 ATOMS237=6385,6391,6389 ATOMS238=6412,6418,6416 ATOMS239=6439,6445,6443 ATOMS240=6466,6472,6470 ATOMS241=6493,6499,6497 ATOMS242=6520,6526,6524 ATOMS243=6547,6553,6551 ATOMS244=6574,6580,6578 ATOMS245=6601,6607,6605 ATOMS246=6628,6634,6632 ATOMS247=6655,6661,6659 ATOMS248=6682,6688,6686 ATOMS249=6709,6715,6713 ATOMS250=6736,6742,6740 ATOMS251=6763,6769,6767 ATOMS252=6790,6796,6794 c1: DISTANCE_MATRIX GROUP=com0,com1,com2,com3,com4,com5,com6,com7,com8,com9,com10,com11,com12,com13,com14,com15,com16,com17,com18,com19,com20,com21,com22,com23,com24,com25,com26,com27,com28,com29,com30,com31,com32,com33,com34,com35,com36,com37,com38,com39,com40,com41,com42,com43,com44,com45,com46,com47,com48,com49,com50,com51,com52,com53,com54,com55,com56,com57,com58,com59,com60,com61,com62,com63,com64,com65,com66,com67,com68,com69,com70,com71,com72,com73,com74,com75,com76,com77,com78,com79,com80,com81,com82,com83,com84,com85,com86,com87,com88,com89,com90,com91,com92,com93,com94,com95,com96,com97,com98,com99,com100,com101,com102,com103,com104,com105,com106,com107,com108,com109,com110,com111,com112,com113,com114,com115,com116,com117,com118,com119,com120,com121,com122,com123,com124,com125,com126,com127,com128,com129,com130,com131,com132,com133,com134,com135,com136,com137,com138,com139,com140,com141,com142,com143,com144,com145,com146,com147,com148,com149,com150,com151,com152,com153,com154,com155,com156,com157,com158,com159,com160,com161,com162,com163,com164,com165,com166,com167,com168,com169,com170,com171,com172,com173,com174,com175,com176,com177,com178,com179,com180,com181,com182,com183,com184,com185,com186,com187,com188,com189,com190,com191,com192,com193,com194,com195,com196,com197,com198,com199,com200,com201,com202,com203,com204,com205,com206,com207,com208,com209,com210,com211,com212,com213,com214,com215,com216,com217,com218,com219,com220,com221,com222,com223,com224,com225,com226,com227,com228,com229,com230,com231,com232,com233,com234,com235,com236,com237,com238,com239,com240,com241,com242,com243,com244,com245,com246,com247,com248,com249,com250,com251 CUTOFF=5.0 ones: ONES SIZE=252 -qp: QUATERNION_PRODUCT_MATRIX ARG=quat.*,quat.* -ops: CUSTOM ARG=c1,qp.w,qp.i,qp.j,qp.k VAR=x,w,i,j,k FUNC=(((2.26628554234*exp(-((x*10)-6.37235632777)*((x*10)-6.37235632777)/(2*0.030987809338178334)))*2.81566426485e-24*exp(60.9517091737*((0.999999935213*w)+(0.000323260605362*i)+(-3.54954971419e-05*j)+(0.000154325371938*k))^2))+((2.26598891932*exp(-((x*10)-6.37243472055)*((x*10)-6.37243472055)/(2*0.030995922616305432)))*2.74313783032e-24*exp(60.9784690136*((-0.999999975104*w)+(-9.33618007376e-07*i)+(-0.000174903361291*j)+(0.000138561169562*k))^2))+((2.83246817245*exp(-((x*10)-6.94118069019)*((x*10)-6.94118069019)/(2*0.019837642277535556)))*0.0130950591427*exp(7.87597632012*((-0.00314335246277*w)+(0.331888328739*i)+(-0.504016340713*j)+(0.797375560746*k))^2))+((2.23141032403*exp(-((x*10)-6.87945090447)*((x*10)-6.87945090447)/(2*0.031964009823138226)))*0.0107350493097*exp(8.12722630497*((-0.0032553078902*w)+(0.272414440723*i)+(-0.417230695312*j)+(0.867005376192*k))^2))+((2.26563347801*exp(-((x*10)-6.81645001966)*((x*10)-6.81645001966)/(2*0.03100564889875255)))*0.0775451781009*exp(5.47161569795*((0.00999289453389*w)+(0.0115376130044*i)+(-0.00353037871082*j)+(0.999877273455*k))^2))+((2.26829869206*exp(-((x*10)-6.37245683771)*((x*10)-6.37245683771)/(2*0.03093282943904964)))*8.41766101819e-25*exp(62.1895764963*((-0.999999978371*w)+(-6.76320959659e-05*i)+(0.000135881297839*j)+(0.000142199691495*k))^2))+((2.26856314184*exp(-((x*10)-6.37237895273)*((x*10)-6.37237895273)/(2*0.03092561808743208)))*8.90283264343e-25*exp(62.1321413047*((0.999999916445*w)+(-0.000387459116169*i)+(6.61150331893e-06*j)+(0.000130162625944*k))^2))+((2.84313122015*exp(-((x*10)-6.94216988399)*((x*10)-6.94216988399)/(2*0.019689120775829388)))*0.0133120880032*exp(7.85508401972*((-0.0033041458338*w)+(-0.332424752605*i)+(0.504900401912*j)+(0.796591771628*k))^2))+((2.21827805142*exp(-((x*10)-6.87753705648)*((x*10)-6.87753705648)/(2*0.03234358585185355)))*0.0099761880464*exp(8.2193276117*((-0.00312375550685*w)+(-0.271447650829*i)+(0.41694219092*j)+(0.867447764676*k))^2))+((2.27474509536*exp(-((x*10)-6.8181064339)*((x*10)-6.8181064339)/(2*0.030757756683496357)))*0.0794224100073*exp(5.43643088621*((0.0107636888243*w)+(-0.0116508635888*i)+(0.0021743879902*j)+(0.999871827995*k))^2))) PERIODIC=NO +qp: QUATERNION_PRODUCT_MATRIX ARG=quat.*,quat.* MASK=c1 +ops: CUSTOM ARG=c1,qp.w,qp.i,qp.j,qp.k VAR=x,w,i,j,k FUNC=(((2.26628554234*exp(-((x*10)-6.37235632777)*((x*10)-6.37235632777)/(2*0.030987809338178334)))*2.81566426485e-24*exp(60.9517091737*((0.999999935213*w)+(0.000323260605362*i)+(-3.54954971419e-05*j)+(0.000154325371938*k))^2))+((2.26598891932*exp(-((x*10)-6.37243472055)*((x*10)-6.37243472055)/(2*0.030995922616305432)))*2.74313783032e-24*exp(60.9784690136*((-0.999999975104*w)+(-9.33618007376e-07*i)+(-0.000174903361291*j)+(0.000138561169562*k))^2))+((2.83246817245*exp(-((x*10)-6.94118069019)*((x*10)-6.94118069019)/(2*0.019837642277535556)))*0.0130950591427*exp(7.87597632012*((-0.00314335246277*w)+(0.331888328739*i)+(-0.504016340713*j)+(0.797375560746*k))^2))+((2.23141032403*exp(-((x*10)-6.87945090447)*((x*10)-6.87945090447)/(2*0.031964009823138226)))*0.0107350493097*exp(8.12722630497*((-0.0032553078902*w)+(0.272414440723*i)+(-0.417230695312*j)+(0.867005376192*k))^2))+((2.26563347801*exp(-((x*10)-6.81645001966)*((x*10)-6.81645001966)/(2*0.03100564889875255)))*0.0775451781009*exp(5.47161569795*((0.00999289453389*w)+(0.0115376130044*i)+(-0.00353037871082*j)+(0.999877273455*k))^2))+((2.26829869206*exp(-((x*10)-6.37245683771)*((x*10)-6.37245683771)/(2*0.03093282943904964)))*8.41766101819e-25*exp(62.1895764963*((-0.999999978371*w)+(-6.76320959659e-05*i)+(0.000135881297839*j)+(0.000142199691495*k))^2))+((2.26856314184*exp(-((x*10)-6.37237895273)*((x*10)-6.37237895273)/(2*0.03092561808743208)))*8.90283264343e-25*exp(62.1321413047*((0.999999916445*w)+(-0.000387459116169*i)+(6.61150331893e-06*j)+(0.000130162625944*k))^2))+((2.84313122015*exp(-((x*10)-6.94216988399)*((x*10)-6.94216988399)/(2*0.019689120775829388)))*0.0133120880032*exp(7.85508401972*((-0.0033041458338*w)+(-0.332424752605*i)+(0.504900401912*j)+(0.796591771628*k))^2))+((2.21827805142*exp(-((x*10)-6.87753705648)*((x*10)-6.87753705648)/(2*0.03234358585185355)))*0.0099761880464*exp(8.2193276117*((-0.00312375550685*w)+(-0.271447650829*i)+(0.41694219092*j)+(0.867447764676*k))^2))+((2.27474509536*exp(-((x*10)-6.8181064339)*((x*10)-6.8181064339)/(2*0.030757756683496357)))*0.0794224100073*exp(5.43643088621*((0.0107636888243*w)+(-0.0116508635888*i)+(0.0021743879902*j)+(0.999871827995*k))^2))) PERIODIC=NO MASK=c1 sdot: MATRIX_VECTOR_PRODUCT ARG=ops,ones gg: GROUP ATOMS=com0,com1,com2,com3,com4,com5,com6,com7,com8,com11,com14 sdotc: SELECT_COMPONENTS ARG=sdot COMPONENTS=1,2,3,4,5,6,7,8,9,12,15 diff --git a/regtest/gridtools/rt-kldiv/KLPOShack350insphere_coord.dat b/regtest/gridtools/rt-kldiv/KLPOShack350insphere_coord.dat index 9517b20663..a75d96613c 100644 --- a/regtest/gridtools/rt-kldiv/KLPOShack350insphere_coord.dat +++ b/regtest/gridtools/rt-kldiv/KLPOShack350insphere_coord.dat @@ -41,13 +41,13 @@ LABEL=dd_ON ... CONTACT_MATRIX # Calculate matrix in which element i,j tells you if atoms i and j are both within the sphere -spmat_1: OUTER_PRODUCT ARG=sp,sp -spmat_2: OUTER_PRODUCT ARG=sp,sp -spmat_3: OUTER_PRODUCT ARG=sp,sp +spmat_1: OUTER_PRODUCT ARG=sp,sp MASK=dd_centers.w +spmat_2: OUTER_PRODUCT ARG=sp,sp MASK=dd_OO.w +spmat_3: OUTER_PRODUCT ARG=sp,sp MASK=dd_ON.w # Calculate matrix in which element i,j tells you if atoms i and j have both coord num higher than the threshold -coordmat_1: OUTER_PRODUCT ARG=coord_morethan,coord_morethan -coordmat_2: OUTER_PRODUCT ARG=coord_morethan,coord_morethan -coordmat_3: OUTER_PRODUCT ARG=coord_morethan,coord_morethan +coordmat_1: OUTER_PRODUCT ARG=coord_morethan,coord_morethan MASK=dd_centers.w +coordmat_2: OUTER_PRODUCT ARG=coord_morethan,coord_morethan MASK=dd_OO.w +coordmat_3: OUTER_PRODUCT ARG=coord_morethan,coord_morethan MASK=dd_ON.w # Now normalize the vectors bonds_ON_len2: COMBINE ARG=dd_ON.x,dd_ON.y,dd_ON.z POWERS=2,2,2 PERIODIC=NO diff --git a/regtest/symfunc/rt-hexactic/forces.reference_sav b/regtest/symfunc/rt-hexactic/forces.reference similarity index 100% rename from regtest/symfunc/rt-hexactic/forces.reference_sav rename to regtest/symfunc/rt-hexactic/forces.reference diff --git a/regtest/symfunc/rt-hexactic/plumed.dat b/regtest/symfunc/rt-hexactic/plumed.dat index 13999bc4ee..de43dee986 100644 --- a/regtest/symfunc/rt-hexactic/plumed.dat +++ b/regtest/symfunc/rt-hexactic/plumed.dat @@ -6,8 +6,8 @@ PRINT ARG=hex.mean,bb.* FILE=colvar FMT=%8.4f dmat: DISTANCE_MATRIX GROUP=1-400 CUTOFF=3.0 COMPONENTS neigh: NEIGHBORS ARG=dmat.w NLOWEST=6 harm: CYLINDRICAL_HARMONIC DEGREE=6 ARG=dmat.x,dmat.y -rprod: CUSTOM ARG=neigh,harm.rm FUNC=x*y PERIODIC=NO -iprod: CUSTOM ARG=neigh,harm.im FUNC=x*y PERIODIC=NO +rprod: CUSTOM ARG=neigh,harm.rm MASK=neigh FUNC=x*y PERIODIC=NO +iprod: CUSTOM ARG=neigh,harm.im MASK=neigh FUNC=x*y PERIODIC=NO hex2_ones: ONES SIZE=400 hex2_denom: MATRIX_VECTOR_PRODUCT ARG=neigh,hex2_ones harm_rm: MATRIX_VECTOR_PRODUCT ARG=rprod,hex2_ones diff --git a/regtest/symfunc/rt-nbonds-one-q6/plumed.dat b/regtest/symfunc/rt-nbonds-one-q6/plumed.dat index e393cc45a5..91868c587f 100644 --- a/regtest/symfunc/rt-nbonds-one-q6/plumed.dat +++ b/regtest/symfunc/rt-nbonds-one-q6/plumed.dat @@ -8,7 +8,7 @@ data6: CUSTOM ARG=udata6,q6_nmat FUNC=x/y PERIODIC=NO data6T: TRANSPOSE ARG=data6 con6: CONTACT_MATRIX GROUP=q6 SWITCH={RATIONAL D_0=3.0 R_0=1.5} -dot6: MATRIX_PRODUCT ARG=data6,data6T +dot6: MATRIX_PRODUCT ARG=data6,data6T MASK=con6 ww6: CUSTOM ARG=con6,dot6 FUNC=x*y PERIODIC=NO w6: SUM ARG=ww6 PERIODIC=NO diff --git a/regtest/symfunc/rt-nbonds-q6/plumed.dat b/regtest/symfunc/rt-nbonds-q6/plumed.dat index c663c68c43..8bc7117458 100644 --- a/regtest/symfunc/rt-nbonds-q6/plumed.dat +++ b/regtest/symfunc/rt-nbonds-q6/plumed.dat @@ -16,7 +16,7 @@ data4: CUSTOM ARG=udata4,q4_nmat FUNC=x/y PERIODIC=NO data4T: TRANSPOSE ARG=data4 con6: CONTACT_MATRIX GROUP=q6 SWITCH={RATIONAL D_0=3.0 R_0=1.5} -dot6: MATRIX_PRODUCT ARG=data6,data6T +dot6: MATRIX_PRODUCT ARG=data6,data6T MASK=con6 ww6: CUSTOM ARG=con6,dot6 FUNC=x*y PERIODIC=NO @@ -24,7 +24,7 @@ w6: SUM ARG=ww6 PERIODIC=NO PRINT ARG=w6 FILE=colv1 FMT=%8.4f -dot4: MATRIX_PRODUCT ARG=data4,data4T +dot4: MATRIX_PRODUCT ARG=data4,data4T MASK=con6 ww4: CUSTOM ARG=con6,dot4 FUNC=x*y PERIODIC=NO diff --git a/regtest/symfunc/rt-ntwo-lq6/plumed.dat b/regtest/symfunc/rt-ntwo-lq6/plumed.dat index 677412432a..1dca4e6525 100644 --- a/regtest/symfunc/rt-ntwo-lq6/plumed.dat +++ b/regtest/symfunc/rt-ntwo-lq6/plumed.dat @@ -12,7 +12,7 @@ dd: VSTACK ARG=norm_q1_rm-n1,norm_q1_im-n1,norm_q1_rm-0,norm_q1_im-0,norm_q1_rm- ddT: TRANSPOSE ARG=dd con: CONTACT_MATRIX GROUP=q1 SWITCH={RATIONAL R_0=4} -dot: MATRIX_PRODUCT ARG=dd,ddT +dot: MATRIX_PRODUCT ARG=dd,ddT MASK=con mm: CUSTOM ARG=con,dot FUNC=x*y PERIODIC=NO diff --git a/regtest/symfunc/rt-two-coord-stack-mult-q1-av/plumed.dat b/regtest/symfunc/rt-two-coord-stack-mult-q1-av/plumed.dat index 497c5c523d..29dbac23b8 100644 --- a/regtest/symfunc/rt-two-coord-stack-mult-q1-av/plumed.dat +++ b/regtest/symfunc/rt-two-coord-stack-mult-q1-av/plumed.dat @@ -22,5 +22,4 @@ w1_av2: CUSTOM ARG=w1_av FUNC=x*x PERIODIC=NO ss: SUM ARG=w1_av2 PERIODIC=NO PRINT ARG=ss FILE=colvar FMT=%8.4f -DUMPDERIVATIVES ARG=ss FILE=deriv FMT=%8.4f BIASVALUE ARG=ss diff --git a/regtest/symfunc/rt-two-coord-stack-mult-q1-withnorm-matsum/plumed.dat b/regtest/symfunc/rt-two-coord-stack-mult-q1-withnorm-matsum/plumed.dat index 5a81611a12..81794ac832 100644 --- a/regtest/symfunc/rt-two-coord-stack-mult-q1-withnorm-matsum/plumed.dat +++ b/regtest/symfunc/rt-two-coord-stack-mult-q1-withnorm-matsum/plumed.dat @@ -19,5 +19,4 @@ w1_av2: CUSTOM ARG=w1_av FUNC=x*x PERIODIC=NO ss: SUM ARG=w1_av2 PERIODIC=NO PRINT ARG=ss FILE=colvar FMT=%8.4f -DUMPDERIVATIVES ARG=ss FILE=deriv FMT=%8.4f BIASVALUE ARG=ss diff --git a/regtest/symfunc/rt-two-lq1/plumed.dat b/regtest/symfunc/rt-two-lq1/plumed.dat index 74ec1d14d1..3ba73ea417 100644 --- a/regtest/symfunc/rt-two-lq1/plumed.dat +++ b/regtest/symfunc/rt-two-lq1/plumed.dat @@ -12,7 +12,7 @@ BIASVALUE ARG=ss ddT: TRANSPOSE ARG=ddA con: CONTACT_MATRIX GROUP=q1 SWITCH={RATIONAL R_0=4} -dd: MATRIX_PRODUCT ARG=ddA,ddT +dd: MATRIX_PRODUCT ARG=ddA,ddT MASK=con mm: MATHEVAL ARG=con,dd FUNC=x*y PERIODIC=NO ones: ONES SIZE=2 diff --git a/regtest/symfunc/rt-two-lq6/plumed.dat b/regtest/symfunc/rt-two-lq6/plumed.dat index 46413323e2..1ac4e167dc 100644 --- a/regtest/symfunc/rt-two-lq6/plumed.dat +++ b/regtest/symfunc/rt-two-lq6/plumed.dat @@ -5,7 +5,7 @@ ddA: VSTACK ARG=q1_sp.rm-n1,q1_sp.im-n1,q1_sp.rm-0,q1_sp.im-0,q1_sp.rm-p1,q1_sp. ddT: TRANSPOSE ARG=ddA con: CONTACT_MATRIX GROUP=q1 SWITCH={RATIONAL R_0=4} -dd: MATRIX_PRODUCT ARG=ddA,ddT +dd: MATRIX_PRODUCT ARG=ddA,ddT MASK=con mm: MATHEVAL ARG=con,dd FUNC=x*y PERIODIC=NO ones: ONES SIZE=2 diff --git a/regtest/symfunc/rt-urea/plumed.dat b/regtest/symfunc/rt-urea/plumed.dat index d10bcfb136..93203a1034 100644 --- a/regtest/symfunc/rt-urea/plumed.dat +++ b/regtest/symfunc/rt-urea/plumed.dat @@ -311,8 +311,8 @@ smac: SMAC ... ff: MORE_THAN ARG=smac_smac SWITCH={GAUSSIAN D_0=0.41 R_0=0.5 D_MAX=0.42} cm: CONTACT_MATRIX GROUP=m1 SWITCH={RATIONAL D_0=5.99 R_0=0.1 D_MAX=6.0} -dp: OUTER_PRODUCT ARG=ff,ff -c1: CUSTOM ARG=cm,dp FUNC=x*y PERIODIC=NO +dp: OUTER_PRODUCT ARG=ff,ff MASK=cm +c1: CUSTOM ARG=cm,dp FUNC=x*y MASK=cm PERIODIC=NO dfs: DFSCLUSTERING ARG=c1 cw_dfs: CLUSTER_WEIGHTS CLUSTERS=dfs CLUSTER=1 @@ -323,12 +323,12 @@ cc1_morethan: SUM ARG=cc1_prod PERIODIC=NO vecs: VSTACK ARG=m1.x,m1.y,m1.z vecsT: TRANSPOSE ARG=vecs cm1: CONTACT_MATRIX GROUP=m1 SWITCH={RATIONAL D_0=5.99 R_0=0.1 D_MAX=6.0} -dpm: TORSIONS_MATRIX ARG=vecs,vecsT POSITIONS1=m1 POSITIONS2=m1 -kkm1_r2: COMBINE ARG=dpm PARAMETERS=0 POWERS=2 PERIODIC=NO -kkm1: CUSTOM ARG=kkm1_r2 FUNC=step(1.-sqrt(x))*(1.-sqrt(x)) PERIODIC=NO -kkm2_r2: COMBINE ARG=dpm PARAMETERS=pi COEFFICIENTS=2.77778 POWERS=2 PERIODIC=NO -kkm2: CUSTOM ARG=kkm2_r2 FUNC=step(1.-sqrt(x))*(1.-sqrt(x)) PERIODIC=NO -ksum: COMBINE ARG=kkm1,kkm2 PERIODIC=NO +dpm: TORSIONS_MATRIX ARG=vecs,vecsT POSITIONS1=m1 POSITIONS2=m1 MASK=cm1 +kkm1_r2: COMBINE ARG=dpm PARAMETERS=0 POWERS=2 PERIODIC=NO MASK=cm1 +kkm1: CUSTOM ARG=kkm1_r2 FUNC=step(1.-sqrt(x))*(1.-sqrt(x)) PERIODIC=NO MASK=cm1 +kkm2_r2: COMBINE ARG=dpm PARAMETERS=pi COEFFICIENTS=2.77778 POWERS=2 PERIODIC=NO MASK=cm1 +kkm2: CUSTOM ARG=kkm2_r2 FUNC=step(1.-sqrt(x))*(1.-sqrt(x)) PERIODIC=NO MASK=cm1 +ksum: COMBINE ARG=kkm1,kkm2 PERIODIC=NO MASK=cm1 smacm: CUSTOM ARG=cm1,ksum FUNC=x*y PERIODIC=NO dfs1: DFSCLUSTERING ARG=smacm cc2: CLUSTER_NATOMS CLUSTERS=dfs1 CLUSTER=1 diff --git a/regtest/volumes/rt-q3-insphere/forces.reference b/regtest/volumes/rt-q3-insphere/forces.reference index b26a05de0a..bec546e3b4 100644 --- a/regtest/volumes/rt-q3-insphere/forces.reference +++ b/regtest/volumes/rt-q3-insphere/forces.reference @@ -119326,7 +119326,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X -0.1767 -0.9106 -0.2095 +X -0.1767 -0.3926 -0.2095 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 @@ -124466,7 +124466,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X 0.7937 2.7391 23.4004 +X 0.7842 1.9373 23.4004 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 @@ -127194,7 +127194,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X 0.0424 1.1485 0.3650 +X 0.0519 1.9502 0.3650 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 @@ -128714,7 +128714,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X -4.7153 -1.5389 6.9752 +X -4.7153 -2.0570 6.9752 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 @@ -237436,7 +237436,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X 0.0996 0.3472 1.2021 +X 0.0996 0.3472 1.5039 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 @@ -237936,7 +237936,7 @@ X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 -X 3.9996 -3.6966 5.0615 +X 3.9996 -3.6966 4.7597 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 X 0.0000 0.0000 0.0000 diff --git a/regtest/volumes/rt-q3-insphere/plumed.dat b/regtest/volumes/rt-q3-insphere/plumed.dat index 7e3b34c145..a7a6c407e6 100644 --- a/regtest/volumes/rt-q3-insphere/plumed.dat +++ b/regtest/volumes/rt-q3-insphere/plumed.dat @@ -7,7 +7,7 @@ center: FIXEDATOM AT=2.5,2.5,2.5 sphere: INSPHERE ATOMS=ow CENTER=center RADIUS={GAUSSIAN D_0=0.5 R_0=0.01 D_MAX=0.52} # Calculates q3 values -q3: Q3 SPECIES=ow SWITCH={GAUSSIAN D_0=0.32 R_0=0.01 D_MAX=0.34} MASK=sphere +q3: Q3 SPECIES=ow SWITCH={GAUSSIAN D_0=0.32 R_0=0.01 D_MAX=0.34} #MASK=sphere # Probe volume prod: CUSTOM ARG=q3,sphere FUNC=x*y PERIODIC=NO diff --git a/regtest/volumes/rt-small-sm/forces_bias_lambdav.out.0.reference b/regtest/volumes/rt-small-sm/forces_bias_lambdav.out.0.reference index bda3726094..3424527b38 100644 --- a/regtest/volumes/rt-small-sm/forces_bias_lambdav.out.0.reference +++ b/regtest/volumes/rt-small-sm/forces_bias_lambdav.out.0.reference @@ -117,7 +117,7 @@ X 0.0013 0.0005 0.0010 X -0.0004 0.0003 0.0011 X -0.0007 0.0005 -0.0000 X 0.0007 0.0000 0.0011 -X 0.0005 0.0007 -0.0000 +X 0.0006 0.0007 -0.0000 X 0.0003 0.0001 -0.0006 X -0.0002 -0.0005 0.0009 X 0.0007 -0.0002 0.0007 @@ -150,7 +150,7 @@ X 0.0000 -0.0001 -0.0003 X 0.0002 0.0000 -0.0004 X 0.0001 0.0006 -0.0009 X -0.0005 -0.0001 0.0004 -X 0.0008 -0.0001 0.0005 +X 0.0008 -0.0001 0.0007 X 0.0008 -0.0008 -0.0009 X -0.0002 0.0001 -0.0002 X 0.0001 -0.0008 0.0007 @@ -214,7 +214,7 @@ X -0.0004 -0.0005 0.0007 X -0.0004 0.0001 -0.0001 X 0.0002 -0.0007 0.0004 X -0.0001 -0.0004 0.0003 -X 0.0001 -0.0006 -0.0006 +X 0.0002 -0.0006 -0.0006 X -0.0006 0.0005 0.0006 X -0.0001 0.0016 0.0003 X -0.0007 0.0004 0.0022 @@ -329,7 +329,7 @@ X 0.0006 0.0000 0.0004 X 0.0003 -0.0007 0.0002 X -0.0003 -0.0008 0.0001 X 0.0001 -0.0001 -0.0004 -X -0.0009 -0.0002 -0.0007 +X -0.0009 -0.0003 -0.0007 X -0.0002 -0.0001 0.0005 X 0.0002 -0.0003 -0.0004 X -0.0006 0.0004 -0.0003 @@ -337,7 +337,7 @@ X 0.0018 -0.0019 -0.0004 X 0.0002 0.0005 -0.0006 X -0.0003 -0.0008 -0.0002 X 0.0000 0.0002 -0.0007 -X -0.0004 -0.0006 -0.0006 +X -0.0005 -0.0006 -0.0006 X -0.0005 0.0002 -0.0004 X 0.0006 0.0000 0.0000 X 0.0001 0.0002 0.0003 @@ -356,7 +356,7 @@ X -0.0019 0.0016 -0.0008 X 0.0014 -0.0014 -0.0010 X -0.0007 0.0004 -0.0001 X 0.0000 -0.0005 0.0005 -X -0.0002 0.0001 0.0001 +X -0.0003 0.0001 0.0001 X 0.0002 0.0005 -0.0005 X 0.0001 0.0003 -0.0004 X 0.0002 0.0003 0.0003 @@ -405,12 +405,12 @@ X 0.0003 0.0003 0.0011 X 0.0030 -0.0011 -0.0019 X -0.0012 -0.0015 -0.0021 X 0.0001 0.0004 0.0001 -X -0.0005 0.0005 0.0000 +X -0.0005 0.0005 -0.0000 X 0.0006 -0.0009 -0.0001 X -0.0004 0.0003 0.0002 X -0.0001 0.0002 0.0013 X -0.0005 0.0009 -0.0003 -X 0.0004 -0.0002 0.0002 +X 0.0004 -0.0005 0.0002 X 0.0003 -0.0009 0.0011 X 0.0003 -0.0021 -0.0015 X 0.0007 0.0002 -0.0003 @@ -436,7 +436,7 @@ X 0.0000 0.0003 0.0003 X 0.0012 -0.0017 -0.0004 X -0.0007 -0.0002 -0.0008 X -0.0003 -0.0002 -0.0006 -X -0.0005 -0.0003 -0.0001 +X -0.0005 -0.0003 0.0001 X -0.0009 0.0004 0.0002 X -0.0011 -0.0002 0.0002 X -0.0005 -0.0002 -0.0009 @@ -540,7 +540,7 @@ X 0.0001 0.0001 -0.0011 X 0.0005 0.0002 -0.0002 X -0.0009 -0.0003 0.0006 X -0.0001 0.0004 -0.0006 -X 0.0009 0.0003 0.0003 +X 0.0009 0.0003 0.0005 X 0.0004 -0.0010 -0.0071 X 0.0001 0.0000 -0.0008 X 0.0011 0.0004 -0.0004 @@ -554,7 +554,7 @@ X -0.0001 -0.0002 0.0002 X -0.0000 -0.0004 0.0015 X 0.0018 -0.0012 -0.0008 X -0.0003 -0.0001 0.0003 -X 0.0009 0.0003 -0.0005 +X 0.0009 0.0002 -0.0005 X 0.0013 0.0004 0.0012 X 0.0007 -0.0002 0.0003 X 0.0004 -0.0000 -0.0002 @@ -699,7 +699,7 @@ X 0.0005 -0.0005 -0.0006 X 0.0003 0.0009 0.0000 X -0.0005 -0.0007 0.0003 X 0.0002 0.0003 -0.0005 -X -0.0002 0.0001 0.0002 +X -0.0002 0.0001 0.0000 X -0.0004 -0.0005 0.0001 X 0.0015 -0.0006 0.0014 X -0.0009 0.0004 0.0031 @@ -751,7 +751,7 @@ X 0.0003 -0.0000 0.0005 X 0.0008 0.0001 -0.0006 X 0.0006 0.0000 -0.0005 X -0.0012 0.0034 0.0036 -X 0.0003 -0.0001 0.0006 +X 0.0003 -0.0002 0.0006 X -0.0001 0.0001 0.0005 X -0.0019 0.0024 -0.0005 X 0.0010 -0.0008 -0.0003 @@ -928,8 +928,8 @@ X -0.0004 -0.0001 -0.0001 X 0.0021 -0.0001 -0.0022 X 0.0017 0.0013 -0.0011 X -0.0004 0.0008 0.0001 -X -0.0015 0.0002 0.0004 -X 0.0006 0.0003 0.0005 +X -0.0015 -0.0000 0.0004 +X 0.0006 0.0004 0.0005 X -0.0004 0.0008 -0.0005 X 0.0005 0.0000 0.0001 X 0.0004 -0.0001 -0.0004 @@ -1039,7 +1039,7 @@ X 0.0014 -0.0016 -0.0029 X -0.0004 0.0006 0.0005 X 0.0002 -0.0000 0.0006 X -0.0001 0.0001 0.0007 -X 0.0002 -0.0006 0.0009 +X 0.0002 -0.0003 0.0009 X -0.0002 -0.0001 0.0004 X -0.0002 -0.0008 0.0003 X 0.0002 0.0002 0.0005 @@ -1254,7 +1254,7 @@ X 0.0003 0.0008 -0.0004 X -0.0001 0.0002 0.0001 X -0.0019 0.0022 0.0000 X 0.0009 -0.0001 -0.0002 -X 0.0003 0.0007 0.0001 +X 0.0002 0.0007 0.0001 X -0.0004 -0.0000 -0.0007 X -0.0004 0.0008 -0.0002 X -0.0006 0.0000 0.0000 @@ -1328,7 +1328,7 @@ X -0.0014 -0.0017 -0.0038 X -0.0003 -0.0001 -0.0002 X -0.0010 -0.0013 -0.0009 X 0.0023 0.0011 0.0000 -X 0.0002 -0.0008 -0.0004 +X 0.0003 -0.0008 -0.0004 X -0.0011 -0.0020 0.0025 X 0.0002 -0.0001 0.0001 X -0.0003 -0.0001 0.0006 @@ -1598,7 +1598,7 @@ X 0.0010 -0.0019 0.0015 X 0.0003 0.0004 -0.0004 X 0.0003 0.0004 -0.0005 X 0.0010 0.0006 0.0003 -X -0.0000 -0.0005 0.0007 +X -0.0000 -0.0005 0.0008 X 0.0004 -0.0002 -0.0000 X 0.0013 0.0006 0.0004 X 0.0001 -0.0007 -0.0003 @@ -1657,7 +1657,7 @@ X -0.0010 -0.0006 -0.0015 X -0.0003 0.0004 0.0002 X -0.0007 -0.0005 -0.0002 X 0.0002 -0.0003 0.0001 -X -0.0014 -0.0019 -0.0013 +X -0.0014 -0.0018 -0.0013 X 0.0035 -0.0004 0.0004 X 0.0005 0.0002 0.0002 X -0.0008 0.0003 -0.0003 @@ -1759,7 +1759,7 @@ X -0.0000 0.0002 0.0004 X 0.0003 0.0002 0.0009 X -0.0000 0.0011 -0.0001 X -0.0006 -0.0014 -0.0001 -X -0.0004 0.0005 -0.0009 +X -0.0004 0.0006 -0.0009 X 0.0006 -0.0004 -0.0007 X -0.0004 -0.0004 0.0001 X -0.0005 0.0002 -0.0003 @@ -1774,7 +1774,7 @@ X -0.0002 -0.0006 -0.0000 X 0.0001 0.0006 0.0002 X 0.0001 -0.0002 -0.0001 X -0.0001 -0.0006 0.0005 -X -0.0003 0.0003 0.0002 +X -0.0003 0.0002 0.0002 X -0.0002 -0.0001 -0.0010 X -0.0001 0.0000 0.0000 X -0.0006 0.0008 -0.0003 @@ -1835,7 +1835,7 @@ X 0.0002 0.0002 -0.0004 X 0.0002 0.0005 0.0007 X 0.0028 0.0001 -0.0015 X -0.0001 -0.0005 0.0004 -X -0.0004 0.0005 -0.0006 +X -0.0004 0.0003 -0.0006 X -0.0006 -0.0006 -0.0015 X -0.0000 -0.0000 0.0001 X -0.0001 0.0006 0.0002 @@ -1900,7 +1900,7 @@ X 0.0002 -0.0007 0.0012 X 0.0018 0.0009 -0.0019 X 0.0001 -0.0008 0.0017 X 0.0007 0.0004 -0.0001 -X -0.0001 0.0002 0.0002 +X -0.0001 0.0005 0.0002 X 0.0002 0.0003 -0.0007 X -0.0007 0.0001 0.0001 X -0.0005 0.0008 -0.0002 @@ -1921,7 +1921,7 @@ X 0.0004 0.0009 -0.0001 X 0.0007 -0.0009 -0.0011 X -0.0003 -0.0003 0.0003 X 0.0007 -0.0018 0.0003 -X 0.0001 -0.0035 -0.0014 +X 0.0003 -0.0037 -0.0014 X 0.0007 0.0003 0.0001 X 0.0004 -0.0002 0.0001 X 0.0005 -0.0005 -0.0006 @@ -2025,7 +2025,7 @@ X 0.0002 0.0003 0.0007 X -0.0006 0.0000 -0.0000 X -0.0010 -0.0011 0.0006 X 0.0015 0.0029 -0.0008 -X -0.0007 -0.0007 -0.0001 +X -0.0007 -0.0007 -0.0003 X 0.0004 0.0004 -0.0002 X 0.0002 -0.0006 -0.0007 X -0.0010 0.0008 -0.0000 @@ -2046,7 +2046,7 @@ X 0.0000 -0.0001 -0.0001 X -0.0002 0.0010 -0.0004 X 0.0002 0.0007 0.0005 X -0.0002 0.0002 0.0009 -X 0.0009 0.0004 -0.0004 +X 0.0009 0.0004 -0.0003 X -0.0006 0.0001 0.0004 X -0.0005 -0.0000 0.0003 X 0.0005 0.0004 -0.0003 @@ -2402,7 +2402,7 @@ X 0.0008 0.0006 0.0000 X 0.0005 0.0001 0.0002 X 0.0001 -0.0001 -0.0008 X 0.0035 0.0030 -0.0021 -X 0.0002 -0.0004 -0.0005 +X 0.0002 -0.0004 -0.0007 X -0.0002 -0.0013 0.0000 X -0.0000 -0.0005 0.0001 X -0.0009 -0.0002 0.0003 @@ -2470,12 +2470,12 @@ X -0.0000 0.0009 0.0002 X 0.0005 0.0001 0.0001 X 0.0009 -0.0001 -0.0003 X 0.0007 -0.0001 -0.0002 -X 0.0006 0.0000 -0.0001 +X 0.0006 0.0000 0.0001 X -0.0003 0.0003 0.0003 X -0.0006 -0.0004 -0.0002 X -0.0004 0.0007 0.0025 X -0.0006 -0.0005 -0.0005 -X 0.0002 -0.0005 0.0004 +X 0.0002 -0.0004 0.0004 X -0.0006 0.0004 -0.0001 X -0.0000 0.0012 0.0019 X 0.0011 -0.0007 0.0004 @@ -2640,7 +2640,7 @@ X -0.0002 0.0004 0.0006 X 0.0014 0.0025 0.0010 X -0.0006 0.0001 -0.0014 X 0.0007 0.0002 0.0013 -X -0.0001 0.0004 0.0003 +X -0.0002 0.0004 0.0003 X 0.0003 0.0001 -0.0007 X -0.0003 0.0017 -0.0008 X -0.0004 0.0003 0.0004 @@ -2797,7 +2797,7 @@ X -0.0013 0.0015 0.0005 X -0.0006 0.0001 0.0003 X 0.0006 0.0003 -0.0004 X 0.0008 0.0005 -0.0005 -X -0.0006 0.0005 0.0003 +X -0.0006 0.0008 0.0003 X -0.0000 0.0004 -0.0003 X -0.0001 0.0001 0.0004 X -0.0006 -0.0005 -0.0003 @@ -3206,7 +3206,7 @@ X 0.0002 0.0003 -0.0002 X 0.0008 -0.0007 0.0000 X 0.0001 -0.0006 0.0003 X -0.0008 -0.0002 0.0001 -X -0.0001 -0.0002 -0.0004 +X -0.0001 -0.0005 -0.0004 X 0.0002 0.0007 0.0003 X 0.0003 0.0003 -0.0006 X -0.0015 0.0005 -0.0004 @@ -3230,7 +3230,7 @@ X -0.0004 -0.0001 -0.0006 X 0.0001 -0.0003 0.0003 X -0.0008 0.0002 -0.0001 X 0.0006 0.0019 0.0001 -X -0.0001 -0.0005 -0.0001 +X -0.0001 -0.0005 -0.0003 X 0.0003 -0.0005 -0.0011 X 0.0002 -0.0001 -0.0001 X 0.0001 0.0003 -0.0001 @@ -3287,7 +3287,7 @@ X 0.0004 0.0002 -0.0003 X -0.0006 -0.0004 -0.0006 X 0.0000 -0.0005 0.0009 X 0.0002 -0.0012 0.0009 -X -0.0002 0.0000 -0.0002 +X -0.0002 0.0000 -0.0000 X 0.0008 -0.0003 -0.0012 X -0.0005 0.0003 -0.0007 X 0.0010 -0.0001 0.0007 @@ -3320,7 +3320,7 @@ X 0.0004 -0.0006 0.0011 X 0.0006 0.0004 0.0005 X 0.0004 0.0001 -0.0002 X -0.0001 0.0001 0.0000 -X 0.0002 -0.0004 -0.0003 +X 0.0002 -0.0004 -0.0004 X -0.0002 0.0001 -0.0013 X 0.0004 0.0002 -0.0007 X -0.0005 -0.0003 -0.0001 @@ -3398,7 +3398,7 @@ X 0.0004 0.0007 0.0001 X 0.0001 -0.0000 -0.0005 X -0.0001 0.0009 0.0008 X -0.0009 0.0002 0.0015 -X -0.0000 -0.0001 -0.0008 +X -0.0000 -0.0001 -0.0009 X -0.0001 -0.0004 0.0003 X 0.0014 -0.0003 0.0003 X -0.0001 0.0002 0.0003 @@ -3506,7 +3506,7 @@ X -0.0024 -0.0021 -0.0018 X -0.0007 0.0007 0.0002 X 0.0013 -0.0010 0.0006 X -0.0001 -0.0000 -0.0001 -X 0.0005 0.0004 -0.0003 +X 0.0005 0.0004 -0.0006 X 0.0001 -0.0000 -0.0001 X 0.0006 -0.0000 -0.0004 X 0.0013 0.0004 0.0004 @@ -3533,7 +3533,7 @@ X -0.0011 -0.0013 0.0010 X -0.0026 0.0001 0.0003 X -0.0005 0.0002 -0.0003 X -0.0008 -0.0000 -0.0016 -X 0.0002 0.0009 0.0001 +X 0.0002 0.0009 -0.0001 X 0.0003 -0.0005 0.0004 X -0.0010 -0.0004 0.0003 X 0.0002 -0.0002 -0.0003 @@ -3591,7 +3591,7 @@ X 0.0003 -0.0006 0.0002 X -0.0000 0.0005 0.0004 X -0.0001 -0.0004 -0.0004 X 0.0007 -0.0000 0.0005 -X -0.0003 0.0004 0.0008 +X -0.0003 0.0004 0.0010 X 0.0005 0.0001 0.0002 X 0.0004 0.0000 0.0012 X -0.0001 0.0002 0.0009 @@ -3742,7 +3742,7 @@ X -0.0009 0.0001 -0.0004 X 0.0011 0.0001 0.0002 X -0.0022 0.0011 -0.0000 X 0.0006 -0.0002 0.0003 -X 0.0006 0.0004 -0.0002 +X 0.0006 0.0006 -0.0002 X 0.0002 -0.0006 -0.0005 X 0.0011 0.0003 0.0014 X -0.0010 -0.0003 -0.0001 @@ -3766,7 +3766,7 @@ X 0.0005 0.0002 -0.0006 X 0.0016 -0.0004 -0.0017 X -0.0002 0.0000 0.0002 X -0.0007 0.0010 0.0005 -X 0.0000 -0.0002 -0.0002 +X 0.0000 -0.0002 -0.0003 X 0.0000 -0.0016 0.0025 X -0.0000 0.0009 0.0005 X 0.0001 0.0003 0.0002 @@ -3836,7 +3836,7 @@ X -0.0003 -0.0008 0.0010 X -0.0002 -0.0004 0.0003 X -0.0000 -0.0000 0.0003 X -0.0007 -0.0001 -0.0004 -X -0.0012 0.0018 0.0007 +X -0.0015 0.0020 0.0007 X 0.0001 0.0003 -0.0003 X 0.0002 0.0003 0.0003 X -0.0002 0.0007 0.0005 @@ -3846,7 +3846,7 @@ X -0.0001 -0.0011 -0.0005 X -0.0008 -0.0005 0.0002 X 0.0010 0.0006 -0.0009 X 0.0001 0.0002 0.0003 -X 0.0002 0.0004 0.0004 +X 0.0002 0.0003 0.0004 X -0.0004 -0.0000 0.0007 X -0.0001 0.0006 -0.0004 X -0.0002 -0.0001 0.0006 @@ -3881,7 +3881,7 @@ X 0.0005 -0.0000 0.0004 X 0.0009 -0.0004 -0.0004 X -0.0003 -0.0001 -0.0012 X -0.0002 -0.0003 0.0005 -X -0.0005 -0.0002 0.0005 +X -0.0006 -0.0002 0.0005 X -0.0008 0.0000 0.0003 X -0.0000 0.0004 -0.0001 X -0.0002 -0.0003 -0.0010 @@ -3943,7 +3943,7 @@ X -0.0009 0.0002 0.0004 X 0.0005 -0.0005 0.0004 X 0.0029 0.0034 0.0002 X -0.0007 0.0002 -0.0007 -X 0.0004 0.0010 0.0006 +X 0.0004 0.0008 0.0006 X 0.0003 0.0004 -0.0006 X -0.0015 0.0000 -0.0002 X 0.0010 0.0002 0.0002 @@ -4034,7 +4034,7 @@ X -0.0005 0.0001 0.0008 X 0.0018 0.0003 0.0012 X 0.0000 -0.0008 0.0005 X -0.0004 -0.0001 0.0001 -X -0.0005 -0.0004 0.0003 +X -0.0005 -0.0004 0.0004 X 0.0022 0.0006 -0.0005 X 0.0010 -0.0018 -0.0015 X 0.0002 -0.0005 0.0006 @@ -4049,7 +4049,7 @@ X 0.0004 0.0004 -0.0005 X 0.0002 -0.0006 -0.0000 X 0.0022 0.0004 -0.0005 X 0.0008 0.0001 0.0004 -X 0.0009 0.0001 -0.0009 +X 0.0009 0.0003 -0.0009 X 0.0013 -0.0007 0.0004 X -0.0004 0.0001 0.0000 X -0.0002 -0.0004 0.0003 diff --git a/src/clusters/ClusterDiameter.cpp b/src/clusters/ClusterDiameter.cpp index 79318a62c9..008fb81b14 100644 --- a/src/clusters/ClusterDiameter.cpp +++ b/src/clusters/ClusterDiameter.cpp @@ -86,7 +86,7 @@ ClusterDiameter::ClusterDiameter(const ActionOptions& ao): // Distance matrix readInputLine( getShortcutLabel() + "_dmat: DISTANCE_MATRIX GROUP=" + atdata ); // Matrix of bonds in cluster - readInputLine( getShortcutLabel() + "_bmat: OUTER_PRODUCT FUNC=x*y ARG=" + arg_str + "," + arg_str ); + readInputLine( getShortcutLabel() + "_bmat: OUTER_PRODUCT FUNC=x*y ARG=" + arg_str + "," + arg_str + " MASK=" + getShortcutLabel() + "_dmat" ); // Product of matrices readInputLine( getShortcutLabel() + "_dcls: CUSTOM ARG=" + getShortcutLabel() + "_dmat," + getShortcutLabel() + "_bmat FUNC=x*y PERIODIC=NO"); // Convert matrix to a vector to get highest diff --git a/src/clusters/ClusterWithSurface.cpp b/src/clusters/ClusterWithSurface.cpp index 357f21fa2c..ea1c47217c 100644 --- a/src/clusters/ClusterWithSurface.cpp +++ b/src/clusters/ClusterWithSurface.cpp @@ -68,7 +68,7 @@ ClusterWithSurface::ClusterWithSurface(const ActionOptions& ao): // Now create a contact matrix readInputLine( getShortcutLabel() + "_cmat: CONTACT_MATRIX GROUP=" + atdata + " SWITCH={" + rcut_surf_str +"}" ); // Now create a custom matrix - readInputLine( getShortcutLabel() + "_cwmat: OUTER_PRODUCT ARG=" + getShortcutLabel() + "_wnosurf," + getShortcutLabel() + "_wnosurf FUNC=max"); + readInputLine( getShortcutLabel() + "_cwmat: OUTER_PRODUCT ARG=" + getShortcutLabel() + "_wnosurf," + getShortcutLabel() + "_wnosurf FUNC=max MASK=" + getShortcutLabel() + "_cmat"); // Product of matrices readInputLine( getShortcutLabel() + "_pmat: CUSTOM ARG=" + getShortcutLabel() + "_cmat," + getShortcutLabel() + "_cwmat FUNC=x*y PERIODIC=NO"); // DFS clustering diff --git a/src/clusters/ClusteringBase.cpp b/src/clusters/ClusteringBase.cpp index 5a0b6c00e6..357577a3ae 100644 --- a/src/clusters/ClusteringBase.cpp +++ b/src/clusters/ClusteringBase.cpp @@ -27,6 +27,7 @@ namespace clusters { void ClusteringBase::registerKeywords( Keywords& keys ) { matrixtools::MatrixOperationBase::registerKeywords( keys ); keys.use("ARG"); + keys.add("hidden","MASKED_INPUT_ALLOWED","turns on that you are allowed to use masked inputs "); keys.setValueDescription("vector with length that is equal to the number of rows in the input matrix. Elements of this vector are equal to the cluster that each node is a part of"); } diff --git a/src/core/ActionShortcut.cpp b/src/core/ActionShortcut.cpp index 2d17c6d342..29e5658155 100644 --- a/src/core/ActionShortcut.cpp +++ b/src/core/ActionShortcut.cpp @@ -27,25 +27,6 @@ namespace PLMD { -enum class Option { no, yes }; - -Option interpretEnv(const char* env,const char* str) { - if(!str) return Option::no; - if(!std::strcmp(str,"yes"))return Option::yes; - if(!std::strcmp(str,"no"))return Option::no; - plumed_error()<<"Cannot understand env var "< words=Tools::getWords(input); Tools::interpretLabel(words); // Check if this action name has been registered diff --git a/src/core/ActionShortcut.h b/src/core/ActionShortcut.h index 8653d39df4..be4ef136bb 100644 --- a/src/core/ActionShortcut.h +++ b/src/core/ActionShortcut.h @@ -39,7 +39,6 @@ class ActionShortcut : std::vector savedOutputs; void addToSavedInputLines( const std::string& line ); protected: - bool chainsAreOff() const ; std::string getUpdateLimits() const ; public: const std::string & getShortcutLabel() const ; diff --git a/src/core/ActionWithMatrix.cpp b/src/core/ActionWithMatrix.cpp index 98f30449c2..9250aa9f67 100644 --- a/src/core/ActionWithMatrix.cpp +++ b/src/core/ActionWithMatrix.cpp @@ -91,7 +91,7 @@ const ActionWithMatrix* ActionWithMatrix::getFirstMatrixInChain() const { void ActionWithMatrix::setupMatrixStore() { for(int i=0; igetRank()!=2 || myval->hasDerivatives() || !myval->valueIsStored() ) continue; myval->reshapeMatrixStore( getNumberOfColumns() ); } @@ -171,7 +171,7 @@ void ActionWithMatrix::runTask( const std::string& controller, const unsigned& c } } double finalval = myvals.get( myval->getPositionInStream() ); if( !isAdjacencyMatrix() ) checkval=finalval; - if( std::fabs(checkval)>epsilon ) { + if( std::fabs(checkval)>epsilon || (!isAdjacencyMatrix() && getNumberOfMasks()>0) ) { Value* myv = const_cast( myval ); if( ncolsgetShape()[1] ) { myv->set( current*ncols + myval->matrix_bookeeping[current*(1+ncols)], finalval ); diff --git a/src/core/ActionWithVector.cpp b/src/core/ActionWithVector.cpp index ceb13ec7ac..ab1f1e61cf 100644 --- a/src/core/ActionWithVector.cpp +++ b/src/core/ActionWithVector.cpp @@ -568,7 +568,8 @@ void ActionWithVector::runAllTasks() { if(serial) { stride=1; rank=0; } // Clear matrix bookeeping arrays - if( stride>1 ) clearMatrixBookeeping(); + ActionWithMatrix* am=dynamic_cast(this); + if( am && stride>1 ) clearMatrixBookeeping(); // Get the list of active tasks std::vector & partialTaskList( getListOfActiveTasks( this ) ); @@ -633,10 +634,11 @@ void ActionWithVector::runAllTasks() { } void ActionWithVector::gatherProcesses() { + ActionWithMatrix* am=dynamic_cast(this); for(unsigned i=0; istoredata && !myval->hasDeriv ) { - comm.Sum( myval->data ); if( myval->getRank()==2 && myval->getNumberOfColumns()getShape()[1] ) comm.Sum( myval->matrix_bookeeping ); + comm.Sum( myval->data ); if( am && myval->getRank()==2 && myval->getNumberOfColumns()getShape()[1] ) comm.Sum( myval->matrix_bookeeping ); } } if( action_to_do_after ) action_to_do_after->gatherProcesses(); @@ -884,7 +886,7 @@ void ActionWithVector::getForceTasks( std::vector& force_tasks ) const } void ActionWithVector::gatherForcesOnStoredValue( const Value* myval, const unsigned& itask, const MultiValue& myvals, std::vector& forces ) const { - plumed_dbg_assert( myval->storedata && !(myval->getRank()==2 && !myval->hasDerivatives()) ); + plumed_dbg_assert( myval->storedata ); double fforce = myval->getForce(itask); unsigned sspos = myval->getPositionInStream(); for(unsigned j=0; j. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ -#include "core/ActionWithMatrix.h" +#include "core/ActionWithVector.h" #include "core/ActionRegister.h" #include "tools/Torsion.h" @@ -38,19 +38,18 @@ Calculate the product between a matrix of quaternions and the bonds */ //+ENDPLUMEDOC -class QuaternionBondProductMatrix : public ActionWithMatrix { +class QuaternionBondProductMatrix : public ActionWithVector { private: - unsigned nderivatives; - std::vector stored; + std::vector active_tasks; // const Vector4d& rightMultiply(Tensor4d&, Vector4d&); public: static void registerKeywords( Keywords& keys ); explicit QuaternionBondProductMatrix(const ActionOptions&); unsigned getNumberOfDerivatives(); - unsigned getNumberOfColumns() const override ; - void setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const ; - void performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const override; - void runEndOfRowJobs( const unsigned& ival, const std::vector & indices, MultiValue& myvals ) const override ; + void prepare() override ; + void calculate() override ; + std::vector& getListOfActiveTasks( ActionWithVector* action ) override ; + void performTask( const unsigned& current, MultiValue& myvals ) const override ; }; PLUMED_REGISTER_ACTION(QuaternionBondProductMatrix,"QUATERNION_BOND_PRODUCT_MATRIX") @@ -73,7 +72,7 @@ PLUMED_REGISTER_ACTION(QuaternionBondProductMatrix,"QUATERNION_BOND_PRODUCT_MATR void QuaternionBondProductMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); + ActionWithVector::registerKeywords(keys); keys.use("ARG"); keys.addOutputComponent("w","default","the real component of quaternion"); keys.addOutputComponent("i","default","the i component of the quaternion"); keys.addOutputComponent("j","default","the j component of the quaternion"); @@ -82,7 +81,7 @@ void QuaternionBondProductMatrix::registerKeywords( Keywords& keys ) { QuaternionBondProductMatrix::QuaternionBondProductMatrix(const ActionOptions&ao): Action(ao), - ActionWithMatrix(ao) + ActionWithVector(ao) { if( getNumberOfArguments()!=8 ) error("should be eight arguments to this action, 4 quaternion components and 4 matrices"); unsigned nquat = getPntrToArgument(0)->getNumberOfValues(); @@ -111,32 +110,34 @@ QuaternionBondProductMatrix::QuaternionBondProductMatrix(const ActionOptions&ao) addComponent( "i", shape ); componentIsNotPeriodic("i"); addComponent( "j", shape ); componentIsNotPeriodic("j"); addComponent( "k", shape ); componentIsNotPeriodic("k"); - done_in_chain=true; nderivatives = buildArgumentStore(0); - - std::string headstr=getFirstActionInChain()->getLabel(); stored.resize( getNumberOfArguments() ); - for(unsigned i=0; iignoreStoredValue( headstr ); + unsigned nderivatives = buildArgumentStore(0); } unsigned QuaternionBondProductMatrix::getNumberOfDerivatives() { - return nderivatives; + unsigned nder=0; for(unsigned i=0; igetNumberOfStoredValues(); + return nder; } -unsigned QuaternionBondProductMatrix::getNumberOfColumns() const { - const ActionWithMatrix* am=dynamic_cast( getPntrToArgument(4)->getPntrToAction() ); plumed_assert( am ); - if( getPntrToArgument(4)->isSymmetric() && am->getNumberOfColumns()==getPntrToArgument(4)->getShape()[1]-1 ) return am->getNumberOfColumns() + 1; - return am->getNumberOfColumns(); +void QuaternionBondProductMatrix::prepare() { + ActionWithVector::prepare(); active_tasks.resize(0); } -void QuaternionBondProductMatrix::setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const { - Value* myarg = getPntrToArgument(4); unsigned start_n = myarg->getShape()[0], size_v = myarg->getRowLength(task_index); - if( indices.size()!=size_v+1 ) indices.resize( size_v+1 ); - for(unsigned i=0; igetRowIndex( task_index, i); - myvals.setSplitIndex( size_v + 1 ); +std::vector& QuaternionBondProductMatrix::getListOfActiveTasks( ActionWithVector* action ) { + if( active_tasks.size()>0 ) return active_tasks; + + Value* myarg = getPntrToArgument(4); unsigned base=0; + unsigned nrows = myarg->getShape()[0]; + for(unsigned i=0; igetRowLength(i); + for(unsigned j=0; jgetNumberOfColumns(); + } + return active_tasks; } -void QuaternionBondProductMatrix::performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const { - unsigned ind2=index2; - if( index2>=getPntrToArgument(0)->getShape()[0] ) ind2 = index2 - getPntrToArgument(0)->getShape()[0]; +void QuaternionBondProductMatrix::performTask( const unsigned& taskno, MultiValue& myvals) const { + unsigned index1 = std::floor( taskno / getPntrToArgument(4)->getNumberOfColumns() ); + unsigned index2 = taskno - getPntrToArgument(4)->getNumberOfColumns()*index1; std::vector quat(4), bond(4), quatTemp(4); std::vector dqt(2); //dqt[0] -> derivs w.r.t quat [dwt/dw1 dwt/di1 dwt/dj1 dwt/dk1] @@ -146,9 +147,8 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co for(unsigned i=0; i<4; ++i) quat[i] = getPntrToArgument(i)->get(index1); // Retrieve the components of the matrix - unsigned find = getPntrToArgument(4)->getIndexInStore( index1*getPntrToArgument(4)->getShape()[1] + ind2 ); - double weight = getPntrToArgument(4)->get(find, false ); - for(unsigned i=1; i<4; ++i) bond[i] = getPntrToArgument(4+i)->get(find, false ); + double weight = getPntrToArgument(4)->get(taskno, false ); + for(unsigned i=1; i<4; ++i) bond[i] = getPntrToArgument(4+i)->get(taskno, false ); // calculate normalization factor bond[0]=0.0; @@ -243,10 +243,7 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co if( !doNotCalculateDerivatives() ) { for(unsigned i=0; i<4; ++i) { tempDot=dotProduct(Vector4d(quat[0],-quat[1],-quat[2],-quat[3]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( 0, base + find, tempDot ); myvals.updateIndex( 0, base + find ); - } + if( i>0 ) { myvals.addDerivative( 0, base + taskno, tempDot ); myvals.updateIndex( 0, base + taskno ); } base += getPntrToArgument(4+i)->getNumberOfStoredValues(); } } @@ -270,10 +267,7 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co if( !doNotCalculateDerivatives() ) { for(unsigned i=0; i<4; ++i) { tempDot=dotProduct(Vector4d(quat[1],quat[0],quat[3],-quat[2]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( 1, base + find, tempDot+(-bond[i]*normFac*normFac*xf) ); myvals.updateIndex( 1, base + find ); - } + if( i>0 ) { myvals.addDerivative( 1, base + taskno, tempDot+(-bond[i]*normFac*normFac*xf) ); myvals.updateIndex( 1, base + taskno); } base += getPntrToArgument(4+i)->getNumberOfStoredValues(); } } @@ -299,10 +293,7 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co if( !doNotCalculateDerivatives() ) { for(unsigned i=0; i<4; ++i) { tempDot=dotProduct(Vector4d(quat[2],-quat[3],quat[0],quat[1]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( 2, base + find, tempDot+(-bond[i]*normFac*normFac*yf) ); myvals.updateIndex( 2, base + find ); - } + if( i>0 ) { myvals.addDerivative( 2, base + taskno, tempDot+(-bond[i]*normFac*normFac*yf) ); myvals.updateIndex( 2, base + taskno ); } base += getPntrToArgument(4+i)->getNumberOfStoredValues(); } } @@ -328,48 +319,16 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co for(unsigned i=0; i<4; ++i) { tempDot=dotProduct(Vector4d(quat[3],quat[2],-quat[1],quat[0]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( 3, base + find, tempDot+(-bond[i]*normFac*normFac*zf) ); myvals.updateIndex( 3, base + find ); - } + if( i>0 ) { myvals.addDerivative( 3, base + taskno, tempDot+(-bond[i]*normFac*normFac*zf) ); myvals.updateIndex( 3, base + taskno); } base += getPntrToArgument(4+i)->getNumberOfStoredValues(); } } -void QuaternionBondProductMatrix::runEndOfRowJobs( const unsigned& ival, const std::vector & indices, MultiValue& myvals ) const { - if( doNotCalculateDerivatives() ) return ; - - for(unsigned j=0; jgetPositionInMatrixStash(), nmat_ind = myvals.getNumberOfMatrixRowDerivatives( nmat ); - std::vector& matrix_indices( myvals.getMatrixRowDerivativeIndices( nmat ) ); unsigned ntwo_atoms = myvals.getSplitIndex(); - // Quaternion - for(unsigned k=0; k<4; ++k) { matrix_indices[nmat_ind] = arg_deriv_starts[k] + ival; nmat_ind++; } - - if( actionInChain() ) { - // Loop over row of matrix - for(unsigned n=4; n<8; ++n) { - bool found=false; - for(unsigned k=4; kgetPositionInMatrixStash(); - std::vector& imat_indices( myvals.getMatrixRowDerivativeIndices( istrn ) ); - for(unsigned k=0; kgetPositionInMatrixStash() ); - } - } else { - unsigned base=0; for(unsigned k=0; k<4; ++k) base += getPntrToArgument(k)->getNumberOfStoredValues(); - for(unsigned n=4; n<8; ++n) { - unsigned nmult = getPntrToArgument(n)->getRowLength(ival); - unsigned coltot = ival*getPntrToArgument(n)->getNumberOfColumns(); - for(unsigned k=0; kgetNumberOfStoredValues(); - } - } - myvals.setNumberOfMatrixRowDerivatives( nmat, nmat_ind ); - } -} +void QuaternionBondProductMatrix::calculate() { + // Copy bookeeping arrays from input matrices to output matrices + for(unsigned i=0; i<4; ++i) getPntrToComponent(i)->copyBookeepingArrayFromArgument( getPntrToArgument(4+i) ); + runAllTasks(); +} } } diff --git a/src/crystdistrib/QuaternionProductMatrix.cpp b/src/crystdistrib/QuaternionProductMatrix.cpp index 514563a993..e0b5b1c217 100644 --- a/src/crystdistrib/QuaternionProductMatrix.cpp +++ b/src/crystdistrib/QuaternionProductMatrix.cpp @@ -41,7 +41,7 @@ class QuaternionProductMatrix : public ActionWithMatrix { static void registerKeywords( Keywords& keys ); explicit QuaternionProductMatrix(const ActionOptions&); unsigned getNumberOfDerivatives(); - unsigned getNumberOfColumns() const override { return getConstPntrToComponent(0)->getShape()[1]; } + unsigned getNumberOfColumns() const override ; void setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const ; void performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const override; void runEndOfRowJobs( const unsigned& ival, const std::vector & indices, MultiValue& myvals ) const override ; @@ -50,7 +50,7 @@ class QuaternionProductMatrix : public ActionWithMatrix { PLUMED_REGISTER_ACTION(QuaternionProductMatrix,"QUATERNION_PRODUCT_MATRIX") void QuaternionProductMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); + ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); keys.use("MASK"); keys.addOutputComponent("w","default","the real component of quaternion"); keys.addOutputComponent("i","default","the i component of the quaternion"); keys.addOutputComponent("j","default","the j component of the quaternion"); @@ -61,7 +61,8 @@ QuaternionProductMatrix::QuaternionProductMatrix(const ActionOptions&ao): Action(ao), ActionWithMatrix(ao) { - if( getNumberOfArguments()!=8 ) error("should be eight arguments to this action. Four quaternions for each set of atoms. You can repeat actions"); + unsigned nargs=getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks(); + if( nargs!=8 ) error("should be eight arguments to this action. Four quaternions for each set of atoms. You can repeat actions"); unsigned nquat = getPntrToArgument(0)->getNumberOfValues(); for(unsigned i=0; i<8; ++i) { Value* myarg=getPntrToArgument(i); if( i==4 ) nquat = getPntrToArgument(i)->getNumberOfValues(); @@ -85,8 +86,20 @@ unsigned QuaternionProductMatrix::getNumberOfDerivatives() { return nderivatives; } +unsigned QuaternionProductMatrix::getNumberOfColumns() const { + if( getNumberOfMasks()>0 ) return getPntrToArgument(8)->getNumberOfColumns(); + return getConstPntrToComponent(0)->getShape()[1]; +} + void QuaternionProductMatrix::setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const { - unsigned start_n = getPntrToArgument(0)->getShape()[0], size_v = getPntrToArgument(4)->getShape()[0]; + unsigned start_n = getPntrToArgument(0)->getShape()[0]; + if( getNumberOfMasks()>0 ) { + Value* maskarg = getPntrToArgument(8); unsigned size_v = maskarg->getRowLength(task_index); + if( indices.size()!=size_v+1 ) indices.resize( size_v+1 ); + for(unsigned i=0; igetRowIndex( task_index, i ); + myvals.setSplitIndex( 1 + size_v ); return; + } + unsigned size_v = getPntrToArgument(4)->getShape()[0]; if( indices.size()!=size_v+1 ) indices.resize( size_v+1 ); for(unsigned i=0; igetNumberOfArguments(); ActionWithVector* av=dynamic_cast(action); + if( av && av->getNumberOfMasks()>0 ) nargs = nargs - av->getNumberOfMasks(); std::vector var; parseVector(action,"VAR",var); parse(action,"FUNC",func); if(var.size()==0) { - var.resize(action->getNumberOfArguments()); + var.resize(nargs); if(var.size()>3) action->error("Using more than 3 arguments you should explicitly write their names with VAR"); if(var.size()>0) var[0]="x"; if(var.size()>1) var[1]="y"; if(var.size()>2) var[2]="z"; } - if(var.size()!=action->getNumberOfArguments()) action->error("Size of VAR array should be the same as number of arguments"); + if(var.size()!=nargs) action->error("Size of VAR array should be the same as number of arguments"); // Check for operations that are not multiplication (this can probably be done much more cleverly) bool onlymultiplication = func.find("*")!=std::string::npos; // Find first bracket in expression @@ -321,7 +323,7 @@ void Custom::read( ActionWithArguments* action ) { action->log.printf(" with variables :"); for(unsigned i=0; ilog.printf(" %s",var[i].c_str()); action->log.printf("\n"); function.set( func, var, action ); - std::vector zeros( action->getNumberOfArguments(), 0 ); double fval = abs(function.evaluate(zeros)); + std::vector zeros( nargs, 0 ); double fval = abs(function.evaluate(zeros)); zerowhenallzero=(fvallog.printf(" not calculating when all arguments are zero \n"); } diff --git a/src/function/FunctionOfMatrix.h b/src/function/FunctionOfMatrix.h index 0043e35c99..3baba553be 100644 --- a/src/function/FunctionOfMatrix.h +++ b/src/function/FunctionOfMatrix.h @@ -22,7 +22,7 @@ #ifndef __PLUMED_function_FunctionOfMatrix_h #define __PLUMED_function_FunctionOfMatrix_h -#include "core/ActionWithMatrix.h" +#include "core/ActionWithVector.h" #include "FunctionOfVector.h" #include "Sum.h" #include "tools/Matrix.h" @@ -31,22 +31,16 @@ namespace PLMD { namespace function { template -class FunctionOfMatrix : public ActionWithMatrix { +class FunctionOfMatrix : public ActionWithVector { private: -/// Is this the first step of the calculation - bool firststep; /// The function that is being computed T myfunc; -/// The number of derivatives for this action - unsigned nderivatives; -/// A vector that tells us if we have stored the input value - std::vector stored_arguments; -/// Switch off updating the arguments for this action - std::vector update_arguments; -/// The list of actiosn in this chain - std::vector actionsLabelsInChain; +/// Used to hold the list of tasks we are running + std::vector active_tasks; /// Get the shape of the output matrix std::vector getValueShapeFromArguments(); +/// Get a pointer to the first matrix argument + Value* getPntrToFirstMatrixArgument() const ; public: static void registerKeywords(Keywords&); explicit FunctionOfMatrix(const ActionOptions&); @@ -58,21 +52,14 @@ class FunctionOfMatrix : public ActionWithMatrix { unsigned getNumberOfDerivatives() override ; /// Resize the matrices void prepare() override ; -/// This gets the number of columns - unsigned getNumberOfColumns() const override ; -/// This ensures that we create some bookeeping stuff during the first step - void setupStreamedComponents( const std::string& headstr, unsigned& nquants, unsigned& nmat, unsigned& maxcol ) override ; -/// This sets up for the task - void setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const ; -/// Calculate the full matrix - void performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const override ; -/// This updates the indices for the matrix - void runEndOfRowJobs( const unsigned& ind, const std::vector & indices, MultiValue& myvals ) const override ; + void calculate() override ; + std::vector& getListOfActiveTasks( ActionWithVector* action ) override ; + void performTask( const unsigned& current, MultiValue& myvals ) const override ; }; template void FunctionOfMatrix::registerKeywords(Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); std::string name = keys.getDisplayName(); + ActionWithVector::registerKeywords(keys); keys.use("ARG"); std::string name = keys.getDisplayName(); std::size_t und=name.find("_MATRIX"); keys.setDisplayName( name.substr(0,und) ); keys.use("MASK"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); @@ -91,10 +78,8 @@ void FunctionOfMatrix::registerKeywords(Keywords& keys ) { template FunctionOfMatrix::FunctionOfMatrix(const ActionOptions&ao): Action(ao), - ActionWithMatrix(ao), - firststep(true) + ActionWithVector(ao) { - if( myfunc.getArgStart()>0 ) error("this has not beeen implemented -- if you are interested email gareth.tribello@gmail.com"); // Get the shape of the output std::vector shape( getValueShapeFromArguments() ); // Check if the output matrix is symmetric @@ -104,10 +89,9 @@ FunctionOfMatrix::FunctionOfMatrix(const ActionOptions&ao): if( !getPntrToArgument(i)->isSymmetric() ) { symmetric=false; } } } + unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks(); // Read the input and do some checks myfunc.read( this ); - // Setup to do this in chain if possible - if( myfunc.doWithTasks() ) done_in_chain=true; // Check we are not calculating a sum if( myfunc.zeroRank() ) shape.resize(0); // Get the names of the components @@ -130,11 +114,11 @@ FunctionOfMatrix::FunctionOfMatrix(const ActionOptions&ao): } else if( components[i]==".#!value" ) { addValue( shape ); getPntrToComponent(0)->setSymmetric( symmetric ); } else if( components[i].find_first_of("_")!=std::string::npos ) { - if( getNumberOfArguments()-argstart==1 ) { addValue( shape ); getPntrToComponent(0)->setSymmetric( symmetric ); } + if( nargs-argstart==1 ) { addValue( shape ); getPntrToComponent(0)->setSymmetric( symmetric ); } else { - for(unsigned j=argstart; jgetName() + components[i], shape ); - getPntrToComponent(i*(getNumberOfArguments()-argstart)+j-argstart)->setSymmetric( symmetric ); + getPntrToComponent(i*(nargs-argstart)+j-argstart)->setSymmetric( symmetric ); } } } else { addComponent( components[i], shape ); getPntrToComponent(i)->setSymmetric( symmetric ); } @@ -145,42 +129,8 @@ FunctionOfMatrix::FunctionOfMatrix(const ActionOptions&ao): } // Set the periodicities of the output components myfunc.setPeriodicityForOutputs( this ); - // We can't do this with if we are dividing a stack by some a product v.v^T product as we need to store the vector - // In order to do this type of calculation. There should be a neater fix than this but I can't see it. - bool foundneigh=false; const ActionWithMatrix* chainstart = NULL; - for(unsigned i=argstart; iisConstant() && getNumberOfArguments()>1 ) continue ; - std::string argname=(getPntrToArgument(i)->getPntrToAction())->getName(); - if( argname=="NEIGHBORS" ) { foundneigh=true; break; } - ActionWithVector* av=dynamic_cast( getPntrToArgument(i)->getPntrToAction() ); - if( !av ) done_in_chain=false; - - if( getPntrToArgument(i)->getRank()==0 ) { - function::FunctionOfVector* as = dynamic_cast*>( getPntrToArgument(i)->getPntrToAction() ); - if(as) done_in_chain=false; - } else if( getPntrToArgument(i)->ignoreStoredValue( getLabel() ) ) { - // This option deals with the case when you have two adjacency matrices, A_ij and B_ij, multiplied together. This cannot be done in the chain as the rows - // of the two adjacency matrix are run over separately. The value A_ij is thus not available when B_ij is calculated. - ActionWithMatrix* am = dynamic_cast( getPntrToArgument(i)->getPntrToAction() ); - plumed_assert( am ); const ActionWithMatrix* thischain = am->getFirstMatrixInChain(); - if( !thischain->isAdjacencyMatrix() && thischain->getName()!="VSTACK" ) continue; - if( !chainstart ) chainstart = thischain; - else if( thischain!=chainstart ) done_in_chain=false; - } - } - // If we are working with neighbors we trick PLUMED into storing ALL the components of the other arguments - // in this way we can ensure that the function of the neighbours matrix is in a chain starting from the - // Neighbours matrix action. - if( foundneigh ) { - for(unsigned i=argstart; igetPntrToAction(); - if( av->getName()!="NEIGHBORS" ) { - for(int i=0; igetNumberOfComponents(); ++i) (av->copyOutput(i))->buildDataStore(); - } - } - } // Now setup the action in the chain if we can - nderivatives = buildArgumentStore(myfunc.getArgStart()); + unsigned nderivatives = buildArgumentStore(myfunc.getArgStart()); } template @@ -189,9 +139,28 @@ void FunctionOfMatrix::turnOnDerivatives() { ActionWithValue::turnOnDerivatives(); myfunc.setup(this); } +template +std::vector FunctionOfMatrix::getValueShapeFromArguments() { + unsigned argstart=myfunc.getArgStart(); std::vector shape(2); shape[0]=shape[1]=0; + unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks(); + for(unsigned i=argstart; igetRank()==2 || getPntrToArgument(i)->getRank()==0 ); + if( getPntrToArgument(i)->getRank()==2 ) { + if( shape[0]>0 && (getPntrToArgument(i)->getShape()[0]!=shape[0] || getPntrToArgument(i)->getShape()[1]!=shape[1]) ) error("all matrices input should have the same shape"); + else if( shape[0]==0 ) { shape[0]=getPntrToArgument(i)->getShape()[0]; shape[1]=getPntrToArgument(i)->getShape()[1]; } + plumed_assert( !getPntrToArgument(i)->hasDerivatives() ); + } + } + myfunc.setPrefactor( this, 1.0 ); return shape; +} + + template unsigned FunctionOfMatrix::getNumberOfDerivatives() { - return nderivatives; + unsigned nder=0, argstart = myfunc.getArgStart(); + unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks(); + for(unsigned i=argstart; igetNumberOfStoredValues(); + return nder; } template @@ -206,244 +175,116 @@ void FunctionOfMatrix::prepare() { } for(unsigned i=0; igetRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) { - myval->setShape(shape); if( myval->valueIsStored() ) myval->reshapeMatrixStore( shape[1] ); - } + if( myval->getRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) myval->setShape(shape); } - ActionWithVector::prepare(); + ActionWithVector::prepare(); active_tasks.resize(0); } template -unsigned FunctionOfMatrix::getNumberOfColumns() const { - if( getConstPntrToComponent(0)->getRank()==2 ) { - unsigned argstart=myfunc.getArgStart(); - for(unsigned i=argstart; igetRank()==2 ) { - ActionWithMatrix* am=dynamic_cast( getPntrToArgument(i)->getPntrToAction() ); - if( am ) return am->getNumberOfColumns(); - return getPntrToArgument(i)->getShape()[1]; - } - } +Value* FunctionOfMatrix::getPntrToFirstMatrixArgument() const { + unsigned argstart=myfunc.getArgStart(); + for(unsigned i=argstart; igetRank()==2 ) return getPntrToArgument(i); } - plumed_error(); return 0; + plumed_merror("could not find matrix argument"); + return NULL; } template -void FunctionOfMatrix::setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const { - unsigned basemat; - for(unsigned i=0; igetRank()==2 ) { basemat=i; break; } - } - unsigned start_n = getPntrToArgument(basemat)->getShape()[0], size_v = getPntrToArgument(basemat)->getShape()[1]; - if( getNumberOfMasks()>0 ) { - unsigned maskarg = getNumberOfArguments() - getNumberOfMasks(); - size_v = getPntrToArgument(maskarg)->getRowLength(task_index); - if( indices.size()!=size_v+1 ) indices.resize( size_v+1 ); - for(unsigned i=0; igetRowIndex(task_index, i); - myvals.setSplitIndex( size_v + 1 ); return; +std::vector& FunctionOfMatrix::getListOfActiveTasks( ActionWithVector* action ) { + if( active_tasks.size()>0 ) return active_tasks; + + Value* myarg = NULL; + if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks()); + else myarg = getPntrToFirstMatrixArgument(); + + unsigned base=0; unsigned nrows = myarg->getShape()[0]; + for(unsigned i=0; igetRowLength(i); + for(unsigned j=0; jgetNumberOfColumns(); } - unsigned maskarg=0; size_v = size_v+1; - for(unsigned i=0; igetRank()!=2 ) continue ; - unsigned ss = getPntrToArgument(i)->getRowLength(task_index); - if( ss0 && doNotCalculateDerivatives() ) return active_tasks; +// All the matrices input have to have the same sparsity pattern. +// I can do everything I want to do with this limitation. If +// anyone wants to make this smarter in the future they can +#ifndef DNDEBUG + unsigned argstart=myfunc.getArgStart(); + for(unsigned k=argstart; kgetRank()!=2 ) continue ; + for(unsigned i=0; igetRowLength(i); + if( getNumberOfMasks()>0 && ncols==0 ) continue; + plumed_massert( ncols==getPntrToArgument(k)->getRowLength(i), "failing in " + getLabel() ); + for(unsigned j=0; jgetRowIndex(i,j)==getPntrToArgument(k)->getRowIndex(i,j) ); + } } - if( indices.size()!=size_v+1 ) indices.resize( size_v+1 ); - for(unsigned i=0; igetRowIndex(task_index, i); - myvals.setSplitIndex( size_v + 1 ); +#endif + return active_tasks; } template -void FunctionOfMatrix::setupStreamedComponents( const std::string& headstr, unsigned& nquants, unsigned& nmat, unsigned& maxcol ) { - if( firststep ) { - stored_arguments.resize( getNumberOfArguments() ); - update_arguments.resize( getNumberOfArguments(), true ); - std::string control = getFirstActionInChain()->getLabel(); - for(unsigned i=0; iignoreStoredValue( control ); - if( !stored_arguments[i] ) update_arguments[i] = true; - else update_arguments[i] = !argumentDependsOn( headstr, this, getPntrToArgument(i) ); - } - firststep=false; - } - ActionWithMatrix::setupStreamedComponents( headstr, nquants, nmat, maxcol ); -} +void FunctionOfMatrix::performTask( const unsigned& taskno, MultiValue& myvals) const { + unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks(); + unsigned argstart=myfunc.getArgStart(); std::vector args( nargs - argstart ); -template -void FunctionOfMatrix::performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const { - unsigned argstart=myfunc.getArgStart(); std::vector args( getNumberOfArguments() - argstart ); - unsigned ind2 = index2; - if( getConstPntrToComponent(0)->getRank()==2 && index2>=getConstPntrToComponent(0)->getShape()[0] ) ind2 = index2 - getConstPntrToComponent(0)->getShape()[0]; - else if( index2>=getPntrToArgument(0)->getShape()[0] ) ind2 = index2 - getPntrToArgument(0)->getShape()[0]; - if( actionInChain() ) { - for(unsigned i=argstart; igetRank()==0 ) args[i-argstart] = getPntrToArgument(i)->get(); - else if( !getPntrToArgument(i)->valueHasBeenSet() ) args[i-argstart] = myvals.get( getPntrToArgument(i)->getPositionInStream() ); - else args[i-argstart] = getPntrToArgument(i)->get( getPntrToArgument(i)->getShape()[1]*index1 + ind2 ); - } + // Retrieve the arguments + if( getNumberOfMasks()>0 ) { + Value* maskarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks()); + unsigned index1 = std::floor( taskno / maskarg->getNumberOfColumns() ); + unsigned index2 = taskno - index1*maskarg->getNumberOfColumns(); + unsigned tind2 = maskarg->getRowIndex( index1, index2 ); + unsigned maskncol = maskarg->getRowLength(index1); + for(unsigned i=argstart; igetRank()==2 && getPntrToArgument(i)->getRowLength(index1)>maskncol ) args[i-argstart]=getPntrToArgument(i)->get( index1*getPntrToArgument(i)->getShape()[1] + tind2 ); + else if( getPntrToArgument(i)->getRank()==2 ) { + plumed_dbg_assert( maskncol==getPntrToArgument(i)->getRowLength(index1) ); + args[i-argstart]=getPntrToArgument(i)->get( taskno, false ); + } else args[i-argstart] = getPntrToArgument(i)->get(); + } } else { - for(unsigned i=argstart; igetRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( getPntrToArgument(i)->getShape()[1]*index1 + ind2 ); - else args[i-argstart] = getPntrToArgument(i)->get(); - } + for(unsigned i=argstart; igetRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( taskno, false ); + else args[i-argstart] = getPntrToArgument(i)->get(); + } } // Calculate the function and its derivatives - std::vector vals( getNumberOfComponents() ); Matrix derivatives( getNumberOfComponents(), getNumberOfArguments()-argstart ); + std::vector vals( getNumberOfComponents() ); Matrix derivatives( getNumberOfComponents(), nargs-argstart ); myfunc.calc( this, args, vals, derivatives ); + // And set the values - for(unsigned i=0; igetPositionInStream(), vals[i] ); + for(unsigned i=0; igetPositionInStream(); - for(unsigned j=argstart; jgetRank()==2 ) { - unsigned istrn = getPntrToArgument(j)->getPositionInStream(); - if( stored_arguments[j] ) { - unsigned task_index = getPntrToArgument(i)->getShape()[1]*index1 + ind2; - myvals.clearDerivatives(istrn); myvals.addDerivative( istrn, task_index, 1.0 ); myvals.updateIndex( istrn, task_index ); - } - for(unsigned k=0; kgetRank()==2 ) { + unsigned base=0; + for(unsigned j=argstart; jgetRank()==2 ) { for(int i=0; igetPositionInStream(); - for(unsigned j=argstart; jgetRank()==0 ) continue ; - // Ensure we only store one lot of derivative indices - bool found=false; - for(unsigned k=0; kgetPositionInStream(); - for(unsigned k=0; kgetRank()!=2 ) continue ; - if( index2>=getPntrToArgument(j)->getShape()[0] ) ind2 = index2 - getPntrToArgument(j)->getShape()[0]; - break; - } - for(unsigned j=argstart; jgetRank()==2 ) { - for(int i=0; igetPositionInStream(); - unsigned myind = base + getPntrToArgument(j)->getIndexInStore( index1*getPntrToArgument(j)->getShape()[1] + ind2 ); - myvals.addDerivative( ostrn, myind, derivatives(i,j) ); - myvals.updateIndex( ostrn, myind ); - } - } else { - for(int i=0; igetPositionInStream(); - myvals.addDerivative( ostrn, base, derivatives(i,j) ); - myvals.updateIndex( ostrn, base ); - } + myvals.addDerivative( i, base + taskno, derivatives(i,j) ); myvals.updateIndex( i, base + taskno ); } - base += getPntrToArgument(j)->getNumberOfStoredValues(); - } - } -} - -template -void FunctionOfMatrix::runEndOfRowJobs( const unsigned& ind, const std::vector & indices, MultiValue& myvals ) const { - if( doNotCalculateDerivatives() ) return; - - unsigned argstart=myfunc.getArgStart(); - if( actionInChain() && getConstPntrToComponent(0)->getRank()==2 ) { - // This is triggered if we are outputting a matrix - for(int vv=0; vvgetPositionInMatrixStash(); - std::vector& mat_indices( myvals.getMatrixRowDerivativeIndices( nmat ) ); unsigned ntot_mat=0; - if( mat_indices.size()getRank()==0 ) continue ; - // Ensure we only store one lot of derivative indices - bool found=false; - for(unsigned j=0; jgetShape()[1]*ind; - for(unsigned k=1; kgetShape()[0]; - mat_indices[ntot_mat + k - 1] = arg_deriv_starts[i] + tbase + ind2; - } - ntot_mat += indices.size()-1; - } else { - unsigned istrn = getPntrToArgument(i)->getPositionInMatrixStash(); - std::vector& imat_indices( myvals.getMatrixRowDerivativeIndices( istrn ) ); - for(unsigned k=0; kgetPositionInMatrixStash(); - std::vector& mat_indices( myvals.getMatrixRowDerivativeIndices( istrn ) ); - for(unsigned k=0; kgetPositionInStream(); - myvals.updateIndex( ostrn, arg_deriv_starts[i] + mat_indices[k] ); - } - } - } - } else if( getConstPntrToComponent(0)->getRank()==2 ) { - for(int vv=0; vvgetPositionInMatrixStash(); - std::vector& mat_indices( myvals.getMatrixRowDerivativeIndices( nmat ) ); unsigned ntot_mat=0; - if( mat_indices.size()getRank()==0 ) { - mat_indices[ntot_mat] = matderbase; ntot_mat++; - } else { - unsigned ss = getPntrToArgument(i)->getRowLength(ind); unsigned tbase = matderbase + getPntrToArgument(i)->getNumberOfColumns()*myvals.getTaskIndex(); - for(unsigned k=0; kgetNumberOfStoredValues(); + } else { + for(int i=0; igetNumberOfStoredValues(); } } template -std::vector FunctionOfMatrix::getValueShapeFromArguments() { - unsigned argstart=myfunc.getArgStart(); std::vector shape(2); shape[0]=shape[1]=0; - for(unsigned i=argstart; igetRank()==2 || getPntrToArgument(i)->getRank()==0 ); - if( getPntrToArgument(i)->getRank()==2 ) { - if( shape[0]>0 && (getPntrToArgument(i)->getShape()[0]!=shape[0] || getPntrToArgument(i)->getShape()[1]!=shape[1]) ) error("all matrices input should have the same shape"); - else if( shape[0]==0 ) { shape[0]=getPntrToArgument(i)->getShape()[0]; shape[1]=getPntrToArgument(i)->getShape()[1]; } - plumed_assert( !getPntrToArgument(i)->hasDerivatives() ); - } +void FunctionOfMatrix::calculate() { + Value* myarg = NULL; + if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks()); + else myarg = getPntrToFirstMatrixArgument(); + // Copy bookeeping arrays from input matrices to output matrices + for(unsigned i=0; igetRank()==2 ) getPntrToComponent(i)->copyBookeepingArrayFromArgument( myarg ); + else getPntrToComponent(i)->resizeDerivatives( getNumberOfDerivatives() ); } - myfunc.setPrefactor( this, 1.0 ); return shape; + runAllTasks(); } } diff --git a/src/gridtools/KDE.cpp b/src/gridtools/KDE.cpp index 6f324c4d4b..b127fdfd7e 100644 --- a/src/gridtools/KDE.cpp +++ b/src/gridtools/KDE.cpp @@ -114,6 +114,7 @@ void KDE::registerKeywords( Keywords& keys ) { keys.add("optional","GRID_SPACING","the approximate grid spacing (to be used as an alternative or together with GRID_BIN)"); // Keywords for spherical KDE keys.add("compulsory","CONCENTRATION","the concentration parameter for Von Mises-Fisher distributions (only required for SPHERICAL_KDE)"); + keys.add("hidden","MASKED_INPUT_ALLOWED","turns on that you are allowed to use masked inputs "); keys.setValueDescription("a function on a grid that was obtained by doing a Kernel Density Estimation using the input arguments"); } diff --git a/src/matrixtools/OuterProduct.cpp b/src/matrixtools/OuterProduct.cpp index 0c55f049d1..f4a11747cb 100644 --- a/src/matrixtools/OuterProduct.cpp +++ b/src/matrixtools/OuterProduct.cpp @@ -46,7 +46,7 @@ class OuterProduct : public ActionWithMatrix { explicit OuterProduct(const ActionOptions&); unsigned getNumberOfDerivatives(); void prepare() override ; - unsigned getNumberOfColumns() const override { return getConstPntrToComponent(0)->getShape()[1]; } + unsigned getNumberOfColumns() const override ; void setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const ; void performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const override; void runEndOfRowJobs( const unsigned& ival, const std::vector & indices, MultiValue& myvals ) const override ; @@ -104,6 +104,11 @@ unsigned OuterProduct::getNumberOfDerivatives() { return nderivatives; } +unsigned OuterProduct::getNumberOfColumns() const { + if( getNumberOfMasks()>0 ) return getPntrToArgument(2)->getNumberOfColumns(); + return getConstPntrToComponent(0)->getShape()[1]; +} + void OuterProduct::prepare() { ActionWithVector::prepare(); Value* myval=getPntrToComponent(0); if( myval->getShape()[0]==getPntrToArgument(0)->getShape()[0] && myval->getShape()[1]==getPntrToArgument(1)->getShape()[0] ) return; diff --git a/src/symfunc/LocalSteinhardt.cpp b/src/symfunc/LocalSteinhardt.cpp index 07f432582f..34bc30e15c 100644 --- a/src/symfunc/LocalSteinhardt.cpp +++ b/src/symfunc/LocalSteinhardt.cpp @@ -368,8 +368,7 @@ LocalSteinhardt::LocalSteinhardt(const ActionOptions& ao): std::string sw_str; parse("SWITCH",sw_str); std::string maskstr; parse("MASK",maskstr); if( maskstr.length()>0 ) maskstr=" MASK=" + maskstr; readInputLine( getShortcutLabel() + "_cmap: CONTACT_MATRIX GROUP=" + sp_str + " SWITCH={" + sw_str + "}" + maskstr ); // And the matrix of dot products - if( chainsAreOff() ) readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT MASK=" + getShortcutLabel() + "_cmap" ); - else readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT"); + readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT MASK=" + getShortcutLabel() + "_cmap" ); } else if( spa_str.length()>0 ) { // Create a group with these atoms readInputLine( getShortcutLabel() + "_grp: GROUP ATOMS=" + spa_str ); @@ -426,8 +425,7 @@ LocalSteinhardt::LocalSteinhardt(const ActionOptions& ao): readInputLine( getShortcutLabel() + "_vecsB: CUSTOM ARG=" + getShortcutLabel() + "_uvecsB," + getShortcutLabel() + "_nmatB FUNC=x/y PERIODIC=NO"); std::string sw_str; parse("SWITCH",sw_str); std::string maskstr; parse("MASK",maskstr); if( maskstr.length()>0 ) maskstr=" MASK=" + maskstr; readInputLine( getShortcutLabel() + "_cmap: CONTACT_MATRIX GROUPA=" + spa_str + " GROUPB=" + spb_str + " SWITCH={" + sw_str + "}" + maskstr ); - if( chainsAreOff() ) readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecsA," + getShortcutLabel() + "_vecsB MASK=" + getShortcutLabel() + "_cmap"); - else readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecsA," + getShortcutLabel() + "_vecsB"); + readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_vecsA," + getShortcutLabel() + "_vecsB MASK=" + getShortcutLabel() + "_cmap"); } // Now create the product matrix diff --git a/src/symfunc/RadialTetra.cpp b/src/symfunc/RadialTetra.cpp index 8b7b386474..a80f4b171b 100644 --- a/src/symfunc/RadialTetra.cpp +++ b/src/symfunc/RadialTetra.cpp @@ -76,7 +76,7 @@ RadialTetra::RadialTetra( const ActionOptions& ao): // Get the neighbors matrix readInputLine( getShortcutLabel() + "_neigh: NEIGHBORS ARG=" + getShortcutLabel() + "_mat NLOWEST=4"); // Now get distance matrix that just contains four nearest distances - readInputLine( getShortcutLabel() + "_near4: CUSTOM ARG=" + getShortcutLabel() + "_mat," + getShortcutLabel() + "_neigh FUNC=x*y PERIODIC=NO"); + readInputLine( getShortcutLabel() + "_near4: CUSTOM ARG=" + getShortcutLabel() + "_mat," + getShortcutLabel() + "_neigh MASK=" + getShortcutLabel() + "_neigh FUNC=x*y PERIODIC=NO"); //Now compute sum of four nearest distances ActionWithValue* av = plumed.getActionSet().selectWithLabel( getShortcutLabel() + "_mat"); plumed_assert( av && av->getNumberOfComponents()>0 && (av->copyOutput(0))->getRank()==2 ); diff --git a/src/symfunc/SMAC.cpp b/src/symfunc/SMAC.cpp index e4c66f1dc4..1b1d0cd03e 100644 --- a/src/symfunc/SMAC.cpp +++ b/src/symfunc/SMAC.cpp @@ -75,16 +75,14 @@ SMAC::SMAC(const ActionOptions& ao): readInputLine( getShortcutLabel() + "_vecs: VSTACK ARG=" + sp_lab + ".x," + sp_lab + ".y," + sp_lab + ".z" ); readInputLine( getShortcutLabel() + "_vecsT: TRANSPOSE ARG=" + getShortcutLabel() + "_vecs" ); readInputLine( getShortcutLabel() + "_cmap: CONTACT_MATRIX GROUP=" + sp_lab + " SWITCH={" + sw_input + "}"); - if( chainsAreOff() ) readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT POSITIONS1=" + sp_lab + " POSITIONS2=" + sp_lab + " MASK=" + getShortcutLabel() + "_cmap"); - else readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT POSITIONS1=" + sp_lab + " POSITIONS2=" + sp_lab ); + readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecs," + getShortcutLabel() + "_vecsT POSITIONS1=" + sp_lab + " POSITIONS2=" + sp_lab + " MASK=" + getShortcutLabel() + "_cmap"); } else if( sp_laba.length()>0 ) { std::string sp_labb; parse("SPECIESB",sp_labb); readInputLine( getShortcutLabel() + "_vecsa: VSTACK ARG=" + sp_laba + ".x," + sp_laba + ".y," + sp_laba + ".z" ); readInputLine( getShortcutLabel() + "_vecsb: VSTACK ARG=" + sp_labb + ".x," + sp_labb + ".y," + sp_labb + ".z" ); readInputLine( getShortcutLabel() + "_vecsbT: TRANSPOSE ARG=" + getShortcutLabel() + "_vecsb" ); readInputLine( getShortcutLabel() + "_cmap: CONTACT_MATRIX GROUPA=" + sp_laba + " GROUPB=" + sp_labb + " SWITCH={" + sw_input + "}"); - if( chainsAreOff() ) readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecsa," + getShortcutLabel() + "_vecsbT POSITIONS1=" + sp_laba + " POSITIONS2=" + sp_labb + " MASK=" + getShortcutLabel() + "_cmap"); - else readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecsa," + getShortcutLabel() + "_vecsbT POSITIONS1=" + sp_laba + " POSITIONS2=" + sp_labb ); + readInputLine( getShortcutLabel() + "_tpmat: TORSIONS_MATRIX ARG=" + getShortcutLabel() + "_vecsa," + getShortcutLabel() + "_vecsbT POSITIONS1=" + sp_laba + " POSITIONS2=" + sp_labb + " MASK=" + getShortcutLabel() + "_cmap"); } // Now need the Gaussians std::string kmap_input= getShortcutLabel() + "_ksum: COMBINE MASK=" + getShortcutLabel() + "_cmap PERIODIC=NO"; diff --git a/src/valtools/Flatten.cpp b/src/valtools/Flatten.cpp index d1c9f488d4..e1f8e52ea8 100644 --- a/src/valtools/Flatten.cpp +++ b/src/valtools/Flatten.cpp @@ -56,6 +56,7 @@ PLUMED_REGISTER_ACTION(Flatten,"FLATTEN") void Flatten::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + keys.add("hidden","MASKED_INPUT_ALLOWED","turns on that you are allowed to use masked inputs "); keys.setValueDescription("a vector containing all the elements of the input matrix"); }