| 1 |
#include <iostream> |
| 2 |
#include <cstdio> |
| 3 |
#include <cstring> |
| 4 |
#include <cstdlib> |
| 5 |
|
| 6 |
#include "bassDiag.hpp" |
| 7 |
|
| 8 |
void bassDiag::dumpStamps(void){ |
| 9 |
char msg[1000]; |
| 10 |
Component** components; |
| 11 |
int n_components; |
| 12 |
MoleculeStamp* testMolecule; |
| 13 |
|
| 14 |
dumpFormater("First comes the globals..... \n"); |
| 15 |
sprintf(msg,"ForceField = %s\n",globals->getForceField()); |
| 16 |
dumpFormater(msg); |
| 17 |
|
| 18 |
sprintf(msg,"NComponents = %d\n",globals->getNComponents()); |
| 19 |
dumpFormater(msg); |
| 20 |
|
| 21 |
sprintf(msg,"TargatTemp = %lf\n",globals->getTargetTemp()); |
| 22 |
dumpFormater(msg); |
| 23 |
|
| 24 |
sprintf(msg,"Ensemble = %s\n",globals->getEnsemble()); |
| 25 |
dumpFormater(msg); |
| 26 |
|
| 27 |
sprintf(msg,"Dt = %lf\n",globals->getDt()); |
| 28 |
dumpFormater(msg); |
| 29 |
|
| 30 |
sprintf(msg,"RunTime = %lf\n\n",globals->getRunTime()); |
| 31 |
dumpFormater(msg); |
| 32 |
|
| 33 |
sprintf(msg,"Dumping Optional Globals....\n"); |
| 34 |
dumpFormater(msg); |
| 35 |
|
| 36 |
if (globals->haveInitialConfig()){ |
| 37 |
|
| 38 |
sprintf(msg,"InitialConfig = %s\n",globals->getInitialConfig()); |
| 39 |
dumpFormater(msg); |
| 40 |
} |
| 41 |
if (globals->haveFinalConfig()){ |
| 42 |
|
| 43 |
sprintf(msg,"FinalConfig = %s\n",globals->getFinalConfig()); |
| 44 |
dumpFormater(msg); |
| 45 |
} |
| 46 |
|
| 47 |
if (globals->haveNMol()){ |
| 48 |
|
| 49 |
sprintf(msg,"NMol = %d\n",globals->getNMol()); |
| 50 |
dumpFormater(msg); |
| 51 |
} |
| 52 |
|
| 53 |
if (globals->haveDensity()){ |
| 54 |
|
| 55 |
sprintf(msg,"Density = %lf\n",globals->getDensity()); |
| 56 |
dumpFormater(msg); |
| 57 |
} |
| 58 |
|
| 59 |
if (globals->haveBox()){ |
| 60 |
|
| 61 |
sprintf(msg,"Box = %lf\n",globals->getBox()); |
| 62 |
dumpFormater(msg); |
| 63 |
} |
| 64 |
|
| 65 |
if (globals->haveBoxX()){ |
| 66 |
|
| 67 |
sprintf(msg,"BoxX = %lf\n",globals->getBoxX()); |
| 68 |
dumpFormater(msg); |
| 69 |
} |
| 70 |
if (globals->haveBoxY()){ |
| 71 |
|
| 72 |
sprintf(msg,"BoxY = %lf\n",globals->getBoxY()); |
| 73 |
dumpFormater(msg); |
| 74 |
} |
| 75 |
if (globals->haveBoxZ()){ |
| 76 |
|
| 77 |
sprintf(msg,"BoxZ = %lf\n",globals->getBoxZ()); |
| 78 |
dumpFormater(msg); |
| 79 |
} |
| 80 |
|
| 81 |
if (globals->haveSampleTime()){ |
| 82 |
|
| 83 |
sprintf(msg,"SampleTime = %lf\n",globals->getSampleTime()); |
| 84 |
dumpFormater(msg); |
| 85 |
} |
| 86 |
|
| 87 |
if (globals->haveStatusTime()){ |
| 88 |
|
| 89 |
sprintf(msg,"StatusTime = %lf\n",globals->getStatusTime()); |
| 90 |
dumpFormater(msg); |
| 91 |
} |
| 92 |
|
| 93 |
if (globals->haveThermalTime()){ |
| 94 |
|
| 95 |
sprintf(msg,"ThermalTime = %lf\n",globals->getThermalTime()); |
| 96 |
dumpFormater(msg); |
| 97 |
} |
| 98 |
|
| 99 |
if (globals->haveDielectric()){ |
| 100 |
|
| 101 |
sprintf(msg,"Dielectric = %lf\n",globals->getDielectric()); |
| 102 |
dumpFormater(msg); |
| 103 |
} |
| 104 |
|
| 105 |
if (globals->haveRRF()){ |
| 106 |
|
| 107 |
sprintf(msg,"RRF = %lf\n",globals->getRRF()); |
| 108 |
dumpFormater(msg); |
| 109 |
} |
| 110 |
|
| 111 |
if (globals->haveTempSet()){ |
| 112 |
sprintf(msg,"TempSet = %d\n",globals->getTempSet()); |
| 113 |
dumpFormater(msg); |
| 114 |
|
| 115 |
} |
| 116 |
|
| 117 |
n_components = globals->getNComponents(); |
| 118 |
sprintf(msg,"\nWriting out %d components\n",n_components); |
| 119 |
dumpFormater(msg); |
| 120 |
components = globals->getComponents(); |
| 121 |
|
| 122 |
for(int i=0; i < n_components ; i++){ |
| 123 |
|
| 124 |
sprintf(msg,"Component[%d]{\n",i); |
| 125 |
dumpFormater(msg); |
| 126 |
|
| 127 |
sprintf(msg," Type = %s\n",components[i]->getType()); |
| 128 |
dumpFormater(msg); |
| 129 |
|
| 130 |
if (components[i]->haveNMol()){ |
| 131 |
|
| 132 |
sprintf(msg," Nmol = %d\n",components[i]->getNMol()); |
| 133 |
dumpFormater(msg); |
| 134 |
} |
| 135 |
|
| 136 |
sprintf(msg,"{\n\n"); |
| 137 |
dumpFormater(msg); |
| 138 |
} |
| 139 |
|
| 140 |
testMolecule = stamps->getMolecule("tester"); |
| 141 |
|
| 142 |
if(testMolecule != NULL ){ |
| 143 |
|
| 144 |
sprintf(msg,"\nWriting out tester..... \n\n"); |
| 145 |
dumpFormater(msg); |
| 146 |
|
| 147 |
sprintf(msg,"Molecule{\n"); |
| 148 |
dumpFormater(msg); |
| 149 |
|
| 150 |
sprintf(msg," ID = %s\n",testMolecule->getID()); |
| 151 |
dumpFormater(msg); |
| 152 |
|
| 153 |
sprintf(msg," NAtoms = %d\n",testMolecule->getNAtoms()); |
| 154 |
dumpFormater(msg); |
| 155 |
|
| 156 |
int nAtoms = testMolecule->getNAtoms(); |
| 157 |
AtomStamp* aStamp; |
| 158 |
for(int i=0; i<nAtoms;i++){ |
| 159 |
|
| 160 |
aStamp = testMolecule->getAtom(i); |
| 161 |
|
| 162 |
sprintf(msg," Atom[%d]{\n",i); |
| 163 |
dumpFormater(msg); |
| 164 |
|
| 165 |
sprintf(msg," type = %s\n",aStamp->getType()); |
| 166 |
dumpFormater(msg); |
| 167 |
|
| 168 |
if(aStamp->havePosition()){ |
| 169 |
sprintf(msg," position = < %lf, %lf, %lf>\n", |
| 170 |
aStamp->getPosX(), |
| 171 |
aStamp->getPosY(), |
| 172 |
aStamp->getPosZ()); |
| 173 |
dumpFormater(msg); |
| 174 |
} |
| 175 |
|
| 176 |
if(aStamp->haveOrientation()){ |
| 177 |
sprintf(msg," orientation = < %lf, %lf, %lf>\n", |
| 178 |
aStamp->getOrntX(), |
| 179 |
aStamp->getOrntY(), |
| 180 |
aStamp->getOrntZ()); |
| 181 |
dumpFormater(msg); |
| 182 |
} |
| 183 |
sprintf(msg," }\n\n"); |
| 184 |
dumpFormater(msg); |
| 185 |
} |
| 186 |
|
| 187 |
sprintf(msg," NBonds = %d\n",testMolecule->getNBonds()); |
| 188 |
dumpFormater(msg); |
| 189 |
|
| 190 |
int nBonds = testMolecule->getNBonds(); |
| 191 |
BondStamp* boStamp; |
| 192 |
for(int i=0; i<nBonds;i++){ |
| 193 |
|
| 194 |
boStamp = testMolecule->getBond(i); |
| 195 |
|
| 196 |
sprintf(msg," Bond[%d]{\n",i); |
| 197 |
dumpFormater(msg); |
| 198 |
|
| 199 |
sprintf(msg," members = %d, %d\n", |
| 200 |
boStamp->getA(), |
| 201 |
boStamp->getB()); |
| 202 |
dumpFormater(msg); |
| 203 |
|
| 204 |
sprintf(msg," }\n\n"); |
| 205 |
dumpFormater(msg); |
| 206 |
} |
| 207 |
|
| 208 |
sprintf(msg," NBends = %d\n",testMolecule->getNBends()); |
| 209 |
dumpFormater(msg); |
| 210 |
|
| 211 |
int nBends = testMolecule->getNBends(); |
| 212 |
BendStamp* beStamp; |
| 213 |
for(int i=0; i<nBends;i++){ |
| 214 |
|
| 215 |
beStamp = testMolecule->getBend(i); |
| 216 |
|
| 217 |
sprintf(msg," Bend[%d]{\n",i); |
| 218 |
dumpFormater(msg); |
| 219 |
|
| 220 |
sprintf(msg," members = %d, %d, %d\n", |
| 221 |
beStamp->getA(), |
| 222 |
beStamp->getB(), |
| 223 |
beStamp->getC()); |
| 224 |
dumpFormater(msg); |
| 225 |
|
| 226 |
sprintf(msg," }\n\n"); |
| 227 |
dumpFormater(msg); |
| 228 |
} |
| 229 |
|
| 230 |
sprintf(msg," NTorsions = %d\n",testMolecule->getNTorsions()); |
| 231 |
dumpFormater(msg); |
| 232 |
|
| 233 |
int nTorsions = testMolecule->getNTorsions(); |
| 234 |
TorsionStamp* tStamp; |
| 235 |
for(int i=0; i<nTorsions;i++){ |
| 236 |
|
| 237 |
tStamp = testMolecule->getTorsion(i); |
| 238 |
|
| 239 |
sprintf(msg," Torsion[%d]{\n",i); |
| 240 |
dumpFormater(msg); |
| 241 |
|
| 242 |
sprintf(msg," members = %d, %d, %d, %d\n", |
| 243 |
tStamp->getA(), |
| 244 |
tStamp->getB(), |
| 245 |
tStamp->getC(), |
| 246 |
tStamp->getD()); |
| 247 |
dumpFormater(msg); |
| 248 |
|
| 249 |
sprintf(msg," }\n\n"); |
| 250 |
dumpFormater(msg); |
| 251 |
} |
| 252 |
|
| 253 |
sprintf(msg,"}\n\n"); |
| 254 |
dumpFormater(msg); |
| 255 |
|
| 256 |
} |
| 257 |
else{ |
| 258 |
sprintf(msg, "\n**************** Tester.mdl not included *************\n"); |
| 259 |
dumpFormater( msg ); |
| 260 |
|
| 261 |
} |
| 262 |
} |
| 263 |
|
| 264 |
void bassDiag::dumpFormater(char * theString){ |
| 265 |
|
| 266 |
std::cout << theString; |
| 267 |
std::cout.flush(); |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|