| version 1.22 | version 1.23 |
|---|
| |
| } | } |
| | |
| /// \brief Obtain data needed for the calculation for the backend | /// \brief Obtain data needed for the calculation for the backend |
| void read_data(); | virtual void read_data(); |
| | |
| /// \brief Calculate the variable | /// \brief Calculate the variable |
| virtual void calc_value() = 0; | virtual void calc_value() = 0; |
| |
| | |
| | |
| /// \brief Return the previously calculated value | /// \brief Return the previously calculated value |
| virtual colvarvalue const & value() const; | colvarvalue const & value() const; |
| | |
| // /// \brief Return const pointer to the previously calculated value | |
| // virtual const colvarvalue *p_value() const; | |
| | |
| /// \brief Return the previously calculated total force | /// \brief Return the previously calculated total force |
| virtual colvarvalue const & total_force() const; | colvarvalue const & total_force() const; |
| | |
| /// \brief Return the previously calculated divergence of the | /// \brief Return the previously calculated divergence of the |
| /// inverse atomic gradients | /// inverse atomic gradients |
| virtual colvarvalue const & Jacobian_derivative() const; | colvarvalue const & Jacobian_derivative() const; |
| | |
| /// \brief Apply the collective variable force, by communicating the | /// \brief Apply the collective variable force, by communicating the |
| /// atomic forces to the simulation program (\b Note: the \link ft | /// atomic forces to the simulation program (\b Note: the \link ft |
| |
| }; | }; |
| | |
| | |
| | |
| | |
| inline colvarvalue const & colvar::cvc::value() const | inline colvarvalue const & colvar::cvc::value() const |
| { | { |
| return x; | return x; |
| } | } |
| | |
| // inline const colvarvalue * colvar::cvc::p_value() const | |
| // { | |
| // return &x; | |
| // } | |
| | |
| inline colvarvalue const & colvar::cvc::total_force() const | inline colvarvalue const & colvar::cvc::total_force() const |
| { | { |
| return ft; | return ft; |
| } | } |
| | |
| | |
| inline colvarvalue const & colvar::cvc::Jacobian_derivative() const | inline colvarvalue const & colvar::cvc::Jacobian_derivative() const |
| { | { |
| return jd; | return jd; |
| } | } |
| | |
| | |
| inline cvm::real colvar::cvc::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x1.dist2(x2); | |
| } | |
| | |
| inline colvarvalue colvar::cvc::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x1.dist2_grad(x2); | |
| } | |
| | |
| inline colvarvalue colvar::cvc::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x2.dist2_grad(x1); | |
| } | |
| | |
| inline void colvar::cvc::wrap(colvarvalue &x) const | |
| { | |
| return; | |
| } | |
| | |
| | |
| /// \brief Colvar component: distance between the centers of mass of | /// \brief Colvar component: distance between the centers of mass of |
| /// two groups (colvarvalue::type_scalar type, range [0:*)) | /// two groups (colvarvalue::type_scalar type, range [0:*)) |
| |
| public: | public: |
| distance(std::string const &conf); | distance(std::string const &conf); |
| distance(); | distance(); |
| virtual inline ~distance() {} | virtual ~distance() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| // \brief Colvar component: distance vector between centers of mass | // \brief Colvar component: distance vector between centers of mass |
| // of two groups (\link colvarvalue::type_3vector \endlink type, | // of two groups (\link colvarvalue::type_3vector \endlink type, |
| // range (-*:*)x(-*:*)x(-*:*)) | // range (-*:*)x(-*:*)x(-*:*)) |
| |
| public: | public: |
| distance_vec(std::string const &conf); | distance_vec(std::string const &conf); |
| distance_vec(); | distance_vec(); |
| virtual inline ~distance_vec() {} | virtual ~distance_vec() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: distance unit vector (direction) between | /// \brief Colvar component: distance unit vector (direction) between |
| /// centers of mass of two groups (colvarvalue::type_unit3vector type, | /// centers of mass of two groups (colvarvalue::type_unit3vector type, |
| /// range [-1:1]x[-1:1]x[-1:1]) | /// range [-1:1]x[-1:1]x[-1:1]) |
| |
| public: | public: |
| distance_dir(std::string const &conf); | distance_dir(std::string const &conf); |
| distance_dir(); | distance_dir(); |
| virtual inline ~distance_dir() {} | virtual ~distance_dir() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| virtual cvm::real dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| virtual colvarvalue dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| virtual colvarvalue dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: projection of the distance vector along | /// \brief Colvar component: projection of the distance vector along |
| /// an axis(colvarvalue::type_scalar type, range (-*:*)) | /// an axis(colvarvalue::type_scalar type, range (-*:*)) |
| class colvar::distance_z | class colvar::distance_z |
| |
| public: | public: |
| distance_z(std::string const &conf); | distance_z(std::string const &conf); |
| distance_z(); | distance_z(); |
| virtual inline ~distance_z() {} | virtual ~distance_z() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: projection of the distance vector on a | /// \brief Colvar component: projection of the distance vector on a |
| /// plane (colvarvalue::type_scalar type, range [0:*)) | /// plane (colvarvalue::type_scalar type, range [0:*)) |
| class colvar::distance_xy | class colvar::distance_xy |
| |
| public: | public: |
| distance_xy(std::string const &conf); | distance_xy(std::string const &conf); |
| distance_xy(); | distance_xy(); |
| virtual inline ~distance_xy() {} | virtual ~distance_xy() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: average distance between two groups of atoms, weighted as the sixth power, | /// \brief Colvar component: average distance between two groups of atoms, weighted as the sixth power, |
| /// as in NMR refinements(colvarvalue::type_scalar type, range (0:*)) | /// as in NMR refinements(colvarvalue::type_scalar type, range (0:*)) |
| class colvar::distance_inv | class colvar::distance_inv |
| |
| public: | public: |
| distance_inv(std::string const &conf); | distance_inv(std::string const &conf); |
| distance_inv(); | distance_inv(); |
| virtual inline ~distance_inv() {} | virtual ~distance_inv() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: N1xN2 vector of pairwise distances | /// \brief Colvar component: N1xN2 vector of pairwise distances |
| /// (colvarvalue::type_vector type, range (0:*) for each component) | /// (colvarvalue::type_vector type, range (0:*) for each component) |
| class colvar::distance_pairs | class colvar::distance_pairs |
| |
| public: | public: |
| distance_pairs(std::string const &conf); | distance_pairs(std::string const &conf); |
| distance_pairs(); | distance_pairs(); |
| virtual inline ~distance_pairs() {} | virtual ~distance_pairs() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| virtual cvm::real dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| virtual colvarvalue dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| virtual colvarvalue dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const; | |
| }; | }; |
| | |
| | |
| |
| /// Constructor | /// Constructor |
| gyration(std::string const &conf); | gyration(std::string const &conf); |
| gyration(); | gyration(); |
| virtual inline ~gyration() {} | virtual ~gyration() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: moment of inertia of an atom group | /// \brief Colvar component: moment of inertia of an atom group |
| /// (colvarvalue::type_scalar type, range [0:*)) | /// (colvarvalue::type_scalar type, range [0:*)) |
| class colvar::inertia | class colvar::inertia |
| |
| /// Constructor | /// Constructor |
| inertia(std::string const &conf); | inertia(std::string const &conf); |
| inertia(); | inertia(); |
| virtual inline ~inertia() {} | virtual ~inertia() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: moment of inertia of an atom group | /// \brief Colvar component: moment of inertia of an atom group |
| /// around a user-defined axis (colvarvalue::type_scalar type, range [0:*)) | /// around a user-defined axis (colvarvalue::type_scalar type, range [0:*)) |
| class colvar::inertia_z | class colvar::inertia_z |
| |
| /// Constructor | /// Constructor |
| inertia_z(std::string const &conf); | inertia_z(std::string const &conf); |
| inertia_z(); | inertia_z(); |
| virtual inline ~inertia_z() {} | virtual ~inertia_z() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: projection of 3N coordinates onto an | /// \brief Colvar component: projection of 3N coordinates onto an |
| /// eigenvector(colvarvalue::type_scalar type, range (-*:*)) | /// eigenvector(colvarvalue::type_scalar type, range (-*:*)) |
| class colvar::eigenvector | class colvar::eigenvector |
| |
| | |
| /// Constructor | /// Constructor |
| eigenvector(std::string const &conf); | eigenvector(std::string const &conf); |
| virtual inline ~eigenvector() {} | virtual ~eigenvector() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| /// \brief Initialize the three groups after three atoms | /// \brief Initialize the three groups after three atoms |
| angle(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3); | angle(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3); |
| angle(); | angle(); |
| virtual inline ~angle() {} | virtual ~angle() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: angle between the dipole of a molecule and an axis | /// \brief Colvar component: angle between the dipole of a molecule and an axis |
| /// formed by two groups of atoms(colvarvalue::type_scalar type, range [0:PI]) | /// formed by two groups of atoms(colvarvalue::type_scalar type, range [0:PI]) |
| class colvar::dipole_angle | class colvar::dipole_angle |
| |
| /// \brief Initialize the three groups after three atoms | /// \brief Initialize the three groups after three atoms |
| dipole_angle (cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3); | dipole_angle (cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3); |
| dipole_angle(); | dipole_angle(); |
| virtual inline ~dipole_angle() {} | virtual ~dipole_angle() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force (colvarvalue const &force); | virtual void apply_force (colvarvalue const &force); |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: dihedral between the centers of mass of | /// \brief Colvar component: dihedral between the centers of mass of |
| /// four groups (colvarvalue::type_scalar type, range [-PI:PI]) | /// four groups (colvarvalue::type_scalar type, range [-PI:PI]) |
| class colvar::dihedral | class colvar::dihedral |
| |
| /// \brief Initialize the four groups after four atoms | /// \brief Initialize the four groups after four atoms |
| dihedral(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3, cvm::atom const &a4); | dihedral(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3, cvm::atom const &a4); |
| dihedral(); | dihedral(); |
| virtual inline ~dihedral() {} | virtual ~dihedral() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: coordination number between two groups | /// \brief Colvar component: coordination number between two groups |
| /// (colvarvalue::type_scalar type, range [0:N1*N2]) | /// (colvarvalue::type_scalar type, range [0:N1*N2]) |
| class colvar::coordnum | class colvar::coordnum |
| |
| /// Constructor | /// Constructor |
| coordnum(std::string const &conf); | coordnum(std::string const &conf); |
| coordnum(); | coordnum(); |
| virtual inline ~coordnum() {} | virtual ~coordnum() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: self-coordination number within a group | /// \brief Colvar component: self-coordination number within a group |
| /// (colvarvalue::type_scalar type, range [0:N*(N-1)/2]) | /// (colvarvalue::type_scalar type, range [0:N*(N-1)/2]) |
| class colvar::selfcoordnum | class colvar::selfcoordnum |
| |
| /// Constructor | /// Constructor |
| selfcoordnum(std::string const &conf); | selfcoordnum(std::string const &conf); |
| selfcoordnum(); | selfcoordnum(); |
| virtual inline ~selfcoordnum() {} | virtual ~selfcoordnum() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: coordination number between two groups | /// \brief Colvar component: coordination number between two groups |
| /// (colvarvalue::type_scalar type, range [0:N1*N2]) | /// (colvarvalue::type_scalar type, range [0:N1*N2]) |
| class colvar::groupcoordnum | class colvar::groupcoordnum |
| |
| /// Constructor | /// Constructor |
| groupcoordnum(std::string const &conf); | groupcoordnum(std::string const &conf); |
| groupcoordnum(); | groupcoordnum(); |
| virtual inline ~groupcoordnum() {} | virtual ~groupcoordnum() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| static cvm::real switching_function(cvm::rvector const &r0_vec, | static cvm::real switching_function(cvm::rvector const &r0_vec, |
| int const &exp_num, int const &exp_den, | int const &exp_num, int const &exp_den, |
| cvm::atom &A1, cvm::atom &A2); | cvm::atom &A1, cvm::atom &A2); |
| | */ |
| | |
| virtual cvm::real dist2(colvarvalue const &x1, | virtual cvm::real dist2(colvarvalue const &x1, |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| virtual colvarvalue dist2_rgrad(colvarvalue const &x1, | virtual colvarvalue dist2_rgrad(colvarvalue const &x1, |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| */ | |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: hydrogen bond, defined as the product of | /// \brief Colvar component: hydrogen bond, defined as the product of |
| /// a colvar::coordnum and 1/2*(1-cos((180-ang)/ang_tol)) | /// a colvar::coordnum and 1/2*(1-cos((180-ang)/ang_tol)) |
| /// (colvarvalue::type_scalar type, range [0:1]) | /// (colvarvalue::type_scalar type, range [0:1]) |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: alpha helix content of a contiguous | /// \brief Colvar component: alpha helix content of a contiguous |
| /// segment of 5 or more residues, implemented as a sum of phi/psi | /// segment of 5 or more residues, implemented as a sum of phi/psi |
| /// dihedral angles and hydrogen bonds (colvarvalue::type_scalar type, | /// dihedral angles and hydrogen bonds (colvarvalue::type_scalar type, |
| |
| | |
| // alpha_dihedrals (std::string const &conf); | // alpha_dihedrals (std::string const &conf); |
| // alpha_dihedrals(); | // alpha_dihedrals(); |
| // virtual inline ~alpha_dihedrals() {} | // virtual ~alpha_dihedrals() {} |
| // virtual void calc_value(); | // virtual void calc_value(); |
| // virtual void calc_gradients(); | // virtual void calc_gradients(); |
| // virtual void apply_force (colvarvalue const &force); | // virtual void apply_force (colvarvalue const &force); |
| |
| // }; | // }; |
| | |
| | |
| | |
| /// \brief Colvar component: alpha helix content of a contiguous | /// \brief Colvar component: alpha helix content of a contiguous |
| /// segment of 5 or more residues, implemented as a sum of Ca-Ca-Ca | /// segment of 5 or more residues, implemented as a sum of Ca-Ca-Ca |
| /// angles and hydrogen bonds (colvarvalue::type_scalar type, range | /// angles and hydrogen bonds (colvarvalue::type_scalar type, range |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: dihedPC | /// \brief Colvar component: dihedPC |
| /// Projection of the config onto a dihedral principal component | /// Projection of the config onto a dihedral principal component |
| /// See e.g. Altis et al., J. Chem. Phys 126, 244111 (2007) | /// See e.g. Altis et al., J. Chem. Phys 126, 244111 (2007) |
| |
| colvarvalue const &x2) const; | colvarvalue const &x2) const; |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: orientation in space of an atom group, | /// \brief Colvar component: orientation in space of an atom group, |
| /// with respect to a set of reference coordinates | /// with respect to a set of reference coordinates |
| /// (colvarvalue::type_quaternion type, range | /// (colvarvalue::type_quaternion type, range |
| |
| | |
| orientation(std::string const &conf); | orientation(std::string const &conf); |
| orientation(); | orientation(); |
| virtual inline ~orientation() {} | virtual ~orientation() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: angle of rotation with respect to a set | /// \brief Colvar component: angle of rotation with respect to a set |
| /// of reference coordinates (colvarvalue::type_scalar type, range | /// of reference coordinates (colvarvalue::type_scalar type, range |
| /// [0:PI)) | /// [0:PI)) |
| |
| | |
| orientation_angle(std::string const &conf); | orientation_angle(std::string const &conf); |
| orientation_angle(); | orientation_angle(); |
| virtual inline ~orientation_angle() {} | virtual ~orientation_angle() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: cosine of the angle of rotation with respect to a set | /// \brief Colvar component: cosine of the angle of rotation with respect to a set |
| /// of reference coordinates (colvarvalue::type_scalar type, range | /// of reference coordinates (colvarvalue::type_scalar type, range |
| /// [-1:1]) | /// [-1:1]) |
| |
| | |
| orientation_proj(std::string const &conf); | orientation_proj(std::string const &conf); |
| orientation_proj(); | orientation_proj(); |
| virtual inline ~orientation_proj() {} | virtual ~orientation_proj() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| }; | }; |
| | |
| | |
| | |
| /// \brief Colvar component: projection of the orientation vector onto | /// \brief Colvar component: projection of the orientation vector onto |
| /// a predefined axis (colvarvalue::type_scalar type, range [-1:1]) | /// a predefined axis (colvarvalue::type_scalar type, range [-1:1]) |
| class colvar::tilt | class colvar::tilt |
| |
| | |
| tilt(std::string const &conf); | tilt(std::string const &conf); |
| tilt(); | tilt(); |
| virtual inline ~tilt() {} | virtual ~tilt() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| | |
| spin_angle(std::string const &conf); | spin_angle(std::string const &conf); |
| spin_angle(); | spin_angle(); |
| virtual inline ~spin_angle() {} | virtual ~spin_angle() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| | |
| /// Constructor | /// Constructor |
| rmsd(std::string const &conf); | rmsd(std::string const &conf); |
| virtual inline ~rmsd() {} | virtual ~rmsd() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void calc_force_invgrads(); | virtual void calc_force_invgrads(); |
| |
| }; | }; |
| | |
| | |
| | |
| // \brief Colvar component: flat vector of Cartesian coordinates | // \brief Colvar component: flat vector of Cartesian coordinates |
| // Mostly useful to compute scripted colvar values | // Mostly useful to compute scripted colvar values |
| class colvar::cartesian | class colvar::cartesian |
| |
| public: | public: |
| cartesian(std::string const &conf); | cartesian(std::string const &conf); |
| cartesian(); | cartesian(); |
| virtual inline ~cartesian() {} | virtual ~cartesian() {} |
| virtual void calc_value(); | virtual void calc_value(); |
| virtual void calc_gradients(); | virtual void calc_gradients(); |
| virtual void apply_force(colvarvalue const &force); | virtual void apply_force(colvarvalue const &force); |
| |
| | |
| #define simple_scalar_dist_functions(TYPE) \ | #define simple_scalar_dist_functions(TYPE) \ |
| \ | \ |
| inline cvm::real colvar::TYPE::dist2(colvarvalue const &x1, \ | \ |
| | cvm::real colvar::TYPE::dist2(colvarvalue const &x1, \ |
| colvarvalue const &x2) const \ | colvarvalue const &x2) const \ |
| { \ | { \ |
| return (x1.real_value - x2.real_value)*(x1.real_value - x2.real_value); \ | return (x1.real_value - x2.real_value)*(x1.real_value - x2.real_value); \ |
| } \ | } \ |
| \ | \ |
| inline colvarvalue colvar::TYPE::dist2_lgrad(colvarvalue const &x1, \ | \ |
| | colvarvalue colvar::TYPE::dist2_lgrad(colvarvalue const &x1, \ |
| colvarvalue const &x2) const \ | colvarvalue const &x2) const \ |
| { \ | { \ |
| return 2.0 * (x1.real_value - x2.real_value); \ | return 2.0 * (x1.real_value - x2.real_value); \ |
| } \ | } \ |
| \ | \ |
| inline colvarvalue colvar::TYPE::dist2_rgrad(colvarvalue const &x1, \ | \ |
| | colvarvalue colvar::TYPE::dist2_rgrad(colvarvalue const &x1, \ |
| colvarvalue const &x2) const \ | colvarvalue const &x2) const \ |
| { \ | { \ |
| return this->dist2_lgrad(x2, x1); \ | return this->dist2_lgrad(x2, x1); \ |
| } \ | } \ |
| \ | \ |
| | |
| simple_scalar_dist_functions(distance) | |
| // NOTE: distance_z has explicit functions, see below | |
| simple_scalar_dist_functions(distance_xy) | |
| simple_scalar_dist_functions(distance_inv) | |
| simple_scalar_dist_functions(angle) | |
| simple_scalar_dist_functions(dipole_angle) | |
| simple_scalar_dist_functions(coordnum) | |
| simple_scalar_dist_functions(selfcoordnum) | |
| simple_scalar_dist_functions(h_bond) | |
| simple_scalar_dist_functions(gyration) | |
| simple_scalar_dist_functions(inertia) | |
| simple_scalar_dist_functions(inertia_z) | |
| simple_scalar_dist_functions(rmsd) | |
| simple_scalar_dist_functions(orientation_angle) | |
| simple_scalar_dist_functions(orientation_proj) | |
| simple_scalar_dist_functions(tilt) | |
| simple_scalar_dist_functions(eigenvector) | |
| // simple_scalar_dist_functions (alpha_dihedrals) | |
| simple_scalar_dist_functions(alpha_angles) | |
| simple_scalar_dist_functions(dihedPC) | |
| | |
| | |
| // metrics functions for cvc implementations with a periodicity | |
| | |
| inline cvm::real colvar::dihedral::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return diff * diff; | |
| } | |
| | |
| inline colvarvalue colvar::dihedral::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return 2.0 * diff; | |
| } | |
| | |
| inline colvarvalue colvar::dihedral::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return (-2.0) * diff; | |
| } | |
| | |
| inline void colvar::dihedral::wrap(colvarvalue &x) const | |
| { | |
| if ((x.real_value - wrap_center) >= 180.0) { | |
| x.real_value -= 360.0; | |
| return; | |
| } | |
| | |
| if ((x.real_value - wrap_center) < -180.0) { | |
| x.real_value += 360.0; | |
| return; | |
| } | |
| | |
| return; | |
| } | |
| | |
| inline cvm::real colvar::spin_angle::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return diff * diff; | |
| } | |
| | |
| inline colvarvalue colvar::spin_angle::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return 2.0 * diff; | |
| } | |
| | |
| inline colvarvalue colvar::spin_angle::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); | |
| return (-2.0) * diff; | |
| } | |
| | |
| inline void colvar::spin_angle::wrap(colvarvalue &x) const | |
| { | |
| if ((x.real_value - wrap_center) >= 180.0) { | |
| x.real_value -= 360.0; | |
| return; | |
| } | |
| | |
| if ((x.real_value - wrap_center) < -180.0) { | |
| x.real_value += 360.0; | |
| return; | |
| } | |
| | |
| return; | |
| } | |
| | |
| | |
| // Projected distance | |
| // Differences should always be wrapped around 0 (ignoring wrap_center) | |
| inline cvm::real colvar::distance_z::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| if (period != 0.0) { | |
| cvm::real shift = std::floor(diff/period + 0.5); | |
| diff -= shift * period; | |
| } | |
| return diff * diff; | |
| } | |
| | |
| inline colvarvalue colvar::distance_z::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| if (period != 0.0) { | |
| cvm::real shift = std::floor(diff/period + 0.5); | |
| diff -= shift * period; | |
| } | |
| return 2.0 * diff; | |
| } | |
| | |
| inline colvarvalue colvar::distance_z::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| cvm::real diff = x1.real_value - x2.real_value; | |
| if (period != 0.0) { | |
| cvm::real shift = std::floor(diff/period + 0.5); | |
| diff -= shift * period; | |
| } | |
| return (-2.0) * diff; | |
| } | |
| | |
| inline void colvar::distance_z::wrap(colvarvalue &x) const | |
| { | |
| if (! this->b_periodic) { | |
| // don't wrap if the period has not been set | |
| return; | |
| } | |
| | |
| cvm::real shift = std::floor((x.real_value - wrap_center) / period + 0.5); | |
| x.real_value -= shift * period; | |
| return; | |
| } | |
| | |
| | |
| // distance between three dimensional vectors | |
| // | |
| // TODO apply PBC to distance_vec | |
| // Note: differences should be centered around (0, 0, 0)! | |
| | |
| inline cvm::real colvar::distance_vec::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return cvm::position_dist2(x1.rvector_value, x2.rvector_value); | |
| } | |
| | |
| inline colvarvalue colvar::distance_vec::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value); | |
| } | |
| | |
| inline colvarvalue colvar::distance_vec::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return 2.0 * cvm::position_distance(x2.rvector_value, x1.rvector_value); | |
| } | |
| | |
| inline cvm::real colvar::distance_dir::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return (x1.rvector_value - x2.rvector_value).norm2(); | |
| } | |
| | |
| inline colvarvalue colvar::distance_dir::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return colvarvalue((x1.rvector_value - x2.rvector_value), colvarvalue::type_unit3vector); | |
| } | |
| | |
| inline colvarvalue colvar::distance_dir::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return colvarvalue((x2.rvector_value - x1.rvector_value), colvarvalue::type_unit3vector); | |
| } | |
| | |
| inline cvm::real colvar::distance_pairs::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return (x1.vector1d_value - x2.vector1d_value).norm2(); | |
| } | |
| | |
| inline colvarvalue colvar::distance_pairs::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return colvarvalue((x1.vector1d_value - x2.vector1d_value), colvarvalue::type_vector); | |
| } | |
| | |
| inline colvarvalue colvar::distance_pairs::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return colvarvalue((x2.vector1d_value - x1.vector1d_value), colvarvalue::type_vector); | |
| } | |
| | |
| | |
| // distance between quaternions | |
| | |
| inline cvm::real colvar::orientation::dist2(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x1.quaternion_value.dist2(x2); | |
| } | |
| | |
| inline colvarvalue colvar::orientation::dist2_lgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x1.quaternion_value.dist2_grad(x2); | |
| } | |
| | |
| inline colvarvalue colvar::orientation::dist2_rgrad(colvarvalue const &x1, | |
| colvarvalue const &x2) const | |
| { | |
| return x2.quaternion_value.dist2_grad(x1); | |
| } | |
| | |
| | |
| #endif | #endif |