Skip to content

Commit baaa901

Browse files
Gareth Aneurin TribelloGareth Aneurin Tribello
Gareth Aneurin Tribello
authored and
Gareth Aneurin Tribello
committed
No longer passing pointer to action in calculateCV as first step to getting this command running on GPU
1 parent 2986098 commit baaa901

11 files changed

+66
-80
lines changed

src/colvar/Angle.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ class Angle : public Colvar {
110110
static void registerKeywords( Keywords& keys );
111111
static void parseAtomList( const int& num, std::vector<AtomNumber>& t, ActionAtomistic* aa );
112112
static unsigned getModeAndSetupValues( ActionWithValue* av );
113-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
114-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
113+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
115114
};
116115

117116
typedef ColvarShortcut<Angle> AngleShortcut;
@@ -168,14 +167,13 @@ Angle::Angle(const ActionOptions&ao):
168167
void Angle::calculate() {
169168

170169
if(pbc) makeWhole();
171-
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
170+
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
172171
setValue( value[0] );
173172
for(unsigned i=0; i<derivs[0].size(); ++i) setAtomsDerivatives( i, derivs[0][i] );
174173
setBoxDerivatives( virial[0] );
175174
}
176175

177-
void Angle::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
178-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
176+
void Angle::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
179177
Vector dij,dik;
180178
dij=delta(cvin.pos[2],cvin.pos[3]);
181179
dik=delta(cvin.pos[1],cvin.pos[0]);

src/colvar/DihedralCorrelation.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ class DihedralCorrelation : public Colvar {
7373
static void parseAtomList( const int& num, std::vector<AtomNumber>& t, ActionAtomistic* aa );
7474
static unsigned getModeAndSetupValues( ActionWithValue* av );
7575
void calculate() override;
76-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
77-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
76+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
7877
};
7978

8079
typedef ColvarShortcut<DihedralCorrelation> DihedralCorrelationShortcut;
@@ -125,14 +124,13 @@ unsigned DihedralCorrelation::getModeAndSetupValues( ActionWithValue* av ) {
125124
void DihedralCorrelation::calculate() {
126125

127126
if(pbc) makeWhole();
128-
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
127+
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
129128
setValue( value[0] );
130129
for(unsigned i=0; i<derivs[0].size(); ++i) setAtomsDerivatives( i, derivs[0][i] );
131130
setBoxDerivatives( virial[0] );
132131
}
133132

134-
void DihedralCorrelation::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
135-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
133+
void DihedralCorrelation::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
136134
const Vector d10=delta(cvin.pos[1],cvin.pos[0]);
137135
const Vector d11=delta(cvin.pos[2],cvin.pos[1]);
138136
const Vector d12=delta(cvin.pos[3],cvin.pos[2]);

src/colvar/Dipole.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ class Dipole : public Colvar {
9494
static unsigned getModeAndSetupValues( ActionWithValue* av );
9595
void calculate() override;
9696
static void registerKeywords(Keywords& keys);
97-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
98-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
97+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
9998
};
10099

101100
typedef ColvarShortcut<Dipole> DipoleShortcut;
@@ -122,7 +121,7 @@ Dipole::Dipole(const ActionOptions&ao):
122121
derivs(1),
123122
virial(1)
124123
{
125-
parseAtomList(-1,ga_lista,this);
124+
parseAtomList(-1,ga_lista,this);
126125
components=(getModeAndSetupValues(this)==1);
127126
if( components ) {
128127
value.resize(3); derivs.resize(3); virial.resize(3);
@@ -171,12 +170,12 @@ void Dipole::calculate()
171170
unsigned N=getNumberOfAtoms();
172171

173172
if(!components) {
174-
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
173+
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
175174
for(unsigned i=0; i<N; i++) setAtomsDerivatives(i,derivs[0][i]);
176175
setBoxDerivatives(virial[0]);
177176
setValue(value[0]);
178177
} else {
179-
calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial, this );
178+
calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial );
180179
for(unsigned i=0; i<N; i++) {
181180
setAtomsDerivatives(valuex,i,derivs[0][i]);
182181
setAtomsDerivatives(valuey,i,derivs[1][i]);
@@ -191,8 +190,7 @@ void Dipole::calculate()
191190
}
192191
}
193192

194-
void Dipole::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
195-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
193+
void Dipole::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
196194
unsigned N=cvin.pos.size(); double ctot=0.;
197195
for(unsigned i=0; i<N; ++i) ctot += cvin.charges[i];
198196
ctot/=(double)N;

src/colvar/Distance.cpp

+12-14
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ class Distance : public Colvar {
138138
static unsigned getModeAndSetupValues( ActionWithValue* av );
139139
// active methods:
140140
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 );
143142
};
144143

