Skip to content

Commit 518a4bc

Browse files
author
Gareth Aneurin Tribello
committed
Fix for issue with PLANE command
If you calculate the colvar PLANE with only one PLANE (as opposed to a vector of PLANES) the code doesn't work at the moment becuase the data is not passed correctly to the values. This fixes this problem.
1 parent c35754a commit 518a4bc

File tree

5 files changed

+142
-3
lines changed

5 files changed

+142
-3
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#! FIELDS time parameter p1.x p1.y p1.z p1n.x p1n.y p1n.z
2+
0.000000 0 0.00000 2.44705 0.80805 0.00000 2.44705 0.80805
3+
0.000000 1 -2.44705 0.00000 0.02851 -2.44705 0.00000 0.02851
4+
0.000000 2 -0.80805 -0.02851 0.00000 -0.80805 -0.02851 0.00000
5+
0.000000 3 0.00000 -2.44705 -0.80805 0.00000 -2.44705 -0.80805
6+
0.000000 4 2.44705 0.00000 -0.02851 2.44705 0.00000 -0.02851
7+
0.000000 5 0.80805 0.02851 0.00000 0.80805 0.02851 0.00000
8+
0.000000 6 0.00000 1.64577 -0.05614 0.00000 1.64577 -0.05614
9+
0.000000 7 -1.64577 0.00000 -0.05161 -1.64577 0.00000 -0.05161
10+
0.000000 8 0.05614 0.05161 0.00000 0.05614 0.05161 0.00000
11+
0.000000 9 0.00000 -1.64577 0.05614 0.00000 -1.64577 0.05614
12+
0.000000 10 1.64577 0.00000 0.05161 1.64577 0.00000 0.05161
13+
0.000000 11 -0.05614 -0.05161 0.00000 -0.05614 -0.05161 0.00000
14+
0.000000 12 0.00000 -0.17322 -0.04011 -0.00000 -0.17322 -0.04011
15+
0.000000 13 0.17322 0.00000 0.00000 0.17322 0.00000 0.00000
16+
0.000000 14 0.04011 0.00000 0.00000 0.04011 -0.00000 0.00000
17+
0.000000 15 0.00000 1.46726 0.00000 -0.00000 1.46726 -0.00000
18+
0.000000 16 -1.46726 0.00000 -0.04011 -1.46726 0.00000 -0.04011
19+
0.000000 17 0.00000 0.04011 0.00000 -0.00000 0.04011 0.00000
20+
0.000000 18 0.00000 0.00000 1.46726 -0.00000 -0.00000 1.46726
21+
0.000000 19 0.00000 0.00000 0.17322 -0.00000 0.00000 0.17322
22+
0.000000 20 -1.46726 -0.17322 0.00000 -1.46726 -0.17322 0.00000
23+
0.050000 0 0.00000 2.40244 0.78108 0.00000 2.40244 0.78108
24+
0.050000 1 -2.40244 0.00000 0.02046 -2.40244 0.00000 0.02046
25+
0.050000 2 -0.78108 -0.02046 0.00000 -0.78108 -0.02046 0.00000
26+
0.050000 3 0.00000 -2.40244 -0.78108 0.00000 -2.40244 -0.78108
27+
0.050000 4 2.40244 0.00000 -0.02046 2.40244 0.00000 -0.02046
28+
0.050000 5 0.78108 0.02046 0.00000 0.78108 0.02046 0.00000
29+
0.050000 6 0.00000 1.64198 -0.09163 0.00000 1.64198 -0.09163
30+
0.050000 7 -1.64198 0.00000 -0.10765 -1.64198 0.00000 -0.10765
31+
0.050000 8 0.09163 0.10765 0.00000 0.09163 0.10765 0.00000
32+
0.050000 9 0.00000 -1.64198 0.09163 0.00000 -1.64198 0.09163
33+
0.050000 10 1.64198 0.00000 0.10765 1.64198 0.00000 0.10765
34+
0.050000 11 -0.09163 -0.10765 0.00000 -0.09163 -0.10765 0.00000
35+
0.050000 12 0.00000 -0.29224 -0.08221 0.00000 -0.29224 -0.08221
36+
0.050000 13 0.29224 0.00000 0.00000 0.29224 -0.00000 -0.00000
37+
0.050000 14 0.08221 0.00000 0.00000 0.08221 -0.00000 -0.00000
38+
0.050000 15 0.00000 1.50265 0.00000 0.00000 1.50265 0.00000
39+
0.050000 16 -1.50265 0.00000 -0.08221 -1.50265 -0.00000 -0.08221
40+
0.050000 17 0.00000 0.08221 0.00000 0.00000 0.08221 -0.00000
41+
0.050000 18 0.00000 0.00000 1.50265 0.00000 -0.00000 1.50265
42+
0.050000 19 0.00000 0.00000 0.29224 0.00000 -0.00000 0.29224
43+
0.050000 20 -1.50265 -0.29224 0.00000 -1.50265 -0.29224 -0.00000
44+
0.100000 0 0.00000 2.40342 0.74357 0.00000 2.40342 0.74357
45+
0.100000 1 -2.40342 0.00000 0.00469 -2.40342 0.00000 0.00469
46+
0.100000 2 -0.74357 -0.00469 0.00000 -0.74357 -0.00469 0.00000
47+
0.100000 3 0.00000 -2.40342 -0.74357 0.00000 -2.40342 -0.74357
48+
0.100000 4 2.40342 0.00000 -0.00469 2.40342 0.00000 -0.00469
49+
0.100000 5 0.74357 0.00469 0.00000 0.74357 0.00469 0.00000
50+
0.100000 6 0.00000 1.62939 -0.10927 0.00000 1.62939 -0.10927
51+
0.100000 7 -1.62939 0.00000 -0.16810 -1.62939 0.00000 -0.16810
52+
0.100000 8 0.10927 0.16810 0.00000 0.10927 0.16810 0.00000
53+
0.100000 9 0.00000 -1.62939 0.10927 0.00000 -1.62939 0.10927
54+
0.100000 10 1.62939 0.00000 0.16810 1.62939 0.00000 0.16810
55+
0.100000 11 -0.10927 -0.16810 0.00000 -0.10927 -0.16810 0.00000
56+
0.100000 12 0.00000 -0.41166 -0.12449 0.00000 -0.41166 -0.12449
57+
0.100000 13 0.41166 0.00000 0.00000 0.41166 0.00000 0.00000
58+
0.100000 14 0.12449 0.00000 0.00000 0.12449 -0.00000 0.00000
59+
0.100000 15 0.00000 1.47421 0.00000 0.00000 1.47421 0.00000
60+
0.100000 16 -1.47421 0.00000 -0.12449 -1.47421 0.00000 -0.12449
61+
0.100000 17 0.00000 0.12449 0.00000 -0.00000 0.12449 0.00000
62+
0.100000 18 0.00000 0.00000 1.47421 0.00000 0.00000 1.47421
63+
0.100000 19 0.00000 0.00000 0.41166 0.00000 0.00000 0.41166
64+
0.100000 20 -1.47421 -0.41166 0.00000 -1.47421 -0.41166 0.00000
65+
0.150000 0 0.00000 2.44419 0.69638 0.00000 2.44419 0.69638
66+
0.150000 1 -2.44419 0.00000 -0.02175 -2.44419 0.00000 -0.02175
67+
0.150000 2 -0.69638 0.02175 0.00000 -0.69638 0.02175 0.00000
68+
0.150000 3 0.00000 -2.44419 -0.69638 0.00000 -2.44419 -0.69638
69+
0.150000 4 2.44419 0.00000 0.02175 2.44419 0.00000 0.02175
70+
0.150000 5 0.69638 -0.02175 0.00000 0.69638 -0.02175 0.00000
71+
0.150000 6 0.00000 1.61477 -0.11830 0.00000 1.61477 -0.11830
72+
0.150000 7 -1.61477 0.00000 -0.22124 -1.61477 0.00000 -0.22124
73+
0.150000 8 0.11830 0.22124 0.00000 0.11830 0.22124 0.00000
74+
0.150000 9 0.00000 -1.61477 0.11830 0.00000 -1.61477 0.11830
75+
0.150000 10 1.61477 0.00000 0.22124 1.61477 0.00000 0.22124
76+
0.150000 11 -0.11830 -0.22124 0.00000 -0.11830 -0.22124 0.00000
77+
0.150000 12 0.00000 -0.50563 -0.15664 0.00000 -0.50563 -0.15664
78+
0.150000 13 0.50563 0.00000 0.00000 0.50563 0.00000 -0.00000
79+
0.150000 14 0.15664 0.00000 0.00000 0.15664 0.00000 0.00000
80+
0.150000 15 0.00000 1.41365 0.00000 0.00000 1.41365 0.00000
81+
0.150000 16 -1.41365 0.00000 -0.15664 -1.41365 0.00000 -0.15664
82+
0.150000 17 0.00000 0.15664 0.00000 0.00000 0.15664 0.00000
83+
0.150000 18 0.00000 0.00000 1.41365 0.00000 0.00000 1.41365
84+
0.150000 19 0.00000 0.00000 0.50563 0.00000 0.00000 0.50563
85+
0.150000 20 -1.41365 -0.50563 0.00000 -1.41365 -0.50563 0.00000
86+
0.200000 0 0.00000 2.47711 0.64867 0.00000 2.47711 0.64867
87+
0.200000 1 -2.47711 0.00000 -0.04847 -2.47711 0.00000 -0.04847
88+
0.200000 2 -0.64867 0.04847 0.00000 -0.64867 0.04847 0.00000
89+
0.200000 3 0.00000 -2.47711 -0.64867 0.00000 -2.47711 -0.64867
90+
0.200000 4 2.47711 0.00000 0.04847 2.47711 0.00000 0.04847
91+
0.200000 5 0.64867 -0.04847 0.00000 0.64867 -0.04847 0.00000
92+
0.200000 6 0.00000 1.62124 -0.15580 0.00000 1.62124 -0.15580
93+
0.200000 7 -1.62124 0.00000 -0.23917 -1.62124 0.00000 -0.23917
94+
0.200000 8 0.15580 0.23917 0.00000 0.15580 0.23917 0.00000
95+
0.200000 9 0.00000 -1.62124 0.15580 0.00000 -1.62124 0.15580
96+
0.200000 10 1.62124 0.00000 0.23917 1.62124 0.00000 0.23917
97+
0.200000 11 -0.15580 -0.23917 0.00000 -0.15580 -0.23917 0.00000
98+
0.200000 12 0.00000 -0.51386 -0.16269 0.00000 -0.51386 -0.16269
99+
0.200000 13 0.51386 0.00000 0.00000 0.51386 0.00000 0.00000
100+
0.200000 14 0.16269 0.00000 0.00000 0.16269 0.00000 0.00000
101+
0.200000 15 0.00000 1.43758 0.00000 0.00000 1.43758 -0.00000
102+
0.200000 16 -1.43758 0.00000 -0.16269 -1.43758 0.00000 -0.16269
103+
0.200000 17 0.00000 0.16269 0.00000 0.00000 0.16269 0.00000
104+
0.200000 18 0.00000 0.00000 1.43758 0.00000 0.00000 1.43758
105+
0.200000 19 0.00000 0.00000 0.51386 0.00000 0.00000 0.51386
106+
0.200000 20 -1.43758 -0.51386 0.00000 -1.43758 -0.51386 0.00000

