#include <colvarcomp.h>
Inheritance diagram for colvar::spin_angle:

Public Member Functions | |
| spin_angle (std::string const &conf) | |
| spin_angle () | |
| virtual | ~spin_angle () |
| virtual void | calc_value () |
| Calculate the variable. | |
| virtual void | calc_gradients () |
| Calculate the atomic gradients, to be reused later in order to apply forces. | |
| virtual void | apply_force (colvarvalue const &force) |
| Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the member is not altered by this function). | |
| virtual cvm::real | dist2 (colvarvalue const &x1, colvarvalue const &x2) const |
| Redefined to handle the 2*PI periodicity. | |
| virtual colvarvalue | dist2_lgrad (colvarvalue const &x1, colvarvalue const &x2) const |
| Redefined to handle the 2*PI periodicity. | |
| virtual colvarvalue | dist2_rgrad (colvarvalue const &x1, colvarvalue const &x2) const |
| Redefined to handle the 2*PI periodicity. | |
| virtual cvm::real | compare (colvarvalue const &x1, colvarvalue const &x2) const |
| Redefined to handle the 2*PI periodicity. | |
| virtual void | wrap (colvarvalue &x) const |
| Redefined to handle the 2*PI periodicity. | |
Protected Attributes | |
| cvm::rvector | axis |
Definition at line 1074 of file colvarcomp.h.
|
|
Definition at line 249 of file colvarcomp_rotations.C. References axis, colvarmodule::log(), colvarmodule::rvector::norm(), colvarmodule::rvector::norm2(), and colvarvalue::type(). 00250 : orientation (conf) 00251 { 00252 function_type = "spin_angle"; 00253 00254 get_keyval (conf, "axis", axis, cvm::rvector (0.0, 0.0, 1.0)); 00255 00256 if (axis.norm2() != 1.0) { 00257 axis /= axis.norm(); 00258 cvm::log ("Normalizing rotation axis to "+cvm::to_str (axis)+".\n"); 00259 } 00260 00261 period = 360.0; 00262 b_periodic = true; 00263 x.type (colvarvalue::type_scalar); 00264 }
|
|
|
Definition at line 267 of file colvarcomp_rotations.C. References colvarvalue::type(). 00268 : orientation() 00269 { 00270 function_type = "spin_angle"; 00271 period = 360.0; 00272 b_periodic = true; 00273 x.type (colvarvalue::type_scalar); 00274 }
|
|
|
Definition at line 1085 of file colvarcomp.h. 01085 {}
|
|
|
Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the member is not altered by this function). Note: multiple calls to this function within the same simulation step will add the forces altogether
Reimplemented from colvar::orientation. Definition at line 304 of file colvarcomp_rotations.C. References colvarmodule::atom_group::apply_colvar_force(), colvarmodule::atom_group::noforce, and colvarvalue::real_value. 00305 {
00306 cvm::real const &fw = force.real_value;
00307
00308 if (!atoms.noforce) {
00309 atoms.apply_colvar_force (fw);
00310 }
00311 }
|
|
|
Calculate the atomic gradients, to be reused later in order to apply forces.
Reimplemented from colvar::orientation. Definition at line 291 of file colvarcomp_rotations.C. References axis, colvarmodule::rotation::dQ0_2, and colvarmodule::rotation::dspin_angle_dq(). 00292 {
00293 cvm::quaternion const dxdq = rot.dspin_angle_dq (axis);
00294
00295 for (size_t ia = 0; ia < atoms.size(); ia++) {
00296 atoms[ia].grad = cvm::rvector (0.0, 0.0, 0.0);
00297 for (size_t iq = 0; iq < 4; iq++) {
00298 atoms[ia].grad += (dxdq[iq] * (rot.dQ0_2[ia])[iq]);
00299 }
00300 }
00301 }
|
|
|
Calculate the variable.
Reimplemented from colvar::orientation. Definition at line 277 of file colvarcomp_rotations.C. References axis, colvarmodule::rotation::calc_optimal_rotation(), colvarmodule::atom_group::center_of_geometry(), colvarmodule::atom_group::positions_shifted(), colvarvalue::real_value, colvarmodule::rotation::spin_angle(), and wrap(). 00278 {
00279 // atoms.reset_atoms_data();
00280 // atoms.read_positions();
00281
00282 atoms_cog = atoms.center_of_geometry();
00283
00284 rot.calc_optimal_rotation (ref_pos, atoms.positions_shifted (-1.0 * atoms_cog));
00285
00286 x.real_value = rot.spin_angle (axis);
00287 this->wrap (x);
00288 }
|
|
||||||||||||
|
Redefined to handle the 2*PI periodicity.
Reimplemented from colvar::orientation. Definition at line 1214 of file colvarcomp.h. References dist2_lgrad(). 01216 {
01217 return dist2_lgrad (x1, x2);
01218 }
|
|
||||||||||||
|
Redefined to handle the 2*PI periodicity.
Reimplemented from colvar::orientation. Definition at line 1190 of file colvarcomp.h. References colvarvalue::real_value. 01192 {
01193 cvm::real diff = x1.real_value - x2.real_value;
01194 diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
01195 return diff * diff;
01196 }
|
|
||||||||||||
|
Redefined to handle the 2*PI periodicity.
Reimplemented from colvar::orientation. Definition at line 1198 of file colvarcomp.h. References colvarvalue::real_value. Referenced by compare(). 01200 {
01201 cvm::real diff = x1.real_value - x2.real_value;
01202 diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
01203 return 2.0 * diff;
01204 }
|
|
||||||||||||
|
Redefined to handle the 2*PI periodicity.
Reimplemented from colvar::orientation. Definition at line 1206 of file colvarcomp.h. References colvarvalue::real_value. 01208 {
01209 cvm::real diff = x1.real_value - x2.real_value;
01210 diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff));
01211 return (-2.0) * diff;
01212 }
|
|
|
Redefined to handle the 2*PI periodicity.
Reimplemented from colvar::cvc. Definition at line 1220 of file colvarcomp.h. References colvarvalue::real_value. Referenced by calc_value(). 01221 {
01222 if ((x.real_value - wrap_center) >= 180.0) {
01223 x.real_value -= 360.0;
01224 return;
01225 }
01226
01227 if ((x.real_value - wrap_center) < -180.0) {
01228 x.real_value += 360.0;
01229 return;
01230 }
01231
01232 return;
01233 }
|
|
|
Definition at line 1079 of file colvarcomp.h. Referenced by calc_gradients(), calc_value(), and spin_angle(). |
1.3.9.1