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

colvar::alpha_angles Class Reference

Colvar component: alpha helix content of a contiguous segment of 5 or more residues, implemented as a sum of Ca-Ca-Ca angles and hydrogen bonds (colvarvalue::type_scalar type, range [0:1]). More...

#include <colvarcomp.h>

Inheritance diagram for colvar::alpha_angles:

colvar::cvc colvarparse List of all members.

Public Member Functions

 alpha_angles (std::string const &conf)
 alpha_angles ()
virtual ~alpha_angles ()
void calc_value ()
 Calculate the variable.
void calc_gradients ()
 Calculate the atomic gradients, to be reused later in order to apply forces.
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
 Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities).
virtual colvarvalue dist2_lgrad (colvarvalue const &x1, colvarvalue const &x2) const
 Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
virtual colvarvalue dist2_rgrad (colvarvalue const &x1, colvarvalue const &x2) const
 Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
virtual cvm::real compare (colvarvalue const &x1, colvarvalue const &x2) const
 Return a positive number if x2>x1, zero if x2==x1, negative otherwise (can be redefined to transparently implement constraints, symmetries and periodicities) Note: it only works with scalar variables, otherwise raises an error.

Protected Attributes

cvm::real theta_ref
 Reference Calpha-Calpha angle (default: 88 degrees).
cvm::real theta_tol
 Tolerance on the Calpha-Calpha angle.
std::vector< angle * > theta
 List of Calpha-Calpha angles.
std::vector< h_bond * > hb
 List of hydrogen bonds.
cvm::real hb_coeff
 Contribution of the hb terms.

Detailed Description

Colvar component: alpha helix content of a contiguous segment of 5 or more residues, implemented as a sum of Ca-Ca-Ca angles and hydrogen bonds (colvarvalue::type_scalar type, range [0:1]).

Definition at line 789 of file colvarcomp.h.


Constructor & Destructor Documentation

colvar::alpha_angles::alpha_angles std::string const &  conf  ) 
 

Definition at line 14 of file colvarcomp_protein.C.

References colvarmodule::debug(), colvarmodule::fatal_error(), hb, hb_coeff, colvarparse::key_lookup(), colvarmodule::log(), theta, theta_ref, theta_tol, and colvarvalue::type().

00015   : cvc (conf)
00016 {
00017   if (cvm::debug())
00018     cvm::log ("Initializing alpha_angles object.\n");
00019 
00020   function_type = "alpha_angles";
00021   x.type (colvarvalue::type_scalar);
00022 
00023   std::string segment_id;
00024   get_keyval (conf, "psfSegID", segment_id, std::string ("MAIN"));
00025 
00026   std::vector<int> residues;
00027   {
00028     std::string residues_conf = "";
00029     key_lookup (conf, "residueRange", residues_conf);
00030     if (residues_conf.size()) {
00031       std::istringstream is (residues_conf);
00032       int initial, final;
00033       char dash;
00034       if ( (is >> initial) && (initial > 0) &&
00035            (is >> dash) && (dash == '-') &&
00036            (is >> final) && (final > 0) ) {
00037         for (int rnum = initial; rnum <= final; rnum++) {
00038           residues.push_back (rnum);
00039         }
00040       }
00041     } else {
00042       cvm::fatal_error ("Error: no residues defined in \"residueRange\".\n");
00043     }
00044   }
00045 
00046   if (residues.size() < 5) {
00047     cvm::fatal_error ("Error: not enough residues defined in \"residueRange\".\n");
00048   }
00049 
00050   std::string const &sid    = segment_id;
00051   std::vector<int> const &r = residues;
00052 
00053 
00054   get_keyval (conf, "hBondCoeff", hb_coeff, 0.5);
00055   if ( (hb_coeff < 0.0) || (hb_coeff > 1.0) ) {
00056     cvm::fatal_error ("Error: hBondCoeff must be defined between 0 and 1.\n");
00057   }
00058 
00059 
00060   get_keyval (conf, "angleRef", theta_ref, 88.0, parse_silent);
00061   get_keyval (conf, "angleTol", theta_tol, 15.0, parse_silent);
00062 
00063   if (hb_coeff < 1.0) {
00064 
00065     for (size_t i = 0; i < residues.size()-2; i++) {
00066       theta.push_back (new colvar::angle (cvm::atom (r[i  ], "CA", sid),
00067                                           cvm::atom (r[i+1], "CA", sid),
00068                                           cvm::atom (r[i+2], "CA", sid)));
00069     }
00070 
00071   } else {
00072     cvm::log ("The hBondCoeff specified will disable the Calpha-Calpha-Calpha angle terms.\n");
00073   }
00074 
00075   {
00076     cvm::real r0;
00077     size_t en, ed;
00078     get_keyval (conf, "hBondCutoff",   r0, (3.3 * cvm::unit_angstrom()));
00079     get_keyval (conf, "hBondExpNumer", en, 6);
00080     get_keyval (conf, "hBondExpDenom", ed, 8);
00081 
00082     if (hb_coeff > 0.0) {
00083 
00084       for (size_t i = 0; i < residues.size()-4; i++) {
00085         hb.push_back (new colvar::h_bond (cvm::atom (r[i  ], "O",  sid),
00086                                           cvm::atom (r[i+4], "N",  sid),
00087                                           r0, en, ed));
00088       }
00089 
00090     } else {
00091       cvm::log ("The hBondCoeff specified will disable the hydrogen bond terms.\n");
00092     }
00093   }
00094 
00095   if (cvm::debug())
00096     cvm::log ("Done initializing alpha_angles object.\n");
00097 }

