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 256 of file FreeEnergyRestrain.C.

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

00256                              {
00257 //-----------------------------------------------------------------
00258 // each APosRestraint restrains 1 group of atoms to a location
00259 //-----------------------------------------------------------------
00260   m_NumGroups = 1;
00261   m_pGroups = new AGroup[m_NumGroups];
00262   m_pCOMs = new AVector[m_NumGroups];
00263 }


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 295 of file FreeEnergyRestrain.C.

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

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

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

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

Definition at line 310 of file FreeEnergyRestrain.C.

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

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

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

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

Implemented in AFixedPosRestraint, ABoundPosRestraint, and AForcingPosRestraint.

Referenced by PrintInfo().

void APosRestraint::PrintInfo (  )  [virtual]

Implements ARestraint.

Definition at line 266 of file FreeEnergyRestrain.C.

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

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


The documentation for this class was generated from the following files:
Generated on Mon Jun 18 01:17:16 2018 for NAMD by  doxygen 1.4.7