void testRotateAboutVector() { cout<<"Testing RotateAtomAboutVector"<<endl; double rotation = 90; Atom vertex = createAtom(-1, 0, 0, 0); Atom head = createAtom(-1, 1, 0, 0); Atom toRotate = createAtom(-1, 0, 1, 0); Atom rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); assert(fabs(rotated.y - 0.0) < .01); assert(fabs(rotated.x - 0.0) < .01); assert(fabs(rotated.z - 1.0) < .01); rotation = 45; rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); assert(fabs(rotated.y - sqrt(.5)) < .01); assert(fabs(rotated.x - 0.0) < .01); assert(fabs(rotated.z - sqrt(.5)) < .01); rotation = 90; //test rotating about atom with 0 intial angle toRotate = createAtom(-1,2,0,0); rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); assert(fabs(rotated.x - 2) < .01); assert(fabs(rotated.y - 0) < .01); assert(fabs(rotated.z - 0) < .01); cout<<"Testing RotateAtomAboutVector Complete\n"<<endl; }
// Descr: evident TEST(GeometryTest, RotateAboutVector) { double rotation = 90; unsigned long inval = (unsigned long) -1; Atom vertex = createAtom(inval, 0, 0, 0); Atom head = createAtom(inval, 1, 0, 0); Atom toRotate = createAtom(inval, 0, 1, 0); Atom rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); EXPECT_LT( fabs(rotated.y - 0.0), .01); EXPECT_LT( fabs(rotated.x - 0.0), .01); EXPECT_LT( fabs(rotated.z - 1.0), .01); rotation = 45; rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); EXPECT_LT( fabs(rotated.y - sqrt(.5)), .01); EXPECT_LT( fabs(rotated.x - 0.0), .01); EXPECT_LT( fabs(rotated.z - sqrt(.5)), .01); rotation = 90; //test rotating about atom with 0 intial angle toRotate = createAtom(inval, 2, 0, 0); rotated = rotateAtomAboutVector(toRotate, vertex, head, rotation); EXPECT_LT( fabs(rotated.y - 0), .01); EXPECT_LT( fabs(rotated.z - 0), .01); EXPECT_LT( fabs(rotated.x - 2), .01); }
void Opls_Scan::addLineToTable(string line, int numOfLines) { string hashNum; int secCol; double charge,sigma,epsilon; string name, extra; stringstream ss(line); //check to see what format it is opls, V value, or neither int format = checkFormat(line); if(format == 1) { ss >> hashNum >> secCol >> name >> charge >> sigma >> epsilon; char *atomtype = (char*)name.c_str(); Atom temp = createAtom(0, -1, -1, -1, sigma, epsilon, charge, *atomtype); pair<map<string,Atom>::iterator,bool> ret; ret = oplsTable.insert( pair<string,Atom>(hashNum,temp) ); if (ret.second==false) { errHashes.push_back(hashNum); } }
void Zmatrix_Scan::parseLine(string line, int numOfLines){ string atomID, atomType, oplsA, oplsB, bondWith, bondDistance, angleWith, angleMeasure, dihedralWith, dihedralMeasure; stringstream ss; //check if line contains correct format int format = checkFormat(line); if(format == 1){ //read in strings in columns and store the data in temporary variables ss << line; ss >> atomID >> atomType >> oplsA >> oplsB >> bondWith >> bondDistance >> angleWith >> angleMeasure >> dihedralWith >> dihedralMeasure; //setup structures for permanent encapsulation Atom lineAtom; Bond lineBond; Angle lineAngle; Dihedral lineDihedral; if (oplsA.compare("-1") != 0) { lineAtom = oplsScanner->getAtom(oplsA); lineAtom.id = atoi(atomID.c_str()); lineAtom.x = 0; lineAtom.y = 0; lineAtom.z = 0; } else//dummy atom { char dummy = 'X'; lineAtom = createAtom(atoi(atomID.c_str()), -1, -1, -1, -1, -1, -1, dummy); } atomVector.push_back(lineAtom); if (bondWith.compare("0") != 0){ lineBond.atom1 = lineAtom.id; lineBond.atom2 = atoi(bondWith.c_str()); lineBond.distance = atof(bondDistance.c_str()); lineBond.variable = false; bondVector.push_back(lineBond); } if (angleWith.compare("0") != 0){ lineAngle.atom1 = lineAtom.id; lineAngle.atom2 = atoi(angleWith.c_str()); lineAngle.value = atof(angleMeasure.c_str()); lineAngle.variable = false; angleVector.push_back(lineAngle); } if (dihedralWith.compare("0") != 0){ lineDihedral.atom1 = lineAtom.id; lineDihedral.atom2 = atoi(dihedralWith.c_str()); lineDihedral.value = atof(dihedralMeasure.c_str()); lineDihedral.variable = false; dihedralVector.push_back(lineDihedral); } } //end if format == 1
void testRotateInPlane() { cout<<"Testing RotateAtomInPlane"<<endl; double rotation = 90; Atom vertex = createAtom(-1, 0, .5, 0); Atom head = createAtom(-1, 0, 0, 0); Atom toRotate = createAtom(-1, 0, 1, 0); Atom rotated = rotateAtomInPlane(toRotate, vertex, head, rotation); assert(fabs(rotated.y - .5) < .01); rotation = 45; vertex = createAtom(-1, 0, 0, 0); head = createAtom(-1, 0, 0, -1); toRotate = createAtom(-1, 0, 1, 0); rotated = rotateAtomInPlane(toRotate, vertex, head, rotation); assert(fabs(rotated.y - sqrt(.5)) < .01); assert(fabs(rotated.x - 0.0) < .01); assert(fabs(rotated.z - sqrt(.5)) < .01); cout<<"Testing RotateAtomInPlane Complete\n"<<endl; }
Atom getAtomFromLine(string line){ Atom returnAtom = createAtom(-1, -1, -1, -1, -1, -1); char *tokens; char *charLine = (char *)malloc(sizeof(char) * line.size()); strcpy(charLine, line.c_str()); tokens = strtok(charLine, " "); strcpy(charLine, line.c_str()); tokens = strtok(charLine, " "); //read in atoms int tokenNumber = 0; while(tokens != NULL){ switch(tokenNumber){ case 0: // id returnAtom.id = atoi(tokens); break; case 1: // x returnAtom.x = atof(tokens); break; case 2: // y returnAtom.y = atof(tokens); break; case 3: // z returnAtom.z = atof(tokens); break; case 4: // sigma returnAtom.sigma = atof(tokens); break; case 5: // epsilon returnAtom.epsilon = atof(tokens); break; case 6: //charge returnAtom.charge = atof(tokens); break; } tokens = strtok(NULL, " "); tokenNumber++; } return returnAtom; }
void testGetAngle() { cout << "Testing getAngle" << endl; Atom atom1= createAtom(1,5,6,7); Atom atom2= createAtom(2,10,11,12); Atom atom3= createAtom(3,14,22,9); assert(percentDifference(getAngle(atom1,atom2,atom3),124.986)); atom1= createAtom(1,15,23,8); atom2= createAtom(2,5,3,12); atom3= createAtom(3,9,18,7); assert(percentDifference(getAngle(atom1,atom2,atom3),13.6609)); cout << "Testing getAngle Complete\n" << endl; }
void testGetDistance(){ cout << "Testing getDistance" << endl; Atom atom1= createAtom(1,5,6,7); Atom atom2= createAtom(2,10,11,12); assert(percentDifference(getDistance(atom1,atom2),8.66025) ); atom1= createAtom(1,8,12,21); atom2= createAtom(2,4,5,10); assert(percentDifference(getDistance(atom1,atom2),13.638181) ); atom1= createAtom(1,45,2,22); atom2= createAtom(2,37,22,18); assert(percentDifference(getDistance(atom1,atom2),21.9089023002) ); cout << "Testing getDistance Complete\n" << endl; }
MAKEATOM(packing); MAKEATOM(parentHelpers); MAKEATOM(path); MAKEATOM(prefetcherInstanceMarker); MAKEATOM(quick); MAKEATOM(results); MAKEATOM(rowAllocatorMarker); MAKEATOM(rtlFieldKeyMarker); MAKEATOM(serializer); MAKEATOM(serializerInstanceMarker); MAKEATOM(skipActionMarker); MAKEATOM(skipReturnMarker); MAKEATOM(speed); MAKEATOM(spill); MAKEATOM(subgraph); utf8Atom = createAtom("utf-8"); MAKEATOM(wrapper); MAKEATOM(xmlColumnProvider); MAKEATOM(xmlReadMarker); MAKESYSATOM(accessedFromChild); MAKESYSATOM(conditionalRowMarker); MAKESYSATOM(loop); MAKESYSATOM(loopFirst); MAKESYSATOM(noAccess); MAKESYSATOM(noReplicate); MAKESYSATOM(noVirtual); MAKESYSATOM(regexFindInstance); MAKESYSATOM(regexInstance); MAKESYSATOM(selfJoinPlaceholder); MAKESYSATOM(spill);
Molecule createMeshZMolecules(Opls_Scan *scanner) { //1 S 200 0 0 0.000000 0 0.000000 0 0.000000 0 Atom atom1=scanner->getAtom("200"); atom1.id=1; // 2 DUM -1 0 1 0.500000 0 0.000000 0 0.000000 0 Atom atom2=createAtom(2,-1,-1,-1,-1,-1,-1,NULL); Bond bond2=createBond(2,1,0.5,false); //3 DUM -1 0 2 0.500000 1 90.000000 0 0.000000 0 Atom atom3=createAtom(3,-1,-1,-1,-1,-1,-1,NULL); Bond bond3=createBond(3,2,0.5,false); Angle angle3=createAngle(3,1,90,false); //4 hH 204 0 1 1.336532 2 90.000000 3 180.000000 0 Atom atom4=scanner->getAtom("204"); atom4.id=4; Bond bond4=createBond(4,1,1.336532,true); Angle angle4=createAngle(4,2,90,false); Dihedral dihed4=createDihedral(4,3,180,false); //5 C 217 0 1 1.811119 4 96.401770 2 180.000000 0 Atom atom5=scanner->getAtom("217"); atom5.id=5; Bond bond5=createBond(5,1,1.811119,true); Angle angle5=createAngle(5,4,96.401770,true); Dihedral dihed5=createDihedral(5,2,180,false); //6 HC 140 0 5 1.090187 1 110.255589 4 179.999947 0 Atom atom6=scanner->getAtom("140"); atom6.id=6; Bond bond6=createBond(6,5,1.090187,true); Angle angle6=createAngle(6,1,110.255589,true); Dihedral dihed6=createDihedral(6,4,179.999947,true); //7 HC 140 0 5 1.090135 6 108.527646 1 121.053891 0 Atom atom7=scanner->getAtom("140"); atom7.id=7; Bond bond7=createBond(7,5,1.090135,true); Angle angle7=createAngle(7,6,108.527646,true); Dihedral dihed7=createDihedral(7,1,121.053891,true); //8 HC 140 0 5 1.090135 6 108.527646 1 238.946114 0 Atom atom8=scanner->getAtom("140"); atom8.id=8; Bond bond8=createBond(8,5,1.090135,true); Angle angle8=createAngle(8,6,108.527646,true); Dihedral dihed8=createDihedral(8,1,238.946114,true); /* HOPS and BONDS Diagram of Mesh.z // 1--2--3 // |\ // | \ // 4 5 // /|\ // / | \ // 6 7 8 */ //All hops that have a hop distance >= 3 Hop hop1= createHop(2,6,3); Hop hop2= createHop(2,7,3); Hop hop3= createHop(2,8,3); Hop hop4= createHop(3,4,3); Hop hop5= createHop(3,5,3); Hop hop6= createHop(3,6,4); Hop hop7= createHop(3,7,4); Hop hop8= createHop(3,8,4); Hop hop9= createHop(4,6,3); Hop hop10= createHop(4,7,3); Hop hop11= createHop(4,8,3); Atom *atomPtr = new Atom[8]; Bond *bondPtr = new Bond[7]; Angle *anglePtr = new Angle[6]; Dihedral *dihedPtr = new Dihedral[5]; Hop *hopPtr = new Hop[11]; atomPtr[0]=atom1; atomPtr[1]=atom2; atomPtr[2]=atom3; atomPtr[3]=atom4; atomPtr[4]=atom5; atomPtr[5]=atom6; atomPtr[6]=atom7; atomPtr[7]=atom8; bondPtr[0]=bond2; bondPtr[1]=bond3; bondPtr[2]=bond4; bondPtr[3]=bond5; bondPtr[4]=bond6; bondPtr[5]=bond7; bondPtr[6]=bond8; anglePtr[0]=angle3; anglePtr[1]=angle4; anglePtr[2]=angle5; anglePtr[3]=angle6; anglePtr[4]=angle7; anglePtr[5]=angle8; dihedPtr[0]=dihed4; dihedPtr[1]=dihed5; dihedPtr[2]=dihed6; dihedPtr[3]=dihed7; dihedPtr[4]=dihed8; hopPtr[0]=hop1; hopPtr[1]=hop2; hopPtr[2]=hop3; hopPtr[3]=hop4; hopPtr[4]=hop5; hopPtr[5]=hop6; hopPtr[6]=hop7; hopPtr[7]=hop8; hopPtr[8]=hop9; hopPtr[9]=hop10; hopPtr[10]=hop11; return createMolecule(1,atomPtr,anglePtr,bondPtr,dihedPtr,hopPtr,8,6,7,5,11); }
vector<Molecule> createT3pdimMolecules(Opls_Scan *scanner) { // TIP3P Water Dimer Tot. E = -6.5396 //1 O 111 111 0 .000000 0 .000000 0 .000000 0 Atom atom1 = scanner->getAtom("111"); atom1.id=1; //2 DU -1 -1 1 1.000000 0 .000000 0 .000000 0 Atom atom2=createAtom(2,-1,-1,-1,-1,-1,-1,NULL); Bond bond2=createBond(2,1,1.0,false); //3 DU -1 -1 2 1.000000 1 90.000000 0 .000000 0 Atom atom3=createAtom(3,-1,-1,-1,-1,-1,-1,NULL); Bond bond3=createBond(3,2,1.0,false); Angle angle3=createAngle(3,1,90.0,false); //4 HO 112 112 1 .957200 2 127.740000 3 90.000000 0 Atom atom4=scanner->getAtom("112"); atom4.id=4; Bond bond4=createBond(4,1,.957200,false); Angle angle4=createAngle(4,2,127.740000,false); Dihedral dihed4=createDihedral(4,3,90.00,false); //5 HO 112 112 1 .957200 4 104.520000 2 180.000000 0 Atom atom5=scanner->getAtom("112"); atom5.id=5; Bond bond5=createBond(5,1,.957200,false); Angle angle5=createAngle(5,4,104.520000,false); Dihedral dihed5=createDihedral(5,2,180.00,false); //6 X -1 -1 1 .150000 4 52.260000 5 .000000 0 Atom atom6=createAtom(6,-1,-1,-1,-1,-1,-1,NULL); Bond bond6=createBond(6,1,.150000,false); Angle angle6=createAngle(6,4,52.260000,false); Dihedral dihed6=createDihedral(6,5,.00,false); //TERZ 2nd Bonded Molecule //7 O 111 111 1 2.751259 2 131.716186 3 269.946364 0 Atom atom7=scanner->getAtom("111"); atom7.id=7; Bond bond7=createBond(7,1,2.751259,false); Angle angle7=createAngle(7,2,131.716186,false); Dihedral dihed7=createDihedral(7,3,269.946364,false); //8 DU -1 -1 7 1.000000 1 21.472391 2 179.887530 0 Atom atom8=createAtom(8,-1,-1,-1,-1,-1,-1,NULL); Bond bond8=createBond(8,7,1.0,false); Angle angle8=createAngle(8,1,21.472391,false); Dihedral dihed8=createDihedral(8,2,179.887530,false); //9 DU -1 -1 8 1.000000 7 90.000000 1 179.624613 0 Atom atom9=createAtom(9,-1,-1,-1,-1,-1,-1,NULL); Bond bond9=createBond(9,8,1.0,false); Angle angle9=createAngle(9,7,90.000000,false); Dihedral dihed9=createDihedral(9,1,179.624613,false); //10 HO 112 112 7 .957200 8 127.740000 9 90.000000 0 Atom atom10=scanner->getAtom("112"); atom10.id=10; Bond bond10=createBond(10,7,0.957200,false); Angle angle10=createAngle(10,8,127.74,false); Dihedral dihed10=createDihedral(10,9,90.0,false); //11 HO 112 112 7 .957200 10 104.520000 8 180.000000 0 Atom atom11=scanner->getAtom("112"); atom11.id=11; Bond bond11=createBond(11,7,0.957200,false); Angle angle11=createAngle(11,10,104.52,false); Dihedral dihed11=createDihedral(11,8,180.0,false); //12 X -1 -1 7 .150000 10 52.260000 11 .000000 0 Atom atom12=createAtom(12,-1,-1,-1,-1,-1,-1,NULL); Bond bond12=createBond(12,7,0.15,false); Angle angle12=createAngle(12,10,52.26,false); Dihedral dihed12=createDihedral(12,11,0.0,false); /* HOPS and BONDS Diagram of Mesh.z // // // 10 11 12 // \ | / // \|/ // 7--8--9 // | // | // 1--2--3 // /|\ // / | \ // 4 5 6 */ //All intermolecular hops that have a hop distance >= 3 //bottom Molecule Hop hop1=createHop(3,4,3); Hop hop2=createHop(3,5,3); Hop hop3=createHop(3,6,3); //top Molecule Hop hop4=createHop(9,10,3); Hop hop5=createHop(9,11,3); Hop hop6=createHop(9,12,3); Atom *atomPtr = new Atom[6]; Bond *bondPtr = new Bond[5]; Angle *anglePtr = new Angle[4]; Dihedral *dihedPtr = new Dihedral[3]; Hop *hopPtr = new Hop[3]; vector<Molecule> retVect; atomPtr[0]=atom1; atomPtr[1]=atom2; atomPtr[2]=atom3; atomPtr[3]=atom4; atomPtr[4]=atom5; atomPtr[5]=atom6; bondPtr[0]=bond2; bondPtr[1]=bond3; bondPtr[2]=bond4; bondPtr[3]=bond5; bondPtr[4]=bond6; anglePtr[0]=angle3; anglePtr[1]=angle4; anglePtr[2]=angle5; anglePtr[3]=angle6; dihedPtr[0]=dihed4; dihedPtr[1]=dihed5; dihedPtr[2]=dihed6; hopPtr[0]=hop1; hopPtr[1]=hop2; hopPtr[2]=hop3; retVect.push_back( createMolecule(1,atomPtr,anglePtr,bondPtr,dihedPtr,hopPtr,6,4,5,3,3) ); Atom *atomPt = new Atom[6]; Bond *bondPt = new Bond[6]; Angle *anglePt = new Angle[6]; Dihedral *dihedPt = new Dihedral[6]; Hop *hopPt = new Hop[3]; atomPt[0]=atom7; atomPt[1]=atom8; atomPt[2]=atom9; atomPt[3]=atom10; atomPt[4]=atom11; atomPt[5]=atom12; bondPt[0]=bond7; bondPt[1]=bond8; bondPt[2]=bond9; bondPt[3]=bond10; bondPt[4]=bond11; bondPt[5]=bond12; anglePt[0]=angle7; anglePt[1]=angle8; anglePt[2]=angle9; anglePt[3]=angle10; anglePt[4]=angle11; anglePt[5]=angle12; dihedPt[0]=dihed7; dihedPt[1]=dihed8; dihedPt[2]=dihed9; dihedPt[3]=dihed10; dihedPt[4]=dihed11; dihedPt[5]=dihed12; hopPt[0]=hop4; hopPt[1]=hop5; hopPt[2]=hop6; retVect.push_back( createMolecule(7,atomPt,anglePt,bondPt,dihedPt,hopPt,6,6,6,6,3) ); return retVect; }
//MORE: Need to change many MAKEATOM to MAKEID in this file, and most of the explicit calls should be removed/changed #define MAKEATOM(x) x##Atom = createLowerCaseAtom(#x) #define MAKESYSATOM(x) _##x##_Atom = createSystemAtom("$_" #x "_") #define MAKEID(x) x##IdAtom = createIdentifierAtom(#x) MODULE_INIT(INIT_PRIORITY_HQLATOM-1) { MAKEATOM(activeActivityMarker); MAKEATOM(activeMatchText); MAKEATOM(activeMatchUnicode); MAKEATOM(activeMatchUtf8); MAKEATOM(activeProductionMarker); MAKEATOM(activeValidateMarker); MAKEATOM(activityIdMarker); acosAtom = createAtom("_acos"); MAKEATOM(addAggregateRow); MAKEATOM(addAll); MAKEATOM(addRange); MAKEATOM(addWorkunitAssertFailure); MAKEATOM(addWorkunitException); MAKEATOM(an2b); MAKEATOM(an2f); MAKEATOM(an2l4); MAKEATOM(an2l8); MAKEATOM(an2ls4); MAKEATOM(an2ls8); MAKEATOM(appendRowsToRowset); MAKEATOM(appendSetX); MAKEATOM(ascii2ebcdic); asinAtom = createAtom("_asin");
MAKEATOM(terminate); MAKEATOM(terminator); MAKEATOM(escape); MAKEATOM(thor); MAKEATOM(threshold); MAKEATOM(timeout); MAKEATOM(timeLimit); MAKEATOM(timestamp); MAKEATOM(tiny); MAKEATOM(tomita); MAKEATOM(top); MAKEATOM(trim); MAKEATOM(true); MAKEATOM(type); MAKESYSATOM(uid); unnamedAtom = createAtom("<unnamed>"); MAKEATOM(unknown); MAKEATOM(unknownSizeField); MAKEATOM(unicode); MAKEATOM(unordered); MAKEATOM(unsorted); MAKEATOM(unstable); MAKEATOM(update); MAKEATOM(userMatchFunction); MAKEATOM(value); MAKEATOM(version); MAKEATOM(virtual); MAKEATOM(volatile); MAKEATOM(warning); MAKEATOM(whole); MAKEATOM(width);