git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12612 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2014-10-07 20:30:25 +00:00
parent 3c0612815f
commit 044084847b
33 changed files with 2284 additions and 2595 deletions

View File

@ -1,3 +1,5 @@
/// -*- c++ -*-
#include <cmath>
#include "colvarmodule.h"
@ -57,11 +59,12 @@ colvar::orientation::orientation (std::string const &conf)
"assumed that each atom is the closest "
"periodic image to the center of geometry.\n");
cvm::rvector cog (0.0, 0.0, 0.0);
for (size_t i = 0; i < ref_pos.size(); i++) {
size_t i;
for (i = 0; i < ref_pos.size(); i++) {
cog += ref_pos[i];
}
cog /= cvm::real (ref_pos.size());
for (size_t i = 0; i < ref_pos.size(); i++) {
for (i = 0; i < ref_pos.size(); i++) {
ref_pos[i] -= cog;
}
@ -167,10 +170,61 @@ void colvar::orientation_angle::calc_gradients()
for (size_t ia = 0; ia < atoms.size(); ia++) {
atoms[ia].grad = (dxdq0 * (rot.dQ0_2[ia])[0]);
}
if (b_debug_gradients) {
cvm::log ("Debugging orientationAngle component gradients:\n");
debug_gradients (atoms);
}
}
void colvar::orientation_angle::apply_force (colvarvalue const &force)
{
cvm::real const &fw = force.real_value;
if (!atoms.noforce) {
atoms.apply_colvar_force (fw);
}
}
colvar::orientation_proj::orientation_proj (std::string const &conf)
: orientation (conf)
{
function_type = "orientation_proj";
x.type (colvarvalue::type_scalar);
}
colvar::orientation_proj::orientation_proj()
: orientation()
{
function_type = "orientation_proj";
x.type (colvarvalue::type_scalar);
}
void colvar::orientation_proj::calc_value()
{
atoms_cog = atoms.center_of_geometry();
rot.calc_optimal_rotation (ref_pos, atoms.positions_shifted (-1.0 * atoms_cog));
x.real_value = 2.0 * (rot.q).q0 * (rot.q).q0 - 1.0;
}
void colvar::orientation_proj::calc_gradients()
{
cvm::real const dxdq0 = 2.0 * 2.0 * (rot.q).q0;
for (size_t ia = 0; ia < atoms.size(); ia++) {
atoms[ia].grad = (dxdq0 * (rot.dQ0_2[ia])[0]);
}
if (b_debug_gradients) {
cvm::log ("Debugging orientationProj component gradients:\n");
debug_gradients (atoms);
}
}
void colvar::orientation_proj::apply_force (colvarvalue const &force)
{
cvm::real const &fw = force.real_value;
@ -180,6 +234,7 @@ void colvar::orientation_angle::apply_force (colvarvalue const &force)
}
colvar::tilt::tilt (std::string const &conf)
: orientation (conf)
{