APosRestraint Class Reference

#include <FreeEnergyRestrain.h>

Inheritance diagram for APosRestraint:

ARestraint ABoundPosRestraint AFixedPosRestraint AForcingPosRestraint List of all members.

Public Member Functions

 APosRestraint ()
void PrintInfo ()
virtual AVector GetPosTarget ()=0
virtual double GetDistance ()=0

Protected Member Functions

double GetE (AVector RefPos, double LambdaKf=1.0)
AVector GetGrad (int WhichGroup, AVector RefPos, double LambdaKf=1.0)

Detailed Description

Definition at line 102 of file FreeEnergyRestrain.h.


Constructor & Destructor Documentation

APosRestraint::APosRestraint (  ) 

Definition at line 260 of file FreeEnergyRestrain.C.

References ARestraint::m_NumGroups, ARestraint::m_pCOMs, and ARestraint::m_pGroups.

00260                              {
00261 //-----------------------------------------------------------------
00262 // each APosRestraint restrains 1 group of atoms to a location
00263 //-----------------------------------------------------------------
00264   m_NumGroups = 1;
00265   m_pGroups = new AGroup[m_NumGroups];
00266   m_pCOMs = new AVector[m_NumGroups];
00267 }


Member Function Documentation

virtual double APosRestraint::GetDistance (  )  [pure virtual]

Implemented in AFixedPosRestraint, ABoundPosRestraint, and AForcingPosRestraint.

Referenced by PrintInfo().

double APosRestraint::GetE ( AVector  RefPos,
double  LambdaKf = 1.0 
) [protected]

Definition at line 299 of file FreeEnergyRestrain.C.

References ARestraint::m_Kf, and ARestraint::m_pCOMs.

Referenced by AForcingPosRestraint::GetEnergy(), and AFixedPosRestraint::GetEnergy().

00299                                                           {
00300 //--------------------------------------------------------------------
00301 // calculate and return the Energy for this position restraint.
00302 //
00303 //     E = (Kf/2) * (|ri - rref|)**2
00304 //
00305 // where |ri - rref| is the distance between a) the center-of-mass
00306 // of the restrained atoms and b) the reference position.
00307 //
00308 // Note:  COM is calculated before this routine is called.
00309 //--------------------------------------------------------------------
00310   return( ((m_Kf*LambdaKf)/2.0) * m_pCOMs[0].DistSqr(RefPos) );
00311 }

AVector APosRestraint::GetGrad ( int  WhichGroup,
AVector  RefPos,
double  LambdaKf = 1.0 
) [protected]

Definition at line 314 of file FreeEnergyRestrain.C.

References ARestraint::m_Kf, and ARestraint::m_pCOMs.

Referenced by AForcingPosRestraint::GetGradient(), and AFixedPosRestraint::GetGradient().

00315                                                                 {
00316 //-------------------------------------------------------------------------
00317 // calculate and return the gradient for this position restraint.
00318 //
00319 //     E = (Kf/2) * (|ri - rref|)**2
00320 //
00321 // return:  grad(E)
00322 //
00323 // Notes: COM is calculated before this routine is called.
00324 //        m_pCOMs points to an array of vectors
00325 //        m_pCOMS[0] references the only COM for a position restraint
00326 //        m_pCOMS[0][0] returns the x value from the vector (x,y,z)
00327 //        (operator[] is defined to return an item from the vector)
00328 //-------------------------------------------------------------------------
00329   // WhichGroup = 0;  // don't care -- there's only 1 atom restrained
00330   AVector Vec(m_pCOMs[0][0] - RefPos[0],
00331               m_pCOMs[0][1] - RefPos[1],
00332               m_pCOMs[0][2] - RefPos[2]);
00333   return(Vec*m_Kf*LambdaKf);
00334 }

virtual AVector APosRestraint::GetPosTarget (  )  [pure virtual]

Implemented in AFixedPosRestraint, ABoundPosRestraint, and AForcingPosRestraint.

Referenced by PrintInfo().

void APosRestraint::PrintInfo (  )  [virtual]

Implements ARestraint.

Definition at line 270 of file FreeEnergyRestrain.C.

References endi(), GetDistance(), GetPosTarget(), iout, ARestraint::m_pCOMs, and AVector::Out().

00270                               {
00271 //--------------------------------------------------------------------
00272 // print the position for this position restraint
00273 //--------------------------------------------------------------------
00274   double  Distance;
00275   char    Str[20];
00276 
00277   Distance = GetDistance();
00278   sprintf(Str, "%7.3f", Distance);
00279 
00280 #if defined(_VERBOSE_PMF)
00281   iout << "Position = ";
00282   m_pCOMs[0].Out();
00283   iout << "  Target = ";
00284   GetPosTarget().Out();
00285   iout << "  Distance = ";
00286   iout << Str;
00287   iout << std::endl << endi;
00288 #else
00289   m_pCOMs[0].Out();
00290   iout << "  ";
00291   GetPosTarget().Out();
00292   iout << "  ";
00293   iout << Str;
00294   iout << " | ";
00295 #endif
00296 }


The documentation for this class was generated from the following files:
Generated on Mon Sep 25 01:17:16 2017 for NAMD by  doxygen 1.4.7