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

Public Member Functions | |
| 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 void | PrintInfo ()=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 | GetAngle (AVector &A, AVector &B, AVector &C) |
| double | GetDihe (AVector &A, AVector &B, AVector &C, AVector &D) |
| void | EarlyExit (char *Str, int AtomID) |
Protected Attributes | |
| double | m_Kf |
| int | m_NumGroups |
| AGroup * | m_pGroups |
| AVector * | m_pCOMs |
Static Protected Attributes | |
| double | m_LambdaKf = 1.0 |
| double | m_LambdaRef = 0.0 |
|
|
Definition at line 42 of file FreeEnergyRestrain.C. References m_NumGroups, m_pCOMs, and m_pGroups. 00042 {
00043 //-----------------------------------------------------------------
00044 // constructor for base class
00045 //-----------------------------------------------------------------
00046 m_pGroups = NULL;
00047 m_pCOMs = NULL;
00048 m_NumGroups = 0;
00049 }
|
|
|
Definition at line 52 of file FreeEnergyRestrain.C. References ASSERT, m_pCOMs, and m_pGroups. 00052 {
00053 //-----------------------------------------------------------------
00054 // free space that may have been allocated for Groups and COM's
00055 //-----------------------------------------------------------------
00056 if (m_pGroups != NULL) {
00057 ASSERT(m_pCOMs != NULL);
00058 delete []m_pGroups;
00059 delete []m_pCOMs;
00060 }
00061 }
|
|
||||||||||||||||
|
Definition at line 183 of file FreeEnergyRestrain.C. References GlobalMasterFreeEnergy::addForce(), ASSERT, AtomID, EarlyExit(), Force, GlobalMasterFreeEnergy::getMass(), AGroup::GetNumInGroup(), m_NumGroups, m_pGroups, Mass, and SetEqual(). Referenced by ARestraintManager::AddForces(). 00184 {
00185 //----------------------------------------------------------------------
00186 // Distribute Force among the group of atoms specified by WhichGroup
00187 //
00188 // note: m_pGroups points to an array of Groups
00189 // m_pGroups[WhichGroup] references one of the Groups
00190 // m_pGroups[WhichGroup][i] returns an AtomID from the Group
00191 // (operator[] is defined to return an item from the Group)
00192 //----------------------------------------------------------------------
00193 int i, AtomID, NumAtoms, RetVal;
00194 double Mass, TotalMass=0;
00195 AVector SmallForce;
00196 Vector NAMD_Vector;
00197
00198 ASSERT( (WhichGroup>=0) && (WhichGroup<m_NumGroups) );
00199
00200 // calculate the total mass for the group
00201 NumAtoms = m_pGroups[WhichGroup].GetNumInGroup();
00202 for (i=0; i<NumAtoms; i++) {
00203 AtomID = m_pGroups[WhichGroup][i];
00204 Mass = CFE.getMass(AtomID);
00205 if (Mass < 0) {EarlyExit("Negative Mass", AtomID);};
00206 TotalMass += Mass;
00207 }
00208
00209 // distribute Force according to mass of each atom in the group
00210 for (i=0; i<NumAtoms; i++) {
00211 AtomID = m_pGroups[WhichGroup][i];
00212 Mass = CFE.getMass(AtomID);
00213 if (Mass < 0) {EarlyExit("Negative Mass", AtomID);}
00214 SmallForce = Force * (Mass/TotalMass);
00215 // cast SmallForce to a NAMD-type vector (addForce uses Vector class)
00216 SetEqual(NAMD_Vector, SmallForce);
00217 RetVal = CFE.addForce(AtomID, NAMD_Vector);
00218 if (RetVal < 0) {EarlyExit("Can't add Force", AtomID);}
00219 }
00220 }
|
|
||||||||||||
|
Definition at line 64 of file FreeEnergyRestrain.C. References AtomID, iout, and NAMD_die(). Referenced by DistributeForce(), and UpdateCOMs(). 00064 {
00065 //-----------------------------------------------------------------
00066 // unrecoverable error
00067 //-----------------------------------------------------------------
00068 char NumStr[40];
00069
00070 iout << "FreeEnergy: " << std::endl << endi;
00071 sprintf(NumStr, "%d", AtomID);
00072 strcat(Str, " for AtomID: ");
00073 strcat(Str, NumStr);
00074 iout << "FreeEnergy: " << Str;
00075 iout << std::endl << endi;
00076 NAMD_die("FreeEnergy: Fatal Error with Fixed or Forcing Restraints");
00077 }
|
|
|
Reimplemented in AForcingPosRestraint, AForcingDistRestraint, AForcingAngleRestraint, and AForcingDiheRestraint. Definition at line 77 of file FreeEnergyRestrain.h. Referenced by ARestraintManager::Print_dU_dLambda_Info(), and ARestraintManager::Sum_dU_dLambdas(). 00077 {return(0.0);}
|
|
||||||||||||||||
|
Definition at line 131 of file FreeEnergyRestrain.C. References AVector::Dist(). Referenced by AForcingAngleRestraint::Get_dU_dLambda(), AnAngleRestraint::GetE(), ABoundAngleRestraint::GetEnergy(), ABoundAngleRestraint::GetGradient(), and AnAngleRestraint::PrintInfo(). 00131 {
00132 //-----------------------------------------------------------------
00133 // determine the angle formed by the points A-B-C
00134 //-----------------------------------------------------------------
00135 double u;
00136 double a = B.Dist(C);
00137 double b = A.Dist(C);
00138 double c = A.Dist(B);
00139
00140 u = (a*a + c*c - b*b) / (2.0*a*c);
00141 // protect against acos(<-1.0) and acos(>1.0)
00142 if (u < -1.0) {u = -1.0;}
00143 if (u > 1.0) {u = 1.0;}
00144 return(acos(u));
00145 }
|
|
||||||||||||||||||||
|
Definition at line 148 of file FreeEnergyRestrain.C. References Angle, AVector::cross(), AVector::Dist(), and AVector::dot(). Referenced by AForcingDiheRestraint::Get_dU_dLambda(), ADiheRestraint::GetE(), ABoundDiheRestraint::GetEnergy(), ADiheRestraint::GetGrad(), ABoundDiheRestraint::GetGradient(), and ADiheRestraint::PrintInfo(). 00148 {
00149 //-----------------------------------------------------------------
00150 // determine the dihedral angle formed by the points A-B-C-D
00151 //-----------------------------------------------------------------
00152 AVector CD(D - C);
00153 AVector CB(B - C);
00154 AVector BC(C - B);
00155 AVector BA(A - B);
00156 AVector CDxCB, BCxBA;
00157 double top, bot, cos_u, sin_u, Angle;
00158 AVector topVec;
00159
00160 CDxCB = CD.cross(CB);
00161 BCxBA = BC.cross(BA);
00162
00163 top = CDxCB.dot(BCxBA);
00164 bot = CDxCB.Dist() * BCxBA.Dist();
00165 cos_u = top/bot;
00166
00167 // protect against acos(<-1.0) and acos(>1.0)
00168 if (cos_u < -1.0) {cos_u = -1.0;}
00169 if (cos_u > 1.0) {cos_u = 1.0;}
00170
00171 topVec = CDxCB.cross(BCxBA);
00172 sin_u = (topVec/bot).dot(CB/CB.Dist());
00173
00174 // protect against asin(<-1.0) and asin(>1.0)
00175 if (sin_u < -1.0) {sin_u = -1.0;}
00176 if (sin_u > 1.0) {sin_u = 1.0;}
00177
00178 Angle = atan2(sin_u, cos_u);
00179 return(Angle);
00180 }
|
|
|
|
|
Definition at line 51 of file FreeEnergyRestrain.h. 00051 {return(m_Kf);}
|
|
|
Definition at line 54 of file FreeEnergyRestrain.h. 00054 {return(m_LambdaKf);}
|
|
|
Definition at line 55 of file FreeEnergyRestrain.h. 00055 {return(m_LambdaRef);}
|
|
|
Definition at line 49 of file FreeEnergyRestrain.h. Referenced by ARestraintManager::AddForces(). 00049 {return(m_NumGroups);}
|
|
|
|
Reimplemented in AForcingPosRestraint, AForcingDistRestraint, AForcingAngleRestraint, and AForcingDiheRestraint. Definition at line 76 of file FreeEnergyRestrain.h. References Bool_t. Referenced by ARestraintManager::Print_dU_dLambda_Info(), and ARestraintManager::ThereIsAForcingRestraint(). 00076 {return(kFalse);}
|
|
|
Implemented in APosRestraint, ADistRestraint, AnAngleRestraint, and ADiheRestraint. Referenced by ARestraintManager::PrintRestraintInfo(). |
|
|
Reimplemented in ABoundPosRestraint, ABoundDistRestraint, and ABoundAngleRestraint. Definition at line 82 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00082 {ASSERT(kFalse);}
|
|
||||||||||||
|
Definition at line 80 of file FreeEnergyRestrain.C. References ASSERT, m_NumGroups, and m_pGroups. 00080 {
00081 //-----------------------------------------------------------------
00082 // set one group of atoms
00083 //-----------------------------------------------------------------
00084 ASSERT( (GroupIndex>=0) && (GroupIndex<m_NumGroups) );
00085 m_pGroups[GroupIndex] = Group;
00086 }
|
|
||||||||||||||||||||
|
Definition at line 119 of file FreeEnergyRestrain.C. References ASSERT, m_NumGroups, and m_pGroups. 00119 {
00120 //-----------------------------------------------------------------
00121 // set four groups of atoms
00122 //-----------------------------------------------------------------
00123 ASSERT(m_NumGroups >= 4);
00124 m_pGroups[0] = Group1;
00125 m_pGroups[1] = Group2;
00126 m_pGroups[2] = Group3;
00127 m_pGroups[3] = Group4;
00128 }
|
|
||||||||||||||||
|
Definition at line 108 of file FreeEnergyRestrain.C. References ASSERT, m_NumGroups, and m_pGroups. 00108 {
00109 //-----------------------------------------------------------------
00110 // set three groups of atoms
00111 //-----------------------------------------------------------------
00112 ASSERT(m_NumGroups >= 3);
00113 m_pGroups[0] = Group1;
00114 m_pGroups[1] = Group2;
00115 m_pGroups[2] = Group3;
00116 }
|
|
||||||||||||
|
Definition at line 98 of file FreeEnergyRestrain.C. References ASSERT, m_NumGroups, and m_pGroups. 00098 {
00099 //-----------------------------------------------------------------
00100 // set two groups of atoms
00101 //-----------------------------------------------------------------
00102 ASSERT(m_NumGroups >= 2);
00103 m_pGroups[0] = Group1;
00104 m_pGroups[1] = Group2;
00105 }
|
|
|
Definition at line 89 of file FreeEnergyRestrain.C. References ASSERT, m_NumGroups, and m_pGroups. Referenced by GetRestraint(). 00089 {
00090 //-----------------------------------------------------------------
00091 // set one group of atoms
00092 //-----------------------------------------------------------------
00093 ASSERT(m_NumGroups >= 1);
00094 m_pGroups[0] = Group1;
00095 }
|
|
|
Reimplemented in ABoundDiheRestraint. Definition at line 85 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00085 {ASSERT(kFalse);}
|
|
|
Definition at line 50 of file FreeEnergyRestrain.h. Referenced by GetRestraint(). 00050 {m_Kf=Kf;}
|
|
|
Definition at line 52 of file FreeEnergyRestrain.h. Referenced by ARestraintManager::SetLambdaKf(), and ARestraintManager::SetLambdas(). 00052 {m_LambdaKf=LambdaKf;}
|
|
|
Definition at line 53 of file FreeEnergyRestrain.h. Referenced by ARestraintManager::SetLambdaRef(), and ARestraintManager::SetLambdas(). 00053 {m_LambdaRef=LambdaRef;}
|
|
|
Reimplemented in ABoundDiheRestraint. Definition at line 83 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00083 {ASSERT(kFalse);}
|
|
|
Reimplemented in AFixedAngleRestraint, ABoundAngleRestraint, and AFixedDiheRestraint. Definition at line 81 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00081 {ASSERT(kFalse);}
|
|
|
Reimplemented in ABoundPosRestraint, AFixedDistRestraint, and ABoundDistRestraint. Definition at line 80 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00080 {ASSERT(kFalse);}
|
|
|
Reimplemented in AFixedPosRestraint, and ABoundPosRestraint. Definition at line 79 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00079 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingAngleRestraint, and AForcingDiheRestraint. Definition at line 90 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00090 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingDistRestraint. Definition at line 88 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00088 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingPosRestraint. Definition at line 86 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00086 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingAngleRestraint, and AForcingDiheRestraint. Definition at line 91 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00091 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingDistRestraint. Definition at line 89 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00089 {ASSERT(kFalse);}
|
|
|
Reimplemented in AForcingPosRestraint. Definition at line 87 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00087 {ASSERT(kFalse);}
|
|
|
Reimplemented in ABoundDiheRestraint. Definition at line 84 of file FreeEnergyRestrain.h. References ASSERT, and kFalse. Referenced by GetRestraint(). 00084 {ASSERT(kFalse);}
|
|
|
Definition at line 223 of file FreeEnergyRestrain.C. References ASSERT, AtomID, EarlyExit(), GlobalMasterFreeEnergy::getMass(), AGroup::GetNumInGroup(), GlobalMasterFreeEnergy::getPosition(), j, m_NumGroups, m_pCOMs, m_pGroups, Mass, AVector::Set(), and SetEqual(). Referenced by ARestraintManager::UpdateCOMs(). 00223 {
00224 //-----------------------------------------------------------------
00225 // calculate the center-of-mass of each group of atoms
00226 //
00227 // note: m_pGroups points to an array of Groups
00228 // m_pGroups[i] references one of the Groups
00229 // m_pGroups[i][j] returns an AtomID from the Group
00230 // (operator[] is defined to return an item from the Group)
00231 //-----------------------------------------------------------------
00232 int i, j, AtomID, RetVal;
00233 Vector NAMD_Vector;
00234 AVector COM, Pos;
00235 double Mass, TotalMass;
00236
00237 ASSERT(m_NumGroups > 0);
00238 // for each group of atoms
00239 for (i=0; i<m_NumGroups; i++) {
00240 TotalMass = 0;
00241 COM.Set(0,0,0);
00242 // for each atom in the group
00243 for (j=0; j<m_pGroups[i].GetNumInGroup(); j++) {
00244 AtomID = m_pGroups[i][j];
00245 // get its position, weight position with atom's mass
00246 RetVal = CFE.getPosition(AtomID, NAMD_Vector);
00247 if (RetVal < 0) {EarlyExit("Can't get Position", AtomID);}
00248 // cast NAMD_Vector to AVector (getPosition uses Vector class)
00249 SetEqual(Pos, NAMD_Vector);
00250 Mass = CFE.getMass(AtomID);
00251 if (Mass < 0) {EarlyExit("Negative Mass", AtomID);}
00252 TotalMass += Mass;
00253 COM += Pos * Mass;
00254 }
00255 m_pCOMs[i] = COM / TotalMass;
00256 }
00257 }
|
|
|
Definition at line 37 of file FreeEnergyRestrain.h. |
|
|
Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved. Definition at line 29 of file FreeEnergyRestrain.C. |
|
|
Definition at line 30 of file FreeEnergyRestrain.C. |
|
|
Definition at line 38 of file FreeEnergyRestrain.h. Referenced by ARestraint(), DistributeForce(), SetGroup(), SetGroups(), and UpdateCOMs(). |
|
|
Definition at line 40 of file FreeEnergyRestrain.h. Referenced by ARestraint(), UpdateCOMs(), and ~ARestraint(). |
|
|
Definition at line 39 of file FreeEnergyRestrain.h. Referenced by ARestraint(), DistributeForce(), SetGroup(), SetGroups(), UpdateCOMs(), and ~ARestraint(). |
1.3.9.1