regtest/basic/rt-plane/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../../scripts/test.make

regtest/basic/rt-plane/config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type=driver
2+
# this is to test a different name
3+
arg="--plumed plumed.dat --trajectory-stride 10 --timestep 0.005 --ixyz trajectory.xyz --dump-forces forces --dump-forces-fmt=%10.6f"
4+
extra_files="../../trajectories/trajectory.xyz"

regtest/basic/rt-plane/plumed.dat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
p1: PLANE ATOMS=2,6,3
2+
p1n: PLANE ATOMS=2,6,3 NUMERICAL_DERIVATIVES
3+
4+
DUMPDERIVATIVES ...
5+
STRIDE=10
6+
ARG=p1.*,p1n.*
7+
FILE=DERIVATIVES
8+
FMT=%8.5f
9+
... DUMPDERIVATIVES
10+
11+
ENDPLUMED
12+

src/colvar/Plane.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,27 @@ void Plane::calculate() {
149149
makeWhole();
150150
}
151151
calculateCV( 0, masses, charges, getPositions(), value, derivs, virial, this );
152-
setValue( value[0] );
152+
Value* valuex=getPntrToComponent("x");
153+
Value* valuey=getPntrToComponent("y");
154+
Value* valuez=getPntrToComponent("z");
155+
153156
for(unsigned i=0; i<derivs[0].size(); ++i) {
154-
setAtomsDerivatives( i, derivs[0][i] );
157+
setAtomsDerivatives( valuex, i, derivs[0][i] );
158+
}
159+
setBoxDerivatives( valuex, virial[0] );
160+
valuex->set( value[0] );
161+
162+
for(unsigned i=0; i<derivs[1].size(); ++i) {
163+
setAtomsDerivatives( valuey, i, derivs[1][i] );
164+
}
165+
setBoxDerivatives( valuey, virial[1] );
166+
valuey->set( value[1] );
167+
168+
for(unsigned i=0; i<derivs[2].size(); ++i) {
169+
setAtomsDerivatives( valuez, i, derivs[2][i] );
155170
}
156-
setBoxDerivatives( virial[0] );
171+
setBoxDerivatives( valuez, virial[2] );
172+
valuez->set( value[2] );
157173
}
158174

159175
void Plane::calculateCV( const unsigned& mode, const std::vector<double>& masses, const std::vector<double>& charges,

0 commit comments

Comments
 (0)