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

#include <FreeEnergyRestrain.h>

Inheritance diagram for APosRestraint:
ARestraint ABoundPosRestraint AFixedPosRestraint AForcingPosRestraint

Public Member Functions

 APosRestraint ()
 
void PrintInfo ()
 
virtual AVector GetPosTarget ()=0
 
virtual double GetDistance ()=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 (AVector RefPos, double LambdaKf=1.0)
 
AVector GetGrad (int WhichGroup, AVector RefPos, 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 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.

256  {
257 //-----------------------------------------------------------------
258 // each APosRestraint restrains 1 group of atoms to a location
259 //-----------------------------------------------------------------
260  m_NumGroups = 1;
262  m_pCOMs = new AVector[m_NumGroups];
263 }
AGroup * m_pGroups
AVector * m_pCOMs

Member Function Documentation

virtual double APosRestraint::GetDistance ( )
pure virtual
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 AFixedPosRestraint::GetEnergy(), and AForcingPosRestraint::GetEnergy().

295  {
296 //--------------------------------------------------------------------
297 // calculate and return the Energy for this position restraint.
298 //
299 // E = (Kf/2) * (|ri - rref|)**2
300 //
301 // where |ri - rref| is the distance between a) the center-of-mass
302 // of the restrained atoms and b) the reference position.
303 //
304 // Note: COM is calculated before this routine is called.
305 //--------------------------------------------------------------------
306  return( ((m_Kf*LambdaKf)/2.0) * m_pCOMs[0].DistSqr(RefPos) );
307 }
AVector * m_pCOMs
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 AFixedPosRestraint::GetGradient(), and AForcingPosRestraint::GetGradient().

311  {
312 //-------------------------------------------------------------------------
313 // calculate and return the gradient for this position restraint.
314 //
315 // E = (Kf/2) * (|ri - rref|)**2
316 //
317 // return: grad(E)
318 //
319 // Notes: COM is calculated before this routine is called.
320 // m_pCOMs points to an array of vectors
321 // m_pCOMS[0] references the only COM for a position restraint
322 // m_pCOMS[0][0] returns the x value from the vector (x,y,z)
323 // (operator[] is defined to return an item from the vector)
324 //-------------------------------------------------------------------------
325  // WhichGroup = 0; // don't care -- there's only 1 atom restrained
326  AVector Vec(m_pCOMs[0][0] - RefPos[0],
327  m_pCOMs[0][1] - RefPos[1],
328  m_pCOMs[0][2] - RefPos[2]);
329  return(Vec*m_Kf*LambdaKf);
330 }
AVector * m_pCOMs
virtual AVector APosRestraint::GetPosTarget ( )
pure virtual
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().

266  {
267 //--------------------------------------------------------------------
268 // print the position for this position restraint
269 //--------------------------------------------------------------------
270  double Distance;
271  char Str[20];
272 
273  Distance = GetDistance();
274  sprintf(Str, "%7.3f", Distance);
275 
276 #if defined(_VERBOSE_PMF)
277  iout << "Position = ";
278  m_pCOMs[0].Out();
279  iout << " Target = ";
280  GetPosTarget().Out();
281  iout << " Distance = ";
282  iout << Str;
283  iout << std::endl << endi;
284 #else
285  m_pCOMs[0].Out();
286  iout << " ";
287  GetPosTarget().Out();
288  iout << " ";
289  iout << Str;
290  iout << " | ";
291 #endif
292 }
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
virtual AVector GetPosTarget()=0
virtual double GetDistance()=0
AVector * m_pCOMs

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