--- trunk/SHAPES/GridBuilder.cpp 2004/06/18 19:40:31 1280 +++ trunk/SHAPES/GridBuilder.cpp 2004/06/21 15:10:29 1282 @@ -25,36 +25,47 @@ 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 minDist = 10.0; //minimum start distance + sList = sGrid; + sigList = sigmaGrid; + epsList = epsGrid; forcefield = forceField; //first determine the start distance - we always start at least minDist away startDist = rbMol->findMaxExtent() + minDist; if (startDist < minDist) startDist = minDist; - - initBody(); - for (i=0; igetNumAtoms(); i++){ + rbMol->getAtomPos(rbAtomPos, i); + + rXij = rbAtomPos[0]; + rYij = rbAtomPos[1]; + rZij = rbAtomPos[2] - probeCoor; + + 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 + switch(forcefield){ + case 1:{ + //we are using the CHARMm force field + atomRpar = rbMol->getAtomRpar(i); + atomEps = rbMol->getAtomEps(i); + + rValSquared = ((rparHe+atomRpar)*(rparHe+atomRpar)) / (rijSquared); + rValPowerSix = rValSquared * rValSquared * rValSquared; + potEnergy += sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 2.0)); + }; break; + + case 2:{ + //we are using the AMBER force field + atomRpar = rbMol->getAtomRpar(i); + atomEps = rbMol->getAtomEps(i); + + rValSquared = ((rparHe+atomRpar)*(rparHe+atomRpar)) / (rijSquared); + rValPowerSix = rValSquared * rValSquared * rValSquared; + potEnergy += sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 2.0)); + }; break; + + case 3:{ + //we are using Allen-Tildesley LJ parameters + atomRpar = rbMol->getAtomRpar(i); + atomEps = rbMol->getAtomEps(i); + + rValSquared = ((rparHe+atomRpar)*(rparHe+atomRpar)) / (4*rijSquared); + rValPowerSix = rValSquared * rValSquared * rValSquared; + potEnergy += 4*sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 1.0)); + + }; break; + + case 4:{ + //we are using the OPLS force field + atomRpar = rbMol->getAtomRpar(i); + atomEps = rbMol->getAtomEps(i); + + rValSquared = (pow(sqrt(rparHe+atomRpar),2)) / (rijSquared); + rValPowerSix = rValSquared * rValSquared * rValSquared; + potEnergy += 4*sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 1.0)); + }; break; + + case 5:{ + //we are using the GAFF force field + atomRpar = rbMol->getAtomRpar(i); + atomEps = rbMol->getAtomEps(i); + + rValSquared = ((rparHe+atomRpar)*(rparHe+atomRpar)) / (rijSquared); + rValPowerSix = rValSquared * rValSquared * rValSquared; + potEnergy += sqrt(epsHe*atomEps)*(rValPowerSix * (rValPowerSix - 2.0)); + }; break; + } + } +} -void GridBuilder::stepTheta(double increment){ +void GridBuilder::rotBody(double pValue, double tValue){ //zero out the euler angles - for (i=0; i<3; i++) + 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] = pValue; //the second euler angle is for rotation about the x-axis (we use the zxz convention) - angles[1] = increment; + angles[1] = tValue; //obtain the rotation matrix through the rigid body class rbMol->doEulerToRotMat(angles, rotX); - + + //start from the reference position + identityMat3(rbMatrix); + rbMol->setA(rbMatrix); + //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 (i=0; i<3; i++) - 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"); + ofstream epsOut("eps.grid"); + + for (k=0; k