Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

colvarcomp.C

Go to the documentation of this file.
00001 #include "colvarmodule.h"
00002 #include "colvarvalue.h"
00003 #include "colvar.h"
00004 #include "colvarcomp.h"
00005 
00006 
00007 
00008 colvar::cvc::cvc()
00009   : sup_coeff (1.0), sup_np (1),
00010     b_periodic (false),
00011     b_debug_gradients (false),
00012     b_inverse_gradients (false),
00013     b_Jacobian_derivative (false)
00014 {}
00015 
00016 
00017 colvar::cvc::cvc (std::string const &conf)
00018   : sup_coeff (1.0), sup_np (1),
00019     b_periodic (false),
00020     b_debug_gradients (false),
00021     b_inverse_gradients (false),
00022     b_Jacobian_derivative (false)
00023 {
00024   if (cvm::debug())
00025     cvm::log ("Initializing cvc base object.\n");
00026 
00027   get_keyval (conf, "name", this->name, std::string (""), parse_silent);
00028 
00029   get_keyval (conf, "componentCoeff", sup_coeff, 1.0);
00030   get_keyval (conf, "componentExp", sup_np, 1);
00031 
00032   get_keyval (conf, "period", period, 0.0, parse_silent);
00033 
00034   get_keyval (conf, "debugGradients", b_debug_gradients, false, parse_silent);
00035 
00036   if (cvm::debug())
00037     cvm::log ("Done initializing cvc base object.\n");
00038 }
00039 
00040 
00041 void colvar::cvc::parse_group (std::string const &conf, 
00042                                char const *group_key,
00043                                cvm::atom_group &group,
00044                                bool optional)
00045 {
00046   if (key_lookup (conf, group_key)) {
00047     group.parse (conf, group_key);
00048   } else {
00049     if (! optional) {
00050       cvm::fatal_error ("Error: definition for atom group \""+
00051                       std::string (group_key)+"\" not found.\n");
00052     }
00053   }
00054 }
00055 
00056 
00057 colvar::cvc::~cvc()
00058 {}
00059 
00060 
00061 void colvar::cvc::calc_force_invgrads()
00062 {
00063   cvm::fatal_error ("Error: calculation of inverse gradients is not implemented "
00064                     "for colvar components of type \""+function_type+"\".\n");
00065 }
00066 
00067 
00068 void colvar::cvc::calc_Jacobian_derivative()
00069 {
00070   cvm::fatal_error ("Error: calculation of inverse gradients is not implemented "
00071                     "for colvar components of type \""+function_type+"\".\n");
00072 }
00073 
00074 
00075 colvarvalue colvar::cvc::fdiff_change (cvm::atom_group &group)
00076 {  
00077   colvarvalue change (x.type());
00078 
00079   if (group.old_pos.size()) {
00080     for (size_t i = 0; i < group.size(); i++) {
00081       cvm::rvector const &pold = group.old_pos[i];
00082       cvm::rvector const &p = group[i].pos;
00083       change += group[i].grad * (p - pold);
00084     }
00085   }
00086 
00087   // save for next step
00088   group.old_pos = group.positions();
00089   return change;
00090 }

Generated on Mon Nov 23 04:59:18 2009 for NAMD by  doxygen 1.3.9.1