@@ -138,8 +138,7 @@ class Distance : public Colvar {
138
138
static unsigned getModeAndSetupValues ( ActionWithValue* av );
139
139
// active methods:
140
140
void calculate () override ;
141
- static void calculateCV ( const ColvarInput& cvin, std::vector<double >& vals, std::vector<std::vector<Vector> >& derivs,
142
- std::vector<Tensor>& virial, const ActionAtomistic* aa );
141
+ static void calculateCV ( const ColvarInput& cvin, std::vector<double >& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
143
142
};
144
143
145
144
typedef ColvarShortcut<Distance> DistanceShortcut;
@@ -226,7 +225,7 @@ void Distance::calculate() {
226
225
if (pbc) makeWhole ();
227
226
228
227
if ( components ) {
229
- calculateCV ( ColvarInput::createColvarInput ( 1 , getPositions (), this ), value, derivs, virial, this );
228
+ calculateCV ( ColvarInput::createColvarInput ( 1 , getPositions (), this ), value, derivs, virial );
230
229
Value* valuex=getPntrToComponent (" x" );
231
230
Value* valuey=getPntrToComponent (" y" );
232
231
Value* valuez=getPntrToComponent (" z" );
@@ -243,7 +242,7 @@ void Distance::calculate() {
243
242
setBoxDerivatives (valuez,virial[2 ]);
244
243
valuez->set (value[2 ]);
245
244
} else if ( scaled_components ) {
246
- calculateCV ( ColvarInput::createColvarInput ( 2 , getPositions (), this ), value, derivs, virial, this );
245
+ calculateCV ( ColvarInput::createColvarInput ( 2 , getPositions (), this ), value, derivs, virial );
247
246
248
247
Value* valuea=getPntrToComponent (" a" );
249
248
Value* valueb=getPntrToComponent (" b" );
@@ -255,15 +254,14 @@ void Distance::calculate() {
255
254
for (unsigned i=0 ; i<2 ; ++i) setAtomsDerivatives (valuec,i,derivs[2 ][i] );
256
255
valuec->set (value[2 ]);
257
256
} else {
258
- calculateCV ( ColvarInput::createColvarInput ( 0 , getPositions (), this ), value, derivs, virial, this );
257
+ calculateCV ( ColvarInput::createColvarInput ( 0 , getPositions (), this ), value, derivs, virial );
259
258
for (unsigned i=0 ; i<2 ; ++i) setAtomsDerivatives (i,derivs[0 ][i] );
260
259
setBoxDerivatives (virial[0 ]);
261
260
setValue (value[0 ]);
262
261
}
263
262
}
264
263
265
- void Distance::calculateCV ( const ColvarInput& cvin, std::vector<double >& vals, std::vector<std::vector<Vector> >& derivs,
266
- std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
264
+ void Distance::calculateCV ( const ColvarInput& cvin, std::vector<double >& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
267
265
Vector distance=delta (cvin.pos [0 ],cvin.pos [1 ]);
268
266
const double value=distance.modulo ();
269
267
const double invvalue=1.0 /value;
@@ -282,15 +280,15 @@ void Distance::calculateCV( const ColvarInput& cvin, std::vector<double>& vals,
282
280
vals[2 ] = distance[2 ];
283
281
setBoxDerivativesNoPbc ( cvin.pos , derivs, virial );
284
282
} else if (cvin.mode ==2 ) {
285
- Vector d=aa-> getPbc () .realToScaled (distance);
286
- derivs[0 ][0 ] = matmul (aa-> getPbc () .getInvBox (),Vector (-1 ,0 ,0 ));
287
- derivs[0 ][1 ] = matmul (aa-> getPbc () .getInvBox (),Vector (+1 ,0 ,0 ));
283
+ Vector d=cvin. pbc .realToScaled (distance);
284
+ derivs[0 ][0 ] = matmul (cvin. pbc .getInvBox (),Vector (-1 ,0 ,0 ));
285
+ derivs[0 ][1 ] = matmul (cvin. pbc .getInvBox (),Vector (+1 ,0 ,0 ));
288
286
vals[0 ] = Tools::pbc (d[0 ]);
289
- derivs[1 ][0 ] = matmul (aa-> getPbc () .getInvBox (),Vector (0 ,-1 ,0 ));
290
- derivs[1 ][1 ] = matmul (aa-> getPbc () .getInvBox (),Vector (0 ,+1 ,0 ));
287
+ derivs[1 ][0 ] = matmul (cvin. pbc .getInvBox (),Vector (0 ,-1 ,0 ));
288
+ derivs[1 ][1 ] = matmul (cvin. pbc .getInvBox (),Vector (0 ,+1 ,0 ));
291
289
vals[1 ] = Tools::pbc (d[1 ]);
292
- derivs[2 ][0 ] = matmul (aa-> getPbc () .getInvBox (),Vector (0 ,0 ,-1 ));
293
- derivs[2 ][1 ] = matmul (aa-> getPbc () .getInvBox (),Vector (0 ,0 ,+1 ));
290
+ derivs[2 ][0 ] = matmul (cvin. pbc .getInvBox (),Vector (0 ,0 ,-1 ));
291
+ derivs[2 ][1 ] = matmul (cvin. pbc .getInvBox (),Vector (0 ,0 ,+1 ));
294
292
vals[2 ] = Tools::pbc (d[2 ]);
295
293
} else {
296
294
derivs[0 ][0 ] = -invvalue*distance;
0 commit comments