colvar::alpha_angles::alpha_angles  ) 
 

Definition at line 100 of file colvarcomp_protein.C.

References colvarvalue::type().

00101   : cvc ()
00102 {
00103   function_type = "alpha_angles";
00104   x.type (colvarvalue::type_scalar);
00105 }

virtual colvar::alpha_angles::~alpha_angles  )  [inline, virtual]
 

Definition at line 813 of file colvarcomp.h.

00813 {}


Member Function Documentation

void colvar::alpha_angles::apply_force colvarvalue const &  force  )  [virtual]
 

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

Parameters:
cvforce The collective variable force, usually coming from the biases and eventually manipulated by the parent object

Implements colvar::cvc.

Definition at line 162 of file colvarcomp_protein.C.

References hb, hb_coeff, colvarmodule::real, colvarvalue::real_value, theta, and theta_tol.

00163 {
00164 
00165   if (theta.size()) {
00166 
00167     cvm::real const theta_norm = 
00168       (1.0-hb_coeff) / cvm::real (theta.size());
00169     
00170     for (size_t i = 0; i < theta.size(); i++) {
00171 
00172       cvm::real const t = ((theta[i])->value().real_value-theta_ref)/theta_tol;
00173       cvm::real const f = ( (1.0 - ::pow (t, (int) 2)) /
00174                             (1.0 - ::pow (t, (int) 4)) );
00175 
00176       cvm::real const dfdt =
00177         1.0/(1.0 - ::pow (t, (int) 4)) * 
00178         ( (-2.0 * t) + (-1.0*f)*(-4.0 * ::pow (t, (int) 3)) );
00179 
00180       (theta[i])->apply_force (theta_norm * 
00181                                dfdt * (1.0/theta_tol) *
00182                                force.real_value );
00183     }
00184   }
00185 
00186   if (hb.size()) {
00187 
00188     cvm::real const hb_norm =
00189       hb_coeff / cvm::real (hb.size());
00190 
00191     for (size_t i = 0; i < hb.size(); i++) {
00192       (hb[i])->apply_force (0.5 * hb_norm * force.real_value);
00193     }
00194   }
00195 }

void colvar::alpha_angles::calc_gradients  )  [virtual]
 

Calculate the atomic gradients, to be reused later in order to apply forces.

Implements colvar::cvc.

Definition at line 152 of file colvarcomp_protein.C.

References hb, and theta.

00153 {
00154   for (size_t i = 0; i < theta.size(); i++) 
00155     (theta[i])->calc_gradients();
00156 
00157   for (size_t i = 0; i < hb.size(); i++)
00158     (hb[i])->calc_gradients();
00159 }

void colvar::alpha_angles::calc_value  )  [virtual]
 

Calculate the variable.

Implements colvar::cvc.

Definition at line 108 of file colvarcomp_protein.C.

References colvarmodule::debug(), hb, hb_coeff, colvarmodule::log(), colvarmodule::real, colvarvalue::real_value, theta, and colvarmodule::to_str().

