#include <FreeEnergyRestrain.h>
Inheritance diagram for AnAngleRestraint:

Public Member Functions | |
| AnAngleRestraint () | |
| void | PrintInfo () |
| virtual double | GetAngleTarget ()=0 |
Protected Member Functions | |
| double | GetE (double RefAngle, double LambdaKf=1.0) |
| AVector | GetGrad (int WhichGroup, double RefAngle, double LambdaKf=1.0) |
|
|
Definition at line 425 of file FreeEnergyRestrain.C. 00425 {
00426 //-----------------------------------------------------------------------
00427 // each AnAngleRestraint restrains the angle between 3 groups of atoms
00428 //-----------------------------------------------------------------------
00429 m_NumGroups = 3;
00430 m_pGroups = new AGroup[m_NumGroups];
00431 m_pCOMs = new AVector[m_NumGroups];
00432 }
|
|
|
Implemented in AFixedAngleRestraint, ABoundAngleRestraint, and AForcingAngleRestraint. Referenced by PrintInfo(). |
|
||||||||||||
|
Definition at line 464 of file FreeEnergyRestrain.C. References Angle, and ARestraint::GetAngle(). Referenced by AForcingAngleRestraint::GetEnergy(), ABoundAngleRestraint::GetEnergy(), and AFixedAngleRestraint::GetEnergy(). 00464 {
00465 //---------------------------------------------------------------------------
00466 // calculate and return the Energy for this angle restraint.
00467 //
00468 // E = (Kf/2) * (Theta-ThetaRef)**2
00469 //
00470 // where Theta is the angle between 3 centers-of-mass of restrained atoms,
00471 // m_pCOMs[0] -- m_pCOMs[1] -- m_pCOMs[2].
00472 // ThetaRef is the reference angle.
00473 //
00474 // Note: COM's are calculated before this routine is called.
00475 //---------------------------------------------------------------------------
00476 double Angle, Diff;
00477
00478 Angle = GetAngle(m_pCOMs[0], m_pCOMs[1], m_pCOMs[2]);
00479 Diff = Angle - RefAngle;
00480 return( ((m_Kf*LambdaKf)/2.0) * (Diff*Diff) );
00481 }
|
|
||||||||||||||||
|
Definition at line 484 of file FreeEnergyRestrain.C. References Angle, ASSERT, and AVector::Dist(). Referenced by AForcingAngleRestraint::GetGradient(), ABoundAngleRestraint::GetGradient(), and AFixedAngleRestraint::GetGradient(). 00485 {
00486 //---------------------------------------------------------------------------
00487 // calculate and return the gradient for this angle restraint.
00488 //
00489 // E = (Kf/2) * (Theta-ThetaRef)**2
00490 //
00491 // return: grad(E)
00492 //
00493 // Notes: COM's are calculated before this routine is called.
00494 //---------------------------------------------------------------------------
00495 AVector A, B, C;
00496 double Angle;
00497 double a, b, c;
00498 double u;
00499 double Const1, Const2, Const3, Const4, Const5;
00500 AVector Vec1, Vec2;
00501
00502 ASSERT( (WhichGroup==0) || (WhichGroup==1) || (WhichGroup==2) );
00503 A = m_pCOMs[0];
00504 B = m_pCOMs[1];
00505 C = m_pCOMs[2];
00506
00507 a = B.Dist(C);
00508 b = A.Dist(C);
00509 c = A.Dist(B);
00510
00511 u = (a*a + c*c - b*b) / (2.0*a*c);
00512
00513 // protect against acos(<-1.0), acos(>1.0), sqrt(<0), and divide by 0
00514 if (u < -1.0) {u = -1.0;}
00515 if (u > kAlmostOne) {u = kAlmostOne;}
00516 Angle = acos(u);
00517
00518 Const1 = -1.0 / sqrt(1.0 - u*u);
00519 Const2 = m_Kf * LambdaKf * (Angle-RefAngle) * Const1;
00520
00521 Const3 = -a/(2.0*c*c) + 1.0/(a+a) + (b*b)/(2.0*a*c*c);
00522 Const4 = -c/(2.0*a*a) + 1.0/(c+c) + (b*b)/(2.0*c*a*a);
00523 Const5 = -b/(a*c);
00524
00525 if (WhichGroup == 0) {
00526 Vec1 = (A-C) * (Const5/b);
00527 Vec2 = (A-B) * (Const3/c);
00528 }
00529 else if (WhichGroup == 1) {
00530 Vec1 = (B-A) * (Const3/c);
00531 Vec2 = (B-C) * (Const4/a);
00532 }
00533 else {
00534 Vec1 = (C-A) * (Const5/b);
00535 Vec2 = (C-B) * (Const4/a);
00536 }
00537 return( (Vec1+Vec2)*Const2);
00538 }
|
|
|
Implements ARestraint. Definition at line 435 of file FreeEnergyRestrain.C. References Angle, ARestraint::GetAngle(), GetAngleTarget(), and iout. 00435 {
00436 //--------------------------------------------------------------------
00437 // print the angle for this angle restraint
00438 //--------------------------------------------------------------------
00439 double Angle;
00440 char Str1[20], Str2[20];
00441
00442 Angle = GetAngle(m_pCOMs[0], m_pCOMs[1], m_pCOMs[2]) * (180/kPi);
00443 sprintf(Str1, "%8.3f", Angle);
00444 Angle = GetAngleTarget() * (180/kPi);
00445 sprintf(Str2, "%8.3f", Angle);
00446
00447 #if defined(_VERBOSE_PMF)
00448 iout << "Angle = ";
00449 iout << Str1;
00450 iout << " degrees";
00451 iout << " Target = ";
00452 iout << Str2;
00453 iout << " degrees";
00454 iout << std::endl << endi;
00455 #else
00456 iout << Str1;
00457 iout << " ";
00458 iout << Str2;
00459 iout << " | ";
00460 #endif
00461 }
|
1.3.9.1