# | Line 6 | Line 6 | |
---|---|---|
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(){ | |
# | Line 19 | Line 30 | void SimSetup::parseFile( char* fileName ){ | |
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; | |
# | Line 43 | Line 88 | void SimSetup::createSim( void ){ | |
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" | |
# | Line 78 | Line 130 | void SimSetup::createSim( void ){ | |
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 " | |
# | Line 97 | Line 149 | void SimSetup::createSim( void ){ | |
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; | |
# | Line 110 | Line 162 | void SimSetup::createSim( void ){ | |
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; | |
# | Line 126 | Line 178 | void SimSetup::createSim( void ){ | |
178 | simnfo->n_SRI = tot_SRI; | |
179 | ||
180 | // create the atom and short range interaction arrays | |
181 | < | |
181 | > | |
182 | the_atoms = new Atom*[tot_atoms]; | |
183 | + | Atom::createArrays(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]; | |
# | Line 142 | Line 195 | void SimSetup::createSim( void ){ | |
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 ){ | |
# | Line 188 | Line 241 | void SimSetup::createSim( void ){ | |
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 ) ); | |
# | Line 214 | Line 267 | void SimSetup::createSim( void ){ | |
267 | } | |
268 | simnfo->box_z = the_globals->getBoxZ(); | |
269 | } | |
270 | < | |
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 | ||
272 | < | delete fileInit; |
273 | < | } |
274 | < | else{ |
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 | ||
230 | – | if( the_globals->haveFinalConfig() ){ |
231 | – | strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
232 | – | } |
233 | – | else{ |
234 | – | strcpy( simnfo->finalName, inFileName ); |
235 | – | char* endTest; |
236 | – | int nameLength = strlen( simnfo->finalName ); |
237 | – | endTest = &(simnfo->finalName[nameLength - 5]); |
238 | – | if( !strcmp( endTest, ".bass" ) ){ |
239 | – | strcpy( endTest, ".eor" ); |
240 | – | } |
241 | – | else if( !strcmp( endTest, ".BASS" ) ){ |
242 | – | strcpy( endTest, ".eor" ); |
243 | – | } |
244 | – | else{ |
245 | – | endTest = &(simnfo->finalName[nameLength - 4]); |
246 | – | if( !strcmp( endTest, ".bss" ) ){ |
247 | – | strcpy( endTest, ".eor" ); |
248 | – | } |
249 | – | else if( !strcmp( endTest, ".mdl" ) ){ |
250 | – | strcpy( endTest, ".eor" ); |
251 | – | } |
252 | – | else{ |
253 | – | strcat( simnfo->finalName, ".eor" ); |
254 | – | } |
255 | – | } |
256 | – | } |
257 | – | |
258 | – | // make the sample and status out names |
284 | ||
285 | < | strcpy( simnfo->sampleName, inFileName ); |
286 | < | char* endTest; |
287 | < | int nameLength = strlen( simnfo->sampleName ); |
288 | < | endTest = &(simnfo->sampleName[nameLength - 5]); |
289 | < | if( !strcmp( endTest, ".bass" ) ){ |
290 | < | strcpy( endTest, ".dump" ); |
291 | < | } |
292 | < | else if( !strcmp( endTest, ".BASS" ) ){ |
293 | < | strcpy( endTest, ".dump" ); |
294 | < | } |
295 | < | else{ |
296 | < | endTest = &(simnfo->sampleName[nameLength - 4]); |
297 | < | if( !strcmp( endTest, ".bss" ) ){ |
298 | < | strcpy( endTest, ".dump" ); |
299 | < | } |
300 | < | else if( !strcmp( endTest, ".mdl" ) ){ |
301 | < | strcpy( endTest, ".dump" ); |
302 | < | } |
303 | < | else{ |
304 | < | strcat( simnfo->sampleName, ".dump" ); |
305 | < | } |
306 | < | } |
307 | < | |
308 | < | strcpy( simnfo->statusName, inFileName ); |
309 | < | nameLength = strlen( simnfo->statusName ); |
310 | < | endTest = &(simnfo->statusName[nameLength - 5]); |
311 | < | if( !strcmp( endTest, ".bass" ) ){ |
312 | < | strcpy( endTest, ".stat" ); |
313 | < | } |
314 | < | else if( !strcmp( endTest, ".BASS" ) ){ |
315 | < | strcpy( endTest, ".stat" ); |
316 | < | } |
317 | < | else{ |
318 | < | endTest = &(simnfo->statusName[nameLength - 4]); |
319 | < | if( !strcmp( endTest, ".bss" ) ){ |
320 | < | strcpy( endTest, ".stat" ); |
321 | < | } |
322 | < | else if( !strcmp( endTest, ".mdl" ) ){ |
323 | < | strcpy( endTest, ".stat" ); |
324 | < | } |
325 | < | else{ |
326 | < | strcat( simnfo->statusName, ".stat" ); |
327 | < | } |
328 | < | } |
329 | < | |
285 | > | // } |
286 | > | |
287 | > | // if( the_globals->haveFinalConfig() ){ |
288 | > | // strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
289 | > | // } |
290 | > | // else{ |
291 | > | // strcpy( simnfo->finalName, inFileName ); |
292 | > | // char* endTest; |
293 | > | // int nameLength = strlen( simnfo->finalName ); |
294 | > | // endTest = &(simnfo->finalName[nameLength - 5]); |
295 | > | // if( !strcmp( endTest, ".bass" ) ){ |
296 | > | // strcpy( endTest, ".eor" ); |
297 | > | // } |
298 | > | // else if( !strcmp( endTest, ".BASS" ) ){ |
299 | > | // strcpy( endTest, ".eor" ); |
300 | > | // } |
301 | > | // else{ |
302 | > | // endTest = &(simnfo->finalName[nameLength - 4]); |
303 | > | // if( !strcmp( endTest, ".bss" ) ){ |
304 | > | // strcpy( endTest, ".eor" ); |
305 | > | // } |
306 | > | // else if( !strcmp( endTest, ".mdl" ) ){ |
307 | > | // strcpy( endTest, ".eor" ); |
308 | > | // } |
309 | > | // else{ |
310 | > | // strcat( simnfo->finalName, ".eor" ); |
311 | > | // } |
312 | > | // } |
313 | > | // } |
314 | > | |
315 | > | // // make the sample and status out names |
316 | > | |
317 | > | // strcpy( simnfo->sampleName, inFileName ); |
318 | > | // char* endTest; |
319 | > | // int nameLength = strlen( simnfo->sampleName ); |
320 | > | // endTest = &(simnfo->sampleName[nameLength - 5]); |
321 | > | // if( !strcmp( endTest, ".bass" ) ){ |
322 | > | // strcpy( endTest, ".dump" ); |
323 | > | // } |
324 | > | // else if( !strcmp( endTest, ".BASS" ) ){ |
325 | > | // strcpy( endTest, ".dump" ); |
326 | > | // } |
327 | > | // else{ |
328 | > | // endTest = &(simnfo->sampleName[nameLength - 4]); |
329 | > | // if( !strcmp( endTest, ".bss" ) ){ |
330 | > | // strcpy( endTest, ".dump" ); |
331 | > | // } |
332 | > | // else if( !strcmp( endTest, ".mdl" ) ){ |
333 | > | // strcpy( endTest, ".dump" ); |
334 | > | // } |
335 | > | // else{ |
336 | > | // strcat( simnfo->sampleName, ".dump" ); |
337 | > | // } |
338 | > | // } |
339 | > | |
340 | > | // strcpy( simnfo->statusName, inFileName ); |
341 | > | // nameLength = strlen( simnfo->statusName ); |
342 | > | // endTest = &(simnfo->statusName[nameLength - 5]); |
343 | > | // if( !strcmp( endTest, ".bass" ) ){ |
344 | > | // strcpy( endTest, ".stat" ); |
345 | > | // } |
346 | > | // else if( !strcmp( endTest, ".BASS" ) ){ |
347 | > | // strcpy( endTest, ".stat" ); |
348 | > | // } |
349 | > | // else{ |
350 | > | // endTest = &(simnfo->statusName[nameLength - 4]); |
351 | > | // if( !strcmp( endTest, ".bss" ) ){ |
352 | > | // strcpy( endTest, ".stat" ); |
353 | > | // } |
354 | > | // else if( !strcmp( endTest, ".mdl" ) ){ |
355 | > | // strcpy( endTest, ".stat" ); |
356 | > | // } |
357 | > | // else{ |
358 | > | // strcat( simnfo->statusName, ".stat" ); |
359 | > | // } |
360 | > | // } |
361 | > | |
362 | > | |
363 | // set the status, sample, and themal kick times | |
364 | ||
365 | if( the_globals->haveSampleTime() ){ | |
366 | < | simnfo->sampleTime = the_globals->getSampleTime(); |
366 | > | simnfo->sampleTime = the_globals->getSampleTime(); |
367 | simnfo->statusTime = simnfo->sampleTime; | |
368 | simnfo->thermalTime = simnfo->sampleTime; | |
369 | } | |
370 | else{ | |
371 | < | simnfo->sampleTime = the_globals->getRunTime(); |
371 | > | simnfo->sampleTime = the_globals->getRunTime(); |
372 | simnfo->statusTime = simnfo->sampleTime; | |
373 | simnfo->thermalTime = simnfo->sampleTime; | |
374 | } | |
# | Line 326 | Line 384 | void SimSetup::createSim( void ){ | |
384 | // check for the temperature set flag | |
385 | ||
386 | if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); | |
387 | < | |
388 | < | |
387 | > | |
388 | > | |
389 | // make the longe range forces and the integrator | |
390 | < | |
390 | > | |
391 | new AllLong( simnfo ); | |
392 | < | |
392 | > | |
393 | if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo ); | |
394 | if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo ); | |
395 | if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo ); | |
396 | } | |
397 | ||
398 | void SimSetup::makeAtoms( void ){ | |
399 | < | |
399 | > | |
400 | int i, j, k, index; | |
401 | double ux, uy, uz, uSqr, u; | |
402 | AtomStamp* current_atom; | |
403 | DirectionalAtom* dAtom; | |
404 | int molIndex, molStart, molEnd, nMemb; | |
347 | – | |
405 | ||
406 | + | |
407 | molIndex = 0; | |
408 | index = 0; | |
409 | for( i=0; i<n_components; i++ ){ | |
410 | < | |
410 | > | |
411 | for( j=0; j<components_nmol[i]; j++ ){ | |
412 | < | |
412 | > | |
413 | molStart = index; | |
414 | nMemb = comp_stamps[i]->getNAtoms(); | |
415 | for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ | |
416 | < | |
416 | > | |
417 | current_atom = comp_stamps[i]->getAtom( k ); | |
418 | < | if( current_atom->haveOrientation() ){ |
418 | > | if( current_atom->haveOrientation() ){ |
419 | ||
420 | < | dAtom = new DirectionalAtom; |
420 | > | dAtom = new DirectionalAtom(index); |
421 | simnfo->n_oriented++; | |
422 | the_atoms[index] = dAtom; | |
423 | < | |
423 | > | |
424 | ux = current_atom->getOrntX(); | |
425 | uy = current_atom->getOrntY(); | |
426 | uz = current_atom->getOrntZ(); | |
427 | < | |
427 | > | |
428 | uSqr = (ux * ux) + (uy * uy) + (uz * uz); | |
429 | < | |
429 | > | |
430 | u = sqrt( uSqr ); | |
431 | ux = ux / u; | |
432 | uy = uy / u; | |
433 | uz = uz / u; | |
434 | < | |
434 | > | |
435 | dAtom->setSUx( ux ); | |
436 | dAtom->setSUy( uy ); | |
437 | dAtom->setSUz( uz ); | |
438 | } | |
439 | else{ | |
440 | < | the_atoms[index] = new GeneralAtom; |
440 | > | the_atoms[index] = new GeneralAtom(index); |
441 | } | |
442 | the_atoms[index]->setType( current_atom->getType() ); | |
443 | the_atoms[index]->setIndex( index ); | |
444 | < | |
444 | > | |
445 | // increment the index and repeat; | |
446 | index++; | |
447 | } | |
448 | < | |
448 | > | |
449 | molEnd = index -1; | |
450 | the_molecules[molIndex].setNMembers( nMemb ); | |
451 | the_molecules[molIndex].setStartAtom( molStart ); | |
# | Line 396 | Line 454 | void SimSetup::makeAtoms( void ){ | |
454 | ||
455 | } | |
456 | } | |
457 | < | |
457 | > | |
458 | the_ff->initializeAtoms(); | |
459 | } | |
460 | ||
# | Line 410 | Line 468 | void SimSetup::makeBonds( void ){ | |
468 | index = 0; | |
469 | offset = 0; | |
470 | for( i=0; i<n_components; i++ ){ | |
471 | < | |
471 | > | |
472 | for( j=0; j<components_nmol[i]; j++ ){ | |
473 | < | |
473 | > | |
474 | for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ | |
475 | < | |
475 | > | |
476 | current_bond = comp_stamps[i]->getBond( k ); | |
477 | the_bonds[index].a = current_bond->getA() + offset; | |
478 | the_bonds[index].b = current_bond->getB() + offset; | |
# | Line 428 | Line 486 | void SimSetup::makeBonds( void ){ | |
486 | offset += comp_stamps[i]->getNAtoms(); | |
487 | } | |
488 | } | |
489 | < | |
489 | > | |
490 | the_ff->initializeBonds( the_bonds ); | |
491 | } | |
492 | ||
# | Line 442 | Line 500 | void SimSetup::makeBends( void ){ | |
500 | index = 0; | |
501 | offset = 0; | |
502 | for( i=0; i<n_components; i++ ){ | |
503 | < | |
503 | > | |
504 | for( j=0; j<components_nmol[i]; j++ ){ | |
505 | < | |
505 | > | |
506 | for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ | |
507 | < | |
507 | > | |
508 | current_bend = comp_stamps[i]->getBend( k ); | |
509 | the_bends[index].a = current_bend->getA() + offset; | |
510 | the_bends[index].b = current_bend->getB() + offset; | |
# | Line 461 | Line 519 | void SimSetup::makeBends( void ){ | |
519 | offset += comp_stamps[i]->getNAtoms(); | |
520 | } | |
521 | } | |
522 | < | |
522 | > | |
523 | the_ff->initializeBends( the_bends ); | |
524 | } | |
525 | ||
# | Line 475 | Line 533 | void SimSetup::makeTorsions( void ){ | |
533 | index = 0; | |
534 | offset = 0; | |
535 | for( i=0; i<n_components; i++ ){ | |
536 | < | |
536 | > | |
537 | for( j=0; j<components_nmol[i]; j++ ){ | |
538 | < | |
538 | > | |
539 | for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ | |
540 | < | |
540 | > | |
541 | current_torsion = comp_stamps[i]->getTorsion( k ); | |
542 | the_torsions[index].a = current_torsion->getA() + offset; | |
543 | the_torsions[index].b = current_torsion->getB() + offset; | |
# | Line 495 | Line 553 | void SimSetup::makeTorsions( void ){ | |
553 | offset += comp_stamps[i]->getNAtoms(); | |
554 | } | |
555 | } | |
556 | < | |
556 | > | |
557 | the_ff->initializeTorsions( the_torsions ); | |
558 | } | |
559 | ||
# | Line 536 | Line 594 | void SimSetup::initFromBass( void ){ | |
594 | celly = simnfo->box_y / temp3; | |
595 | cellz = simnfo->box_z / temp3; | |
596 | } | |
597 | < | |
597 | > | |
598 | current_mol = 0; | |
599 | current_comp_mol = 0; | |
600 | current_comp = 0; | |
601 | current_atom_ndx = 0; | |
602 | < | |
602 | > | |
603 | for( i=0; i < n_cells ; i++ ){ | |
604 | for( j=0; j < n_cells; j++ ){ | |
605 | for( k=0; k < n_cells; k++ ){ | |
606 | < | |
606 | > | |
607 | makeElement( i * cellx, | |
608 | j * celly, | |
609 | k * cellz ); | |
610 | < | |
610 | > | |
611 | makeElement( i * cellx + 0.5 * cellx, | |
612 | j * celly + 0.5 * celly, | |
613 | k * cellz ); | |
614 | < | |
614 | > | |
615 | makeElement( i * cellx, | |
616 | j * celly + 0.5 * celly, | |
617 | k * cellz + 0.5 * cellz ); | |
618 | < | |
618 | > | |
619 | makeElement( i * cellx + 0.5 * cellx, | |
620 | j * celly, | |
621 | k * cellz + 0.5 * cellz ); | |
# | Line 567 | Line 625 | void SimSetup::initFromBass( void ){ | |
625 | ||
626 | if( have_extra ){ | |
627 | done = 0; | |
628 | < | |
628 | > | |
629 | int start_ndx; | |
630 | for( i=0; i < (n_cells+1) && !done; i++ ){ | |
631 | for( j=0; j < (n_cells+1) && !done; j++ ){ | |
632 | < | |
632 | > | |
633 | if( i < n_cells ){ | |
634 | < | |
634 | > | |
635 | if( j < n_cells ){ | |
636 | start_ndx = n_cells; | |
637 | } | |
638 | else start_ndx = 0; | |
639 | } | |
640 | else start_ndx = 0; | |
641 | < | |
641 | > | |
642 | for( k=start_ndx; k < (n_cells+1) && !done; k++ ){ | |
643 | < | |
643 | > | |
644 | makeElement( i * cellx, | |
645 | j * celly, | |
646 | k * cellz ); | |
647 | done = ( current_mol >= tot_nmol ); | |
648 | < | |
648 | > | |
649 | if( !done && n_per_extra > 1 ){ | |
650 | makeElement( i * cellx + 0.5 * cellx, | |
651 | j * celly + 0.5 * celly, | |
652 | k * cellz ); | |
653 | done = ( current_mol >= tot_nmol ); | |
654 | } | |
655 | < | |
655 | > | |
656 | if( !done && n_per_extra > 2){ | |
657 | makeElement( i * cellx, | |
658 | j * celly + 0.5 * celly, | |
659 | k * cellz + 0.5 * cellz ); | |
660 | done = ( current_mol >= tot_nmol ); | |
661 | } | |
662 | < | |
662 | > | |
663 | if( !done && n_per_extra > 3){ | |
664 | makeElement( i * cellx + 0.5 * cellx, | |
665 | j * celly, | |
# | Line 612 | Line 670 | void SimSetup::initFromBass( void ){ | |
670 | } | |
671 | } | |
672 | } | |
673 | < | |
674 | < | |
673 | > | |
674 | > | |
675 | for( i=0; i<simnfo->n_atoms; i++ ){ | |
676 | simnfo->atoms[i]->set_vx( 0.0 ); | |
677 | simnfo->atoms[i]->set_vy( 0.0 ); | |
# | Line 629 | Line 687 | void SimSetup::makeElement( double x, double y, double | |
687 | double rotMat[3][3]; | |
688 | ||
689 | for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ | |
690 | < | |
690 | > | |
691 | current_atom = comp_stamps[current_comp]->getAtom( k ); | |
692 | if( !current_atom->havePosition() ){ | |
693 | std::cerr << "Component " << comp_stamps[current_comp]->getID() | |
# | Line 639 | Line 697 | void SimSetup::makeElement( double x, double y, double | |
697 | << " position.\n"; | |
698 | exit(8); | |
699 | } | |
700 | < | |
700 | > | |
701 | the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); | |
702 | the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() ); | |
703 | the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() ); | |
704 | < | |
704 | > | |
705 | if( the_atoms[current_atom_ndx]->isDirectional() ){ | |
706 | < | |
706 | > | |
707 | dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx]; | |
708 | < | |
708 | > | |
709 | rotMat[0][0] = 1.0; | |
710 | rotMat[0][1] = 0.0; | |
711 | rotMat[0][2] = 0.0; | |
# | Line 665 | Line 723 | void SimSetup::makeElement( double x, double y, double | |
723 | ||
724 | current_atom_ndx++; | |
725 | } | |
726 | < | |
726 | > | |
727 | current_mol++; | |
728 | current_comp_mol++; | |
729 | ||
730 | if( current_comp_mol >= components_nmol[current_comp] ){ | |
731 | < | |
731 | > | |
732 | current_comp_mol = 0; | |
733 | current_comp++; | |
734 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |