ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/interface_implementation/SimSetup.cpp
Revision: 144
Committed: Thu Oct 17 21:59:12 2002 UTC (21 years, 11 months ago) by mmeineke
File size: 17124 byte(s)
Log Message:

Changing internal storage of positions, torqes, forces, velocities, etc.

not sure here, still working

File Contents

# User Rev Content
1 mmeineke 10 #include <cstdlib>
2     #include <iostream>
3     #include <cmath>
4    
5     #include "SimSetup.hpp"
6     #include "parse_me.h"
7     #include "LRI.hpp"
8     #include "Integrator.hpp"
9 mmeineke 144
10 chuckv 131 #ifdef IS_MPI
11 chuckv 139 #include "mpiBASS.h"
12 chuckv 131 #include "bassDiag.hpp"
13     #endif
14 mmeineke 10
15     SimSetup::SimSetup(){
16     stamps = new MakeStamps();
17     globals = new Globals();
18     }
19    
20     SimSetup::~SimSetup(){
21     delete stamps;
22     delete globals;
23     }
24    
25     void SimSetup::parseFile( char* fileName ){
26    
27     inFileName = fileName;
28     set_interface_stamps( stamps, globals );
29 chuckv 131 #ifdef IS_MPI
30 chuckv 124 mpiEventInit();
31     #endif
32 mmeineke 10 yacc_BASS( fileName );
33 chuckv 131 #ifdef IS_MPI
34 chuckv 124 throwMPIEvent(NULL);
35     #endif
36    
37 mmeineke 10 }
38    
39 chuckv 131 #ifdef IS_MPI
40 chuckv 124 void SimSetup::receiveParse(void){
41    
42     set_interface_stamps( stamps, globals );
43     mpiEventInit();
44     mpiEventLoop();
45    
46     }
47    
48 chuckv 131
49 chuckv 128 void SimSetup::testMe(void){
50     bassDiag* dumpMe = new bassDiag(globals,stamps);
51     dumpMe->dumpStamps();
52     delete dumpMe;
53     }
54 chuckv 131 #endif
55 mmeineke 10 void SimSetup::createSim( void ){
56    
57     MakeStamps *the_stamps;
58     Globals* the_globals;
59     int i;
60    
61     // get the stamps and globals;
62     the_stamps = stamps;
63     the_globals = globals;
64    
65     // set the easy ones first
66     simnfo->target_temp = the_globals->getTargetTemp();
67     simnfo->dt = the_globals->getDt();
68     simnfo->run_time = the_globals->getRunTime();
69    
70     // get the ones we know are there, yet still may need some work.
71     n_components = the_globals->getNComponents();
72     strcpy( force_field, the_globals->getForceField() );
73     strcpy( ensemble, the_globals->getEnsemble() );
74 chuckv 124
75 mmeineke 10 if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF();
76     else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF();
77     else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
78     else{
79 chuckv 124 std::cerr<< "SimSetup Error. Unrecognized force field -> "
80 mmeineke 10 << force_field << "\n";
81     exit(8);
82     }
83    
84     // get the components and calculate the tot_nMol and indvidual n_mol
85     the_components = the_globals->getComponents();
86     components_nmol = new int[n_components];
87     comp_stamps = new MoleculeStamp*[n_components];
88 chuckv 124
89 mmeineke 10 if( !the_globals->haveNMol() ){
90 chuckv 124 // we don't have the total number of molecules, so we assume it is
91 mmeineke 10 // given in each component
92    
93     tot_nmol = 0;
94     for( i=0; i<n_components; i++ ){
95 chuckv 124
96 mmeineke 10 if( !the_components[i]->haveNMol() ){
97     // we have a problem
98     std::cerr << "SimSetup Error. No global NMol or component NMol"
99     << " given. Cannot calculate the number of atoms.\n";
100     exit( 8 );
101     }
102    
103     tot_nmol += the_components[i]->getNMol();
104     components_nmol[i] = the_components[i]->getNMol();
105     }
106     }
107     else{
108     std::cerr << "NOT A SUPPORTED FEATURE\n";
109 chuckv 124
110 mmeineke 10 // tot_nmol = the_globals->getNMol();
111 chuckv 124
112 mmeineke 10 // //we have the total number of molecules, now we check for molfractions
113     // for( i=0; i<n_components; i++ ){
114 chuckv 124
115 mmeineke 10 // if( !the_components[i]->haveMolFraction() ){
116 chuckv 124
117 mmeineke 10 // if( !the_components[i]->haveNMol() ){
118     // //we have a problem
119     // std::cerr << "SimSetup error. Neither molFraction nor "
120     // << " nMol was given in component
121    
122     }
123    
124     // make an array of molecule stamps that match the components used.
125    
126     for( i=0; i<n_components; i++ ){
127    
128 chuckv 124 comp_stamps[i] =
129 mmeineke 10 the_stamps->getMolecule( the_components[i]->getType() );
130     }
131    
132    
133 chuckv 124
134 mmeineke 10 // caclulate the number of atoms, bonds, bends and torsions
135    
136     tot_atoms = 0;
137     tot_bonds = 0;
138     tot_bends = 0;
139     tot_torsions = 0;
140     for( i=0; i<n_components; i++ ){
141 chuckv 124
142 mmeineke 10 tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms();
143     tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds();
144     tot_bends += components_nmol[i] * comp_stamps[i]->getNBends();
145     tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions();
146     }
147 chuckv 124
148 mmeineke 10 tot_SRI = tot_bonds + tot_bends + tot_torsions;
149 chuckv 124
150 mmeineke 10 simnfo->n_atoms = tot_atoms;
151     simnfo->n_bonds = tot_bonds;
152     simnfo->n_bends = tot_bends;
153     simnfo->n_torsions = tot_torsions;
154     simnfo->n_SRI = tot_SRI;
155    
156     // create the atom and short range interaction arrays
157 chuckv 124
158 mmeineke 10 the_atoms = new Atom*[tot_atoms];
159 mmeineke 113 the_molecules = new Molecule[tot_nmol];
160 chuckv 124
161    
162 mmeineke 10 if( tot_SRI ){
163     the_sris = new SRI*[tot_SRI];
164     the_excludes = new ex_pair[tot_SRI];
165     }
166    
167     // set the arrays into the SimInfo object
168    
169     simnfo->atoms = the_atoms;
170     simnfo->sr_interactions = the_sris;
171     simnfo->n_exclude = tot_SRI;
172     simnfo->excludes = the_excludes;
173    
174 chuckv 124
175 mmeineke 10 // initialize the arrays
176 chuckv 124
177 mmeineke 10 the_ff->setSimInfo( simnfo );
178 chuckv 124
179 mmeineke 10 makeAtoms();
180    
181     if( tot_bonds ){
182     makeBonds();
183     }
184    
185     if( tot_bends ){
186     makeBends();
187     }
188    
189     if( tot_torsions ){
190     makeTorsions();
191     }
192    
193     // makeMolecules();
194    
195     // get some of the tricky things that may still be in the globals
196    
197     if( simnfo->n_dipoles ){
198    
199     if( !the_globals->haveRRF() ){
200     std::cerr << "SimSetup Error, system has dipoles, but no rRF was set.\n";
201     exit(8);
202     }
203     if( !the_globals->haveDielectric() ){
204     std::cerr << "SimSetup Error, system has dipoles, but no"
205     << " dielectric was set.\n";
206     exit(8);
207     }
208    
209     simnfo->rRF = the_globals->getRRF();
210     simnfo->dielectric = the_globals->getDielectric();
211     }
212    
213     if( the_globals->haveBox() ){
214     simnfo->box_x = the_globals->getBox();
215     simnfo->box_y = the_globals->getBox();
216     simnfo->box_z = the_globals->getBox();
217     }
218     else if( the_globals->haveDensity() ){
219 chuckv 124
220 mmeineke 10 double vol;
221     vol = (double)tot_nmol / the_globals->getDensity();
222     simnfo->box_x = pow( vol, ( 1.0 / 3.0 ) );
223     simnfo->box_y = simnfo->box_x;
224     simnfo->box_z = simnfo->box_x;
225     }
226     else{
227     if( !the_globals->haveBoxX() ){
228     std::cerr << "SimSetup error, no periodic BoxX size given.\n";
229     exit(8);
230     }
231     simnfo->box_x = the_globals->getBoxX();
232    
233     if( !the_globals->haveBoxY() ){
234     std::cerr << "SimSetup error, no periodic BoxY size given.\n";
235     exit(8);
236     }
237     simnfo->box_y = the_globals->getBoxY();
238    
239     if( !the_globals->haveBoxZ() ){
240     std::cerr << "SimSetup error, no periodic BoxZ size given.\n";
241     exit(8);
242     }
243     simnfo->box_z = the_globals->getBoxZ();
244     }
245    
246 chuckv 124
247     // if( the_globals->haveInitialConfig() ){
248     // InitializeFromFile* fileInit;
249     // fileInit = new InitializeFromFile( the_globals->getInitialConfig() );
250    
251     // fileInit->read_xyz( simnfo ); // default velocities on
252    
253     // delete fileInit;
254     // }
255     // else{
256    
257 mmeineke 10 initFromBass();
258    
259    
260 chuckv 124 // }
261    
262     // if( the_globals->haveFinalConfig() ){
263     // strcpy( simnfo->finalName, the_globals->getFinalConfig() );
264     // }
265     // else{
266     // strcpy( simnfo->finalName, inFileName );
267     // char* endTest;
268     // int nameLength = strlen( simnfo->finalName );
269     // endTest = &(simnfo->finalName[nameLength - 5]);
270     // if( !strcmp( endTest, ".bass" ) ){
271     // strcpy( endTest, ".eor" );
272     // }
273     // else if( !strcmp( endTest, ".BASS" ) ){
274     // strcpy( endTest, ".eor" );
275     // }
276     // else{
277     // endTest = &(simnfo->finalName[nameLength - 4]);
278     // if( !strcmp( endTest, ".bss" ) ){
279     // strcpy( endTest, ".eor" );
280     // }
281     // else if( !strcmp( endTest, ".mdl" ) ){
282     // strcpy( endTest, ".eor" );
283     // }
284     // else{
285     // strcat( simnfo->finalName, ".eor" );
286     // }
287     // }
288     // }
289    
290     // // make the sample and status out names
291    
292     // strcpy( simnfo->sampleName, inFileName );
293     // char* endTest;
294     // int nameLength = strlen( simnfo->sampleName );
295     // endTest = &(simnfo->sampleName[nameLength - 5]);
296     // if( !strcmp( endTest, ".bass" ) ){
297     // strcpy( endTest, ".dump" );
298     // }
299     // else if( !strcmp( endTest, ".BASS" ) ){
300     // strcpy( endTest, ".dump" );
301     // }
302     // else{
303     // endTest = &(simnfo->sampleName[nameLength - 4]);
304     // if( !strcmp( endTest, ".bss" ) ){
305     // strcpy( endTest, ".dump" );
306     // }
307     // else if( !strcmp( endTest, ".mdl" ) ){
308     // strcpy( endTest, ".dump" );
309     // }
310     // else{
311     // strcat( simnfo->sampleName, ".dump" );
312     // }
313     // }
314    
315     // strcpy( simnfo->statusName, inFileName );
316     // nameLength = strlen( simnfo->statusName );
317     // endTest = &(simnfo->statusName[nameLength - 5]);
318     // if( !strcmp( endTest, ".bass" ) ){
319     // strcpy( endTest, ".stat" );
320     // }
321     // else if( !strcmp( endTest, ".BASS" ) ){
322     // strcpy( endTest, ".stat" );
323     // }
324     // else{
325     // endTest = &(simnfo->statusName[nameLength - 4]);
326     // if( !strcmp( endTest, ".bss" ) ){
327     // strcpy( endTest, ".stat" );
328     // }
329     // else if( !strcmp( endTest, ".mdl" ) ){
330     // strcpy( endTest, ".stat" );
331     // }
332     // else{
333     // strcat( simnfo->statusName, ".stat" );
334     // }
335     // }
336    
337    
338 mmeineke 10 // set the status, sample, and themal kick times
339    
340     if( the_globals->haveSampleTime() ){
341 chuckv 124 simnfo->sampleTime = the_globals->getSampleTime();
342 mmeineke 10 simnfo->statusTime = simnfo->sampleTime;
343     simnfo->thermalTime = simnfo->sampleTime;
344     }
345     else{
346 chuckv 124 simnfo->sampleTime = the_globals->getRunTime();
347 mmeineke 10 simnfo->statusTime = simnfo->sampleTime;
348     simnfo->thermalTime = simnfo->sampleTime;
349     }
350    
351     if( the_globals->haveStatusTime() ){
352     simnfo->statusTime = the_globals->getStatusTime();
353     }
354    
355     if( the_globals->haveThermalTime() ){
356     simnfo->thermalTime = the_globals->getThermalTime();
357     }
358    
359     // check for the temperature set flag
360    
361     if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet();
362 chuckv 124
363    
364 mmeineke 10 // make the longe range forces and the integrator
365 chuckv 124
366 mmeineke 10 new AllLong( simnfo );
367 chuckv 124
368 mmeineke 10 if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo );
369     if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo );
370     if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo );
371     }
372    
373     void SimSetup::makeAtoms( void ){
374 chuckv 124
375 mmeineke 10 int i, j, k, index;
376     double ux, uy, uz, uSqr, u;
377     AtomStamp* current_atom;
378     DirectionalAtom* dAtom;
379 mmeineke 117 int molIndex, molStart, molEnd, nMemb;
380 mmeineke 10
381 chuckv 124
382 mmeineke 117 molIndex = 0;
383 mmeineke 10 index = 0;
384     for( i=0; i<n_components; i++ ){
385 chuckv 124
386 mmeineke 10 for( j=0; j<components_nmol[i]; j++ ){
387 chuckv 124
388 mmeineke 117 molStart = index;
389     nMemb = comp_stamps[i]->getNAtoms();
390 mmeineke 10 for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){
391 chuckv 124
392 mmeineke 10 current_atom = comp_stamps[i]->getAtom( k );
393 chuckv 124 if( current_atom->haveOrientation() ){
394 mmeineke 10
395     dAtom = new DirectionalAtom;
396     simnfo->n_oriented++;
397     the_atoms[index] = dAtom;
398 chuckv 124
399 mmeineke 10 ux = current_atom->getOrntX();
400     uy = current_atom->getOrntY();
401     uz = current_atom->getOrntZ();
402 chuckv 124
403 mmeineke 10 uSqr = (ux * ux) + (uy * uy) + (uz * uz);
404 chuckv 124
405 mmeineke 10 u = sqrt( uSqr );
406     ux = ux / u;
407     uy = uy / u;
408     uz = uz / u;
409 chuckv 124
410 mmeineke 10 dAtom->setSUx( ux );
411     dAtom->setSUy( uy );
412     dAtom->setSUz( uz );
413     }
414     else{
415     the_atoms[index] = new GeneralAtom;
416     }
417     the_atoms[index]->setType( current_atom->getType() );
418     the_atoms[index]->setIndex( index );
419 chuckv 124
420 mmeineke 10 // increment the index and repeat;
421     index++;
422     }
423 chuckv 124
424 mmeineke 117 molEnd = index -1;
425     the_molecules[molIndex].setNMembers( nMemb );
426     the_molecules[molIndex].setStartAtom( molStart );
427     the_molecules[molIndex].setEndAtom( molEnd );
428     molIndex++;
429    
430 mmeineke 10 }
431     }
432 chuckv 124
433 mmeineke 10 the_ff->initializeAtoms();
434     }
435    
436     void SimSetup::makeBonds( void ){
437    
438     int i, j, k, index, offset;
439     bond_pair* the_bonds;
440     BondStamp* current_bond;
441    
442     the_bonds = new bond_pair[tot_bonds];
443     index = 0;
444     offset = 0;
445     for( i=0; i<n_components; i++ ){
446 chuckv 124
447 mmeineke 10 for( j=0; j<components_nmol[i]; j++ ){
448 chuckv 124
449 mmeineke 10 for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){
450 chuckv 124
451 mmeineke 10 current_bond = comp_stamps[i]->getBond( k );
452     the_bonds[index].a = current_bond->getA() + offset;
453     the_bonds[index].b = current_bond->getB() + offset;
454    
455     the_excludes[index].i = the_bonds[index].a;
456     the_excludes[index].j = the_bonds[index].b;
457    
458     // increment the index and repeat;
459     index++;
460     }
461     offset += comp_stamps[i]->getNAtoms();
462     }
463     }
464 chuckv 124
465 mmeineke 10 the_ff->initializeBonds( the_bonds );
466     }
467    
468     void SimSetup::makeBends( void ){
469    
470     int i, j, k, index, offset;
471     bend_set* the_bends;
472     BendStamp* current_bend;
473    
474     the_bends = new bend_set[tot_bends];
475     index = 0;
476     offset = 0;
477     for( i=0; i<n_components; i++ ){
478 chuckv 124
479 mmeineke 10 for( j=0; j<components_nmol[i]; j++ ){
480 chuckv 124
481 mmeineke 10 for( k=0; k<comp_stamps[i]->getNBends(); k++ ){
482 chuckv 124
483 mmeineke 10 current_bend = comp_stamps[i]->getBend( k );
484     the_bends[index].a = current_bend->getA() + offset;
485     the_bends[index].b = current_bend->getB() + offset;
486     the_bends[index].c = current_bend->getC() + offset;
487    
488     the_excludes[index + tot_bonds].i = the_bends[index].a;
489     the_excludes[index + tot_bonds].j = the_bends[index].c;
490    
491     // increment the index and repeat;
492     index++;
493     }
494     offset += comp_stamps[i]->getNAtoms();
495     }
496     }
497 chuckv 124
498 mmeineke 10 the_ff->initializeBends( the_bends );
499     }
500    
501     void SimSetup::makeTorsions( void ){
502    
503     int i, j, k, index, offset;
504     torsion_set* the_torsions;
505     TorsionStamp* current_torsion;
506    
507     the_torsions = new torsion_set[tot_torsions];
508     index = 0;
509     offset = 0;
510     for( i=0; i<n_components; i++ ){
511 chuckv 124
512 mmeineke 10 for( j=0; j<components_nmol[i]; j++ ){
513 chuckv 124
514 mmeineke 10 for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){
515 chuckv 124
516 mmeineke 10 current_torsion = comp_stamps[i]->getTorsion( k );
517     the_torsions[index].a = current_torsion->getA() + offset;
518     the_torsions[index].b = current_torsion->getB() + offset;
519     the_torsions[index].c = current_torsion->getC() + offset;
520     the_torsions[index].d = current_torsion->getD() + offset;
521    
522     the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a;
523     the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d;
524    
525     // increment the index and repeat;
526     index++;
527     }
528     offset += comp_stamps[i]->getNAtoms();
529     }
530     }
531 chuckv 124
532 mmeineke 10 the_ff->initializeTorsions( the_torsions );
533     }
534    
535     void SimSetup::initFromBass( void ){
536    
537     int i, j, k;
538     int n_cells;
539     double cellx, celly, cellz;
540     double temp1, temp2, temp3;
541     int n_per_extra;
542     int n_extra;
543     int have_extra, done;
544    
545     temp1 = (double)tot_nmol / 4.0;
546     temp2 = pow( temp1, ( 1.0 / 3.0 ) );
547     temp3 = ceil( temp2 );
548    
549     have_extra =0;
550     if( temp2 < temp3 ){ // we have a non-complete lattice
551     have_extra =1;
552    
553     n_cells = (int)temp3 - 1;
554     cellx = simnfo->box_x / temp3;
555     celly = simnfo->box_y / temp3;
556     cellz = simnfo->box_z / temp3;
557     n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells );
558     temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) );
559     n_per_extra = (int)ceil( temp1 );
560    
561     if( n_per_extra > 4){
562     std::cerr << "THere has been an error in constructing the non-complete lattice.\n";
563     exit(8);
564     }
565     }
566     else{
567     n_cells = (int)temp3;
568     cellx = simnfo->box_x / temp3;
569     celly = simnfo->box_y / temp3;
570     cellz = simnfo->box_z / temp3;
571     }
572 chuckv 124
573 mmeineke 10 current_mol = 0;
574     current_comp_mol = 0;
575     current_comp = 0;
576     current_atom_ndx = 0;
577 chuckv 124
578 mmeineke 10 for( i=0; i < n_cells ; i++ ){
579     for( j=0; j < n_cells; j++ ){
580     for( k=0; k < n_cells; k++ ){
581 chuckv 124
582 mmeineke 10 makeElement( i * cellx,
583     j * celly,
584     k * cellz );
585 chuckv 124
586 mmeineke 10 makeElement( i * cellx + 0.5 * cellx,
587     j * celly + 0.5 * celly,
588     k * cellz );
589 chuckv 124
590 mmeineke 10 makeElement( i * cellx,
591     j * celly + 0.5 * celly,
592     k * cellz + 0.5 * cellz );
593 chuckv 124
594 mmeineke 10 makeElement( i * cellx + 0.5 * cellx,
595     j * celly,
596     k * cellz + 0.5 * cellz );
597     }
598     }
599     }
600    
601     if( have_extra ){
602     done = 0;
603 chuckv 124
604 mmeineke 10 int start_ndx;
605     for( i=0; i < (n_cells+1) && !done; i++ ){
606     for( j=0; j < (n_cells+1) && !done; j++ ){
607 chuckv 124
608 mmeineke 10 if( i < n_cells ){
609 chuckv 124
610 mmeineke 10 if( j < n_cells ){
611     start_ndx = n_cells;
612     }
613     else start_ndx = 0;
614     }
615     else start_ndx = 0;
616 chuckv 124
617 mmeineke 10 for( k=start_ndx; k < (n_cells+1) && !done; k++ ){
618 chuckv 124
619 mmeineke 10 makeElement( i * cellx,
620     j * celly,
621     k * cellz );
622     done = ( current_mol >= tot_nmol );
623 chuckv 124
624 mmeineke 10 if( !done && n_per_extra > 1 ){
625     makeElement( i * cellx + 0.5 * cellx,
626     j * celly + 0.5 * celly,
627     k * cellz );
628     done = ( current_mol >= tot_nmol );
629     }
630 chuckv 124
631 mmeineke 10 if( !done && n_per_extra > 2){
632     makeElement( i * cellx,
633     j * celly + 0.5 * celly,
634     k * cellz + 0.5 * cellz );
635     done = ( current_mol >= tot_nmol );
636     }
637 chuckv 124
638 mmeineke 10 if( !done && n_per_extra > 3){
639     makeElement( i * cellx + 0.5 * cellx,
640     j * celly,
641     k * cellz + 0.5 * cellz );
642     done = ( current_mol >= tot_nmol );
643     }
644     }
645     }
646     }
647     }
648 chuckv 124
649    
650 mmeineke 10 for( i=0; i<simnfo->n_atoms; i++ ){
651     simnfo->atoms[i]->set_vx( 0.0 );
652     simnfo->atoms[i]->set_vy( 0.0 );
653     simnfo->atoms[i]->set_vz( 0.0 );
654     }
655     }
656    
657     void SimSetup::makeElement( double x, double y, double z ){
658    
659     int k;
660     AtomStamp* current_atom;
661     DirectionalAtom* dAtom;
662     double rotMat[3][3];
663    
664     for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){
665 chuckv 124
666 mmeineke 10 current_atom = comp_stamps[current_comp]->getAtom( k );
667     if( !current_atom->havePosition() ){
668     std::cerr << "Component " << comp_stamps[current_comp]->getID()
669     << ", atom " << current_atom->getType()
670     << " does not have a position specified.\n"
671     << "The initialization routine is unable to give a start"
672     << " position.\n";
673     exit(8);
674     }
675 chuckv 124
676 mmeineke 10 the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() );
677     the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() );
678     the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() );
679 chuckv 124
680 mmeineke 10 if( the_atoms[current_atom_ndx]->isDirectional() ){
681 chuckv 124
682 mmeineke 10 dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx];
683 chuckv 124
684 mmeineke 10 rotMat[0][0] = 1.0;
685     rotMat[0][1] = 0.0;
686     rotMat[0][2] = 0.0;
687    
688     rotMat[1][0] = 0.0;
689     rotMat[1][1] = 1.0;
690     rotMat[1][2] = 0.0;
691    
692     rotMat[2][0] = 0.0;
693     rotMat[2][1] = 0.0;
694     rotMat[2][2] = 1.0;
695    
696     dAtom->setA( rotMat );
697     }
698    
699     current_atom_ndx++;
700     }
701 chuckv 124
702 mmeineke 10 current_mol++;
703     current_comp_mol++;
704    
705     if( current_comp_mol >= components_nmol[current_comp] ){
706 chuckv 124
707 mmeineke 10 current_comp_mol = 0;
708     current_comp++;
709     }
710     }