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

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

00337                                {
00338 //-----------------------------------------------------------------------
00339 // each ADistRestraint restrains the distance between 2 groups of atoms
00340 //-----------------------------------------------------------------------
00341   m_NumGroups = 2;
00342   m_pGroups = new AGroup[m_NumGroups];
00343   m_pCOMs = new AVector[m_NumGroups];
00344 }


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

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

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

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

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

Definition at line 393 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().

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

void ADistRestraint::PrintInfo (  )  [virtual]

Implements ARestraint.

Definition at line 347 of file FreeEnergyRestrain.C.

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

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


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