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

colvar::alpha_dihedrals Class Reference

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

#include <colvarcomp.h>

Inheritance diagram for colvar::alpha_dihedrals:

colvar::cvc colvarparse List of all members.

Public Member Functions

 alpha_dihedrals (std::string const &conf)
 alpha_dihedrals ()
virtual ~alpha_dihedrals ()
virtual void calc_value ()
 Calculate the variable.
virtual void calc_gradients ()
 Calculate the atomic gradients, to be reused later in order to apply forces.
virtual 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 phi_ref
 Alpha-helical reference phi value.
cvm::real psi_ref
 Alpha-helical reference psi value.
std::vector< dihedral * > phi
 List of phi dihedral angles.
std::vector< dihedral * > psi
 List of psi dihedral angles.
std::vector< h_bond * > hb
 List of hydrogen bonds.

Detailed Description

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

Definition at line 746 of file colvarcomp.h.


Constructor & Destructor Documentation

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

Definition at line 219 of file colvarcomp_protein.C.

References colvarmodule::debug(), colvarmodule::fatal_error(), hb, colvarmodule::log(), phi, phi_ref, psi, psi_ref, and colvarvalue::type().

00220   : cvc (conf)
00221 {
00222   if (cvm::debug())
00223     cvm::log ("Initializing alpha_dihedrals object.\n");
00224 
00225   function_type = "alpha_dihedrals";
00226   x.type (colvarvalue::type_scalar);
00227 
00228   std::vector<int> residues;
00229 
00230   get_keyval (conf, "residues", residues, std::vector<int>());
00231 
00232   phi.reserve (residues.size());
00233   psi.reserve (residues.size());
00234   hb.reserve  (residues.size());
00235 
00236   get_keyval (conf, "phi_ref", phi_ref, -57.8, parse_silent);
00237   get_keyval (conf, "psi_ref", psi_ref, -47.0, parse_silent);
00238 
00239   if (residues.size() < 5) {
00240     cvm::fatal_error ("Error: not enough residues defined.\n");
00241   }
00242 
00243   std::string segment_id;
00244   get_keyval (conf, "segment_id", segment_id, std::string ("MAIN"));
00245 
00246   std::string const &sid    = segment_id;
00247   std::vector<int> const &r = residues;
00248   for (size_t i = 0; i < residues.size()-1; i++) {
00249 
00250     phi.push_back (new colvar::dihedral (cvm::atom (r[i  ], "C",  sid),
00251                                          cvm::atom (r[i+1], "N",  sid),
00252                                          cvm::atom (r[i+1], "CA", sid),
00253                                          cvm::atom (r[i+1], "C",  sid)));
00254 
00255     psi.push_back (new colvar::dihedral (cvm::atom (r[i  ], "N",  sid),
00256                                          cvm::atom (r[i  ], "CA", sid),
00257                                          cvm::atom (r[i  ], "C",  sid),
00258                                          cvm::atom (r[i+1], "N",  sid)));
00259   }
00260 
00261   for (size_t i = 0; i < residues.size()-4; i++) {
00262     hb.push_back (new colvar::h_bond (cvm::atom (r[i  ], "O",  sid),
00263                                       cvm::atom (r[i+4], "N",  sid),
00264                                       3.3 * cvm::unit_angstrom(),
00265                                       6, 8));
00266   }
00267 
00268   if (cvm::debug())
00269     cvm::log ("Done initializing alpha_dihedrals object.\n");
00270 }

colvar::alpha_dihedrals::alpha_dihedrals  ) 
 

Definition at line 273 of file colvarcomp_protein.C.

References colvarvalue::type().

00274   : cvc ()
00275 {
00276   function_type = "alpha_dihedrals";
00277   x.type (colvarvalue::type_scalar);
00278 }

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

Definition at line 770 of file colvarcomp.h.

00770 {}


Member Function Documentation

void colvar::alpha_dihedrals::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 330 of file colvarcomp_protein.C.

References dih_deriv(), dih_func(), hb, phi, phi_ref, psi, psi_ref, colvarvalue::real_value, and colvar::cvc::value().

00331 {
00332   for (size_t i = 0; i < phi.size(); i++) {
00333 
00334     (phi[i])->apply_force ( 0.5 *
00335                             dih_func (((psi[i])->value()).real_value, psi_ref) *
00336                             dih_deriv (((phi[i])->value()).real_value, phi_ref) *
00337                             force.real_value );
00338 
00339     (psi[i])->apply_force ( 0.5 *
00340                             dih_func (((phi[i])->value()).real_value, phi_ref) *
00341                             dih_deriv (((psi[i])->value()).real_value, psi_ref) *
00342                             force.real_value );
00343   }
00344 
00345   for (size_t i = 0; i < hb.size(); i++) {
00346     (hb[i])->apply_force (0.5 * force.real_value);
00347   }
00348 }

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

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

Implements colvar::cvc.

Definition at line 318 of file colvarcomp_protein.C.

References hb, phi, and psi.

00319 {
00320   for (size_t i = 0; i < phi.size(); i++) {
00321     (phi[i])->calc_gradients();
00322     (psi[i])->calc_gradients();
00323   }
00324   for (size_t i = 0; i < hb.size(); i++) {
00325     (hb[i])->calc_gradients();
00326   }
00327 }

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

Calculate the variable.

Implements colvar::cvc.

Definition at line 281 of file colvarcomp_protein.C.

References colvarmodule::debug(), dih_func(), hb, colvarmodule::log(), phi, phi_ref, psi, psi_ref, colvarvalue::real_value, and colvar::cvc::value().

00282 {
00283   x.real_value = 0.0;
00284 
00285   for (size_t i = 0; i < phi.size(); i++) {
00286 
00287     (phi[i])->calc_value();
00288     (psi[i])->calc_value();
00289 
00290     x.real_value += 0.5 *
00291       dih_func (((phi[i])->value()).real_value, phi_ref) *
00292       dih_func (((psi[i])->value()).real_value, psi_ref);
00293 
00294     if (cvm::debug())
00295       cvm::log ("Phi dihedral no. "+cvm::to_str (i+1)+" in \""+
00296                 this->name+"\" has a value of "+
00297                 (cvm::to_str ((phi[i])->value().real_value))+
00298                 " degrees.\n");
00299 
00300     if (cvm::debug())
00301       cvm::log ("Psi dihedral no. "+cvm::to_str (i+1)+" in \""+
00302                 this->name+"\" has a value of "+
00303                 (cvm::to_str ((psi[i])->value().real_value))+
00304                 " degrees.\n");
00305   }
00306 
00307   for (size_t i = 0; i < hb.size(); i++) {
00308     (hb[i])->calc_value();
00309     x.real_value += 0.5 * (hb[i])->value().real_value;
00310     if (cvm::debug())
00311       cvm::log ("Hydrogen bond no. "+cvm::to_str (i+1)+" in \""+
00312                 this->name+"\" has a value of "+
00313                 (cvm::to_str ((hb[i])->value().real_value))+".\n");
00314   }
00315 }

virtual cvm::real colvar::alpha_dihedrals::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_dihedrals::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_dihedrals::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_dihedrals::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_dihedrals::hb [protected]
 

List of hydrogen bonds.

Definition at line 764 of file colvarcomp.h.

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

std::vector<dihedral *> colvar::alpha_dihedrals::phi [protected]
 

List of phi dihedral angles.

Definition at line 758 of file colvarcomp.h.

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

cvm::real colvar::alpha_dihedrals::phi_ref [protected]
 

Alpha-helical reference phi value.

Definition at line 752 of file colvarcomp.h.

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

std::vector<dihedral *> colvar::alpha_dihedrals::psi [protected]
 

List of psi dihedral angles.

Definition at line 761 of file colvarcomp.h.

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

cvm::real colvar::alpha_dihedrals::psi_ref [protected]
 

Alpha-helical reference psi value.

Definition at line 755 of file colvarcomp.h.

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


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