@@ -35,7 +35,7 @@ class Gyration : public Colvar {
3535// The number of types of gyration are defined here
3636// The enum then contains double the number of types defined here as you can do every one of them with
3737// masses as weights or with unit weights
38- static constexpr unsigned NUMBER_OF_GYRATION_TYPES = 11 ;
38+ static constexpr unsigned NUMBER_OF_GYRATION_TYPES = 11 ;
3939 enum CV_TYPE :unsigned {RADIUS =0 , TRACE =1 , GTPC_1 =2 , GTPC_2 =3 , GTPC_3 =4 , ASPHERICITY =5 , ACYLINDRICITY =6 , KAPPA2 =7 , GYRATION_3 =8 , GYRATION_2 =9 , GYRATION_1 =10 ,
4040 RADIUS_MASS =NUMBER_OF_GYRATION_TYPES +RADIUS ,TRACE_MASS =NUMBER_OF_GYRATION_TYPES +TRACE ,
4141 GTPC_1_MASS =NUMBER_OF_GYRATION_TYPES +GTPC_1 , GTPC_2_MASS =NUMBER_OF_GYRATION_TYPES +GTPC_2 , GTPC_3_MASS =NUMBER_OF_GYRATION_TYPES +GTPC_3 ,
@@ -219,17 +219,17 @@ void Gyration<T>::calculate() {
219219template <typename T>
220220void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvout ) {
221221
222- Vector com;
222+ VectorTyped<T, 3 > com;
223223 T totmass = 0 .;
224224 if ( cvin.mode >=NUMBER_OF_GYRATION_TYPES ) {
225225 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
226226 totmass+=cvin.mass [i];
227- com+=cvin.mass [i]*Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]);
227+ com+=cvin.mass [i]*VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]);
228228 }
229229 } else {
230230 totmass = static_cast <T>(cvin.pos .size ());
231231 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
232- com+=Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]);
232+ com+=VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]);
233233 }
234234 }
235235 com /= totmass;
@@ -239,13 +239,13 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
239239 if (cvin.mode ==CV_TYPE ::RADIUS ||cvin.mode ==CV_TYPE ::TRACE ||cvin.mode ==CV_TYPE ::RADIUS_MASS ||cvin.mode ==CV_TYPE ::TRACE_MASS ) {
240240 if ( cvin.mode >=NUMBER_OF_GYRATION_TYPES ) {
241241 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
242- auto diff = delta ( com, Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
242+ auto diff = delta ( com, VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
243243 rgyr += cvin.mass [i]*diff.modulo2 ();
244244 cvout.derivs [0 ][i] = cvin.mass [i]*diff;
245245 }
246246 } else {
247247 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
248- const Vector diff = delta ( com, Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
248+ const VectorTyped<T, 3 > diff = delta ( com, VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
249249 rgyr += diff.modulo2 ();
250250 cvout.derivs [0 ][i] = diff;
251251 }
@@ -269,11 +269,11 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
269269 }
270270
271271
272- Tensor3d gyr_tens;
272+ TensorTyped<T, 3 , 3 > gyr_tens;
273273 // calculate gyration tensor
274274 if ( cvin.mode >=NUMBER_OF_GYRATION_TYPES ) {
275275 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
276- const Vector diff=delta ( com, Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
276+ const VectorTyped<T, 3 > diff=delta ( com, VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
277277 gyr_tens[0 ][0 ]+=cvin.mass [i]*diff[0 ]*diff[0 ];
278278 gyr_tens[1 ][1 ]+=cvin.mass [i]*diff[1 ]*diff[1 ];
279279 gyr_tens[2 ][2 ]+=cvin.mass [i]*diff[2 ]*diff[2 ];
@@ -283,7 +283,7 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
283283 }
284284 } else {
285285 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
286- const Vector diff=delta ( com, Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
286+ const VectorTyped<T, 3 > diff=delta ( com, VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
287287 gyr_tens[0 ][0 ]+=diff[0 ]*diff[0 ];
288288 gyr_tens[1 ][1 ]+=diff[1 ]*diff[1 ];
289289 gyr_tens[2 ][2 ]+=diff[2 ]*diff[2 ];
@@ -297,8 +297,8 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
297297 gyr_tens[1 ][0 ] = gyr_tens[0 ][1 ];
298298 gyr_tens[2 ][0 ] = gyr_tens[0 ][2 ];
299299 gyr_tens[2 ][1 ] = gyr_tens[1 ][2 ];
300- Tensor3d ttransf,transf;
301- Vector princ_comp,prefactor;
300+ TensorTyped<T, 3 , 3 > ttransf,transf;
301+ VectorTyped<T, 3 > princ_comp,prefactor;
302302 // diagonalize gyration tensor
303303 diagMatSym (gyr_tens, princ_comp, ttransf);
304304 transf=transpose (ttransf);
@@ -358,7 +358,7 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
358358 case GTPC_1_MASS :
359359 case GTPC_2_MASS :
360360 case GTPC_3_MASS : {
361- int pc_index = cvin.mode -2 ; // index of principal component
361+ unsigned pc_index = cvin.mode -2 ; // index of principal component
362362 if ( pc_index>=NUMBER_OF_GYRATION_TYPES ) {
363363 pc_index = pc_index - NUMBER_OF_GYRATION_TYPES ;
364364 }
@@ -436,8 +436,8 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
436436
437437 if ( cvin.mode >=NUMBER_OF_GYRATION_TYPES ) {
438438 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
439- Vector tX;
440- const Vector diff=delta ( com,Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
439+ VectorTyped<T, 3 > tX;
440+ const VectorTyped<T, 3 > diff=delta ( com,VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
441441 // project atomic postional vectors to diagonalized frame
442442 for (unsigned j=0 ; j<3 ; j++) {
443443 tX[j]=transf[0 ][j]*diff[0 ]+transf[1 ][j]*diff[1 ]+transf[2 ][j]*diff[2 ];
@@ -449,8 +449,8 @@ void Gyration<T>::calculateCV( const ColvarInput<T>& cvin, ColvarOutput<T>& cvou
449449 }
450450 } else {
451451 for (unsigned i=0 ; i<cvin.pos .size (); i++) {
452- Vector tX;
453- const Vector diff=delta ( com, Vector (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
452+ VectorTyped<T, 3 > tX;
453+ const VectorTyped<T, 3 > diff=delta ( com, VectorTyped<T, 3 > (cvin.pos [i][0 ],cvin.pos [i][1 ],cvin.pos [i][2 ]) );
454454 // project atomic postional vectors to diagonalized frame
455455 for (unsigned j=0 ; j<3 ; j++) {
456456 tX[j]=transf[0 ][j]*diff[0 ]+transf[1 ][j]*diff[1 ]+transf[2 ][j]*diff[2 ];
0 commit comments