ADistRestraint Class Reference

#include <FreeEnergyRestrain.h>

Inheritance diagram for ADistRestraint:

ARestraint ABoundDistRestraint AFixedDistRestraint AForcingDistRestraint List of all members.

Public Member Functions

 ADistRestraint ()
void PrintInfo ()
virtual double GetDistTarget ()=0

Protected Member Functions

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

Detailed Description

Definition at line 118 of file FreeEnergyRestrain.h.


Constructor & Destructor Documentation

ADistRestraint::ADistRestraint (  ) 

Definition at line 333 of file FreeEnergyRestrain.C.

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

00333                                {
00334 //-----------------------------------------------------------------------
00335 // each ADistRestraint restrains the distance between 2 groups of atoms
00336 //-----------------------------------------------------------------------
00337   m_NumGroups = 2;
00338   m_pGroups = new AGroup[m_NumGroups];
00339   m_pCOMs = new AVector[m_NumGroups];
00340 }


Member Function Documentation

virtual double ADistRestraint::GetDistTarget (  )  [pure virtual]

Implemented in AFixedDistRestraint, ABoundDistRestraint, and AForcingDistRestraint.

Referenced by PrintInfo().

double ADistRestraint::GetE ( double  RefDist,
double  LambdaKf = 1.0 
) [protected]

Definition at line 370 of file FreeEnergyRestrain.C.

References AVector::Dist(), ARestraint::m_Kf, and ARestraint::m_pCOMs.

Referenced by AForcingDistRestraint::GetEnergy(), ABoundDistRestraint::GetEnergy(), and AFixedDistRestraint::GetEnergy().

00370                                                            {
00371 //---------------------------------------------------------------------------
00372 // calculate and return the Energy for this distance restraint.
00373 //
00374 //     E = (Kf/2) * (di-dref)**2
00375 //
00376 // where di is the distance between 2 centers-of-mass of restrained atoms,
00377 // and dref is the reference distance.
00378 //
00379 // Note:  COM's are calculated before this routine is called.
00380 //---------------------------------------------------------------------------
00381   double Dist, Diff;
00382 
00383   Dist = m_pCOMs[0].Dist(m_pCOMs[1]);
00384   Diff = Dist - RefDist;
00385   return( ((m_Kf*LambdaKf)/2.0) * (Diff*Diff) );
00386 }

AVector ADistRestraint::GetGrad ( int  WhichGroup,
double  RefDist,
double  LambdaKf = 1.0 
) [protected]

Definition at line 389 of file FreeEnergyRestrain.C.

References A, ASSERT, B, ARestraint::m_Kf, ARestraint::m_pCOMs, and AVector::Set().

Referenced by AForcingDistRestraint::GetGradient(), ABoundDistRestraint::GetGradient(), and AFixedDistRestraint::GetGradient().

00390                                                                  {
00391 //---------------------------------------------------------------------------
00392 // calculate and return the gradient for this distance restraint.
00393 //
00394 //     E = (Kf/2) * (di-dref)**2
00395 //
00396 // return:  grad(E)
00397 //
00398 // Notes: COM is calculated before this routine is called.
00399 //        m_pCOMS[0 & 1] reference the COM's of each group of atoms
00400 //---------------------------------------------------------------------------
00401   double  Dist;
00402   AVector Vec, A, B;
00403 
00404   ASSERT( (WhichGroup==0) || (WhichGroup==1) );
00405   if (WhichGroup == 0) {
00406     A = m_pCOMs[0];
00407     B = m_pCOMs[1];
00408   }
00409   else {
00410     A = m_pCOMs[1];
00411     B = m_pCOMs[0];
00412   }
00413 
00414   Dist = A.Dist(B);
00415   Vec.Set(A[0]-B[0], A[1]-B[1], A[2]-B[2]);
00416   Vec *= m_Kf * LambdaKf * (Dist - RefDist) / Dist;
00417   return(Vec);
00418 }

void ADistRestraint::PrintInfo (  )  [virtual]

Implements ARestraint.

Definition at line 343 of file FreeEnergyRestrain.C.

References AVector::Dist(), endi(), GetDistTarget(), iout, and ARestraint::m_pCOMs.

00343                                {
00344 //--------------------------------------------------------------------
00345 // print the distance for this distance restraint
00346 //--------------------------------------------------------------------
00347   double  Distance;
00348   char    Str1[20], Str2[20];
00349 
00350   Distance = m_pCOMs[0].Dist(m_pCOMs[1]);
00351   sprintf(Str1, "%7.3f", Distance);
00352   Distance = GetDistTarget();
00353   sprintf(Str2, "%7.3f", Distance);
00354 
00355 #if defined(_VERBOSE_PMF)
00356   iout << "Distance = ";
00357   iout << Str1;
00358   iout << "  Target = ";
00359   iout << Str2;
00360   iout << std::endl << endi;
00361 #else
00362   iout << Str1;
00363   iout << "  ";
00364   iout << Str2;
00365   iout << " | ";
00366 #endif
00367 }


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