Collective Variables Module - Developer Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
colvarcomp.h
1 // -*- c++ -*-
2 
3 #ifndef COLVARCOMP_H
4 #define COLVARCOMP_H
5 
6 // Declaration of colvar::cvc base class and derived ones.
7 //
8 // Future cvc's could be declared on additional header files.
9 // After the declaration of a new derived class, its metric
10 // functions must be reimplemented as well.
11 // If the new cvc has no symmetry or periodicity,
12 // this can be done straightforwardly by using the macro:
13 // simple_scalar_dist_functions (derived_class)
14 
15 
16 #include <fstream>
17 #include <cmath>
18 
19 
20 #include "colvarmodule.h"
21 #include "colvar.h"
22 #include "colvaratoms.h"
23 
24 
62 
64  : public colvarparse, public colvardeps
65 {
66 public:
67 
70  std::string name;
71 
80  std::string function_type;
81 
85  int sup_np;
86 
88  bool b_periodic;
89 
92 
95 
102  cvc(std::string const &conf);
103 
107  cvm::atom_group *parse_group(std::string const &conf,
108  char const *group_key,
109  bool optional = false);
110 
112  virtual int init_total_force_params(std::string const &conf);
113 
115  int setup();
116 
119  cvc();
120 
122  virtual ~cvc();
123 
125  static std::vector<feature *> cvc_features;
126 
128  virtual std::vector<feature *> &features() {
129  return cvc_features;
130  }
131 
133  virtual void read_data();
134 
136  virtual void calc_value() = 0;
137 
140  virtual void calc_gradients() = 0;
141 
143  virtual void debug_gradients(cvm::atom_group *group);
144 
147  virtual void calc_force_invgrads();
148 
150  virtual void calc_Jacobian_derivative();
151 
152 
154  colvarvalue const & value() const;
155 
157  colvarvalue const & total_force() const;
158 
161  colvarvalue const & Jacobian_derivative() const;
162 
172  virtual void apply_force(colvarvalue const &cvforce) = 0;
173 
202  virtual cvm::real dist2(colvarvalue const &x1,
203  colvarvalue const &x2) const;
204 
208  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
209  colvarvalue const &x2) const;
210 
214  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
215  colvarvalue const &x2) const;
216 
218  virtual void wrap(colvarvalue &x) const;
219 
222  std::vector<cvm::atom_group *> atom_groups;
223 
226 
227 protected:
228 
231 
234 
240 
244 };
245 
246 
247 inline colvarvalue const & colvar::cvc::value() const
248 {
249  return x;
250 }
251 
252 
253 inline colvarvalue const & colvar::cvc::total_force() const
254 {
255  return ft;
256 }
257 
258 
260 {
261  return jd;
262 }
263 
264 
265 
268 
270  : public colvar::cvc
271 {
272 protected:
280  bool b_no_PBC;
281 public:
282  distance(std::string const &conf);
283  distance();
284  virtual ~distance() {}
285  virtual void calc_value();
286  virtual void calc_gradients();
287  virtual void calc_force_invgrads();
288  virtual void calc_Jacobian_derivative();
289  virtual void apply_force(colvarvalue const &force);
290  virtual cvm::real dist2(colvarvalue const &x1,
291  colvarvalue const &x2) const;
292  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
293  colvarvalue const &x2) const;
294  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
295  colvarvalue const &x2) const;
296 };
297 
298 
299 
300 // \brief Colvar component: distance vector between centers of mass
301 // of two groups (\link colvarvalue::type_3vector \endlink type,
302 // range (-*:*)x(-*:*)x(-*:*))
304  : public colvar::distance
305 {
306 public:
307  distance_vec(std::string const &conf);
308  distance_vec();
309  virtual ~distance_vec() {}
310  virtual void calc_value();
311  virtual void calc_gradients();
312  virtual void apply_force(colvarvalue const &force);
314  virtual cvm::real dist2(colvarvalue const &x1,
315  colvarvalue const &x2) const;
317  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
318  colvarvalue const &x2) const;
320  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
321  colvarvalue const &x2) const;
322 };
323 
324 
325 
330  : public colvar::distance
331 {
332 public:
333  distance_dir(std::string const &conf);
334  distance_dir();
335  virtual ~distance_dir() {}
336  virtual void calc_value();
337  virtual void calc_gradients();
338  virtual void apply_force(colvarvalue const &force);
340  virtual cvm::real dist2(colvarvalue const &x1,
341  colvarvalue const &x2) const;
343  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
344  colvarvalue const &x2) const;
346  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
347  colvarvalue const &x2) const;
348 };
349 
350 
351 
355  : public colvar::cvc
356 {
357 protected:
365  bool b_no_PBC;
374 public:
375  distance_z(std::string const &conf);
376  distance_z();
377  virtual ~distance_z() {}
378  virtual void calc_value();
379  virtual void calc_gradients();
380  virtual void calc_force_invgrads();
381  virtual void calc_Jacobian_derivative();
382  virtual void apply_force(colvarvalue const &force);
383  virtual cvm::real dist2(colvarvalue const &x1,
384  colvarvalue const &x2) const;
385  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
386  colvarvalue const &x2) const;
387  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
388  colvarvalue const &x2) const;
390  virtual void wrap(colvarvalue &x) const;
391 };
392 
393 
394 
398  : public colvar::distance_z
399 {
400 protected:
405 public:
406  distance_xy(std::string const &conf);
407  distance_xy();
408  virtual ~distance_xy() {}
409  virtual void calc_value();
410  virtual void calc_gradients();
411  virtual void calc_force_invgrads();
412  virtual void calc_Jacobian_derivative();
413  virtual void apply_force(colvarvalue const &force);
414  virtual cvm::real dist2(colvarvalue const &x1,
415  colvarvalue const &x2) const;
416  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
417  colvarvalue const &x2) const;
418  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
419  colvarvalue const &x2) const;
420 };
421 
422 
423 
427  : public colvar::distance
428 {
429 protected:
431  int exponent;
432 public:
433  distance_inv(std::string const &conf);
434  distance_inv();
435  virtual ~distance_inv() {}
436  virtual void calc_value();
437  virtual void calc_gradients();
438  virtual void apply_force(colvarvalue const &force);
439  virtual cvm::real dist2(colvarvalue const &x1,
440  colvarvalue const &x2) const;
441  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
442  colvarvalue const &x2) const;
443  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
444  colvarvalue const &x2) const;
445 };
446 
447 
448 
452  : public colvar::cvc
453 {
454 protected:
460  bool b_no_PBC;
461 public:
462  distance_pairs(std::string const &conf);
463  distance_pairs();
464  virtual ~distance_pairs() {}
465  virtual void calc_value();
466  virtual void calc_gradients();
467  virtual void apply_force(colvarvalue const &force);
468 };
469 
470 
471 
475  : public colvar::cvc
476 {
477 protected:
480 public:
482  gyration(std::string const &conf);
483  gyration();
484  virtual ~gyration() {}
485  virtual void calc_value();
486  virtual void calc_gradients();
487  virtual void calc_force_invgrads();
488  virtual void calc_Jacobian_derivative();
489  virtual void apply_force(colvarvalue const &force);
490  virtual cvm::real dist2(colvarvalue const &x1,
491  colvarvalue const &x2) const;
492  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
493  colvarvalue const &x2) const;
494  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
495  colvarvalue const &x2) const;
496 };
497 
498 
499 
503  : public colvar::gyration
504 {
505 public:
507  inertia(std::string const &conf);
508  inertia();
509  virtual ~inertia() {}
510  virtual void calc_value();
511  virtual void calc_gradients();
512  virtual void apply_force(colvarvalue const &force);
513  virtual cvm::real dist2(colvarvalue const &x1,
514  colvarvalue const &x2) const;
515  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
516  colvarvalue const &x2) const;
517  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
518  colvarvalue const &x2) const;
519 };
520 
521 
522 
526  : public colvar::inertia
527 {
528 protected:
531 public:
533  inertia_z(std::string const &conf);
534  inertia_z();
535  virtual ~inertia_z() {}
536  virtual void calc_value();
537  virtual void calc_gradients();
538  virtual void apply_force(colvarvalue const &force);
539  virtual cvm::real dist2(colvarvalue const &x1,
540  colvarvalue const &x2) const;
541  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
542  colvarvalue const &x2) const;
543  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
544  colvarvalue const &x2) const;
545 };
546 
547 
548 
552  : public colvar::cvc
553 {
554 protected:
555 
558 
560  std::vector<cvm::atom_pos> ref_pos;
561 
564 
566  std::vector<cvm::rvector> eigenvec;
567 
570 
571 public:
572 
574  eigenvector(std::string const &conf);
575  virtual ~eigenvector() {}
576  virtual void calc_value();
577  virtual void calc_gradients();
578  virtual void calc_force_invgrads();
579  virtual void calc_Jacobian_derivative();
580  virtual void apply_force(colvarvalue const &force);
581  virtual cvm::real dist2(colvarvalue const &x1,
582  colvarvalue const &x2) const;
583  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
584  colvarvalue const &x2) const;
585  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
586  colvarvalue const &x2) const;
587 };
588 
589 
590 
594  : public colvar::cvc
595 {
596 protected:
597 
604 
611 
616 public:
617 
619  angle(std::string const &conf);
621  angle(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3);
622  angle();
623  virtual ~angle() {}
624  virtual void calc_value();
625  virtual void calc_gradients();
626  virtual void calc_force_invgrads();
627  virtual void calc_Jacobian_derivative();
628  virtual void apply_force(colvarvalue const &force);
629  virtual cvm::real dist2(colvarvalue const &x1,
630  colvarvalue const &x2) const;
631  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
632  colvarvalue const &x2) const;
633  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
634  colvarvalue const &x2) const;
635 };
636 
637 
638 
642  : public colvar::cvc
643 {
644 protected:
645 
652 
659 
664 public:
665 
667  dipole_angle (std::string const &conf);
669  dipole_angle (cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3);
670  dipole_angle();
671  virtual ~dipole_angle() {}
672  virtual void calc_value();
673  virtual void calc_gradients();
674  virtual void apply_force (colvarvalue const &force);
675  virtual cvm::real dist2 (colvarvalue const &x1,
676  colvarvalue const &x2) const;
677  virtual colvarvalue dist2_lgrad (colvarvalue const &x1,
678  colvarvalue const &x2) const;
679  virtual colvarvalue dist2_rgrad (colvarvalue const &x1,
680  colvarvalue const &x2) const;
681 };
682 
683 
684 
688  : public colvar::cvc
689 {
690 protected:
691 
701  cvm::rvector r12, r23, r34;
702 
706 
707 public:
708 
710  dihedral(std::string const &conf);
712  dihedral(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3, cvm::atom const &a4);
713  dihedral();
714  virtual ~dihedral() {}
715  virtual void calc_value();
716  virtual void calc_gradients();
717  virtual void calc_force_invgrads();
718  virtual void calc_Jacobian_derivative();
719  virtual void apply_force(colvarvalue const &force);
720 
722  virtual cvm::real dist2(colvarvalue const &x1,
723  colvarvalue const &x2) const;
725  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
726  colvarvalue const &x2) const;
728  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
729  colvarvalue const &x2) const;
731  virtual void wrap(colvarvalue &x) const;
732 };
733 
734 
735 
739  : public colvar::cvc
740 {
741 protected:
754  int en;
756  int ed;
760 public:
762  coordnum(std::string const &conf);
763  coordnum();
764  virtual ~coordnum() {}
765  virtual void calc_value();
766  virtual void calc_gradients();
767  virtual void apply_force(colvarvalue const &force);
768  template<bool b_gradients>
774  int const &exp_num, int const &exp_den,
775  cvm::atom &A1, cvm::atom &A2);
776 
777  template<bool b_gradients>
784  int const &exp_num, int const &exp_den,
785  cvm::atom &A1, cvm::atom &A2);
786 
787  virtual cvm::real dist2(colvarvalue const &x1,
788  colvarvalue const &x2) const;
789  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
790  colvarvalue const &x2) const;
791  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
792  colvarvalue const &x2) const;
793 };
794 
795 
796 
800  : public colvar::cvc
801 {
802 protected:
808  int en;
810  int ed;
811 public:
813  selfcoordnum(std::string const &conf);
814  selfcoordnum();
815  virtual ~selfcoordnum() {}
816  virtual void calc_value();
817  virtual void calc_gradients();
818  virtual void apply_force(colvarvalue const &force);
819  template<bool b_gradients>
825  int const &exp_num, int const &exp_den,
826  cvm::atom &A1, cvm::atom &A2);
827 
828  virtual cvm::real dist2(colvarvalue const &x1,
829  colvarvalue const &x2) const;
830  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
831  colvarvalue const &x2) const;
832  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
833  colvarvalue const &x2) const;
834 };
835 
836 
837 
841  : public colvar::distance
842 {
843 protected:
852  int en;
854  int ed;
855 public:
857  groupcoordnum(std::string const &conf);
858  groupcoordnum();
859  virtual ~groupcoordnum() {}
860  virtual void calc_value();
861  virtual void calc_gradients();
862  virtual void apply_force(colvarvalue const &force);
863  template<bool b_gradients>
869  int const &exp_num, int const &exp_den,
870  cvm::atom &A1, cvm::atom &A2);
871 
872  /*
873  template<bool b_gradients>
879  static cvm::real switching_function(cvm::rvector const &r0_vec,
880  int const &exp_num, int const &exp_den,
881  cvm::atom &A1, cvm::atom &A2);
882  */
883 
884  virtual cvm::real dist2(colvarvalue const &x1,
885  colvarvalue const &x2) const;
886  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
887  colvarvalue const &x2) const;
888  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
889  colvarvalue const &x2) const;
890 };
891 
892 
893 
898  : public colvar::cvc
899 {
900 protected:
904  int en;
906  int ed;
907 public:
908  h_bond(std::string const &conf);
910  h_bond(cvm::atom const &acceptor,
911  cvm::atom const &donor,
912  cvm::real r0, int en, int ed);
913  h_bond();
914  virtual ~h_bond();
915  virtual void calc_value();
916  virtual void calc_gradients();
917  virtual void apply_force(colvarvalue const &force);
918 
919  virtual cvm::real dist2(colvarvalue const &x1,
920  colvarvalue const &x2) const;
921  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
922  colvarvalue const &x2) const;
923  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
924  colvarvalue const &x2) const;
925 };
926 
927 
928 
933 // class colvar::alpha_dihedrals
934 // : public colvar::cvc
935 // {
936 // protected:
937 
938 // /// Alpha-helical reference phi value
939 // cvm::real phi_ref;
940 
941 // /// Alpha-helical reference psi value
942 // cvm::real psi_ref;
943 
944 // /// List of phi dihedral angles
945 // std::vector<dihedral *> phi;
946 
947 // /// List of psi dihedral angles
948 // std::vector<dihedral *> psi;
949 
950 // /// List of hydrogen bonds
951 // std::vector<h_bond *> hb;
952 
953 // public:
954 
955 // alpha_dihedrals (std::string const &conf);
956 // alpha_dihedrals();
957 // virtual ~alpha_dihedrals() {}
958 // virtual void calc_value();
959 // virtual void calc_gradients();
960 // virtual void apply_force (colvarvalue const &force);
961 // virtual cvm::real dist2 (colvarvalue const &x1,
962 // colvarvalue const &x2) const;
963 // virtual colvarvalue dist2_lgrad (colvarvalue const &x1,
964 // colvarvalue const &x2) const;
965 // virtual colvarvalue dist2_rgrad (colvarvalue const &x1,
966 // colvarvalue const &x2) const;
967 // };
968 
969 
970 
976  : public colvar::cvc
977 {
978 protected:
979 
982 
985 
987  std::vector<angle *> theta;
988 
990  std::vector<h_bond *> hb;
991 
994 
995 public:
996 
997  alpha_angles(std::string const &conf);
998  alpha_angles();
999  virtual ~alpha_angles();
1000  void calc_value();
1001  void calc_gradients();
1002  void apply_force(colvarvalue const &force);
1003  virtual cvm::real dist2(colvarvalue const &x1,
1004  colvarvalue const &x2) const;
1005  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1006  colvarvalue const &x2) const;
1007  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1008  colvarvalue const &x2) const;
1009 };
1010 
1011 
1012 
1018  : public colvar::cvc
1019 {
1020 protected:
1021 
1022  std::vector<dihedral *> theta;
1023  std::vector<cvm::real> coeffs;
1024 
1025 public:
1026 
1027  dihedPC(std::string const &conf);
1028  dihedPC();
1029  virtual ~dihedPC();
1030  void calc_value();
1031  void calc_gradients();
1032  void apply_force(colvarvalue const &force);
1033  virtual cvm::real dist2(colvarvalue const &x1,
1034  colvarvalue const &x2) const;
1035  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1036  colvarvalue const &x2) const;
1037  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1038  colvarvalue const &x2) const;
1039 };
1040 
1041 
1042 
1048  : public colvar::cvc
1049 {
1050 protected:
1051 
1056 
1058  std::vector<cvm::atom_pos> ref_pos;
1059 
1062 
1066 
1067 public:
1068 
1069  orientation(std::string const &conf);
1070  orientation();
1071  virtual ~orientation() {}
1072  virtual void calc_value();
1073  virtual void calc_gradients();
1074  virtual void apply_force(colvarvalue const &force);
1075  virtual cvm::real dist2(colvarvalue const &x1,
1076  colvarvalue const &x2) const;
1077  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1078  colvarvalue const &x2) const;
1079  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1080  colvarvalue const &x2) const;
1081 };
1082 
1083 
1084 
1089  : public colvar::orientation
1090 {
1091 public:
1092 
1093  orientation_angle(std::string const &conf);
1095  virtual ~orientation_angle() {}
1096  virtual void calc_value();
1097  virtual void calc_gradients();
1098  virtual void apply_force(colvarvalue const &force);
1099  virtual cvm::real dist2(colvarvalue const &x1,
1100  colvarvalue const &x2) const;
1101  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1102  colvarvalue const &x2) const;
1103  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1104  colvarvalue const &x2) const;
1105 };
1106 
1107 
1108 
1113  : public colvar::orientation
1114 {
1115 public:
1116 
1117  orientation_proj(std::string const &conf);
1118  orientation_proj();
1119  virtual ~orientation_proj() {}
1120  virtual void calc_value();
1121  virtual void calc_gradients();
1122  virtual void apply_force(colvarvalue const &force);
1123  virtual cvm::real dist2(colvarvalue const &x1,
1124  colvarvalue const &x2) const;
1125  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1126  colvarvalue const &x2) const;
1127  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1128  colvarvalue const &x2) const;
1129 };
1130 
1131 
1132 
1136  : public colvar::orientation
1137 {
1138 protected:
1139 
1140  cvm::rvector axis;
1141 
1142 public:
1143 
1144  tilt(std::string const &conf);
1145  tilt();
1146  virtual ~tilt() {}
1147  virtual void calc_value();
1148  virtual void calc_gradients();
1149  virtual void apply_force(colvarvalue const &force);
1150  virtual cvm::real dist2(colvarvalue const &x1,
1151  colvarvalue const &x2) const;
1152  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1153  colvarvalue const &x2) const;
1154  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1155  colvarvalue const &x2) const;
1156 };
1157 
1158 
1159 
1163  : public colvar::orientation
1164 {
1165 protected:
1166 
1167  cvm::rvector axis;
1168 
1169 public:
1170 
1171  spin_angle(std::string const &conf);
1172  spin_angle();
1173  virtual ~spin_angle() {}
1174  virtual void calc_value();
1175  virtual void calc_gradients();
1176  virtual void apply_force(colvarvalue const &force);
1178  virtual cvm::real dist2(colvarvalue const &x1,
1179  colvarvalue const &x2) const;
1181  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1182  colvarvalue const &x2) const;
1184  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1185  colvarvalue const &x2) const;
1187  virtual void wrap(colvarvalue &x) const;
1188 };
1189 
1190 
1191 
1197  : public colvar::cvc
1198 {
1199 protected:
1200 
1203 
1205  std::vector<cvm::atom_pos> ref_pos;
1206 
1207 public:
1208 
1210  rmsd(std::string const &conf);
1211  virtual ~rmsd() {}
1212  virtual void calc_value();
1213  virtual void calc_gradients();
1214  virtual void calc_force_invgrads();
1215  virtual void calc_Jacobian_derivative();
1216  virtual void apply_force(colvarvalue const &force);
1217  virtual cvm::real dist2(colvarvalue const &x1,
1218  colvarvalue const &x2) const;
1219  virtual colvarvalue dist2_lgrad(colvarvalue const &x1,
1220  colvarvalue const &x2) const;
1221  virtual colvarvalue dist2_rgrad(colvarvalue const &x1,
1222  colvarvalue const &x2) const;
1223 };
1224 
1225 
1226 
1227 // \brief Colvar component: flat vector of Cartesian coordinates
1228 // Mostly useful to compute scripted colvar values
1230  : public colvar::cvc
1231 {
1232 protected:
1236  std::vector<size_t> axes;
1237 public:
1238  cartesian(std::string const &conf);
1239  cartesian();
1240  virtual ~cartesian() {}
1241  virtual void calc_value();
1242  virtual void calc_gradients();
1243  virtual void apply_force(colvarvalue const &force);
1244 };
1245 
1246 
1247 // metrics functions for cvc implementations
1248 
1249 // simple definitions of the distance functions; these are useful only
1250 // for optimization (the type check performed in the default
1251 // colvarcomp functions is skipped)
1252 
1253 // definitions assuming the scalar type
1254 
1255 #define simple_scalar_dist_functions(TYPE) \
1256  \
1257  \
1258  cvm::real colvar::TYPE::dist2(colvarvalue const &x1, \
1259  colvarvalue const &x2) const \
1260  { \
1261  return (x1.real_value - x2.real_value)*(x1.real_value - x2.real_value); \
1262  } \
1263  \
1264  \
1265  colvarvalue colvar::TYPE::dist2_lgrad(colvarvalue const &x1, \
1266  colvarvalue const &x2) const \
1267  { \
1268  return 2.0 * (x1.real_value - x2.real_value); \
1269  } \
1270  \
1271  \
1272  colvarvalue colvar::TYPE::dist2_rgrad(colvarvalue const &x1, \
1273  colvarvalue const &x2) const \
1274  { \
1275  return this->dist2_lgrad(x2, x1); \
1276  } \
1277  \
1278 
1279 #endif
Colvar component: average distance between two groups of atoms, weighted as the sixth power...
Definition: colvarcomp.h:426
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_rotations.cpp:392
Colvar component: moment of inertia of an atom group (colvarvalue::type_scalar type, range [0:*))
Definition: colvarcomp.h:502
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_rotations.cpp:191
virtual void calc_value()=0
Calculate the variable.
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_angles.cpp:199
int en
Integer exponent of the function numerator.
Definition: colvarcomp.h:904
1-dimensional vector of real numbers with four components and a quaternion algebra ...
Definition: colvartypes.h:1025
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:298
cvm::rvector r0_vec
"Cutoff vector" for anisotropic calculation
Definition: colvarcomp.h:847
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:58
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
bool b_try_scalable
Whether or not this CVC will be computed in parallel whenever possible.
Definition: colvarcomp.h:225
virtual void wrap(colvarvalue &x) const
Redefined to make use of the user-provided period.
Definition: colvarcomp_distances.cpp:348
bool b_periodic
Is this a periodic component?
Definition: colvarcomp.h:88
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
int ed
Integer exponent of the function denominator.
Definition: colvarcomp.h:810
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::real axis_norm
Norm of the axis.
Definition: colvarcomp.h:369
cvm::atom_group * group2
Atom group.
Definition: colvarcomp.h:649
bool b_no_PBC
Use absolute positions, ignoring PBCs when present.
Definition: colvarcomp.h:280
cvm::atom_group * atoms
Atom group.
Definition: colvarcomp.h:1202
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_angles.cpp:312
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp_distances.cpp:336
Colvar component: hydrogen bond, defined as the product of a colvar::coordnum and 1/2*(1-cos((180-ang...
Definition: colvarcomp.h:897
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
Colvar component: orientation in space of an atom group, with respect to a set of reference coordinat...
Definition: colvarcomp.h:1047
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:833
std::vector< angle * > theta
List of Calpha-Calpha angles.
Definition: colvarcomp.h:987
Definition: colvarcomp.h:303
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_angles.cpp:474
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_rotations.cpp:298
std::vector< size_t > axes
Which Cartesian coordinates to include.
Definition: colvarcomp.h:1236
cvm::atom_group * group1
First atom group.
Definition: colvarcomp.h:743
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
cvm::rvector v12
Vector distances.
Definition: colvarcomp.h:404
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_protein.cpp:406
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:489
int ed
Integer exponent of the function denominator.
Definition: colvarcomp.h:906
cvm::real r0
"Cutoff" distance between acceptor and donor
Definition: colvarcomp.h:902
int ed
Integer exponent of the function denominator.
Definition: colvarcomp.h:756
int exponent
Components of the distance vector orthogonal to the axis.
Definition: colvarcomp.h:431
cvm::rvector r0_vec
"Cutoff vector" for anisotropic calculation
Definition: colvarcomp.h:749
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
cvm::atom_group * group1
First atom group.
Definition: colvarcomp.h:274
Stores numeric id, mass and all mutable data for an atom, mostly used by a cvc.
Definition: colvaratoms.h:20
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:632
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:1304
cvc()
Default constructor (used when cvc objects are declared within other ones)
Definition: colvarcomp.cpp:10
Colvar component: coordination number between two groups (colvarvalue::type_scalar type...
Definition: colvarcomp.h:738
cvm::atom_group * ref2
Optional, second ref atom group.
Definition: colvarcomp.h:363
void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_protein.cpp:398
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the box periodicity.
Definition: colvarcomp_distances.cpp:151
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp.cpp:305
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_coordnums.cpp:341
cvm::atom_group * main
Main atom group.
Definition: colvarcomp.h:359
virtual void wrap(colvarvalue &x) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_angles.cpp:492
static std::vector< feature * > cvc_features
Implementation of the feature list for colvar.
Definition: colvarcomp.h:125
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:887
colvarvalue jd
Calculated Jacobian derivative (divergence of the inverse gradients): serves to calculate the phase s...
Definition: colvarcomp.h:243
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_rotations.cpp:103
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:877
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:1422
cvm::rvector dxdr1
Derivatives wrt group centers of mass.
Definition: colvarcomp.h:610
Colvar component: cosine of the angle of rotation with respect to a set of reference coordinates (col...
Definition: colvarcomp.h:1112
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:46
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_rotations.cpp:178
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:760
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:229
cvm::real period
Period of this cvc value, (default: 0.0, non periodic)
Definition: colvarcomp.h:91
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:1442
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:511
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp.cpp:312
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:1321
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
bool b_no_PBC
Use absolute positions, ignoring PBCs when present.
Definition: colvarcomp.h:460
vector of real numbers with three components
Definition: colvartypes.h:709
cvm::rotation rot
Rotation object.
Definition: colvarcomp.h:1061
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:407
cvm::atom_group * group3
Atom group.
Definition: colvarcomp.h:603
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
bool b_1site_force
Definition: colvarcomp.h:663
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:670
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp.cpp:167
cvm::atom_group * atoms
Atoms involved.
Definition: colvarcomp.h:479
bool b_anisotropic
Wheter dist/r0 or {dist}*{1/r0_vec} should ne be used.
Definition: colvarcomp.h:850
cvm::atom_group * atoms
Atom group.
Definition: colvarcomp.h:1234
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_coordnums.cpp:332
virtual ~cvc()
Destructor.
Definition: colvarcomp.cpp:136
Colvar component: projection of the distance vector on a plane (colvarvalue::type_scalar type...
Definition: colvarcomp.h:397
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:116
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:1328
cvm::atom_group * group1
Dipole atom group.
Definition: colvarcomp.h:647
Colvar component: projection of the distance vector along an axis(colvarvalue::type_scalar type...
Definition: colvarcomp.h:354
virtual void read_data()
Obtain data needed for the calculation for the backend.
Definition: colvarcomp.cpp:145
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
cvm::rvector axis
Vector on which the inertia tensor is projected.
Definition: colvarcomp.h:530
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
cvm::real r0
"Cutoff" for isotropic calculation (default)
Definition: colvarcomp.h:806
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_coordnums.cpp:274
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the box periodicity.
Definition: colvarcomp_distances.cpp:144
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_rotations.cpp:88
cvm::atom_group * ref1
Reference atom group.
Definition: colvarcomp.h:361
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
Collective variables main module.
Colvar component: projection of the orientation vector onto a predefined axis (colvarvalue::type_scal...
Definition: colvarcomp.h:1135
cvm::real eigenvec_invnorm2
Inverse square norm of the eigenvector.
Definition: colvarcomp.h:569
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:134
Definition: colvarcomp.h:1229
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:85
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_rotations.cpp:164
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual void wrap(colvarvalue &x) const
Wrapp value (for periodic/symmetric cvcs)
Definition: colvarcomp.cpp:319
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:279
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::real r0
"Cutoff" for isotropic calculation (default)
Definition: colvarcomp.h:845
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_angles.cpp:409
cvm::rvector r21
Inter site vectors.
Definition: colvarcomp.h:606
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
bool b_1site_force
Compute total force on first site only to avoid unwanted coupling to other colvars (see e...
Definition: colvarcomp.h:705
cvm::atom_group * group3
Atom group.
Definition: colvarcomp.h:697
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_angles.cpp:447
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
Definition: colvarcomp_rotations.cpp:126
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_angles.cpp:465
cvm::rvector dist_v
Vector distance, cached to be recycled.
Definition: colvarcomp.h:371
Colvar component: moment of inertia of an atom group around a user-defined axis (colvarvalue::type_sc...
Definition: colvarcomp.h:525
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:1038
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
Colvar component: alpha helix content of a contiguous segment of 5 or more residues, implemented as a sum of phi/psi dihedral angles and hydrogen bonds (colvarvalue::type_scalar type, range [0:1])
Definition: colvarcomp.h:975
static cvm::real switching_function(cvm::real const &r0, int const &exp_num, int const &exp_den, cvm::atom &A1, cvm::atom &A2)
Calculate a coordination number through the function (1-x**n)/(1-x**m), x = |A1-A2|/r0.
Definition: colvarcomp_coordnums.cpp:398
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
Definition: colvarcomp.cpp:298
virtual void apply_force(colvarvalue const &cvforce)=0
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to override the distance ones.
Definition: colvarcomp_distances.cpp:539
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_angles.cpp:73
cvm::rvector dist_v_ortho
Components of the distance vector orthogonal to the axis.
Definition: colvarcomp.h:402
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_coordnums.cpp:489
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_coordnums.cpp:321
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_rotations.cpp:112
Colvar component: projection of 3N coordinates onto an eigenvector(colvarvalue::type_scalar type...
Definition: colvarcomp.h:551
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:34
std::vector< cvm::rvector > eigenvec
Eigenvector (of a normal or essential mode): will always have zero center.
Definition: colvarcomp.h:566
cvm::real theta_ref
Reference Calpha-Calpha angle (default: 88 degrees)
Definition: colvarcomp.h:981
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:1340
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
Definition: colvarcomp_distances.cpp:312
std::vector< cvm::atom_group * > atom_groups
Pointers to all atom groups, to let colvars collect info e.g. atomic gradients.
Definition: colvarcomp.h:222
cvm::real wrap_center
If the component is periodic, wrap around this value (default: 0.0)
Definition: colvarcomp.h:94
colvarvalue ft
Calculated total force (Note: this is calculated from the total atomic forces read from the program...
Definition: colvarcomp.h:239
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:792
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_rotations.cpp:285
Colvar component: dihedral between the centers of mass of four groups (colvarvalue::type_scalar type...
Definition: colvarcomp.h:687
std::vector< h_bond * > hb
List of hydrogen bonds.
Definition: colvarcomp.h:990
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
colvarvalue ft
Total force, as derived from the atomic trajectory; should equal the system force plus f...
Definition: colvar.h:186
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_coordnums.cpp:475
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:84
std::vector< cvm::atom_pos > ref_pos
Reference coordinates.
Definition: colvarcomp.h:1058
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::real hb_coeff
Contribution of the hb terms.
Definition: colvarcomp.h:993
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:1052
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp_distances.cpp:324
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_rotations.cpp:237
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:1434
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_angles.cpp:122
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:779
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_rotations.cpp:340
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_angles.cpp:230
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:770
int sup_np
Exponent in the polynomial combination (default: 1)
Definition: colvarcomp.h:85
static cvm::real switching_function(cvm::real const &r0, int const &exp_num, int const &exp_den, cvm::atom &A1, cvm::atom &A2)
Calculate a coordination number through the function (1-x**n)/(1-x**m), x = |A1-A2|/r0.
static cvm::real switching_function(cvm::real const &r0, int const &exp_num, int const &exp_den, cvm::atom &A1, cvm::atom &A2)
Calculate a coordination number through the function (1-x**n)/(1-x**m), x = |A1-A2|/r0.
Definition: colvarcomp_coordnums.cpp:15
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
colvarvalue const & value() const
Return the previously calculated value.
Definition: colvarcomp.h:247
cvm::atom_group * parse_group(std::string const &conf, char const *group_key, bool optional=false)
Within the constructor, make a group parse its own options from the provided configuration string Ret...
Definition: colvarcomp.cpp:85
cvm::atom_group * group1
Atom group.
Definition: colvarcomp.h:599
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to override the distance ones.
Definition: colvarcomp_distances.cpp:532
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::atom_pos ref_pos_center
Geometric center of the reference coordinates.
Definition: colvarcomp.h:563
int en
Integer exponent of the function numerator.
Definition: colvarcomp.h:808
cvm::rvector dist_v
Vector distance, cached to be recycled.
Definition: colvarcomp.h:278
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::real r21l
Inter site vector norms.
Definition: colvarcomp.h:608
cvm::atom_group * group4
Atom group.
Definition: colvarcomp.h:699
virtual void debug_gradients(cvm::atom_group *group)
Calculate finite-difference gradients alongside the analytical ones, for each Cartesian component...
Definition: colvarcomp.cpp:183
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
int ed
Integer exponent of the function denominator.
Definition: colvarcomp.h:854
Colvar component: angle between the centers of mass of three groups (colvarvalue::type_scalar type...
Definition: colvarcomp.h:593
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
Colvar component: self-coordination number within a group (colvarvalue::type_scalar type...
Definition: colvarcomp.h:799
int en
Integer exponent of the function numerator.
Definition: colvarcomp.h:754
cvm::atom_group * group2
Second atom group.
Definition: colvarcomp.h:276
cvm::atom_pos atoms_cog
Center of geometry of the group.
Definition: colvarcomp.h:1055
Colvar component: distance unit vector (direction) between centers of mass of two groups (colvarvalue...
Definition: colvarcomp.h:329
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:448
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp.cpp:175
cvm::real sup_coeff
Coefficient in the polynomial combination (default: 1.0)
Definition: colvarcomp.h:83
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
colvarvalue x
Cached value.
Definition: colvarcomp.h:230
int en
Integer exponent of the function numerator.
Definition: colvarcomp.h:852
virtual int init_total_force_params(std::string const &conf)
Parse options pertaining to total force calculation.
Definition: colvarcomp.cpp:55
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
cvm::atom_group * group1
First atom group.
Definition: colvarcomp.h:804
cvm::atom_group * group2
Atom group.
Definition: colvarcomp.h:601
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:1031
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
cvm::rvector r21
Inter site vectors.
Definition: colvarcomp.h:654
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:1313
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_angles.cpp:177
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to override the distance ones.
Definition: colvarcomp_distances.cpp:525
Colvar component: angle between the dipole of a molecule and an axis formed by two groups of atoms(co...
Definition: colvarcomp.h:641
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_rotations.cpp:374
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:257
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:841
rmsd(std::string const &conf)
Constructor.
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:1006
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
cvm::atom_group * group2
Second atom group.
Definition: colvarcomp.h:458
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_rotations.cpp:220
colvarvalue const & Jacobian_derivative() const
Return the previously calculated divergence of the inverse atomic gradients.
Definition: colvarcomp.h:259
Colvar component: Radius of gyration of an atom group (colvarvalue::type_scalar type, range [0:*))
Definition: colvarcomp.h:474
Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies...
Definition: colvardeps.h:19
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_rotations.cpp:364
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_coordnums.cpp:280
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_rotations.cpp:351
Colvar component: distance between the centers of mass of two groups (colvarvalue::type_scalar type...
Definition: colvarcomp.h:269
Colvar component: angle of rotation around a predefined axis (colvarvalue::type_scalar type...
Definition: colvarcomp.h:1162
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:895
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_coordnums.cpp:123
cvm::real r21l
Inter site vector norms.
Definition: colvarcomp.h:656
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_coordnums.cpp:461
eigenvector(std::string const &conf)
Constructor.
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the box periodicity.
Definition: colvarcomp_distances.cpp:158
colvarvalue const & total_force() const
Return the previously calculated total force.
Definition: colvarcomp.h:253
void calc_value()
Calculate the variable.
Definition: colvarcomp_protein.cpp:136
cvm::atom_group * group1
First atom group.
Definition: colvarcomp.h:456
cvm::rvector dxdr1
Derivatives wrt group centers of mass.
Definition: colvarcomp.h:658
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:582
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:700
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual void calc_gradients()=0
Calculate the atomic gradients, to be reused later in order to apply forces.
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp_rotations.cpp:133
Colvar component (base class); most implementations of cvc utilize one or more colvarmodule::atom or ...
Definition: colvarcomp.h:63
cvm::atom_group * group2
Atom group.
Definition: colvarcomp.h:695
cvm::atom_group * group3
Atom group.
Definition: colvarcomp.h:651
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_rotations.cpp:228
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_angles.cpp:90
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:66
cvm::atom_group * group2
Second atom group.
Definition: colvarcomp.h:745
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
Colvar component: dihedPC Projection of the config onto a dihedral principal component See e...
Definition: colvarcomp.h:1017
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_angles.cpp:113
cvm::quaternion ref_quat
This is used to remove jumps in the sign of the quaternion, which may be annoying in the colvars traj...
Definition: colvarcomp.h:1065
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_angles.cpp:483
Colvar component: root mean square deviation (RMSD) of a group with respect to a set of reference coo...
Definition: colvarcomp.h:1196
virtual void calc_force_invgrads()
Calculate the total force from the system using the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:435
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
void calc_value()
Calculate the variable.
Definition: colvarcomp_protein.cpp:386
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:292
cvm::rvector r12
Inter site vectors.
Definition: colvarcomp.h:701
std::vector< cvm::atom_pos > ref_pos
Reference coordinates.
Definition: colvarcomp.h:560
Base class containing parsing functions; all objects which need to parse input inherit from this...
Definition: colvarparse.h:18
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:384
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_angles.cpp:335
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_rotations.cpp:383
Colvar component: coordination number between two groups (colvarvalue::type_scalar type...
Definition: colvarcomp.h:840
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
A rotation between two sets of coordinates (for the moment a wrapper for colvarmodule::quaternion) ...
Definition: colvartypes.h:1374
Colvar component: angle of rotation with respect to a set of reference coordinates (colvarvalue::type...
Definition: colvarcomp.h:1088
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_angles.cpp:440
void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_protein.cpp:180
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_coordnums.cpp:286
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
bool b_anisotropic
Wheter dist/r0 or {dist}*{1/r0_vec} should ne be used.
Definition: colvarcomp.h:752
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:706
cvm::atom_group * group1
Atom group.
Definition: colvarcomp.h:693
cvm::real r0
"Cutoff" for isotropic calculation (default)
Definition: colvarcomp.h:747
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:501
cvm::rvector axis
Vector on which the distance vector is projected.
Definition: colvarcomp.h:367
std::vector< cvm::atom_pos > ref_pos
Reference coordinates (for RMSD calculation only)
Definition: colvarcomp.h:1205
virtual std::vector< feature * > & features()
Implementation of the feature list accessor for colvar.
Definition: colvarcomp.h:128
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
virtual colvarvalue dist2_rgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x2) of the square distance (can be redefined to transparently implement cons...
Definition: colvarcomp_rotations.cpp:140
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_distances.cpp:824
cvm::real theta_tol
Tolerance on the Calpha-Calpha angle.
Definition: colvarcomp.h:984
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:1019
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:620
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_coordnums.cpp:158
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_rotations.cpp:275
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:798
virtual void calc_gradients()
Calculate the atomic gradients, to be reused later in order to apply forces.
Definition: colvarcomp_distances.cpp:127
cvm::atom_group * atoms
Atom group.
Definition: colvarcomp.h:557
virtual void calc_value()
Calculate the variable.
Definition: colvarcomp_angles.cpp:56
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_coordnums.cpp:194
virtual cvm::real dist2(colvarvalue const &x1, colvarvalue const &x2) const
Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities)
std::string name
The name of the object (helps to identify this cvc instance when debugging)
Definition: colvarcomp.h:70
bool b_no_PBC
Use absolute positions, ignoring PBCs when present.
Definition: colvarcomp.h:365
virtual colvarvalue dist2_lgrad(colvarvalue const &x1, colvarvalue const &x2) const
Gradient(with respect to x1) of the square distance (can be redefined to transparently implement cons...
std::string function_type
Description of the type of collective variable.
Definition: colvarcomp.h:80
int setup()
After construction, set data related to dependency handling.
Definition: colvarcomp.cpp:123
virtual void wrap(colvarvalue &x) const
Redefined to handle the 2*PI periodicity.
Definition: colvarcomp_rotations.cpp:401
virtual void calc_Jacobian_derivative()
Calculate the divergence of the inverse atomic gradients.
Definition: colvarcomp_distances.cpp:78
cvm::atom_group * atoms
Atom group.
Definition: colvarcomp.h:1053
Colvar component: N1xN2 vector of pairwise distances (colvarvalue::type_vector type, range (0:*) for each component)
Definition: colvarcomp.h:451
bool fixed_axis
Flag: using a fixed axis vector?
Definition: colvarcomp.h:373
colvarvalue x_old
Value at the previous step.
Definition: colvarcomp.h:233
bool b_group2_center_only
If true, group2 will be treated as a single atom (default: loop over all pairs of atoms in group1 and...
Definition: colvarcomp.h:759
Group of atom objects, mostly used by a cvc object to gather all atomic data.
Definition: colvaratoms.h:141
void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_protein.cpp:191
bool b_1site_force
Definition: colvarcomp.h:615
virtual void apply_force(colvarvalue const &force)
Apply the collective variable force, by communicating the atomic forces to the simulation program (No...
Definition: colvarcomp_distances.cpp:454