00109 {
00110   x.real_value = 0.0;
00111 
00112   if (theta.size()) {
00113 
00114     cvm::real const theta_norm = 
00115       (1.0-hb_coeff) / cvm::real (theta.size());
00116 
00117     for (size_t i = 0; i < theta.size(); i++) {
00118 
00119       (theta[i])->calc_value();
00120 
00121       cvm::real const t = ((theta[i])->value().real_value-theta_ref)/theta_tol;
00122       cvm::real const f = ( (1.0 - ::pow (t, (int) 2)) /
00123                             (1.0 - ::pow (t, (int) 4)) );
00124 
00125       x.real_value += theta_norm * f;
00126 
00127       if (cvm::debug())
00128         cvm::log ("Calpha-Calpha angle no. "+cvm::to_str (i+1)+" in \""+
00129                   this->name+"\" has a value of "+
00130                   (cvm::to_str ((theta[i])->value().real_value))+
00131                   " degrees, f = "+cvm::to_str (f)+".\n");
00132     }
00133   }
00134 
00135   if (hb.size()) {
00136 
00137     cvm::real const hb_norm =
00138       hb_coeff / cvm::real (hb.size());
00139 
00140     for (size_t i = 0; i < hb.size(); i++) {
00141       (hb[i])->calc_value();
00142       x.real_value += hb_norm * (hb[i])->value().real_value;
00143       if (cvm::debug())
00144         cvm::log ("Hydrogen bond no. "+cvm::to_str (i+1)+" in \""+
00145                   this->name+"\" has a value of "+
00146                   (cvm::to_str ((hb[i])->value().real_value))+".\n");
00147     }
00148   }
00149 }

virtual cvm::real colvar::alpha_angles::compare colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Return a positive number if x2>x1, zero if x2==x1, negative otherwise (can be redefined to transparently implement constraints, symmetries and periodicities) Note: it only works with scalar variables, otherwise raises an error.

Reimplemented from colvar::cvc.

virtual cvm::real colvar::alpha_angles::dist2 colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities).

colvar::cvc::dist2() and the related functions are declared as "const" functions, but not "static", because additional parameters defining the metrics (e.g. the periodicity) may be specific to each colvar::cvc object.

If symmetries or periodicities are present, the colvar::cvc::dist2() should be redefined to return the "closest distance" value and colvar::cvc::dist2_lgrad(), colvar::cvc::dist2_rgrad() to return its gradients.

If constraints are present (and not already implemented by any of the types), the colvar::cvc::dist2_lgrad() and colvar::cvc::dist2_rgrad() functions should be redefined to provide a gradient which is compatible with the constraint, i.e. already deprived of its component normal to the constraint hypersurface.

Finally, another useful application, if you are performing very many operations with these functions, could be to override the member functions and access directly its member data. For instance: to define dist2(x1,x2) as (x2.real_value-x1.real_value)*(x2.real_value-x1.real_value) in case of a scalar type.

Reimplemented from colvar::cvc.

virtual colvarvalue colvar::alpha_angles::dist2_lgrad colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).

Reimplemented from colvar::cvc.

virtual colvarvalue colvar::alpha_angles::dist2_rgrad colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).

Reimplemented from colvar::cvc.


Member Data Documentation

std::vector<h_bond *> colvar::alpha_angles::hb [protected]
 

List of hydrogen bonds.

Definition at line 804 of file colvarcomp.h.

Referenced by alpha_angles(), apply_force(), calc_gradients(), and calc_value().

cvm::real colvar::alpha_angles::hb_coeff [protected]
 

Contribution of the hb terms.

Definition at line 807 of file colvarcomp.h.

Referenced by alpha_angles(), apply_force(), and calc_value().

std::vector<angle *> colvar::alpha_angles::theta [protected]
 

List of Calpha-Calpha angles.

Definition at line 801 of file colvarcomp.h.

Referenced by alpha_angles(), apply_force(), calc_gradients(), and calc_value().

cvm::real colvar::alpha_angles::theta_ref [protected]
 

Reference Calpha-Calpha angle (default: 88 degrees).

Definition at line 795 of file colvarcomp.h.

Referenced by alpha_angles().

cvm::real colvar::alpha_angles::theta_tol [protected]
 

Tolerance on the Calpha-Calpha angle.

Definition at line 798 of file colvarcomp.h.

Referenced by alpha_angles(), and apply_force().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:59:31 2009 for NAMD by  doxygen 1.3.9.1