6 |
|
#include "parse_me.h" |
7 |
|
#include "LRI.hpp" |
8 |
|
#include "Integrator.hpp" |
9 |
+ |
#include "simError.h" |
10 |
|
|
11 |
+ |
#ifdef IS_MPI |
12 |
+ |
#include "mpiBASS.h" |
13 |
+ |
#include "bassDiag.hpp" |
14 |
+ |
#endif |
15 |
+ |
|
16 |
|
SimSetup::SimSetup(){ |
17 |
|
stamps = new MakeStamps(); |
18 |
|
globals = new Globals(); |
19 |
+ |
|
20 |
+ |
#ifdef IS_MPI |
21 |
+ |
strcpy( checkPointMsg, "SimSetup creation successful" ); |
22 |
+ |
MPIcheckPoint(); |
23 |
+ |
#endif // IS_MPI |
24 |
|
} |
25 |
|
|
26 |
|
SimSetup::~SimSetup(){ |
30 |
|
|
31 |
|
void SimSetup::parseFile( char* fileName ){ |
32 |
|
|
33 |
< |
inFileName = fileName; |
34 |
< |
set_interface_stamps( stamps, globals ); |
35 |
< |
yacc_BASS( fileName ); |
33 |
> |
#ifdef IS_MPI |
34 |
> |
if( worldRank == 0 ){ |
35 |
> |
#endif // is_mpi |
36 |
> |
|
37 |
> |
inFileName = fileName; |
38 |
> |
set_interface_stamps( stamps, globals ); |
39 |
> |
|
40 |
> |
#ifdef IS_MPI |
41 |
> |
mpiEventInit(); |
42 |
> |
#endif |
43 |
> |
|
44 |
> |
yacc_BASS( fileName ); |
45 |
> |
|
46 |
> |
#ifdef IS_MPI |
47 |
> |
throwMPIEvent(NULL); |
48 |
> |
} |
49 |
> |
else receiveParse(); |
50 |
> |
#endif |
51 |
> |
|
52 |
|
} |
53 |
|
|
54 |
+ |
#ifdef IS_MPI |
55 |
+ |
void SimSetup::receiveParse(void){ |
56 |
+ |
|
57 |
+ |
set_interface_stamps( stamps, globals ); |
58 |
+ |
mpiEventInit(); |
59 |
+ |
MPIcheckPoint(); |
60 |
+ |
mpiEventLoop(); |
61 |
+ |
|
62 |
+ |
} |
63 |
+ |
|
64 |
+ |
|
65 |
+ |
void SimSetup::testMe(void){ |
66 |
+ |
bassDiag* dumpMe = new bassDiag(globals,stamps); |
67 |
+ |
dumpMe->dumpStamps(); |
68 |
+ |
delete dumpMe; |
69 |
+ |
} |
70 |
+ |
#endif |
71 |
+ |
|
72 |
|
void SimSetup::createSim( void ){ |
73 |
|
|
74 |
|
MakeStamps *the_stamps; |
88 |
|
n_components = the_globals->getNComponents(); |
89 |
|
strcpy( force_field, the_globals->getForceField() ); |
90 |
|
strcpy( ensemble, the_globals->getEnsemble() ); |
91 |
< |
|
91 |
> |
|
92 |
|
if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF(); |
93 |
|
else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); |
94 |
|
else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); |
95 |
|
else{ |
96 |
< |
std::cerr<< "SimSetup Error. Unrecognized force field -> " |
97 |
< |
<< force_field << "\n"; |
98 |
< |
exit(8); |
96 |
> |
sprintf( painCave.errMsg, |
97 |
> |
"SimSetup Error. Unrecognized force field -> %s\n", |
98 |
> |
force_field ); |
99 |
> |
painCave.isFatal = 1; |
100 |
> |
simError(); |
101 |
|
} |
102 |
|
|
103 |
+ |
#ifdef IS_MPI |
104 |
+ |
strcpy( checkPointMsg, "ForceField creation successful" ); |
105 |
+ |
MPIcheckPoint(); |
106 |
+ |
#endif // is_mpi |
107 |
+ |
|
108 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
109 |
|
the_components = the_globals->getComponents(); |
110 |
|
components_nmol = new int[n_components]; |
111 |
|
comp_stamps = new MoleculeStamp*[n_components]; |
112 |
< |
|
112 |
> |
|
113 |
|
if( !the_globals->haveNMol() ){ |
114 |
< |
// we don't have the total number of molecules, so we assume it is |
114 |
> |
// we don't have the total number of molecules, so we assume it is |
115 |
|
// given in each component |
116 |
|
|
117 |
|
tot_nmol = 0; |
118 |
|
for( i=0; i<n_components; i++ ){ |
119 |
< |
|
119 |
> |
|
120 |
|
if( !the_components[i]->haveNMol() ){ |
121 |
|
// we have a problem |
122 |
|
std::cerr << "SimSetup Error. No global NMol or component NMol" |
130 |
|
} |
131 |
|
else{ |
132 |
|
std::cerr << "NOT A SUPPORTED FEATURE\n"; |
133 |
< |
|
133 |
> |
|
134 |
|
// tot_nmol = the_globals->getNMol(); |
135 |
< |
|
135 |
> |
|
136 |
|
// //we have the total number of molecules, now we check for molfractions |
137 |
|
// for( i=0; i<n_components; i++ ){ |
138 |
< |
|
138 |
> |
|
139 |
|
// if( !the_components[i]->haveMolFraction() ){ |
140 |
< |
|
140 |
> |
|
141 |
|
// if( !the_components[i]->haveNMol() ){ |
142 |
|
// //we have a problem |
143 |
|
// std::cerr << "SimSetup error. Neither molFraction nor " |
149 |
|
|
150 |
|
for( i=0; i<n_components; i++ ){ |
151 |
|
|
152 |
< |
comp_stamps[i] = |
152 |
> |
comp_stamps[i] = |
153 |
|
the_stamps->getMolecule( the_components[i]->getType() ); |
154 |
|
} |
155 |
|
|
104 |
– |
|
156 |
|
|
157 |
+ |
|
158 |
|
// caclulate the number of atoms, bonds, bends and torsions |
159 |
|
|
160 |
|
tot_atoms = 0; |
162 |
|
tot_bends = 0; |
163 |
|
tot_torsions = 0; |
164 |
|
for( i=0; i<n_components; i++ ){ |
165 |
< |
|
165 |
> |
|
166 |
|
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
167 |
|
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
168 |
|
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
169 |
|
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
170 |
|
} |
171 |
< |
|
171 |
> |
|
172 |
|
tot_SRI = tot_bonds + tot_bends + tot_torsions; |
173 |
< |
|
173 |
> |
|
174 |
|
simnfo->n_atoms = tot_atoms; |
175 |
|
simnfo->n_bonds = tot_bonds; |
176 |
|
simnfo->n_bends = tot_bends; |
178 |
|
simnfo->n_SRI = tot_SRI; |
179 |
|
|
180 |
|
// create the atom and short range interaction arrays |
181 |
< |
|
181 |
> |
|
182 |
> |
Atom::createArrays(tot_atoms); |
183 |
|
the_atoms = new Atom*[tot_atoms]; |
184 |
|
the_molecules = new Molecule[tot_nmol]; |
185 |
< |
|
186 |
< |
|
185 |
> |
|
186 |
> |
|
187 |
|
if( tot_SRI ){ |
188 |
|
the_sris = new SRI*[tot_SRI]; |
189 |
|
the_excludes = new ex_pair[tot_SRI]; |
195 |
|
simnfo->sr_interactions = the_sris; |
196 |
|
simnfo->n_exclude = tot_SRI; |
197 |
|
simnfo->excludes = the_excludes; |
145 |
– |
|
198 |
|
|
199 |
+ |
|
200 |
|
// initialize the arrays |
201 |
< |
|
201 |
> |
|
202 |
|
the_ff->setSimInfo( simnfo ); |
203 |
< |
|
203 |
> |
|
204 |
|
makeAtoms(); |
205 |
|
|
206 |
|
if( tot_bonds ){ |
241 |
|
simnfo->box_z = the_globals->getBox(); |
242 |
|
} |
243 |
|
else if( the_globals->haveDensity() ){ |
244 |
< |
|
244 |
> |
|
245 |
|
double vol; |
246 |
|
vol = (double)tot_nmol / the_globals->getDensity(); |
247 |
|
simnfo->box_x = pow( vol, ( 1.0 / 3.0 ) ); |
267 |
|
} |
268 |
|
simnfo->box_z = the_globals->getBoxZ(); |
269 |
|
} |
217 |
– |
|
218 |
– |
if( the_globals->haveInitialConfig() ){ |
219 |
– |
InitializeFromFile* fileInit; |
220 |
– |
fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); |
221 |
– |
|
222 |
– |
fileInit->read_xyz( simnfo ); // default velocities on |
270 |
|
|
271 |
< |
delete fileInit; |
272 |
< |
} |
273 |
< |
else{ |
271 |
> |
|
272 |
> |
// if( the_globals->haveInitialConfig() ){ |
273 |
> |
// InitializeFromFile* fileInit; |
274 |
> |
// fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); |
275 |
> |
|
276 |
> |
// fileInit->read_xyz( simnfo ); // default velocities on |
277 |
> |
|
278 |
> |
// delete fileInit; |
279 |
> |
// } |
280 |
> |
// else{ |
281 |
> |
|
282 |
|
initFromBass(); |
228 |
– |
} |
283 |
|
|
284 |
< |
if( the_globals->haveFinalConfig() ){ |
285 |
< |
strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
286 |
< |
} |
287 |
< |
else{ |
288 |
< |
strcpy( simnfo->finalName, inFileName ); |
289 |
< |
char* endTest; |
290 |
< |
int nameLength = strlen( simnfo->finalName ); |
291 |
< |
endTest = &(simnfo->finalName[nameLength - 5]); |
292 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
293 |
< |
strcpy( endTest, ".eor" ); |
294 |
< |
} |
295 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
296 |
< |
strcpy( endTest, ".eor" ); |
297 |
< |
} |
298 |
< |
else{ |
245 |
< |
endTest = &(simnfo->finalName[nameLength - 4]); |
246 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
247 |
< |
strcpy( endTest, ".eor" ); |
284 |
> |
|
285 |
> |
// } |
286 |
> |
|
287 |
> |
#ifdef IS_MPI |
288 |
> |
if( worldRank == TESTWRITE ){ |
289 |
> |
#endif // is_mpi |
290 |
> |
|
291 |
> |
fprintf( stderr, |
292 |
> |
"infile name is \"%s\"\n", |
293 |
> |
inFileName ); |
294 |
> |
|
295 |
> |
inFileName = "./butane.bass"; |
296 |
> |
|
297 |
> |
if( the_globals->haveFinalConfig() ){ |
298 |
> |
strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
299 |
|
} |
300 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
301 |
< |
strcpy( endTest, ".eor" ); |
300 |
> |
else{ |
301 |
> |
strcpy( simnfo->finalName, inFileName ); |
302 |
> |
char* endTest; |
303 |
> |
int nameLength = strlen( simnfo->finalName ); |
304 |
> |
endTest = &(simnfo->finalName[nameLength - 5]); |
305 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
306 |
> |
strcpy( endTest, ".eor" ); |
307 |
> |
} |
308 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
309 |
> |
strcpy( endTest, ".eor" ); |
310 |
> |
} |
311 |
> |
else{ |
312 |
> |
endTest = &(simnfo->finalName[nameLength - 4]); |
313 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
314 |
> |
strcpy( endTest, ".eor" ); |
315 |
> |
} |
316 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
317 |
> |
strcpy( endTest, ".eor" ); |
318 |
> |
} |
319 |
> |
else{ |
320 |
> |
strcat( simnfo->finalName, ".eor" ); |
321 |
> |
} |
322 |
> |
} |
323 |
|
} |
324 |
+ |
|
325 |
+ |
// make the sample and status out names |
326 |
+ |
|
327 |
+ |
strcpy( simnfo->sampleName, inFileName ); |
328 |
+ |
char* endTest; |
329 |
+ |
int nameLength = strlen( simnfo->sampleName ); |
330 |
+ |
endTest = &(simnfo->sampleName[nameLength - 5]); |
331 |
+ |
if( !strcmp( endTest, ".bass" ) ){ |
332 |
+ |
strcpy( endTest, ".dump" ); |
333 |
+ |
} |
334 |
+ |
else if( !strcmp( endTest, ".BASS" ) ){ |
335 |
+ |
strcpy( endTest, ".dump" ); |
336 |
+ |
} |
337 |
|
else{ |
338 |
< |
strcat( simnfo->finalName, ".eor" ); |
338 |
> |
endTest = &(simnfo->sampleName[nameLength - 4]); |
339 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
340 |
> |
strcpy( endTest, ".dump" ); |
341 |
> |
} |
342 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
343 |
> |
strcpy( endTest, ".dump" ); |
344 |
> |
} |
345 |
> |
else{ |
346 |
> |
strcat( simnfo->sampleName, ".dump" ); |
347 |
> |
} |
348 |
|
} |
349 |
+ |
|
350 |
+ |
strcpy( simnfo->statusName, inFileName ); |
351 |
+ |
nameLength = strlen( simnfo->statusName ); |
352 |
+ |
endTest = &(simnfo->statusName[nameLength - 5]); |
353 |
+ |
if( !strcmp( endTest, ".bass" ) ){ |
354 |
+ |
strcpy( endTest, ".stat" ); |
355 |
+ |
} |
356 |
+ |
else if( !strcmp( endTest, ".BASS" ) ){ |
357 |
+ |
strcpy( endTest, ".stat" ); |
358 |
+ |
} |
359 |
+ |
else{ |
360 |
+ |
endTest = &(simnfo->statusName[nameLength - 4]); |
361 |
+ |
if( !strcmp( endTest, ".bss" ) ){ |
362 |
+ |
strcpy( endTest, ".stat" ); |
363 |
+ |
} |
364 |
+ |
else if( !strcmp( endTest, ".mdl" ) ){ |
365 |
+ |
strcpy( endTest, ".stat" ); |
366 |
+ |
} |
367 |
+ |
else{ |
368 |
+ |
strcat( simnfo->statusName, ".stat" ); |
369 |
+ |
} |
370 |
+ |
} |
371 |
+ |
|
372 |
+ |
#ifdef IS_MPI |
373 |
|
} |
374 |
< |
} |
257 |
< |
|
258 |
< |
// make the sample and status out names |
374 |
> |
#endif // is_mpi |
375 |
|
|
260 |
– |
strcpy( simnfo->sampleName, inFileName ); |
261 |
– |
char* endTest; |
262 |
– |
int nameLength = strlen( simnfo->sampleName ); |
263 |
– |
endTest = &(simnfo->sampleName[nameLength - 5]); |
264 |
– |
if( !strcmp( endTest, ".bass" ) ){ |
265 |
– |
strcpy( endTest, ".dump" ); |
266 |
– |
} |
267 |
– |
else if( !strcmp( endTest, ".BASS" ) ){ |
268 |
– |
strcpy( endTest, ".dump" ); |
269 |
– |
} |
270 |
– |
else{ |
271 |
– |
endTest = &(simnfo->sampleName[nameLength - 4]); |
272 |
– |
if( !strcmp( endTest, ".bss" ) ){ |
273 |
– |
strcpy( endTest, ".dump" ); |
274 |
– |
} |
275 |
– |
else if( !strcmp( endTest, ".mdl" ) ){ |
276 |
– |
strcpy( endTest, ".dump" ); |
277 |
– |
} |
278 |
– |
else{ |
279 |
– |
strcat( simnfo->sampleName, ".dump" ); |
280 |
– |
} |
281 |
– |
} |
282 |
– |
|
283 |
– |
strcpy( simnfo->statusName, inFileName ); |
284 |
– |
nameLength = strlen( simnfo->statusName ); |
285 |
– |
endTest = &(simnfo->statusName[nameLength - 5]); |
286 |
– |
if( !strcmp( endTest, ".bass" ) ){ |
287 |
– |
strcpy( endTest, ".stat" ); |
288 |
– |
} |
289 |
– |
else if( !strcmp( endTest, ".BASS" ) ){ |
290 |
– |
strcpy( endTest, ".stat" ); |
291 |
– |
} |
292 |
– |
else{ |
293 |
– |
endTest = &(simnfo->statusName[nameLength - 4]); |
294 |
– |
if( !strcmp( endTest, ".bss" ) ){ |
295 |
– |
strcpy( endTest, ".stat" ); |
296 |
– |
} |
297 |
– |
else if( !strcmp( endTest, ".mdl" ) ){ |
298 |
– |
strcpy( endTest, ".stat" ); |
299 |
– |
} |
300 |
– |
else{ |
301 |
– |
strcat( simnfo->statusName, ".stat" ); |
302 |
– |
} |
303 |
– |
} |
304 |
– |
|
376 |
|
// set the status, sample, and themal kick times |
377 |
|
|
378 |
|
if( the_globals->haveSampleTime() ){ |
379 |
< |
simnfo->sampleTime = the_globals->getSampleTime(); |
379 |
> |
simnfo->sampleTime = the_globals->getSampleTime(); |
380 |
|
simnfo->statusTime = simnfo->sampleTime; |
381 |
|
simnfo->thermalTime = simnfo->sampleTime; |
382 |
|
} |
383 |
|
else{ |
384 |
< |
simnfo->sampleTime = the_globals->getRunTime(); |
384 |
> |
simnfo->sampleTime = the_globals->getRunTime(); |
385 |
|
simnfo->statusTime = simnfo->sampleTime; |
386 |
|
simnfo->thermalTime = simnfo->sampleTime; |
387 |
|
} |
397 |
|
// check for the temperature set flag |
398 |
|
|
399 |
|
if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); |
400 |
< |
|
401 |
< |
|
400 |
> |
|
401 |
> |
|
402 |
|
// make the longe range forces and the integrator |
403 |
< |
|
403 |
> |
|
404 |
|
new AllLong( simnfo ); |
405 |
< |
|
405 |
> |
|
406 |
|
if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo ); |
407 |
|
if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo ); |
408 |
|
if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo ); |
409 |
|
} |
410 |
|
|
411 |
|
void SimSetup::makeAtoms( void ){ |
412 |
< |
|
412 |
> |
|
413 |
|
int i, j, k, index; |
414 |
|
double ux, uy, uz, uSqr, u; |
415 |
|
AtomStamp* current_atom; |
416 |
|
DirectionalAtom* dAtom; |
417 |
|
int molIndex, molStart, molEnd, nMemb; |
347 |
– |
|
418 |
|
|
419 |
+ |
|
420 |
|
molIndex = 0; |
421 |
|
index = 0; |
422 |
|
for( i=0; i<n_components; i++ ){ |
423 |
< |
|
423 |
> |
|
424 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
425 |
< |
|
425 |
> |
|
426 |
|
molStart = index; |
427 |
|
nMemb = comp_stamps[i]->getNAtoms(); |
428 |
|
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
429 |
< |
|
429 |
> |
|
430 |
|
current_atom = comp_stamps[i]->getAtom( k ); |
431 |
< |
if( current_atom->haveOrientation() ){ |
431 |
> |
if( current_atom->haveOrientation() ){ |
432 |
|
|
433 |
< |
dAtom = new DirectionalAtom; |
433 |
> |
dAtom = new DirectionalAtom(index); |
434 |
|
simnfo->n_oriented++; |
435 |
|
the_atoms[index] = dAtom; |
436 |
< |
|
436 |
> |
|
437 |
|
ux = current_atom->getOrntX(); |
438 |
|
uy = current_atom->getOrntY(); |
439 |
|
uz = current_atom->getOrntZ(); |
440 |
< |
|
440 |
> |
|
441 |
|
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
442 |
< |
|
442 |
> |
|
443 |
|
u = sqrt( uSqr ); |
444 |
|
ux = ux / u; |
445 |
|
uy = uy / u; |
446 |
|
uz = uz / u; |
447 |
< |
|
447 |
> |
|
448 |
|
dAtom->setSUx( ux ); |
449 |
|
dAtom->setSUy( uy ); |
450 |
|
dAtom->setSUz( uz ); |
451 |
|
} |
452 |
|
else{ |
453 |
< |
the_atoms[index] = new GeneralAtom; |
453 |
> |
the_atoms[index] = new GeneralAtom(index); |
454 |
|
} |
455 |
|
the_atoms[index]->setType( current_atom->getType() ); |
456 |
|
the_atoms[index]->setIndex( index ); |
457 |
< |
|
457 |
> |
|
458 |
|
// increment the index and repeat; |
459 |
|
index++; |
460 |
|
} |
461 |
< |
|
461 |
> |
|
462 |
|
molEnd = index -1; |
463 |
|
the_molecules[molIndex].setNMembers( nMemb ); |
464 |
|
the_molecules[molIndex].setStartAtom( molStart ); |
467 |
|
|
468 |
|
} |
469 |
|
} |
470 |
< |
|
470 |
> |
|
471 |
|
the_ff->initializeAtoms(); |
472 |
|
} |
473 |
|
|
481 |
|
index = 0; |
482 |
|
offset = 0; |
483 |
|
for( i=0; i<n_components; i++ ){ |
484 |
< |
|
484 |
> |
|
485 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
486 |
< |
|
486 |
> |
|
487 |
|
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
488 |
< |
|
488 |
> |
|
489 |
|
current_bond = comp_stamps[i]->getBond( k ); |
490 |
|
the_bonds[index].a = current_bond->getA() + offset; |
491 |
|
the_bonds[index].b = current_bond->getB() + offset; |
499 |
|
offset += comp_stamps[i]->getNAtoms(); |
500 |
|
} |
501 |
|
} |
502 |
< |
|
502 |
> |
|
503 |
|
the_ff->initializeBonds( the_bonds ); |
504 |
|
} |
505 |
|
|
513 |
|
index = 0; |
514 |
|
offset = 0; |
515 |
|
for( i=0; i<n_components; i++ ){ |
516 |
< |
|
516 |
> |
|
517 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
518 |
< |
|
518 |
> |
|
519 |
|
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
520 |
< |
|
520 |
> |
|
521 |
|
current_bend = comp_stamps[i]->getBend( k ); |
522 |
|
the_bends[index].a = current_bend->getA() + offset; |
523 |
|
the_bends[index].b = current_bend->getB() + offset; |
532 |
|
offset += comp_stamps[i]->getNAtoms(); |
533 |
|
} |
534 |
|
} |
535 |
< |
|
535 |
> |
|
536 |
|
the_ff->initializeBends( the_bends ); |
537 |
|
} |
538 |
|
|
546 |
|
index = 0; |
547 |
|
offset = 0; |
548 |
|
for( i=0; i<n_components; i++ ){ |
549 |
< |
|
549 |
> |
|
550 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
551 |
< |
|
551 |
> |
|
552 |
|
for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
553 |
< |
|
553 |
> |
|
554 |
|
current_torsion = comp_stamps[i]->getTorsion( k ); |
555 |
|
the_torsions[index].a = current_torsion->getA() + offset; |
556 |
|
the_torsions[index].b = current_torsion->getB() + offset; |
566 |
|
offset += comp_stamps[i]->getNAtoms(); |
567 |
|
} |
568 |
|
} |
569 |
< |
|
569 |
> |
|
570 |
|
the_ff->initializeTorsions( the_torsions ); |
571 |
|
} |
572 |
|
|
607 |
|
celly = simnfo->box_y / temp3; |
608 |
|
cellz = simnfo->box_z / temp3; |
609 |
|
} |
610 |
< |
|
610 |
> |
|
611 |
|
current_mol = 0; |
612 |
|
current_comp_mol = 0; |
613 |
|
current_comp = 0; |
614 |
|
current_atom_ndx = 0; |
615 |
< |
|
615 |
> |
|
616 |
|
for( i=0; i < n_cells ; i++ ){ |
617 |
|
for( j=0; j < n_cells; j++ ){ |
618 |
|
for( k=0; k < n_cells; k++ ){ |
619 |
< |
|
619 |
> |
|
620 |
|
makeElement( i * cellx, |
621 |
|
j * celly, |
622 |
|
k * cellz ); |
623 |
< |
|
623 |
> |
|
624 |
|
makeElement( i * cellx + 0.5 * cellx, |
625 |
|
j * celly + 0.5 * celly, |
626 |
|
k * cellz ); |
627 |
< |
|
627 |
> |
|
628 |
|
makeElement( i * cellx, |
629 |
|
j * celly + 0.5 * celly, |
630 |
|
k * cellz + 0.5 * cellz ); |
631 |
< |
|
631 |
> |
|
632 |
|
makeElement( i * cellx + 0.5 * cellx, |
633 |
|
j * celly, |
634 |
|
k * cellz + 0.5 * cellz ); |
638 |
|
|
639 |
|
if( have_extra ){ |
640 |
|
done = 0; |
641 |
< |
|
641 |
> |
|
642 |
|
int start_ndx; |
643 |
|
for( i=0; i < (n_cells+1) && !done; i++ ){ |
644 |
|
for( j=0; j < (n_cells+1) && !done; j++ ){ |
645 |
< |
|
645 |
> |
|
646 |
|
if( i < n_cells ){ |
647 |
< |
|
647 |
> |
|
648 |
|
if( j < n_cells ){ |
649 |
|
start_ndx = n_cells; |
650 |
|
} |
651 |
|
else start_ndx = 0; |
652 |
|
} |
653 |
|
else start_ndx = 0; |
654 |
< |
|
654 |
> |
|
655 |
|
for( k=start_ndx; k < (n_cells+1) && !done; k++ ){ |
656 |
< |
|
656 |
> |
|
657 |
|
makeElement( i * cellx, |
658 |
|
j * celly, |
659 |
|
k * cellz ); |
660 |
|
done = ( current_mol >= tot_nmol ); |
661 |
< |
|
661 |
> |
|
662 |
|
if( !done && n_per_extra > 1 ){ |
663 |
|
makeElement( i * cellx + 0.5 * cellx, |
664 |
|
j * celly + 0.5 * celly, |
665 |
|
k * cellz ); |
666 |
|
done = ( current_mol >= tot_nmol ); |
667 |
|
} |
668 |
< |
|
668 |
> |
|
669 |
|
if( !done && n_per_extra > 2){ |
670 |
|
makeElement( i * cellx, |
671 |
|
j * celly + 0.5 * celly, |
672 |
|
k * cellz + 0.5 * cellz ); |
673 |
|
done = ( current_mol >= tot_nmol ); |
674 |
|
} |
675 |
< |
|
675 |
> |
|
676 |
|
if( !done && n_per_extra > 3){ |
677 |
|
makeElement( i * cellx + 0.5 * cellx, |
678 |
|
j * celly, |
683 |
|
} |
684 |
|
} |
685 |
|
} |
686 |
< |
|
687 |
< |
|
686 |
> |
|
687 |
> |
|
688 |
|
for( i=0; i<simnfo->n_atoms; i++ ){ |
689 |
|
simnfo->atoms[i]->set_vx( 0.0 ); |
690 |
|
simnfo->atoms[i]->set_vy( 0.0 ); |
700 |
|
double rotMat[3][3]; |
701 |
|
|
702 |
|
for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ |
703 |
< |
|
703 |
> |
|
704 |
|
current_atom = comp_stamps[current_comp]->getAtom( k ); |
705 |
|
if( !current_atom->havePosition() ){ |
706 |
|
std::cerr << "Component " << comp_stamps[current_comp]->getID() |
710 |
|
<< " position.\n"; |
711 |
|
exit(8); |
712 |
|
} |
713 |
< |
|
713 |
> |
|
714 |
|
the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); |
715 |
|
the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() ); |
716 |
|
the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() ); |
717 |
< |
|
717 |
> |
|
718 |
|
if( the_atoms[current_atom_ndx]->isDirectional() ){ |
719 |
< |
|
719 |
> |
|
720 |
|
dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx]; |
721 |
< |
|
721 |
> |
|
722 |
|
rotMat[0][0] = 1.0; |
723 |
|
rotMat[0][1] = 0.0; |
724 |
|
rotMat[0][2] = 0.0; |
736 |
|
|
737 |
|
current_atom_ndx++; |
738 |
|
} |
739 |
< |
|
739 |
> |
|
740 |
|
current_mol++; |
741 |
|
current_comp_mol++; |
742 |
|
|
743 |
|
if( current_comp_mol >= components_nmol[current_comp] ){ |
744 |
< |
|
744 |
> |
|
745 |
|
current_comp_mol = 0; |
746 |
|
current_comp++; |
747 |
|
} |