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

This commit is contained in:
sjplimp
2012-08-23 13:09:47 +00:00
parent 7ebff3faf6
commit 81ec0e96e1
12 changed files with 86 additions and 163 deletions

View File

@ -72,7 +72,6 @@ colvar::orientation::orientation (std::string const &conf)
rot.request_group2_gradients (atoms.size());
}
rot.b_debug_gradients = this->b_debug_gradients;
}
@ -228,38 +227,6 @@ void colvar::tilt::calc_gradients()
atoms[ia].grad += (dxdq[iq] * (rot.dQ0_2[ia])[iq]);
}
}
if (cvm::debug()) {
std::vector<cvm::atom_pos> pos_test (atoms.positions_shifted (-1.0 * atoms_cog));
for (size_t comp = 0; comp < 3; comp++) {
// correct this cartesian component for the "new" center of geometry
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] -=
cvm::debug_gradients_step_size / cvm::real (atoms.size());
}
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] += cvm::debug_gradients_step_size;
rot.calc_optimal_rotation (ref_pos, pos_test);
pos_test[ia][comp] -= cvm::debug_gradients_step_size;
cvm::log ("|dx(real) - dx(pred)|/dx(real) = "+
cvm::to_str (std::fabs (rot.cos_theta (axis) - x.real_value -
cvm::debug_gradients_step_size * atoms[ia].grad[comp]) /
std::fabs (rot.cos_theta (axis) - x.real_value),
cvm::cv_width, cvm::cv_prec)+".\n");
}
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] +=
cvm::debug_gradients_step_size / cvm::real (atoms.size());
}
}
}
}
@ -326,38 +293,6 @@ void colvar::spin_angle::calc_gradients()
atoms[ia].grad += (dxdq[iq] * (rot.dQ0_2[ia])[iq]);
}
}
if (cvm::debug()) {
std::vector<cvm::atom_pos> pos_test (atoms.positions_shifted (-1.0 * atoms_cog));
for (size_t comp = 0; comp < 3; comp++) {
// correct this cartesian component for the "new" center of geometry
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] -=
cvm::debug_gradients_step_size / cvm::real (atoms.size());
}
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] += cvm::debug_gradients_step_size;
rot.calc_optimal_rotation (ref_pos, pos_test);
pos_test[ia][comp] -= cvm::debug_gradients_step_size;
cvm::log ("|dx(real) - dx(pred)|/dx(real) = "+
cvm::to_str (std::fabs (rot.spin_angle (axis) - x.real_value -
cvm::debug_gradients_step_size * atoms[ia].grad[comp]) /
std::fabs (rot.spin_angle (axis) - x.real_value),
cvm::cv_width, cvm::cv_prec)+".\n");
}
for (size_t ia = 0; ia < atoms.size(); ia++) {
pos_test[ia][comp] +=
cvm::debug_gradients_step_size / cvm::real (atoms.size());
}
}
}
}