#include <FreeEnergyVector.h>
Public Member Functions | |
| AVector (Vector_t Type=kRegular) | |
| AVector (double x, double y, double z) | |
| AVector (const AVector &Vector) | |
| Bool_t | Set (double x, double y, double z) |
| AVector | operator+ (const AVector &Vector) |
| AVector | operator- (const AVector &Vector) |
| AVector | operator/ (double divisor) |
| AVector & | operator/= (double divisor) |
| AVector & | operator *= (double scalar) |
| AVector | operator * (double scalar) |
| AVector & | operator= (const AVector &Vector) |
| AVector & | operator+= (const AVector &Vector) |
| AVector | cross (const AVector &Vector) |
| double | dot (const AVector &Vector) |
| double & | operator[] (int index) |
| double | Dist () |
| double | DistSqr () |
| double | Dist (const AVector &Vector) |
| double | DistSqr (const AVector &Vector) |
| void | Out () |
| void | Output () |
| AVector & | Scale (AVector &SmallVec, AVector &BigVec) |
| AVector & | Random () |
Protected Attributes | |
| double | m_x |
| double | m_y |
| double | m_z |
Friends | |
| void | SetEqual (AVector &Vec1, const Vector &Vec2) |
| void | SetEqual (Vector &Vec1, const AVector &Vec2) |
|
|
Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved. Definition at line 18 of file FreeEnergyVector.C. References ASSERT, kRandom, m_x, m_y, m_z, and Random(). 00018 {
00019 //------------------------------------------------
00020 // init this vector to (0,0,0) for kRegular Type
00021 // init this vector to (x,y,z) for kRandom Type
00022 // where x, y, and z are in the range (0:1)
00023 //
00024 // Note: The assumption is made that srand() has
00025 // already been called.
00026 //------------------------------------------------
00027 if (Type == kRegular) {
00028 m_x = 0.0;
00029 m_y = 0.0;
00030 m_z = 0.0;
00031 }
00032 else {
00033 ASSERT(Type == kRandom);
00034 Random();
00035 }
00036 }
|
|
||||||||||||||||
|
Definition at line 39 of file FreeEnergyVector.C. 00039 {
00040 //-------------------------------------------
00041 // init this vector to (x,y,z)
00042 //-------------------------------------------
00043 m_x = x;
00044 m_y = y;
00045 m_z = z;
00046 }
|
|
|
Definition at line 49 of file FreeEnergyVector.C. 00049 {
00050 //-------------------------------------------
00051 // init this vector to Vector
00052 //-------------------------------------------
00053 m_x = Vector.m_x;
00054 m_y = Vector.m_y;
00055 m_z = Vector.m_z;
00056 }
|
|
|
Definition at line 243 of file FreeEnergyVector.C. Referenced by ARestraint::GetDihe(), and ADiheRestraint::GetGrad(). 00243 {
00244 //-------------------------------------------------------------------
00245 // calculate this vector crossed with Vector (this x Vector).
00246 // see Mathematical Handbook, p.118.
00247 //-------------------------------------------------------------------
00248 AVector CrossProduct;
00249
00250 CrossProduct.m_x = (m_y * Vector.m_z) - (m_z * Vector.m_y);
00251 CrossProduct.m_y = (m_z * Vector.m_x) - (m_x * Vector.m_z);
00252 CrossProduct.m_z = (m_x * Vector.m_y) - (m_y * Vector.m_x);
00253 return(CrossProduct);
00254 }
|
|
|
Definition at line 221 of file FreeEnergyVector.C. 00221 {
00222 //-------------------------------------------------------------------
00223 // calculate distance between this point and Vector
00224 //-------------------------------------------------------------------
00225 double d1 = (m_x - Vector.m_x);
00226 double d2 = (m_y - Vector.m_y);
00227 double d3 = (m_z - Vector.m_z);
00228 return( sqrt(d1*d1 + d2*d2 + d3*d3) );
00229 }
|
|
|
Definition at line 205 of file FreeEnergyVector.C. Referenced by AForcingDistRestraint::Get_dU_dLambda(), ARestraint::GetAngle(), ARestraint::GetDihe(), AForcingPosRestraint::GetDistance(), ABoundPosRestraint::GetDistance(), AFixedPosRestraint::GetDistance(), ADistRestraint::GetE(), ABoundDistRestraint::GetEnergy(), ABoundPosRestraint::GetEnergy(), ADiheRestraint::GetGrad(), AnAngleRestraint::GetGrad(), ADistRestraint::GetGrad(), ABoundDistRestraint::GetGradient(), ABoundPosRestraint::GetGradient(), ADiheRestraint::gradU(), and ADistRestraint::PrintInfo(). 00205 {
00206 //-------------------------------------------------------------------
00207 // calculate distance from this point to (0, 0, 0)
00208 //-------------------------------------------------------------------
00209 return( sqrt(m_x*m_x + m_y*m_y + m_z*m_z) );
00210 }
|
|
|
Definition at line 232 of file FreeEnergyVector.C. 00232 {
00233 //-------------------------------------------------------------------
00234 // calculate distance-squared between this point and Vector
00235 //-------------------------------------------------------------------
00236 double d1 = (m_x - Vector.m_x);
00237 double d2 = (m_y - Vector.m_y);
00238 double d3 = (m_z - Vector.m_z);
00239 return(d1*d1 + d2*d2 + d3*d3);
00240 }
|
|
|
Definition at line 213 of file FreeEnergyVector.C. Referenced by APosRestraint::GetE(). 00213 {
00214 //-------------------------------------------------------------------
00215 // calculate distance-squared from this point to (0, 0, 0)
00216 //-------------------------------------------------------------------
00217 return(m_x*m_x + m_y*m_y + m_z*m_z);
00218 }
|
|
|
Definition at line 257 of file FreeEnergyVector.C. Referenced by ARestraint::GetDihe(), ADiheRestraint::GetGrad(), and ADiheRestraint::gradU(). 00257 {
00258 //-------------------------------------------------------------------
00259 // calculate dot product of this vector and Vector
00260 // see Mathematical Handbook, p.118.
00261 //-------------------------------------------------------------------
00262 return(m_x*Vector.m_x + m_y*Vector.m_y + m_z*Vector.m_z);
00263 }
|
|
|
Definition at line 137 of file FreeEnergyVector.C. 00137 {
00138 //---------------------------------------------------
00139 // create a new vector: this one divided by divisor
00140 //---------------------------------------------------
00141 AVector Point(m_x*scalar, m_y*scalar, m_z*scalar);
00142 return(Point);
00143 }
|
|
|
Definition at line 126 of file FreeEnergyVector.C. 00126 {
00127 //------------------------------------------------------
00128 // multiply this vector by scalar and return a ref to it
00129 //------------------------------------------------------
00130 m_x *= scalar;
00131 m_y *= scalar;
00132 m_z *= scalar;
00133 return(*this);
00134 }
|
|
|
Definition at line 88 of file FreeEnergyVector.C. 00088 {
00089 //----------------------------------------------------------
00090 // create a new vector: the sum of this one and passed one
00091 //----------------------------------------------------------
00092 AVector Point(vector.m_x+m_x, vector.m_y+m_y, vector.m_z+m_z);
00093 return(Point);
00094 }
|
|
|
Definition at line 177 of file FreeEnergyVector.C. 00177 {
00178 //--------------------------------------------------
00179 // set this vector to this one plus the passed one
00180 //--------------------------------------------------
00181 m_x += vector.m_x;
00182 m_y += vector.m_y;
00183 m_z += vector.m_z;
00184 return(*this);
00185 }
|
|
|
Definition at line 97 of file FreeEnergyVector.C. 00097 {
00098 //----------------------------------------------------------
00099 // create a new vector: this one minus the passed one
00100 //----------------------------------------------------------
00101 AVector Point(m_x-vector.m_x, m_y-vector.m_y, m_z-vector.m_z);
00102 return(Point);
00103 }
|
|
|
Definition at line 106 of file FreeEnergyVector.C. 00106 {
00107 //---------------------------------------------------
00108 // create a new vector: this one divided by divisor
00109 //---------------------------------------------------
00110 AVector Point(m_x/divisor, m_y/divisor, m_z/divisor);
00111 return(Point);
00112 }
|
|
|
Definition at line 115 of file FreeEnergyVector.C. 00115 {
00116 //------------------------------------------------------
00117 // divide this vector by divisor and return a ref to it
00118 //------------------------------------------------------
00119 m_x /= divisor;
00120 m_y /= divisor;
00121 m_z /= divisor;
00122 return(*this);
00123 }
|
|
|
Definition at line 166 of file FreeEnergyVector.C. 00166 {
00167 //-------------------------------------------
00168 // set this vector to the passed one
00169 //-------------------------------------------
00170 m_x = vector.m_x;
00171 m_y = vector.m_y;
00172 m_z = vector.m_z;
00173 return(*this);
00174 }
|
|
|
Definition at line 188 of file FreeEnergyVector.C. References ASSERT. 00188 {
00189 //-------------------------------------------------------------------
00190 // return one element of this vector
00191 // note: this op is used to get AND set an element
00192 // (since it returns double&)
00193 //-------------------------------------------------------------------
00194 ASSERT( (index>=0) && (index<3) );
00195
00196 switch(index) {
00197 case 0: return(m_x);
00198 case 1: return(m_y);
00199 case 2: return(m_z);
00200 default: return(m_x); // should never get here
00201 }
00202 }
|
|
|
Definition at line 266 of file FreeEnergyVector.C. References iout, m_x, m_y, and m_z. Referenced by APosRestraint::PrintInfo(). 00266 {
00267 //-------------------------------------------------------------------
00268 // write it
00269 //-------------------------------------------------------------------
00270 char Str1[20], Str2[20], Str3[20];
00271
00272 sprintf(Str1, "%8.3f", m_x);
00273 sprintf(Str2, "%8.3f", m_y);
00274 sprintf(Str3, "%8.3f", m_z);
00275 iout << "(" << Str1 << "," << Str2 << "," << Str3 << ")";
00276 }
|
|
|
Definition at line 279 of file FreeEnergyVector.C. References iout, m_x, m_y, and m_z. 00279 {
00280 //-------------------------------------------------------------------
00281 // write it to standard output
00282 //-------------------------------------------------------------------
00283 char Word1[20], Word2[20], Word3[20];
00284
00285 if ( (fabs(m_x)<99999) && (fabs(m_y)<99999) && (fabs(m_z)<99999) ) {
00286 sprintf(Word1, "%10.3f", m_x);
00287 sprintf(Word2, "%10.3f", m_y);
00288 sprintf(Word3, "%10.3f", m_z);
00289 }
00290 else {
00291 sprintf(Word1, "%10.2e", m_x);
00292 sprintf(Word2, "%10.2e", m_y);
00293 sprintf(Word3, "%10.2e", m_z);
00294 }
00295 iout << "( " << Word1 << " " << Word2 << " " << Word3 << " )";
00296 }
|
|
|
Definition at line 59 of file FreeEnergyVector.C. References ASSERT, m_x, m_y, and m_z. Referenced by AVector(). 00059 {
00060 //------------------------------------------------
00061 // replace this vector with a new random vector
00062 // where x, y, and z are in the range (0:1)
00063 //------------------------------------------------
00064 double RandMax;
00065
00066 RandMax = RAND_MAX;
00067 m_x = (double)rand() / RandMax;
00068 m_y = (double)rand() / RandMax;
00069 m_z = (double)rand() / RandMax;
00070 ASSERT(m_x <= 1.0);
00071 ASSERT(m_y <= 1.0);
00072 ASSERT(m_z <= 1.0);
00073 return(*this);
00074 }
|
|
||||||||||||
|
Definition at line 299 of file FreeEnergyVector.C. 00299 {
00300 //-------------------------------------------------------------------
00301 // scale this vector, whose (x,y,z) are in the range (0:1),
00302 // to be in the range (SmallVec:BigVec)
00303 //-------------------------------------------------------------------
00304 m_x = SmallVec.m_x + (BigVec.m_x - SmallVec.m_x) * m_x;
00305 m_y = SmallVec.m_y + (BigVec.m_y - SmallVec.m_y) * m_y;
00306 m_z = SmallVec.m_z + (BigVec.m_z - SmallVec.m_z) * m_z;
00307 return(*this);
00308 }
|
|
||||||||||||||||
|
Definition at line 77 of file FreeEnergyVector.C. References Bool_t, m_x, m_y, and m_z. Referenced by ADiheRestraint::GetGrad(), ADistRestraint::GetGrad(), ABoundPosRestraint::GetGradient(), and ARestraint::UpdateCOMs(). 00077 {
00078 //-------------------------------------------
00079 // int this vector to (x,y,z)
00080 //-------------------------------------------
00081 m_x = x;
00082 m_y = y;
00083 m_z = z;
00084 return(kTrue);
00085 }
|
|
||||||||||||
|
Definition at line 156 of file FreeEnergyVector.C. 00156 {
00157 //------------------------------------------------------------------------
00158 // used for casting AVector -> Vector
00159 //------------------------------------------------------------------------
00160 Vec1.x = Vec2.m_x;
00161 Vec1.y = Vec2.m_y;
00162 Vec1.z = Vec2.m_z;
00163 }
|
|
||||||||||||
|
Definition at line 146 of file FreeEnergyVector.C. 00146 {
00147 //------------------------------------------------------------------------
00148 // used for casting Vector -> AVector
00149 //------------------------------------------------------------------------
00150 Vec1.m_x = Vec2.x;
00151 Vec1.m_y = Vec2.y;
00152 Vec1.m_z = Vec2.z;
00153 }
|
|
|
Definition at line 17 of file FreeEnergyVector.h. Referenced by AVector(), cross(), Dist(), DistSqr(), dot(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator/(), operator/=(), operator=(), Out(), Output(), Random(), Scale(), Set(), and SetEqual(). |
|
|
Definition at line 18 of file FreeEnergyVector.h. Referenced by AVector(), cross(), Dist(), DistSqr(), dot(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator/(), operator/=(), operator=(), Out(), Output(), Random(), Scale(), Set(), and SetEqual(). |
|
|
Definition at line 19 of file FreeEnergyVector.h. Referenced by AVector(), cross(), Dist(), DistSqr(), dot(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator/(), operator/=(), operator=(), Out(), Output(), Random(), Scale(), Set(), and SetEqual(). |
1.3.9.1