145144
typedef ColvarShortcut<Distance> DistanceShortcut;
@@ -226,7 +225,7 @@ void Distance::calculate() {
226225
if(pbc) makeWhole();
227226

228227
if( components ) {
229-
calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial, this );
228+
calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial );
230229
Value* valuex=getPntrToComponent("x");
231230
Value* valuey=getPntrToComponent("y");
232231
Value* valuez=getPntrToComponent("z");
@@ -243,7 +242,7 @@ void Distance::calculate() {
243242
setBoxDerivatives(valuez,virial[2]);
244243
valuez->set(value[2]);
245244
} 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 );
247246

248247
Value* valuea=getPntrToComponent("a");
249248
Value* valueb=getPntrToComponent("b");
@@ -255,15 +254,14 @@ void Distance::calculate() {
255254
for(unsigned i=0; i<2; ++i) setAtomsDerivatives(valuec,i,derivs[2][i] );
256255
valuec->set(value[2]);
257256
} else {
258-
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
257+
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
259258
for(unsigned i=0; i<2; ++i) setAtomsDerivatives(i,derivs[0][i] );
260259
setBoxDerivatives(virial[0]);
261260
setValue (value[0]);
262261
}
263262
}
264263

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 ) {
267265
Vector distance=delta(cvin.pos[0],cvin.pos[1]);
268266
const double value=distance.modulo();
269267
const double invvalue=1.0/value;
@@ -282,15 +280,15 @@ void Distance::calculateCV( const ColvarInput& cvin, std::vector<double>& vals,
282280
vals[2] = distance[2];
283281
setBoxDerivativesNoPbc( cvin.pos, derivs, virial );
284282
} 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));
288286
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));
291289
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));
294292
vals[2] = Tools::pbc(d[2]);
295293
} else {
296294
derivs[0][0] = -invvalue*distance;

src/colvar/MultiColvarTemplate.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@
2525
namespace PLMD {
2626
namespace colvar {
2727

28-
ColvarInput::ColvarInput( const unsigned& m, const std::vector<Vector>& p, const std::vector<double>& w, const std::vector<double>& q ) :
29-
mode(m),
30-
pos(p),
31-
mass(w),
32-
charges(q)
28+
ColvarInput::ColvarInput( const unsigned& m, const std::vector<Vector>& p, const std::vector<double>& w, const std::vector<double>& q, const Pbc& box ) :
29+
mode(m),
30+
pbc(box),
31+
pos(p),
32+
mass(w),
33+
charges(q)
3334
{
3435
}
3536

3637
ColvarInput ColvarInput::createColvarInput( const unsigned& m, const std::vector<Vector>& p, const Colvar* colv ) {
37-
return ColvarInput( m, p, colv->getMasses(), colv->getCharges(true) );
38+
return ColvarInput( m, p, colv->getMasses(), colv->getCharges(true), colv->getPbc() );
3839
}
3940

4041
}

src/colvar/MultiColvarTemplate.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ namespace colvar {
3434
class ColvarInput {
3535
public:
3636
unsigned mode;
37+
const Pbc& pbc;
3738
const std::vector<Vector>& pos;
3839
const std::vector<double>& mass;
3940
const std::vector<double>& charges;
40-
ColvarInput( const unsigned& m, const std::vector<Vector>& p, const std::vector<double>& w, const std::vector<double>& q );
41+
ColvarInput( const unsigned& m, const std::vector<Vector>& p, const std::vector<double>& w, const std::vector<double>& q, const Pbc& box );
4142
static ColvarInput createColvarInput( const unsigned& m, const std::vector<Vector>& p, const Colvar* colv );
4243
};
4344

@@ -177,7 +178,7 @@ void MultiColvarTemplate<T>::performTask( const unsigned& task_index, MultiValue
177178
std::vector<Tensor> & virial( myvals.getFirstAtomVirialVector() );
178179
std::vector<std::vector<Vector> > & derivs( myvals.getFirstAtomDerivativeVector() );
179180
// Calculate the CVs using the method in the Colvar
180-
T::calculateCV( ColvarInput(mode, fpositions, mass, charge), values, derivs, virial, this );
181+
T::calculateCV( ColvarInput(mode, fpositions, mass, charge, getPbc() ), values, derivs, virial );
181182
for(unsigned i=0; i<values.size(); ++i) myvals.setValue( i, values[i] );
182183
// Finish if there are no derivatives
183184
if( doNotCalculateDerivatives() ) return;

src/colvar/Plane.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ class Plane : public Colvar {
7272
static unsigned getModeAndSetupValues( ActionWithValue* av );
7373
// active methods:
7474
void calculate() override;
75-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
76-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
75+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
7776
};
7877

7978
typedef ColvarShortcut<Plane> PlaneShortcut;
@@ -134,14 +133,13 @@ Plane::Plane(const ActionOptions&ao):
134133
void Plane::calculate() {
135134

136135
if(pbc) makeWhole();
137-
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
136+
calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
138137
setValue( value[0] );
139138
for(unsigned i=0; i<derivs[0].size(); ++i) setAtomsDerivatives( i, derivs[0][i] );
140139
setBoxDerivatives( virial[0] );
141140
}
142141

143-
void Plane::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
144-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
142+
void Plane::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
145143
Vector d1=delta( cvin.pos[1], cvin.pos[0] );
146144
Vector d2=delta( cvin.pos[2], cvin.pos[3] );
147145
Vector cp = crossProduct( d1, d2 );

src/colvar/Position.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ class Position : public Colvar {
103103
static unsigned getModeAndSetupValues( ActionWithValue* av );
104104
// active methods:
105105
void calculate() override;
106-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
107-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
106+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
108107
};
109108

110109
typedef ColvarShortcut<Position> PositionShortcut;
@@ -184,7 +183,7 @@ void Position::calculate() {
184183
}
185184

186185
if(scaled_components) {
187-
calculateCV( ColvarInput::createColvarInput( 1, distance, this ), value, derivs, virial, this );
186+
calculateCV( ColvarInput::createColvarInput( 1, distance, this ), value, derivs, virial );
188187
Value* valuea=getPntrToComponent("a");
189188
Value* valueb=getPntrToComponent("b");
190189
Value* valuec=getPntrToComponent("c");
@@ -195,7 +194,7 @@ void Position::calculate() {
195194
setAtomsDerivatives (valuec,0,derivs[2][0]);
196195
valuec->set(value[2]);
197196
} else {
198-
calculateCV( ColvarInput::createColvarInput( 0, distance, this ), value, derivs, virial, this );
197+
calculateCV( ColvarInput::createColvarInput( 0, distance, this ), value, derivs, virial );
199198
Value* valuex=getPntrToComponent("x");
200199
Value* valuey=getPntrToComponent("y");
201200
Value* valuez=getPntrToComponent("z");
@@ -214,14 +213,13 @@ void Position::calculate() {
214213
}
215214
}
216215

217-
void Position::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
218-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
216+
void Position::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
219217
if( cvin.mode==1 ) {
220-
Vector d=aa->getPbc().realToScaled(cvin.pos[0]);
218+
Vector d=cvin.pbc.realToScaled(cvin.pos[0]);
221219
vals[0]=Tools::pbc(d[0]); vals[1]=Tools::pbc(d[1]); vals[2]=Tools::pbc(d[2]);
222-
derivs[0][0]=matmul(aa->getPbc().getInvBox(),Vector(+1,0,0));
223-
derivs[1][0]=matmul(aa->getPbc().getInvBox(),Vector(0,+1,0));
224-
derivs[2][0]=matmul(aa->getPbc().getInvBox(),Vector(0,0,+1));
220+
derivs[0][0]=matmul(cvin.pbc.getInvBox(),Vector(+1,0,0));
221+
derivs[1][0]=matmul(cvin.pbc.getInvBox(),Vector(0,+1,0));
222+
derivs[2][0]=matmul(cvin.pbc.getInvBox(),Vector(0,0,+1));
225223
} else {
226224
for(unsigned i=0; i<3; ++i) vals[i]=cvin.pos[0][i];
227225
derivs[0][0]=Vector(+1,0,0); derivs[1][0]=Vector(0,+1,0); derivs[2][0]=Vector(0,0,+1);

src/colvar/SelectMassCharge.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ Get the mass of one or multiple atoms
8080
namespace PLMD {
8181
namespace colvar {
8282

83-
class SelectMassCharge :
84-
public ActionAtomistic,
85-
public ActionWithValue {
83+
class SelectMassCharge :
84+
public ActionAtomistic,
85+
public ActionWithValue {
8686
public:
8787
static void registerKeywords( Keywords& keys );
8888
explicit SelectMassCharge(const ActionOptions&);
@@ -112,13 +112,13 @@ SelectMassCharge::SelectMassCharge(const ActionOptions&ao):
112112
std::vector<AtomNumber> atoms; parseAtomList("ATOMS",atoms);
113113
log.printf(" getting %s of atoms : ", getName().c_str() );
114114
for(unsigned i=0; i<atoms.size(); ++i) {
115-
std::pair<std::size_t,std::size_t> p = getValueIndices( atoms[i] );
116-
if( getName()=="MASS" && !masv[p.first]->isConstant() ) error("cannot deal with non-constant " + getName() + " values");
117-
if( getName()=="CHARGE" && !chargev[p.first]->isConstant() ) error("cannot deal with non-constant " + getName() + " values");
118-
log.printf("%d ", atoms[i].serial() );
115+
std::pair<std::size_t,std::size_t> p = getValueIndices( atoms[i] );
116+
if( getName()=="MASS" && !masv[p.first]->isConstant() ) error("cannot deal with non-constant " + getName() + " values");
117+
if( getName()=="CHARGE" && !chargev[p.first]->isConstant() ) error("cannot deal with non-constant " + getName() + " values");
118+
log.printf("%d ", atoms[i].serial() );
119119
}
120120
log.printf("\n"); requestAtoms(atoms);
121-
std::vector<unsigned> shape(1);
121+
std::vector<unsigned> shape(1);
122122
if(atoms.size()==1) shape.resize(0);
123123
else shape[0] = atoms.size();
124124
addValue( shape ); setNotPeriodic();
@@ -127,13 +127,13 @@ SelectMassCharge::SelectMassCharge(const ActionOptions&ao):
127127

128128
// calculator
129129
void SelectMassCharge::calculate() {
130-
Value* myval = getPntrToComponent(0);
131-
if( getName()=="CHARGES" ) {
132-
if( !chargesWereSet ) error("cannot determine charges are charges were not set");
133-
for(unsigned i=0; i<getNumberOfAtoms(); ++i) myval->set( i, getCharge(i) );
134-
} else {
135-
for(unsigned i=0; i<getNumberOfAtoms(); ++i) myval->set( i, getMass(i) );
136-
}
130+
Value* myval = getPntrToComponent(0);
131+
if( getName()=="CHARGES" ) {
132+
if( !chargesWereSet ) error("cannot determine charges are charges were not set");
133+
for(unsigned i=0; i<getNumberOfAtoms(); ++i) myval->set( i, getCharge(i) );
134+
} else {
135+
for(unsigned i=0; i<getNumberOfAtoms(); ++i) myval->set( i, getMass(i) );
136+
}
137137
}
138138

139139
}

src/colvar/Torsion.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ class Torsion : public Colvar {
119119
static unsigned getModeAndSetupValues( ActionWithValue* av );
120120
// active methods:
121121
void calculate() override;
122-
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
123-
std::vector<Tensor>& virial, const ActionAtomistic* aa );
122+
static void calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial );
124123
static void registerKeywords(Keywords& keys);
125124
};
126125

@@ -224,14 +223,13 @@ unsigned Torsion::getModeAndSetupValues( ActionWithValue* av ) {
224223
// calculator
225224
void Torsion::calculate() {
226225
if(pbc) makeWhole();
227-
if(do_cosine) calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial, this );
228-
else calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial, this );
226+
if(do_cosine) calculateCV( ColvarInput::createColvarInput( 1, getPositions(), this ), value, derivs, virial );
227+
else calculateCV( ColvarInput::createColvarInput( 0, getPositions(), this ), value, derivs, virial );
229228
for(unsigned i=0; i<6; ++i) setAtomsDerivatives(i,derivs[0][i] );
230229
setValue(value[0]); setBoxDerivatives( virial[0] );
231230
}
232231

233-
void Torsion::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs,
234-
std::vector<Tensor>& virial, const ActionAtomistic* aa ) {
232+
void Torsion::calculateCV( const ColvarInput& cvin, std::vector<double>& vals, std::vector<std::vector<Vector> >& derivs, std::vector<Tensor>& virial ) {
235233
Vector d0=delta(cvin.pos[1],cvin.pos[0]);
236234
Vector d1=delta(cvin.pos[3],cvin.pos[2]);
237235
Vector d2=delta(cvin.pos[5],cvin.pos[4]);

0 commit comments

Comments
 (0)