--- trunk/SHAPES/GridBuilder.cpp 2004/06/21 13:38:55 1281 +++ trunk/SHAPES/GridBuilder.cpp 2004/06/25 17:51:51 1305 @@ -1,76 +1,91 @@ #include "GridBuilder.hpp" -#include "MatVec3.h" #define PI 3.14159265359 -GridBuilder::GridBuilder(RigidBody* rb, int bandWidth) { +GridBuilder::GridBuilder(RigidBody* rb, int gridWidth) { rbMol = rb; - bandwidth = bandWidth; - thetaStep = PI / bandwidth; + gridwidth = gridWidth; + thetaStep = PI / gridwidth; thetaMin = thetaStep / 2.0; phiStep = thetaStep * 2.0; - - //zero out the rot mats - for (i=0; i<3; i++) { - for (j=0; j<3; j++) { - rotX[i][j] = 0.0; - rotZ[i][j] = 0.0; - rbMatrix[i][j] = 0.0; - } - } } GridBuilder::~GridBuilder() { } -void GridBuilder::launchProbe(int forceField, vector sigmaGrid, vector sGrid, - vector epsGrid){ +void GridBuilder::launchProbe(int forceField, vector sigmaGrid, + vector sGrid, vector epsGrid){ ofstream sigmaOut("sigma.grid"); ofstream sOut("s.grid"); ofstream epsOut("eps.grid"); double startDist; + double phiVal; + double thetaVal; + double sigTemp, sTemp, epsTemp, sigProbe; double minDist = 10.0; //minimum start distance - sList = sGrid; sigList = sigmaGrid; + sList = sGrid; epsList = epsGrid; forcefield = forceField; + + //load the probe atom parameters + switch(forcefield){ + case 1:{ + rparHe = 1.4800; + epsHe = -0.021270; + }; break; + case 2:{ + rparHe = 1.14; + epsHe = 0.0203; + }; break; + case 3:{ + rparHe = 2.28; + epsHe = 0.020269601874; + }; break; + case 4:{ + rparHe = 2.5560; + epsHe = 0.0200; + }; break; + case 5:{ + rparHe = 1.14; + epsHe = 0.0203; + }; break; + } - //first determine the start distance - we always start at least minDist away + if (rparHe < 2.2) + sigProbe = 2*rparHe/1.12246204831; + else + sigProbe = rparHe; + + //determine the start distance - we always start at least minDist away startDist = rbMol->findMaxExtent() + minDist; if (startDist < minDist) startDist = minDist; - initBody(); - for (k=0; ksetEuler(0.0, thetaVal, phiVal); + releaseProbe(startDist); - sigList.push_back(sigDist); - sList.push_back(sDist); - epsList.push_back(epsVal); - - stepPhi(phiStep); + //translate the values to sigma, s, and epsilon of the rigid body + sigTemp = 2*sigDist - sigProbe; + sTemp = (2*(sDist - sigDist))/(0.122462048309) - sigProbe; + epsTemp = pow(epsVal, 2)/fabs(epsHe); + + sigList.push_back(sigTemp); + sList.push_back(sTemp); + epsList.push_back(epsTemp); } - stepTheta(thetaStep); } - /* - //write out the grid files - printf("the grid size is %d\n",sigmaGrid.size()); - for (k=0; kgetNumAtoms(); i++){ rbMol->getAtomPos(rbAtomPos, i); @@ -164,8 +153,8 @@ void GridBuilder::calcEnergy(){ rijSquared = rXij * rXij + rYij * rYij + rZij * rZij; - //in the interest of keeping the code more compact, we are being less efficient by placing - //a switch statement in the calculation loop + //in the interest of keeping the code more compact, we are being less + //efficient by placing a switch statement in the calculation loop switch(forcefield){ case 1:{ //we are using the CHARMm force field @@ -197,7 +186,6 @@ void GridBuilder::calcEnergy(){ potEnergy += 4*sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 1.0)); }; break; - case 4:{ //we are using the OPLS force field @@ -222,40 +210,6 @@ void GridBuilder::calcEnergy(){ } } -void GridBuilder::stepTheta(double increment){ - //zero out the euler angles - for (l=0; l<3; l++) - angles[i] = 0.0; - - //the second euler angle is for rotation about the x-axis (we use the zxz convention) - angles[1] = increment; - - //obtain the rotation matrix through the rigid body class - rbMol->doEulerToRotMat(angles, rotX); - - //rotate the rigid body - rbMol->getA(rbMatrix); - matMul3(rotX, rbMatrix, rotatedMat); - rbMol->setA(rotatedMat); -} - -void GridBuilder::stepPhi(double increment){ - //zero out the euler angles - for (l=0; l<3; l++) - angles[i] = 0.0; - - //the phi euler angle is for rotation about the z-axis (we use the zxz convention) - angles[0] = increment; - - //obtain the rotation matrix through the rigid body class - rbMol->doEulerToRotMat(angles, rotZ); - - //rotate the rigid body - rbMol->getA(rbMatrix); - matMul3(rotZ, rbMatrix, rotatedMat); - rbMol->setA(rotatedMat); -} - void GridBuilder::printGridFiles(){ ofstream sigmaOut("sigma.grid"); ofstream sOut("s.grid"); @@ -266,4 +220,5 @@ void GridBuilder::printGridFiles(){ sOut << sList[k] << "\n0\n"; epsOut << epsList[k] << "\n0\n"; } -} \ No newline at end of file +} +