NAMD
Public Member Functions | Protected Member Functions | List of all members
ADistRestraint Class Referenceabstract

#include <FreeEnergyRestrain.h>

Inheritance diagram for ADistRestraint:
ARestraint ABoundDistRestraint AFixedDistRestraint AForcingDistRestraint

Public Member Functions

 ADistRestraint ()
 
void PrintInfo ()
 
virtual double GetDistTarget ()=0
 
- Public Member Functions inherited from ARestraint
 ARestraint ()
 
virtual ~ARestraint ()
 
int GetNumGroups ()
 
void SetKf (double Kf)
 
double GetKf ()
 
void SetLambdaKf (double LambdaKf)
 
void SetLambdaRef (double LambdaRef)
 
double GetLambdaKf ()
 
double GetLambdaRef ()
 
void SetGroup (AGroup &Group, int GroupIndex)
 
void SetGroups (AGroup &Group1)
 
void SetGroups (AGroup &Group1, AGroup &Group2)
 
void SetGroups (AGroup &Group1, AGroup &Group2, AGroup &Group3)
 
void SetGroups (AGroup &Group1, AGroup &Group2, AGroup &Group3, AGroup &Group4)
 
void UpdateCOMs (GlobalMasterFreeEnergy &CFE)
 
void DistributeForce (int WhichGroup, AVector Force, GlobalMasterFreeEnergy &CFE)
 
virtual AVector GetGradient (int WhichGroup)=0
 
virtual double GetEnergy ()=0
 
virtual void GetStr (char *Str)=0
 
virtual Bool_t IsForcing ()
 
virtual double Get_dU_dLambda ()
 
virtual void SetRefPos (AVector)
 
virtual void SetRefDist (double)
 
virtual void SetRefAngle (double)
 
virtual void SetBound (Bound_t)
 
virtual void SetLowerAngle (double)
 
virtual void SetUpperAngle (double)
 
virtual void SetIntervalAngle (double)
 
virtual void SetStartPos (AVector)
 
virtual void SetStopPos (AVector)
 
virtual void SetStartDist (double)
 
virtual void SetStopDist (double)
 
virtual void SetStartAngle (double)
 
virtual void SetStopAngle (double)
 

Protected Member Functions

double GetE (double RefDist, double LambdaKf=1.0)
 
AVector GetGrad (int WhichGroup, double RefDist, double LambdaKf=1.0)
 
- Protected Member Functions inherited from ARestraint
double GetAngle (AVector &A, AVector &B, AVector &C)
 
double GetDihe (AVector &A, AVector &B, AVector &C, AVector &D)
 
void EarlyExit (const char *Str, int AtomID)
 

Additional Inherited Members

- Protected Attributes inherited from ARestraint
double m_Kf
 
int m_NumGroups
 
AGroupm_pGroups
 
AVectorm_pCOMs
 
- Static Protected Attributes inherited from ARestraint
static double m_LambdaKf = 1.0
 
static double m_LambdaRef = 0.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.

333  {
334 //-----------------------------------------------------------------------
335 // each ADistRestraint restrains the distance between 2 groups of atoms
336 //-----------------------------------------------------------------------
337  m_NumGroups = 2;
339  m_pCOMs = new AVector[m_NumGroups];
340 }
AGroup * m_pGroups
AVector * m_pCOMs

Member Function Documentation

virtual double ADistRestraint::GetDistTarget ( )
pure virtual
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 AFixedDistRestraint::GetEnergy(), ABoundDistRestraint::GetEnergy(), and AForcingDistRestraint::GetEnergy().

370  {
371 //---------------------------------------------------------------------------
372 // calculate and return the Energy for this distance restraint.
373 //
374 // E = (Kf/2) * (di-dref)**2
375 //
376 // where di is the distance between 2 centers-of-mass of restrained atoms,
377 // and dref is the reference distance.
378 //
379 // Note: COM's are calculated before this routine is called.
380 //---------------------------------------------------------------------------
381  double Dist, Diff;
382 
383  Dist = m_pCOMs[0].Dist(m_pCOMs[1]);
384  Diff = Dist - RefDist;
385  return( ((m_Kf*LambdaKf)/2.0) * (Diff*Diff) );
386 }
double Dist()
AVector * m_pCOMs
AVector ADistRestraint::GetGrad ( int  WhichGroup,
double  RefDist,
double  LambdaKf = 1.0 
)
protected

Definition at line 389 of file FreeEnergyRestrain.C.

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

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

390  {
391 //---------------------------------------------------------------------------
392 // calculate and return the gradient for this distance restraint.
393 //
394 // E = (Kf/2) * (di-dref)**2
395 //
396 // return: grad(E)
397 //
398 // Notes: COM is calculated before this routine is called.
399 // m_pCOMS[0 & 1] reference the COM's of each group of atoms
400 //---------------------------------------------------------------------------
401  double Dist;
402  AVector Vec, A, B;
403 
404  ASSERT( (WhichGroup==0) || (WhichGroup==1) );
405  if (WhichGroup == 0) {
406  A = m_pCOMs[0];
407  B = m_pCOMs[1];
408  }
409  else {
410  A = m_pCOMs[1];
411  B = m_pCOMs[0];
412  }
413 
414  Dist = A.Dist(B);
415  Vec.Set(A[0]-B[0], A[1]-B[1], A[2]-B[2]);
416  Vec *= m_Kf * LambdaKf * (Dist - RefDist) / Dist;
417  return(Vec);
418 }
Bool_t Set(double x, double y, double z)
const BigReal A
#define ASSERT(E)
const BigReal B
double Dist()
AVector * m_pCOMs
void ADistRestraint::PrintInfo ( )
virtual

Implements ARestraint.

Definition at line 343 of file FreeEnergyRestrain.C.

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

343  {
344 //--------------------------------------------------------------------
345 // print the distance for this distance restraint
346 //--------------------------------------------------------------------
347  double Distance;
348  char Str1[20], Str2[20];
349 
350  Distance = m_pCOMs[0].Dist(m_pCOMs[1]);
351  sprintf(Str1, "%7.3f", Distance);
352  Distance = GetDistTarget();
353  sprintf(Str2, "%7.3f", Distance);
354 
355 #if defined(_VERBOSE_PMF)
356  iout << "Distance = ";
357  iout << Str1;
358  iout << " Target = ";
359  iout << Str2;
360  iout << std::endl << endi;
361 #else
362  iout << Str1;
363  iout << " ";
364  iout << Str2;
365  iout << " | ";
366 #endif
367 }
#define iout
Definition: InfoStream.h:87
virtual double GetDistTarget()=0
double Dist()
infostream & endi(infostream &s)
Definition: InfoStream.C:38
AVector * m_pCOMs

The documentation for this class was generated from the following files: