From f272f0d14e85cc65f8771386e85e6ab20af7da73 Mon Sep 17 00:00:00 2001 From: davidebr <davide.branduardi@gmail.com> Date: Thu, 23 Feb 2012 16:45:04 +0100 Subject: [PATCH] Projections and propagation of gradients --- regtest/rt18/COLVAR.reference | 6 + regtest/rt18/Makefile | 13 + regtest/rt18/config | 3 + regtest/rt18/forces.reference | 550 +++++++++++++++++++++++++++++ regtest/rt18/plumed.dat | 24 ++ regtest/rt18/projections.reference | 4 + regtest/rt18/trajectory.xyz | 550 +++++++++++++++++++++++++++++ src/Action.cpp | 12 + src/Action.h | 22 +- src/ActionAtomistic.h | 2 +- src/ActionWithArguments.cpp | 9 + src/ActionWithArguments.h | 2 + src/ActionWithValue.cpp | 5 + src/ActionWithValue.h | 2 + src/ActionWithVirtualAtom.cpp | 26 ++ src/ActionWithVirtualAtom.h | 9 + src/GenericDumpProjections.cpp | 91 +++++ src/PlumedMain.cpp | 10 +- src/Value.cpp | 49 +++ src/Value.h | 6 + 20 files changed, 1392 insertions(+), 3 deletions(-) create mode 100644 regtest/rt18/COLVAR.reference create mode 100644 regtest/rt18/Makefile create mode 100644 regtest/rt18/config create mode 100644 regtest/rt18/forces.reference create mode 100644 regtest/rt18/plumed.dat create mode 100644 regtest/rt18/projections.reference create mode 100644 regtest/rt18/trajectory.xyz create mode 100644 src/GenericDumpProjections.cpp diff --git a/regtest/rt18/COLVAR.reference b/regtest/rt18/COLVAR.reference new file mode 100644 index 000000000..d39bbbda2 --- /dev/null +++ b/regtest/rt18/COLVAR.reference @@ -0,0 +1,6 @@ +#! FIELDS time d1 d2 d3 + 0.000000 1.163 2.690 1.304 + 0.050000 1.131 2.726 1.218 + 0.100000 1.098 2.779 1.170 + 0.150000 1.080 2.800 1.191 + 0.200000 1.087 2.788 1.221 diff --git a/regtest/rt18/Makefile b/regtest/rt18/Makefile new file mode 100644 index 000000000..e243f28ec --- /dev/null +++ b/regtest/rt18/Makefile @@ -0,0 +1,13 @@ + +test: + ../scripts/run + +reset: + ../scripts/reset + +clean: + rm -fr tmp/ report.txt + +valgrind: + ../scripts/run --valgrind + diff --git a/regtest/rt18/config b/regtest/rt18/config new file mode 100644 index 000000000..668c1ede7 --- /dev/null +++ b/regtest/rt18/config @@ -0,0 +1,3 @@ +type=driver +# this is to test a different name +arg="--plumed plumed.dat --stride 10 --timestep 0.005 trajectory.xyz --dump-forces forces --dump-forces-fmt=%8.4f" diff --git a/regtest/rt18/forces.reference b/regtest/rt18/forces.reference new file mode 100644 index 000000000..0d521d984 --- /dev/null +++ b/regtest/rt18/forces.reference @@ -0,0 +1,550 @@ +108 + 9.4318 3.4649 1.5451 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +X 0.4339 0.2630 -0.1756 +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 +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 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X -4.3391 -2.6299 1.7562 +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 +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 +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 +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 +108 + 10.1672 3.3670 1.4036 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +X 0.4520 0.2601 -0.1679 +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 +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 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X -4.5203 -2.6013 1.6795 +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 +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 +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 +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 +108 + 10.9422 3.4135 1.3036 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +X 0.4711 0.2631 -0.1626 +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 +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 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X -4.7110 -2.6313 1.6260 +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 +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 +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 +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 +108 + 11.1887 3.4826 1.2951 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +X 0.4773 0.2663 -0.1624 +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 +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 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X -4.7727 -2.6627 1.6238 +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 +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 +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 +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 +108 + 11.1054 3.4227 1.2599 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +X 0.4750 0.2637 -0.1600 +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 +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 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X 0.0000 0.0000 0.0000 +X -4.7498 -2.6369 1.5998 +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 +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 +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 +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/rt18/plumed.dat b/regtest/rt18/plumed.dat new file mode 100644 index 000000000..8b422c9cf --- /dev/null +++ b/regtest/rt18/plumed.dat @@ -0,0 +1,24 @@ +g1: GROUP ATOMS=1-10 +g2: GROUP ATOMS=30-40,5 +c2a: COM ATOMS=70 +c2b: COM ATOMS=71-79 +c1: COM ATOMS=g1 +c2: COM ATOMS=c2a,c2b + +d1: DISTANCE ATOMS=1,10 +d2: DISTANCE ATOMS=c1,50 +d3: DISTANCE ATOMS=50,c2 + +RESTRAINT ARG=d2 AT=0.9 KAPPA=3.0 +DUMPPROJECTIONS ARG=d1,d3 FILE=projections STRIDE=20 + +DEBUG logActivity + +PRINT ... + STRIDE=1 + ARG=d1,d2,d3 + FILE=COLVAR FMT=%6.3f +... PRINT + +ENDPLUMED + diff --git a/regtest/rt18/projections.reference b/regtest/rt18/projections.reference new file mode 100644 index 000000000..eb0a32970 --- /dev/null +++ b/regtest/rt18/projections.reference @@ -0,0 +1,4 @@ +#! FIELDS time d1-d1 d1-d3 d3-d1 d3-d3 + 0.000000 2.0000000000 0.0000000000 0.0000000000 1.1000000000 + 0.100000 2.0000000000 0.0000000000 0.0000000000 1.1000000000 + 0.200000 2.0000000000 0.0000000000 0.0000000000 1.1000000000 diff --git a/regtest/rt18/trajectory.xyz b/regtest/rt18/trajectory.xyz new file mode 100644 index 000000000..f3c9dd586 --- /dev/null +++ b/regtest/rt18/trajectory.xyz @@ -0,0 +1,550 @@ + 108 + 5.03880000000000 5.03880000000000 5.03880000000000 + Ar -3.442612640030015E-002 -3.038146094065802E-003 8.961853877526049E-003 + Ar 0.912465016333831 -1.524861115033656E-002 0.844060122693179 + Ar 0.832342813262219 0.848949986466364 4.278373810313130E-002 + Ar 3.527583123517383E-002 0.896047934140808 0.795328840291565 + Ar -1.888111290252139E-003 4.453056230294513E-002 1.62162507464617 + Ar 0.860851777160665 4.089630217237031E-002 2.48983344757901 + Ar 0.854675871454438 0.842986941975215 1.66825869975346 + Ar -1.030990630180061E-002 0.815049429651274 2.52945420325888 + Ar -8.659954805468062E-002 1.618984616300863E-002 3.35333175349348 + Ar 0.778131911975841 1.387616841389597E-002 4.21637195948668 + Ar 0.865155457459360 0.873706622830978 3.34626927909694 + Ar -3.351170880784502E-002 0.885553892309336 4.19747894997376 + Ar 4.408552976870550E-002 1.64473372507317 2.290279582244573E-002 + Ar 0.778415348285367 1.69954412549695 0.809298967916912 + Ar 0.856213021267037 2.52777984029678 -3.801448288521334E-002 + Ar 3.409326258267278E-002 2.52009970995135 0.804349094056468 + Ar -3.426426457643049E-002 1.67868883407254 1.75982097552947 + Ar 0.746589855418663 1.61255961316801 2.48245491178172 + Ar 0.849271549265006 2.53739762198202 1.76435399070251 + Ar 7.595908452347980E-002 2.57815418930402 2.55008802855880 + Ar 0.118863516214891 1.68026001160674 3.36587169083491 + Ar 0.916528735571405 1.70117523367727 4.20910434627634 + Ar 0.836893393788335 2.57172180865294 3.42822179400943 + Ar 5.307803974735541E-002 2.47426244975434 4.10421864334256 + Ar 8.247899807300250E-002 3.32430194583624 -3.030789960261682E-003 + Ar 0.837058668736381 3.32743550749273 0.819463124350271 + Ar 0.874507592319224 4.17406598848833 -5.049746621739468E-002 + Ar 9.386898128787177E-003 4.26816342296589 0.872165804097830 + Ar 4.404339954918610E-002 3.35586532045936 1.60400663742922 + Ar 0.776236413001911 3.35077289676427 2.51493417072403 + Ar 0.852959576504380 4.23650724963146 1.64462904064498 + Ar 2.974596551501955E-002 4.18819233240482 2.50229559492992 + Ar -2.112318428533188E-002 3.28394181281190 3.40201122162849 + Ar 0.852076889746506 3.34298440154520 4.17876596901595 + Ar 0.834533475401307 4.19723745272282 3.27617753894577 + Ar -1.651879036046454E-002 4.18542539937895 4.15648362726527 + Ar 1.57725865907484 -7.334369139100680E-002 -6.909913841254477E-003 + Ar 2.50309292154114 -6.415773756082110E-002 0.948121122158981 + Ar 2.62248493408315 0.833291833341992 2.315098569680403E-002 + Ar 1.75371633482631 0.798792471538265 0.820577249620091 + Ar 1.71676101014758 1.119682216865766E-002 1.73097663416294 + Ar 2.46201644698870 -2.936225343420254E-002 2.47902634148169 + Ar 2.55203408445186 0.838434770610683 1.64639149287676 + Ar 1.73675854946897 0.848178489691560 2.57066976560053 + Ar 1.76857983777137 -1.429664069675850E-002 3.40806978590743 + Ar 2.52716217395779 3.976167228610505E-002 4.23120467974686 + Ar 2.51218481978332 0.838608102726235 3.43629390544535 + Ar 1.65648032869933 0.917797318187643 4.20115948481197 + Ar 1.69380964888396 1.70694435022641 -1.188118819872011E-002 + Ar 2.58773524785666 1.66750428174081 0.877214331967462 + Ar 2.54335983229385 2.49974109154708 1.862717341398370E-002 + Ar 1.67309457650702 2.52292436194987 0.783647971202027 + Ar 1.69895890471291 1.72317422411882 1.70976080944739 + Ar 2.51587307722765 1.71666838862964 2.50241080663194 + Ar 2.52723939210605 2.55977972964406 1.70834814551538 + Ar 1.64830995159389 2.54177833120081 2.53625648266768 + Ar 1.64980090208238 1.76171446766416 3.33858607371559 + Ar 2.44990752388946 1.68655379810698 4.18218450048959 + Ar 2.51773762058433 2.52749932898193 3.41945480180527 + Ar 1.71477077070589 2.59221034236105 4.18582079763785 + Ar 1.62680709548512 3.35266402628887 -4.501738740930274E-002 + Ar 2.58070128345843 3.38229527660416 0.841618457991160 + Ar 2.56669623081969 4.21569115262128 -1.409727400289687E-002 + Ar 1.66992221843432 4.19234307324958 0.812469544172038 + Ar 1.60214989318681 3.32967017346996 1.68984718855901 + Ar 2.63495214938879 3.36099962902410 2.42966673967338 + Ar 2.48497568456436 4.14829765495600 1.66548195933038 + Ar 1.65475615531958 4.22655539380277 2.49919652894541 + Ar 1.72995075747023 3.37592626111585 3.34564730991203 + Ar 2.50050428247262 3.33285572189487 4.25011415595444 + Ar 2.47716525777221 4.20441778714603 3.37217702210339 + Ar 1.65512913156372 4.20843953533719 4.13484211547866 + Ar 3.40077914210923 -3.591699489044495E-002 -5.051622618223956E-002 + Ar 4.22976845546310 -5.943481989133411E-002 0.827976787257312 + Ar 4.14072613458261 0.823123612344154 -6.003223090053527E-002 + Ar 3.42313348474223 0.843825549637334 0.788486330045433 + Ar 3.30478347756206 6.790201111282566E-002 1.65466092199595 + Ar 4.20797347216182 -2.111407956049807E-002 2.49933644463425 + Ar 4.11091383080115 0.834089903484674 1.67946671704865 + Ar 3.25994748418389 0.881260831196205 2.54230137789363 + Ar 3.37298695682843 6.621968357745202E-002 3.38333949788799 + Ar 4.18290131313650 -3.482350572212091E-002 4.25397912926990 + Ar 4.24457509061821 0.877515421194328 3.45339296316902 + Ar 3.45930296278070 0.887085025463975 4.21810859559471 + Ar 3.30223400408230 1.62030577905443 -6.798919401861923E-003 + Ar 4.19573910449763 1.72299002437158 0.800824784065447 + Ar 4.24287833278377 2.62672179162005 -1.171844632928770E-003 + Ar 3.28317357679018 2.54058349516029 0.854165464158608 + Ar 3.36525900245221 1.68968087928211 1.70274012732660 + Ar 4.24463681109563 1.68001533846426 2.54613252158648 + Ar 4.20445804588838 2.51867188712169 1.69949506574939 + Ar 3.36961295396958 2.58896311786137 2.50369966409017 + Ar 3.33685290604760 1.70947949404163 3.38625422076952 + Ar 4.27405844260463 1.70414008299895 4.26746868193537 + Ar 4.20512933260014 2.47961626832336 3.37422241474624 + Ar 3.31750485888244 2.50434272030152 4.25531265665332 + Ar 3.35655548830140 3.35872692422093 1.379091017629729E-002 + Ar 4.23458967291586 3.32768605253125 0.889743784233561 + Ar 4.11229134987390 4.16680171190873 8.443554208297543E-002 + Ar 3.36962513427898 4.21182638892354 0.830107614826586 + Ar 3.37104109525588 3.32449244832513 1.69184596179443 + Ar 4.14874779473163 3.30138468742149 2.49083991600045 + Ar 4.18037725617577 4.20262174400839 1.68876604034123 + Ar 3.27984405172670 4.23678798697386 2.49511534213407 + Ar 3.33429851464440 3.35707273124879 3.36704782363179 + Ar 4.24959489972031 3.29512882274164 4.22357684606924 + Ar 4.17981307035717 4.11282310856903 3.38233134178325 + Ar 3.39573399684784 4.17462041347496 4.17754464890499 + 108 + 5.03880000000000 5.03880000000000 5.03880000000000 + Ar -5.511825741584489E-002 -3.281336170313875E-003 1.218135023783239E-002 + Ar 0.970111444356837 -1.115049950252208E-002 0.839753971016581 + Ar 0.841992840082703 0.861556191265729 7.929513587454870E-002 + Ar 3.587431829573585E-002 0.916810245303180 0.763471777326105 + Ar -8.214587623282830E-003 8.854095263926748E-002 1.57767599227677 + Ar 0.862456721972611 8.047728334927720E-002 2.48173701402234 + Ar 0.876590149668611 0.834778045945488 1.65188885265378 + Ar -3.586825118959252E-002 0.776001309324528 2.53265204302008 + Ar -0.163621126587859 3.240176862813264E-002 3.36503620259881 + Ar 0.724253629962022 6.738677480626011E-003 4.23207113780966 + Ar 0.893286648080422 0.909784947532151 3.33094192451029 + Ar -3.719465281838220E-002 0.929120870445559 4.19744307829887 + Ar 7.392037198051413E-002 1.64124128216189 1.060928707203983E-002 + Ar 0.737531477565288 1.71691338265824 0.781492330922984 + Ar 0.880793426657636 2.51157723370365 -7.860258353773882E-002 + Ar 6.007528821155831E-002 2.52405783251016 0.779860155511556 + Ar -7.434747843450974E-002 1.67370795506813 1.82856465394750 + Ar 0.689806444940643 1.56456926020255 2.45194178608792 + Ar 0.857843459965281 2.53216274789777 1.82819465058054 + Ar 0.106976851996266 2.60886005111088 2.59931828892928 + Ar 0.209998987647001 1.68299526511279 3.38313478455126 + Ar 0.967033329139707 1.73108801849974 4.22107396359996 + Ar 0.860994828208798 2.61409620894610 3.45774822397038 + Ar 8.848762656830060E-002 2.43386175728329 4.04586034121173 + Ar 0.174466164599900 3.28846956765900 -1.134270990333650E-002 + Ar 0.842930924833860 3.30140486787838 0.792961351973587 + Ar 0.884970629342952 4.12877512365981 -8.941902288481873E-002 + Ar 3.745125537138728E-002 4.32548589722408 0.898032046697077 + Ar 8.763688253287823E-002 3.36081060056274 1.53820982098274 + Ar 0.747688626926769 3.35786959269479 2.50801988258995 + Ar 0.851186541932153 4.28248502505061 1.63215358665001 + Ar 5.577033487910431E-002 4.18364464766652 2.49973916567650 + Ar -3.443310803439401E-002 3.23100766627980 3.44679827812680 + Ar 0.856134143037904 3.34430301649271 4.17164310780205 + Ar 0.844576717455703 4.18220770131492 3.21765369189852 + Ar -1.531900467775684E-002 4.16030681665177 4.10612090766018 + Ar 1.51618410413014 -0.117583186569097 -3.218329702820208E-002 + Ar 2.48699159228940 -0.135841117389762 1.03813184575837 + Ar 2.68668870842993 0.814892309483906 3.175165640905801E-002 + Ar 1.83460825417567 0.778009923469744 0.812702637571463 + Ar 1.74025709776885 2.746498099546270E-002 1.76098680782520 + Ar 2.42942861813589 -3.235165471525878E-002 2.46566888636146 + Ar 2.56761830728424 0.849655235739533 1.61783129926466 + Ar 1.79896733173321 0.864396676017087 2.61391499679674 + Ar 1.84116974325495 -2.941882854445780E-004 3.42911450090773 + Ar 2.54677068957690 6.483241948867709E-002 4.24939675948483 + Ar 2.51035103026406 0.860522274610109 3.50973061347706 + Ar 1.62983911510127 0.976289536024449 4.18315913352560 + Ar 1.70870636667875 1.72937858759363 -2.417867881074230E-002 + Ar 2.65410242685400 1.65266541312614 0.917867585971737 + Ar 2.56147686045650 2.46695804431398 4.035392224078069E-002 + Ar 1.66729523468982 2.52433409332479 0.736165161262292 + Ar 1.73839280594418 1.76315686175215 1.74329649822860 + Ar 2.51098348795027 1.75274383198480 2.49897411778845 + Ar 2.52450104904748 2.60217496765897 1.74705029263699 + Ar 1.64172032318948 2.54852698827359 2.55287986902893 + Ar 1.63008645815293 1.82307360309944 3.32020009691916 + Ar 2.41211932208516 1.69362823087303 4.16748472533849 + Ar 2.51090426828971 2.54094024918172 3.44412210659651 + Ar 1.73348902547202 2.65226445843750 4.16855829288520 + Ar 1.58195493280327 3.36245547485900 -7.840407314153673E-002 + Ar 2.63124580381449 3.40363753160311 0.831084346870071 + Ar 2.62120531195538 4.20273739877979 -1.882711379263441E-002 + Ar 1.66966289057026 4.17781810791988 0.807935702029525 + Ar 1.54644459742261 3.30283116182047 1.68998837597967 + Ar 2.71056821762946 3.36186591282903 2.38509561444690 + Ar 2.44065005757857 4.10902912810676 1.65837742683288 + Ar 1.64822872235996 4.24218412346774 2.49126187704486 + Ar 1.78418522493756 3.39735941231337 3.33335615270753 + Ar 2.48479920725897 3.32956725152979 4.30246543342124 + Ar 2.45560252069526 4.20536893056726 3.37994381968936 + Ar 1.64326707662705 4.21656297068363 4.09767437155694 + Ar 3.42477562605885 -6.403820411580388E-002 -9.335053941097469E-002 + Ar 4.23967117062576 -0.103496736387168 0.823296868967554 + Ar 4.10297189972999 0.825236382869316 -8.988668883680001E-002 + Ar 3.48231201385630 0.854305580028652 0.754725477236463 + Ar 3.25667309996197 0.130477961872137 1.63789852720629 + Ar 4.22416913427801 -3.182827887108397E-002 2.48580324204019 + Ar 4.05746568045247 0.835686152120581 1.68798012538277 + Ar 3.17601260320642 0.901508353969706 2.56778980041261 + Ar 3.38188496201547 0.124470745472216 3.42358148784599 + Ar 4.18786166860411 -6.873161463748667E-002 4.29750088375564 + Ar 4.28144100675377 0.913256102316777 3.50731579081282 + Ar 3.50795013493307 0.952921021923680 4.20440326104952 + Ar 3.26347135623491 1.61250237709139 -4.813272131077679E-003 + Ar 4.18732000600323 1.74914730979405 0.786997454898327 + Ar 4.28433988616220 2.69958609696718 1.541645310706019E-002 + Ar 3.25386288750316 2.55808831451264 0.883384734159628 + Ar 3.37646494012116 1.70006231884180 1.71832858290153 + Ar 4.26798760455984 1.67980967608215 2.59097371811883 + Ar 4.20910782906082 2.50717107189565 1.71754239813405 + Ar 3.37915356162761 2.60492849414610 2.50716179257846 + Ar 3.33172442662119 1.74373259431570 3.42146233039113 + Ar 4.32840881889241 1.73614771385309 4.31837705761772 + Ar 4.21537712603103 2.43246760815139 3.38374627188843 + Ar 3.28406613991099 2.48574392000870 4.31149928878871 + Ar 3.34633106376697 3.34978190801792 2.236597087229162E-002 + Ar 4.27640298711769 3.29017523210779 0.937678428583194 + Ar 4.05965627763185 4.13941157931806 0.125826301770505 + Ar 3.35993223146283 4.21574688626678 0.855875099815207 + Ar 3.39237218301185 3.30130122171935 1.67485892970165 + Ar 4.12610162530762 3.28372502322012 2.45812062806327 + Ar 4.14315092768169 4.20128658872139 1.68788948923140 + Ar 3.20398194300558 4.28413685577959 2.47100165541234 + Ar 3.32787022621768 3.35084905276718 3.38134917839644 + Ar 4.29023112857463 3.25803379622939 4.22495733490184 + Ar 4.16070478480339 4.02326623575585 3.40224115629164 + Ar 3.41697636966586 4.14568180524404 4.13628183320582 + 108 + 5.03880000000000 5.03880000000000 5.03880000000000 + Ar -7.281966794896577E-002 1.715634036527455E-002 9.365487730561863E-003 + Ar 1.03068368713074 8.496410560482847E-003 0.860091502497456 + Ar 0.857892456721288 0.861345079519458 8.606312464401925E-002 + Ar -1.173865094073732E-002 0.886690297228294 0.752334783723381 + Ar -8.576834947757014E-003 0.155917174289646 1.55681009376162 + Ar 0.862579922571045 0.117770937380808 2.48948427128806 + Ar 0.894739645342873 0.817524664974302 1.63905695331720 + Ar -8.262645433770882E-002 0.750760376273362 2.51394008304547 + Ar -0.232403171538608 5.254266215444206E-003 3.39267685440373 + Ar 0.656649489292580 -1.181440609433819E-002 4.22811550104202 + Ar 0.935609438923691 0.920315209492279 3.33098357535671 + Ar 2.077362534541145E-002 0.950130601168683 4.22049137898919 + Ar 0.105561946407679 1.66412875978987 -4.772143040260825E-002 + Ar 0.728253644835499 1.72736926249988 0.784942431121446 + Ar 0.910304826448900 2.47696030472927 -0.104416647630580 + Ar 6.881264671560335E-002 2.52362674062855 0.761686881652125 + Ar -0.142770879941906 1.67405073801646 1.82804367427585 + Ar 0.703070524213510 1.51809745382011 2.43872785884026 + Ar 0.844956969345870 2.48586049418720 1.84901247032368 + Ar 6.821144117365777E-002 2.57728212603035 2.64478942170066 + Ar 0.253420749867027 1.67096688796121 3.37843904447680 + Ar 0.964957540035406 1.78587815282401 4.19910892114844 + Ar 0.945474837266819 2.64261226807484 3.42983479791033 + Ar 8.554851605746489E-002 2.40559086934281 4.10812591473387 + Ar 0.240089858994097 3.26279777505140 -3.584298933283919E-002 + Ar 0.876163206145251 3.27986942786289 0.765570418923242 + Ar 0.865365089162202 4.10532809725986 -0.120740236509193 + Ar 9.254434904548899E-002 4.34217724428954 0.909187662186406 + Ar 0.146554002971359 3.36270419843453 1.50094021655458 + Ar 0.798301235715986 3.38314605943897 2.50150528299688 + Ar 0.856546735411068 4.31204627837529 1.63504112242569 + Ar 5.555632343323345E-002 4.18501372393010 2.48984429473797 + Ar -4.437563529719432E-002 3.22791129762678 3.45207659969871 + Ar 0.851573575467357 3.36374332933648 4.15156407765287 + Ar 0.850789287603105 4.15307777983535 3.19652972804608 + Ar -2.064055214857738E-002 4.14767410414217 4.06242118157768 + Ar 1.51476115123101 -0.119741972807357 -8.493890965179475E-002 + Ar 2.46353949306953 -0.178910696882765 1.05351344293710 + Ar 2.69653564879835 0.759295330192033 4.501924963252886E-002 + Ar 1.91177143151531 0.766551993674228 0.813981179704801 + Ar 1.71286017572430 6.667398188703783E-002 1.75852876384556 + Ar 2.43259435542958 -1.538343133722368E-002 2.50606840565472 + Ar 2.54646788617053 0.897944130468545 1.61169001593919 + Ar 1.83857541441449 0.884069446974359 2.65807342918225 + Ar 1.86827957576695 3.796265029503373E-002 3.44376876034186 + Ar 2.59455291049291 5.819125194747252E-002 4.27169381935187 + Ar 2.51736825022317 0.882789852289291 3.56201557105166 + Ar 1.62076714871133 0.997865340800281 4.17267662425393 + Ar 1.73225190509521 1.73577384375336 -2.968418442928017E-002 + Ar 2.71210953695995 1.65819821548956 0.951107406596888 + Ar 2.54879684557886 2.41971957201531 8.170971605422464E-002 + Ar 1.66479321321915 2.52805170621734 0.711497305615386 + Ar 1.77765906923476 1.78861984751775 1.75007019712929 + Ar 2.50717540660112 1.80093308666153 2.51476435061916 + Ar 2.50978294218910 2.61458793219303 1.74019697607155 + Ar 1.66614621104899 2.57034507167957 2.55729365926213 + Ar 1.60925000796316 1.84134259261342 3.31085972458512 + Ar 2.40951892138549 1.72080125123170 4.17475259842648 + Ar 2.50610470387612 2.54843870101710 3.44561608825310 + Ar 1.71155121378623 2.65754564000176 4.15100115943111 + Ar 1.54945485270250 3.35454927834032 -8.157154446941883E-002 + Ar 2.65275089530800 3.41765220275590 0.807979456019950 + Ar 2.66112960989412 4.19783526489443 -6.750520992506058E-003 + Ar 1.68101725337946 4.15162083942835 0.775497430996584 + Ar 1.51246338673525 3.30237558409112 1.67966979070049 + Ar 2.71064433886672 3.38179702127776 2.42278991054782 + Ar 2.38569284930272 4.04564328856912 1.68490198305791 + Ar 1.66325436575494 4.22682588749412 2.49498306383727 + Ar 1.80876390297900 3.40524846018950 3.31602660078413 + Ar 2.49495486280982 3.35977425129398 4.36185404241975 + Ar 2.47865372675048 4.18817659976153 3.39518942337250 + Ar 1.62473136365647 4.20984556147615 4.08178175621028 + Ar 3.40426223182829 -8.642612935594871E-002 -9.404406440165897E-002 + Ar 4.22514153504561 -0.134145280534041 0.818060686522055 + Ar 4.14858879708533 0.840564575834620 -5.611693631338149E-002 + Ar 3.50905452434680 0.875117479914846 0.762738864942736 + Ar 3.25740544821908 0.144966071041735 1.63819594828794 + Ar 4.23723696221135 -4.694049725502446E-002 2.45621324614741 + Ar 4.05739633381395 0.833768133373417 1.69897461345524 + Ar 3.10946252602729 0.904407516520278 2.58382538816124 + Ar 3.38761162392938 0.164970081561756 3.46958711666924 + Ar 4.21860807819601 -0.107423423027502 4.29988529808353 + Ar 4.28906948927561 0.967769035311134 3.48477479000692 + Ar 3.48772652031809 1.01026440542754 4.12654731705975 + Ar 3.26680146035914 1.67760218844125 9.793659132276769E-003 + Ar 4.19183487857285 1.76906342841272 0.767090686724411 + Ar 4.32244334758399 2.71875985337436 6.506138613014410E-002 + Ar 3.27838368645062 2.54809304454179 0.906009858407789 + Ar 3.39798485633744 1.71770568073960 1.74135324677010 + Ar 4.26327812409298 1.68816518672173 2.65213708350114 + Ar 4.19870577938493 2.47392697940935 1.70540401068308 + Ar 3.37755624628939 2.56141749809246 2.53671285015910 + Ar 3.32442375096260 1.78068432350445 3.46263787064216 + Ar 4.34468052213475 1.76656179308273 4.36853725306570 + Ar 4.21953180304296 2.41802442684233 3.39915838510254 + Ar 3.26388422551728 2.48580771216529 4.35754010232982 + Ar 3.33172001259575 3.32997760441948 3.407578843148700E-002 + Ar 4.27792231432669 3.24257951647762 0.957646519112444 + Ar 4.05995200368632 4.09935289958146 0.118195337633646 + Ar 3.32246796159655 4.21958296786568 0.923997765352682 + Ar 3.45370390895445 3.30101962285655 1.60348616072831 + Ar 4.14624221347601 3.30973701492209 2.43347285326478 + Ar 4.11937281677061 4.20232456608396 1.67979883480476 + Ar 3.17161143510383 4.33097876103089 2.43686439455922 + Ar 3.31765616987546 3.32378980350261 3.38466514585350 + Ar 4.31387173197333 3.25638478794710 4.19945534535344 + Ar 4.15636996424053 3.93354331578350 3.40913676891613 + Ar 3.42215644194033 4.11187151653433 4.12946751247964 + 108 + 5.03880000000000 5.03880000000000 5.03880000000000 + Ar -8.735856035964419E-002 3.511349404237906E-002 1.296773141419529E-002 + Ar 1.09328123411052 4.009060269148090E-002 0.897898320020556 + Ar 0.893793550567136 0.854776850501300 6.847615222804763E-002 + Ar -5.860985396881536E-002 0.859171915838160 0.735653173663602 + Ar -8.576214971048636E-003 0.228402625971825 1.56696315044537 + Ar 0.872039863539916 0.158393455861845 2.51266829177390 + Ar 0.920833748436969 0.802970573603860 1.61245454641008 + Ar -0.122084376099736 0.758232453089905 2.50816506986603 + Ar -0.300050930412277 -2.691790722316102E-002 3.40551136139304 + Ar 0.589408318931022 -4.220822668177523E-002 4.21335531885326 + Ar 1.01099793344525 0.876762950153892 3.32580617609314 + Ar 8.523140746960001E-002 0.933127353330385 4.23513713084302 + Ar 0.156499436832098 1.68468057031760 -9.594827767211603E-002 + Ar 0.746618038106215 1.73662138243060 0.810829542200024 + Ar 0.927288946734158 2.46410925736120 -9.762439061586216E-002 + Ar 7.319605951489296E-002 2.51342859409447 0.756189935960968 + Ar -0.198394513711245 1.67062183892626 1.77471218211948 + Ar 0.748867698726696 1.48029846703818 2.44344173865394 + Ar 0.831481187227995 2.45348624687604 1.83447640560423 + Ar 2.275634915793389E-002 2.52271341006240 2.67424503981914 + Ar 0.238943959037059 1.67403694032172 3.36532631074907 + Ar 0.942620254796907 1.81912126519010 4.15909361060737 + Ar 1.00163065818914 2.66532895836760 3.36930957251371 + Ar 7.923613691992921E-002 2.42133216540335 4.22511555582955 + Ar 0.252483957217493 3.24519104326748 -7.979386912274679E-002 + Ar 0.942814301930496 3.28899337225252 0.746110554407181 + Ar 0.805832964793411 4.12962573724262 -0.140657004889132 + Ar 0.159940438251024 4.33600962296278 0.904694657205339 + Ar 0.213369229874731 3.37963394159564 1.51297959176879 + Ar 0.850275999773602 3.40369575647846 2.49965401838964 + Ar 0.867374063083304 4.32436203352539 1.66731048744850 + Ar 3.321879204841226E-002 4.18618798026429 2.46514029506811 + Ar -2.595559104680908E-002 3.25450818165688 3.43732624666049 + Ar 0.848943921734992 3.40111029827168 4.12161745750416 + Ar 0.853112388901856 4.14014819377398 3.21163977399677 + Ar -2.360287893954655E-002 4.13617159369109 4.02701515419008 + Ar 1.53434877740256 -9.862059722246620E-002 -0.143068860190910 + Ar 2.42929413472072 -0.202018044050102 1.01391903735769 + Ar 2.68850975221274 0.714184415965185 6.215813923704888E-002 + Ar 1.96172030860112 0.737950605922870 0.813688246379800 + Ar 1.66729161635375 9.976589356285996E-002 1.76222560015032 + Ar 2.43524783055626 7.283860601822041E-003 2.55609054567335 + Ar 2.52434003149483 0.941305467110868 1.66020984570691 + Ar 1.87094184307141 0.886211657177718 2.69851813980997 + Ar 1.86029001550161 9.377774473146003E-002 3.44494416822133 + Ar 2.65164050874469 3.675674891677785E-002 4.27470627730305 + Ar 2.53237773297591 0.915115515740788 3.60644838868091 + Ar 1.62348739558255 0.976122568551903 4.19000619463884 + Ar 1.74714204543334 1.71960780038654 -3.180299331921611E-002 + Ar 2.72357265708674 1.67471659587174 0.955815343255857 + Ar 2.50075495959361 2.40559762458999 0.123940014363873 + Ar 1.65697017725872 2.54391837039703 0.718664352730165 + Ar 1.78705988463886 1.82295056396206 1.73823424105958 + Ar 2.50802352225715 1.85323458626510 2.56737770278786 + Ar 2.49714059583393 2.60146393113767 1.72533413405484 + Ar 1.70717245561055 2.63812341680069 2.56312338929261 + Ar 1.60895594190589 1.81829298638051 3.30589547146573 + Ar 2.40466909539224 1.77735361741411 4.17777218576841 + Ar 2.50158282360438 2.54754885618802 3.44787548939131 + Ar 1.67148086080540 2.64773782567095 4.14328399099856 + Ar 1.55856067665018 3.33914886257725 -7.882223611267573E-002 + Ar 2.61401897649377 3.42323653514337 0.805744343409354 + Ar 2.68199978871527 4.20249660577513 2.401513187003788E-003 + Ar 1.70131148235919 4.11224625852237 0.734798642838649 + Ar 1.50744011367944 3.33746989638913 1.66359162278271 + Ar 2.68317527355494 3.40543551523704 2.49105937409657 + Ar 2.30865993097341 3.96454642231613 1.71404351796603 + Ar 1.69073020869972 4.20351567358475 2.49105320830998 + Ar 1.79104324256645 3.40488120714126 3.29374799997469 + Ar 2.52268012820315 3.37663615600579 4.40544846289852 + Ar 2.52690275226929 4.18061141469645 3.42056328195702 + Ar 1.59690054599501 4.19084593585540 4.07988898024915 + Ar 3.38837032905679 -0.106719050973078 -4.044580819091372E-002 + Ar 4.20574882005637 -0.127340558861311 0.824241728638394 + Ar 4.21064834970282 0.859143843346849 -3.048607191605546E-002 + Ar 3.52714128903246 0.891515712949772 0.811294570666182 + Ar 3.29829365298609 9.678824809121567E-002 1.64970824790893 + Ar 4.24779258165091 -8.060095250857245E-002 2.42137863318697 + Ar 4.08628662225109 0.841487343553101 1.73222389512198 + Ar 3.05004747602194 0.907631966281553 2.58964371713587 + Ar 3.38958079865663 0.199058381418399 3.50477081239431 + Ar 4.24808745031262 -0.147777592146594 4.28248268311284 + Ar 4.28344245386949 1.01013663146064 3.44469553501090 + Ar 3.43321954653266 1.05244431874078 4.10034911394721 + Ar 3.31763727211403 1.73521335486417 2.006500916657193E-002 + Ar 4.20268695212408 1.79841295223325 0.745579809104725 + Ar 4.34156837483850 2.69960210790029 0.112246200494744 + Ar 3.33057921681367 2.51995980580015 0.910925609209384 + Ar 3.42369773618588 1.73041116938367 1.79530781722495 + Ar 4.23124644947798 1.69432699031619 2.71118773546222 + Ar 4.18398923911985 2.44681180741616 1.68621090884286 + Ar 3.37454046721136 2.51793386685518 2.56953949733156 + Ar 3.30048333616920 1.83682309426927 3.47314845619438 + Ar 4.30325743099893 1.77079150059311 4.40618089109385 + Ar 4.21675502976708 2.42263013811371 3.43242056200395 + Ar 3.26889408783612 2.52152574924775 4.38400652761676 + Ar 3.35166589609703 3.29461545705247 2.199556782777175E-002 + Ar 4.27375962177807 3.21707865035780 0.951813096355821 + Ar 4.08939395943035 4.05846281502895 9.459333352382746E-002 + Ar 3.30072279587725 4.22606475976981 1.00197308516514 + Ar 3.49578477491527 3.32102036930211 1.54043986519850 + Ar 4.17767771645916 3.34557125587935 2.42029079445840 + Ar 4.11107971070805 4.20427308709450 1.66847390720948 + Ar 3.20825153540620 4.36732876704832 2.39490914474285 + Ar 3.28498236284964 3.26964325452891 3.37491549727801 + Ar 4.31661446993803 3.25360215079398 4.20376952300048 + Ar 4.15434425381581 3.88712049196740 3.36153925845236 + Ar 3.41917467863288 4.08991256559258 4.15013804937161 + 108 + 5.03880000000000 5.03880000000000 5.03880000000000 + Ar -9.136720858518355E-002 5.284615572158460E-002 4.075213226829174E-002 + Ar 1.12394391978709 5.630102669638726E-002 0.904094481050235 + Ar 0.933245805058419 0.860767704476782 4.822337846094350E-002 + Ar -9.175522366906190E-002 0.875885271609885 0.702348492923549 + Ar -1.379213686791012E-002 0.256241229367184 1.59133161572265 + Ar 0.884777629349408 0.212098349106497 2.52533766779658 + Ar 0.933715453866459 0.825165248458579 1.57358471590071 + Ar -0.137239117788243 0.798262273197270 2.51498629101962 + Ar -0.330435935410514 -6.002354054580812E-002 3.39271339064188 + Ar 0.530603459064824 -6.104767017475311E-002 4.19556473677169 + Ar 1.07037330347587 0.826616373920690 3.34414336262104 + Ar 0.139933830206105 0.894944240160303 4.23931373885249 + Ar 0.225196601022043 1.69504085708700 -9.178423323465176E-002 + Ar 0.793827788836604 1.72311560745600 0.854570817004752 + Ar 0.940521123981091 2.45643945458629 -6.398337035142042E-002 + Ar 9.391142211481951E-002 2.50939629174054 0.766706449913365 + Ar -0.226740599535952 1.63329550074631 1.69070068065994 + Ar 0.804766303938961 1.44687865970051 2.43788713999611 + Ar 0.818857298796116 2.43223993968936 1.81326906485039 + Ar -2.329314755294898E-002 2.46974345556616 2.66400331750909 + Ar 0.182680421904259 1.68258056276009 3.34862922787816 + Ar 0.931593318608034 1.82376897746415 4.09362336908870 + Ar 0.992448510028170 2.70321338270518 3.30603426620427 + Ar 5.330866373689025E-002 2.47912871052219 4.29687753961537 + Ar 0.204858643744229 3.23392558875515 -0.102070701737941 + Ar 0.963914375150928 3.30962160438016 0.727171066828687 + Ar 0.763800506497670 4.17166197078741 -0.168197894935180 + Ar 0.209606619288089 4.32503938058369 0.876542895364511 + Ar 0.272828314185285 3.40515969034756 1.55177117420854 + Ar 0.897946160818914 3.40872262532812 2.49843623106145 + Ar 0.887972555224432 4.32905762904702 1.73869027915219 + Ar 1.839815988491761E-002 4.17661011259922 2.43379484365952 + Ar 3.854584526628548E-002 3.28129689652460 3.40430182968019 + Ar 0.850891915276704 3.43069377879109 4.07707639710403 + Ar 0.852523920649425 4.15781266890916 3.25848902033859 + Ar -2.186175562827799E-002 4.12176535222314 4.00951497267457 + Ar 1.56953792368912 -6.505229196836732E-002 -0.201168194941798 + Ar 2.39539508716580 -0.220383835618716 0.976366566950655 + Ar 2.70342143323324 0.695079707482181 8.092766085161066E-002 + Ar 1.97257882407822 0.715624410489050 0.821933573134167 + Ar 1.67427155669166 9.824951461883662E-002 1.78791057267634 + Ar 2.41938091017091 3.105963844678343E-002 2.59717450778374 + Ar 2.50449866199198 0.959376135217158 1.71721563894313 + Ar 1.90328567219838 0.922798968754389 2.72452312681758 + Ar 1.82132902619339 0.145480359717648 3.44931409059657 + Ar 2.69708795127631 -7.053895973110467E-003 4.24961492250714 + Ar 2.55862731601257 0.940250862156656 3.60076667504938 + Ar 1.64114761391124 0.954936143249644 4.22976420065035 + Ar 1.72214558187676 1.67584060692850 -2.497530179377923E-002 + Ar 2.71225785615632 1.67965799759716 0.961383348113579 + Ar 2.47262408943433 2.43729226413208 0.149347304974372 + Ar 1.64110334143129 2.54564290808669 0.746241712611306 + Ar 1.78314831439862 1.85032405351807 1.72579070275583 + Ar 2.50753377105546 1.88326619118105 2.62487546726254 + Ar 2.50049006287067 2.61696145091280 1.71298452655139 + Ar 1.76692097143107 2.69619850555053 2.55805540919807 + Ar 1.62566160455260 1.77328496419602 3.31112294347966 + Ar 2.40276674177359 1.84988649094651 4.19173919336320 + Ar 2.49439356853801 2.56925766794686 3.42493086248947 + Ar 1.66198358502796 2.62662961039618 4.14581214829625 + Ar 1.61432007617580 3.33675992937427 -9.198216120115887E-002 + Ar 2.54997551077735 3.39001218287189 0.804363833238966 + Ar 2.67549399879809 4.22696836103878 2.019092409152441E-002 + Ar 1.69831501887192 4.07907041713030 0.710401192596392 + Ar 1.48901327324377 3.34011407155308 1.62476943995495 + Ar 2.65685596912055 3.40100754562658 2.58347563968942 + Ar 2.26543776263867 3.91432079479253 1.71306213171578 + Ar 1.70804784262747 4.18471288680684 2.51627297613172 + Ar 1.76241400557924 3.41585089716674 3.27435565953233 + Ar 2.53740415340355 3.37637005240528 4.40353620818175 + Ar 2.59882712336245 4.18860370005384 3.43344891237083 + Ar 1.58679351485567 4.16532527349342 4.07891013297633 + Ar 3.41480899148196 -0.105862933987887 4.332197424292997E-002 + Ar 4.18117306748340 -0.104198212794959 0.845630545288090 + Ar 4.26158342257447 0.860538255107908 -7.986763401132907E-003 + Ar 3.51915574246071 0.916666049635457 0.861263189436829 + Ar 3.33779249095084 5.370703219584836E-002 1.65160878918868 + Ar 4.25210237661920 -0.106050756665172 2.39263438790343 + Ar 4.12956174228336 0.858900787345078 1.76555634595488 + Ar 3.00618202547916 0.906180609132706 2.61426031686693 + Ar 3.39101729495302 0.213154855589085 3.52065358084472 + Ar 4.25045707608892 -0.199036766661000 4.30241233273391 + Ar 4.28953467738381 1.02487273955679 3.44257006644446 + Ar 3.39615360597383 1.06606421714045 4.15160907492794 + Ar 3.39317315047633 1.74906165412885 3.829840222083043E-002 + Ar 4.21494911633779 1.80203040880518 0.736983465230285 + Ar 4.31016754071017 2.63869544682861 7.870451971871394E-002 + Ar 3.39877116069656 2.49417514361512 0.895328581375493 + Ar 3.43046483156166 1.72940805158736 1.84480612576827 + Ar 4.18575172819875 1.73449608891478 2.70642857575136 + Ar 4.17098587978233 2.44262911878011 1.68291782509776 + Ar 3.38153229222238 2.47806724082894 2.59385052805114 + Ar 3.27332287709101 1.90549856439275 3.44374420545942 + Ar 4.21859711774123 1.76784920307225 4.42086154720453 + Ar 4.20545854168167 2.46000291143715 3.48964674127964 + Ar 3.28475820436697 2.57538134210400 4.36701459683137 + Ar 3.39506433758779 3.26624750412182 4.107762344320081E-002 + Ar 4.32622103735388 3.21482954005330 0.927977020564315 + Ar 4.13412985645090 4.02325006679475 6.080895986874384E-002 + Ar 3.29372086607892 4.23255420120987 1.04029427605013 + Ar 3.49577371462389 3.35145578011939 1.55584747752986 + Ar 4.19956823542160 3.37780135246845 2.41348593593863 + Ar 4.12118864250303 4.21050970308083 1.68011405294024 + Ar 3.29962417872968 4.38878323501144 2.36340382857920 + Ar 3.28535095964371 3.21534338371035 3.39621591476258 + Ar 4.30440692933406 3.24949161933914 4.22940851531796 + Ar 4.14084086455829 3.87553484377385 3.29277241758537 + Ar 3.41229836071068 4.09680820286438 4.19286599513161 diff --git a/src/Action.cpp b/src/Action.cpp index ed4359683..f70314d98 100644 --- a/src/Action.cpp +++ b/src/Action.cpp @@ -112,6 +112,18 @@ void Action::activate(){ active=true; } +void Action::setOption(const std::string &s){ +// This overloads the action and activate some options + options.insert(s); + for(Dependencies::iterator p=after.begin();p!=after.end();p++) (*p)->setOption(s); +}; + +void Action::clearOptions(){ +// This overloads the action and activate some options + options.clear(); +}; + + void Action::clearDependencies(){ for(Dependencies::iterator p=after.begin();p!=after.end();p++){ (*p)->before.erase(this); diff --git a/src/Action.h b/src/Action.h index ecac916a8..9a5074033 100644 --- a/src/Action.h +++ b/src/Action.h @@ -60,7 +60,10 @@ private: /// Switch to activate Action on this step. bool active; -protected: +/// Option that you might have enabled + std::set<std::string> options; + +public: /// Reference to main plumed object PlumedMain& plumed; @@ -165,18 +168,29 @@ public: /// Set action to active virtual void activate(); +/// + virtual void setOption(const std::string &s); + + virtual void clearOptions(); + /// Set action to inactive virtual void deactivate(); /// Check if action is active bool isActive()const; +/// Check if an option is on + bool isOptionOn(const std::string &s)const; + /// Return dependencies const Dependencies & getDependencies()const{return after;} /// Check if numerical derivatives should be performed virtual bool checkNumericalDerivatives()const{return false;} +/// Check if the action needs gradient + virtual bool checkNeedsGradients()const{return false;} + /// Perform calculation using numerical derivatives virtual void calculateNumericalDerivatives(); @@ -282,6 +296,7 @@ bool Action::parseNumberedVector(const std::string&key, const int no, std::vecto inline void Action::deactivate(){ + options.clear(); active=false; } @@ -290,6 +305,11 @@ bool Action::isActive()const{ return active; } +inline +bool Action::isOptionOn(const std::string &s)const{ + return options.count(s); +} + } #endif diff --git a/src/ActionAtomistic.h b/src/ActionAtomistic.h index 35af6dbde..e3803c8ff 100644 --- a/src/ActionAtomistic.h +++ b/src/ActionAtomistic.h @@ -34,7 +34,7 @@ class ActionAtomistic : bool lockRequestAtoms; // forbid changes to request atoms -protected: +public: /// Request an array of atoms. /// This method is used to ask for a list of atoms. Atoms /// should be asked for by number. If this routine is called diff --git a/src/ActionWithArguments.cpp b/src/ActionWithArguments.cpp index b501a1647..815a69688 100644 --- a/src/ActionWithArguments.cpp +++ b/src/ActionWithArguments.cpp @@ -102,6 +102,15 @@ void ActionWithArguments::calculateNumericalDerivatives(){ } } +double ActionWithArguments::getProjection(unsigned i,unsigned j)const{ + plumed_massert(i<arguments.size()," making projections with an index which is too large"); + plumed_massert(j<arguments.size()," making projections with an index which is too large"); + const Value* v1=arguments[i]; + const Value* v2=arguments[j]; + return Value::projection(*v1,*v2); +} + + diff --git a/src/ActionWithArguments.h b/src/ActionWithArguments.h index 23f9aa2a9..d97491daa 100644 --- a/src/ActionWithArguments.h +++ b/src/ActionWithArguments.h @@ -26,6 +26,8 @@ class ActionWithArguments: protected: ActionWithArguments(const ActionOptions&); virtual ~ActionWithArguments(){}; +/// + double getProjection(unsigned i,unsigned j)const; public: /// Registers the list of keywords static void registerKeywords( Keywords& keys ); diff --git a/src/ActionWithValue.cpp b/src/ActionWithValue.cpp index 6f7d2a950..4b22c1f1c 100644 --- a/src/ActionWithValue.cpp +++ b/src/ActionWithValue.cpp @@ -91,4 +91,9 @@ void ActionWithValue::clearDerivatives(){ for(unsigned i=0;i<values.size();i++) values[i]->clearDerivatives(); } +void ActionWithValue::setGradientsIfNeeded(){ + if(isOptionOn("GRADIENTS")) { + for(unsigned i=0;i<values.size();i++) values[i]->setGradients(); + } +} diff --git a/src/ActionWithValue.h b/src/ActionWithValue.h index 70a20185b..5c8f721ef 100644 --- a/src/ActionWithValue.h +++ b/src/ActionWithValue.h @@ -73,6 +73,8 @@ public: void clearInputForces(); /// Clear the derivatives of values wrt parameters void clearDerivatives(); +/// Calculate the gradients and store them for all the values (need for projections) + void setGradientsIfNeeded(); /// Set the value void setValue(Value*,double); /// Set the default value (the one without name) diff --git a/src/ActionWithVirtualAtom.cpp b/src/ActionWithVirtualAtom.cpp index 3b3a192ea..e7caf52c5 100644 --- a/src/ActionWithVirtualAtom.cpp +++ b/src/ActionWithVirtualAtom.cpp @@ -10,6 +10,7 @@ void ActionWithVirtualAtom::registerKeywords(Keywords& keys){ Action::registerKeywords(keys); ActionAtomistic::registerKeywords(keys); keys.add("atoms","ATOMS","the list of atoms which are involved the virtual atom's definition"); + keys.addFlag("CALC_GRADIENTS", false, " calculate the vector of gradients"); } ActionWithVirtualAtom::ActionWithVirtualAtom(const ActionOptions&ao): @@ -35,4 +36,29 @@ void ActionWithVirtualAtom::requestAtoms(const std::vector<AtomNumber> & a){ derivatives.resize(a.size()); } +void ActionWithVirtualAtom::setGradients(){ + Atoms&atoms(plumed.getAtoms()); + gradients.clear(); + for(unsigned i=0;i<getNumberOfAtoms();i++){ + AtomNumber an=getAbsoluteIndex(i); + // this case if the atom is a virtual one + if(atoms.isVirtualAtom(an.index())){ + const ActionWithVirtualAtom* a=atoms.getVirtualAtomsAction(an.index()); + for(std::map<AtomNumber,Tensor>::const_iterator p=a->gradients.begin();p!=a->gradients.end();++p){ + gradients[(*p).first]+=matmul(derivatives[i],(*p).second); + } + // this case if the atom is a normal one + } else { + gradients[an]+=derivatives[i]; + } + } +} + + +void ActionWithVirtualAtom::setGradientsIfNeeded(){ + if(isOptionOn("GRADIENTS")) { + setGradients() ; + } +} + } diff --git a/src/ActionWithVirtualAtom.h b/src/ActionWithVirtualAtom.h index 8d69c1a99..ee03aa593 100644 --- a/src/ActionWithVirtualAtom.h +++ b/src/ActionWithVirtualAtom.h @@ -23,6 +23,7 @@ class ActionWithVirtualAtom: { unsigned index; std::vector<Tensor> derivatives; + std::map<AtomNumber,Tensor> gradients; void apply(); protected: /// Set position of the virtual atom @@ -36,11 +37,14 @@ protected: /// Set the derivatives of virtual atom coordinate wrt atoms on which it dependes void setAtomsDerivatives(const std::vector<Tensor> &d); public: + void setGradients(); + const std::map<AtomNumber,Tensor> & getGradients()const; /// Return the atom id of the corresponding virtual atom AtomNumber getIndex()const; ActionWithVirtualAtom(const ActionOptions&ao); ~ActionWithVirtualAtom(); static void registerKeywords(Keywords& keys); + void setGradientsIfNeeded(); }; inline @@ -68,6 +72,11 @@ void ActionWithVirtualAtom::setAtomsDerivatives(const std::vector<Tensor> &d){ derivatives=d; } +inline +const std::map<AtomNumber,Tensor> & ActionWithVirtualAtom::getGradients()const{ + return gradients; +} + } #endif diff --git a/src/GenericDumpProjections.cpp b/src/GenericDumpProjections.cpp new file mode 100644 index 000000000..7abecfbe9 --- /dev/null +++ b/src/GenericDumpProjections.cpp @@ -0,0 +1,91 @@ +#include "ActionPilot.h" +#include "ActionWithArguments.h" +#include "ActionRegister.h" +#include "PlumedCommunicator.h" +#include <cassert> + +using namespace std; + +namespace PLMD{ + +//+PLUMEDOC ANALYSIS DUMPPROJECTIONS +/** +Dump the derivatives with respect to the input parameters for one or more objects (generally CVs, functions or biases). + +*/ +//+ENDPLUMEDOC + +class GenericDumpProjections : +public ActionPilot, +public ActionWithArguments +{ + string file; + string fmt; + FILE* fp; +public: + void calculate(){}; + GenericDumpProjections(const ActionOptions&); + static void registerKeywords(Keywords& keys); + void apply(){}; + void update(); + bool checkNeedsGradients()const{return true;} + ~GenericDumpProjections(); +}; + +PLUMED_REGISTER_ACTION(GenericDumpProjections,"DUMPPROJECTIONS") + +void GenericDumpProjections::registerKeywords(Keywords& keys){ + Action::registerKeywords(keys); + ActionPilot::registerKeywords(keys); + ActionWithArguments::registerKeywords(keys); + keys.add("compulsory","STRIDE","1","the frequency with which the derivatives should be output"); + keys.add("compulsory","FILE","the name of the file on which to output the derivatives"); + keys.add("compulsory","FMT","%15.10f","the format with which the derivatives should be output"); +} + +GenericDumpProjections::GenericDumpProjections(const ActionOptions&ao): +Action(ao), +ActionPilot(ao), +ActionWithArguments(ao), +fmt("%15.10f"), +fp(NULL) +{ + parse("FILE",file); + assert(file.length()>0); + parse("FMT",fmt); + fmt=" "+fmt; + if(comm.Get_rank()==0){ + fp=fopen(file.c_str(),"wa"); + log.printf(" on file %s\n",file.c_str()); + log.printf(" with format %s\n",fmt.c_str()); + fprintf(fp,"%s","#! FIELDS time "); + const std::vector<Value*>& arguments(getArguments()); + for(unsigned i=0;i<getNumberOfArguments();i++){ + for(unsigned j=0;j<getNumberOfArguments();j++){ + fprintf(fp," %s-%s",arguments[i]->getFullName().c_str(),arguments[j]->getFullName().c_str()); + } + }; + fprintf(fp,"%s","\n"); + } + checkRead(); +} + + +void GenericDumpProjections::update(){ + if(comm.Get_rank()!=0)return; + fprintf(fp," %f",getTime()); + for(unsigned i=0;i<getNumberOfArguments();i++){ + for(unsigned j=0;j<getNumberOfArguments();j++){ + fprintf(fp,fmt.c_str(),getProjection(i,j)); + } + }; + fprintf(fp,"\n"); +} + +GenericDumpProjections::~GenericDumpProjections(){ + if(fp) fclose(fp); +} + +} + + diff --git a/src/PlumedMain.cpp b/src/PlumedMain.cpp index 916c1410f..afda4e337 100644 --- a/src/PlumedMain.cpp +++ b/src/PlumedMain.cpp @@ -4,6 +4,7 @@ #include "ActionPilot.h" #include "ActionWithValue.h" #include "ActionAtomistic.h" +#include "ActionWithVirtualAtom.h" #include "Atoms.h" #include <set> #include "PlumedConfig.h" @@ -381,7 +382,10 @@ void PlumedMain::prepareDependencies(){ // // First switch off all actions - for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();p++) (*p)->deactivate(); + for(ActionSet::iterator p=actionSet.begin();p!=actionSet.end();p++){ + (*p)->deactivate(); + (*p)->clearOptions(); + } // for optimization, an "active" flag remains false if no action at all is active active=false; @@ -399,6 +403,7 @@ void PlumedMain::prepareDependencies(){ if(Colvar *c=dynamic_cast<Colvar*>(*p)) { if(c->checkIsEnergy()) collectEnergy=true; } + if((*p)->checkNeedsGradients()) (*p)->setOption("GRADIENTS"); } } atoms.setCollectEnergy(collectEnergy); @@ -452,6 +457,9 @@ void PlumedMain::justCalculate(){ if(av)for(int i=0;i<av->getNumberOfValues();++i){ if(av->getValue(i)->getName()=="bias") bias+=av->getValue(i)->get(); } + if(av)av->setGradientsIfNeeded(); + ActionWithVirtualAtom*avv=dynamic_cast<ActionWithVirtualAtom*>(*p); + if(avv)avv->setGradientsIfNeeded(); } } stopwatch.stop("4 Calculating (forward loop)"); diff --git a/src/Value.cpp b/src/Value.cpp index ac93c6b2b..f3ea75151 100644 --- a/src/Value.cpp +++ b/src/Value.cpp @@ -1,6 +1,11 @@ #include "Value.h" #include "ActionWithValue.h" +#include "ActionAtomistic.h" +#include "ActionWithArguments.h" +#include "ActionWithVirtualAtom.h" #include "PlumedException.h" +#include "Atoms.h" +#include "PlumedMain.h" using namespace PLMD; @@ -49,5 +54,49 @@ void Value::enableDerivatives() deriv=true;derivatives.resize(action.getNumberOfParameters()); } +void Value::setGradients(){ + gradients.clear(); + ActionAtomistic*aa=dynamic_cast<ActionAtomistic*>(&action); + ActionWithArguments*aw=dynamic_cast<ActionWithArguments*>(&action); + if(aa){ + Atoms&atoms((aa->plumed).getAtoms()); + for(unsigned j=0;j<aa->getNumberOfAtoms();++j){ + AtomNumber an=aa->getAbsoluteIndex(j); + if(atoms.isVirtualAtom(an.index())){ + const ActionWithVirtualAtom* a=atoms.getVirtualAtomsAction(an.index()); + for(std::map<AtomNumber,Tensor>::const_iterator p=a->getGradients().begin();p!=a->getGradients().end();++p){ +// controllare l'ordine del matmul: + gradients[(*p).first]+=matmul(Vector(derivatives[3*j],derivatives[3*j+1],derivatives[3*j+2]),(*p).second); + } + } else { + for(unsigned i=0;i<3;i++) gradients[an][i]+=derivatives[3*j+i]; + } + } + } else if(aw){ + std::vector<Value*> values=aw->getArguments(); + for(unsigned j=0;j<derivatives.size();j++){ + for(std::map<AtomNumber,Vector>::const_iterator p=values[j]->gradients.begin();p!=values[j]->gradients.end();++p){ + AtomNumber iatom=(*p).first; + gradients[iatom]+=(*p).second*derivatives[j]; + } + } + } else plumed_error(); +} + +double Value::projection(const Value& v1,const Value&v2){ + double proj=0.0; + const std::map<AtomNumber,Vector> & grad1(v1.gradients); + const std::map<AtomNumber,Vector> & grad2(v2.gradients); + for(std::map<AtomNumber,Vector>::const_iterator p1=grad1.begin();p1!=grad1.end();++p1){ + AtomNumber a=(*p1).first; + std::map<AtomNumber,Vector>::const_iterator p2=grad2.find(a); + if(p2!=grad2.end()){ + proj+=dotProduct((*p1).second,(*p2).second); + } + } + return proj; +} + + diff --git a/src/Value.h b/src/Value.h index ca777c452..5963b6f3b 100644 --- a/src/Value.h +++ b/src/Value.h @@ -3,8 +3,11 @@ #include <vector> #include <string> +#include <map> #include "PlumedException.h" #include "Tools.h" +#include "AtomNumber.h" +#include "Vector.h" namespace PLMD{ @@ -21,6 +24,7 @@ class Value{ double inputForce; bool forced; std::vector<double> derivatives; + std::map<AtomNumber,Vector> gradients; std::string name; bool deriv; enum {unset,periodic,notperiodic} periodicity; @@ -28,6 +32,7 @@ class Value{ double max_minus_min; double inv_max_minus_min; public: + void setGradients(); Value(ActionWithValue&action,const std::string& name); void set(double); double get()const; @@ -53,6 +58,7 @@ public: /// check if a force has been added at this step bool checkForced()const; + static double projection(const Value&,const Value&); }; -- GitLab