git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9395 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -292,6 +292,11 @@ colvar::colvar (std::string const &conf)
|
||||
cvm::fatal_error ("Error: trying to expand boundaries that already "
|
||||
"cover a whole period of a periodic colvar.\n");
|
||||
}
|
||||
if (expand_boundaries && hard_lower_boundary && hard_upper_boundary) {
|
||||
cvm::fatal_error ("Error: inconsistent configuration "
|
||||
"(trying to expand boundaries with both "
|
||||
"hardLowerBoundary and hardUpperBoundary enabled).\n");
|
||||
}
|
||||
|
||||
{
|
||||
bool b_extended_lagrangian;
|
||||
@ -676,12 +681,39 @@ void colvar::calc()
|
||||
if (cvm::debug())
|
||||
cvm::log ("Calculating colvar \""+this->name+"\".\n");
|
||||
|
||||
// prepare atom groups for calculation
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
for (size_t ig = 0; ig < cvcs[i]->atom_groups.size(); ig++) {
|
||||
cvm::atom_group &atoms = *(cvcs[i]->atom_groups[ig]);
|
||||
atoms.reset_atoms_data();
|
||||
atoms.read_positions();
|
||||
if (atoms.b_center || atoms.b_rotate) {
|
||||
atoms.calc_apply_roto_translation();
|
||||
}
|
||||
// each atom group will take care of its own ref_pos_group, if defined
|
||||
}
|
||||
}
|
||||
if (tasks[task_output_velocity]) {
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
for (size_t ig = 0; ig < cvcs[i]->atom_groups.size(); ig++) {
|
||||
cvcs[i]->atom_groups[ig]->read_velocities();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tasks[task_system_force]) {
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
for (size_t ig = 0; ig < cvcs[i]->atom_groups.size(); ig++) {
|
||||
cvcs[i]->atom_groups[ig]->read_system_forces();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the value of the colvar
|
||||
|
||||
x.reset();
|
||||
if (x.type() == colvarvalue::type_scalar) {
|
||||
// polynomial combination allowed
|
||||
|
||||
// scalar variable, polynomial combination allowed
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
cvm::increase_depth();
|
||||
(cvcs[i])->calc_value();
|
||||
@ -697,6 +729,7 @@ void colvar::calc()
|
||||
(cvcs[i])->value().real_value );
|
||||
}
|
||||
} else {
|
||||
// only linear combination allowed
|
||||
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
cvm::increase_depth();
|
||||
@ -716,12 +749,29 @@ void colvar::calc()
|
||||
cvm::to_str (x, cvm::cv_width, cvm::cv_prec)+".\n");
|
||||
|
||||
if (tasks[task_gradients]) {
|
||||
// calculate the gradients
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log ("Calculating gradients of colvar \""+this->name+"\".\n");
|
||||
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
// calculate the gradients of each component
|
||||
cvm::increase_depth();
|
||||
|
||||
(cvcs[i])->calc_gradients();
|
||||
|
||||
// if requested, propagate (via chain rule) the gradients above
|
||||
// to the atoms used to define the roto-translation
|
||||
for (size_t ig = 0; ig < cvcs[i]->atom_groups.size(); ig++) {
|
||||
if (cvcs[i]->atom_groups[ig]->b_fit_gradients)
|
||||
cvcs[i]->atom_groups[ig]->calc_fit_gradients();
|
||||
}
|
||||
|
||||
cvm::decrease_depth();
|
||||
}
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log ("Done calculating gradients of colvar \""+this->name+"\".\n");
|
||||
|
||||
if (tasks[task_collect_gradients]) {
|
||||
// Collect the atomic gradients inside colvar object
|
||||
for (int a = 0; a < atomic_gradients.size(); a++) {
|
||||
@ -760,6 +810,10 @@ void colvar::calc()
|
||||
}
|
||||
|
||||
if (tasks[task_system_force]) {
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log ("Calculating system force of colvar \""+this->name+"\".\n");
|
||||
|
||||
ft.reset();
|
||||
|
||||
if(!tasks[task_extended_lagrangian] && (cvm::step_relative() > 0)) {
|
||||
@ -778,6 +832,9 @@ void colvar::calc()
|
||||
// correction internally: biases such as colvarbias_abf will handle it
|
||||
ft += fj;
|
||||
}
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log ("Done calculating system force of colvar \""+this->name+"\".\n");
|
||||
}
|
||||
|
||||
if (tasks[task_fdiff_velocity]) {
|
||||
|
||||
Reference in New Issue
Block a user