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 |
176 |
#include "simError.h" |
10 |
mmeineke |
144 |
|
11 |
chuckv |
131 |
#ifdef IS_MPI |
12 |
chuckv |
139 |
#include "mpiBASS.h" |
13 |
chuckv |
215 |
#include "mpiSimulation.hpp" |
14 |
chuckv |
131 |
#include "bassDiag.hpp" |
15 |
|
|
#endif |
16 |
mmeineke |
10 |
|
17 |
|
|
SimSetup::SimSetup(){ |
18 |
|
|
stamps = new MakeStamps(); |
19 |
|
|
globals = new Globals(); |
20 |
mmeineke |
164 |
|
21 |
|
|
#ifdef IS_MPI |
22 |
|
|
strcpy( checkPointMsg, "SimSetup creation successful" ); |
23 |
|
|
MPIcheckPoint(); |
24 |
mmeineke |
176 |
#endif // IS_MPI |
25 |
mmeineke |
10 |
} |
26 |
|
|
|
27 |
|
|
SimSetup::~SimSetup(){ |
28 |
|
|
delete stamps; |
29 |
|
|
delete globals; |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
void SimSetup::parseFile( char* fileName ){ |
33 |
|
|
|
34 |
chuckv |
131 |
#ifdef IS_MPI |
35 |
mmeineke |
164 |
if( worldRank == 0 ){ |
36 |
|
|
#endif // is_mpi |
37 |
|
|
|
38 |
|
|
inFileName = fileName; |
39 |
|
|
set_interface_stamps( stamps, globals ); |
40 |
|
|
|
41 |
|
|
#ifdef IS_MPI |
42 |
|
|
mpiEventInit(); |
43 |
chuckv |
124 |
#endif |
44 |
mmeineke |
164 |
|
45 |
|
|
yacc_BASS( fileName ); |
46 |
|
|
|
47 |
chuckv |
131 |
#ifdef IS_MPI |
48 |
mmeineke |
164 |
throwMPIEvent(NULL); |
49 |
|
|
} |
50 |
mmeineke |
176 |
else receiveParse(); |
51 |
chuckv |
124 |
#endif |
52 |
|
|
|
53 |
mmeineke |
10 |
} |
54 |
|
|
|
55 |
chuckv |
131 |
#ifdef IS_MPI |
56 |
chuckv |
124 |
void SimSetup::receiveParse(void){ |
57 |
|
|
|
58 |
|
|
set_interface_stamps( stamps, globals ); |
59 |
|
|
mpiEventInit(); |
60 |
mmeineke |
164 |
MPIcheckPoint(); |
61 |
chuckv |
124 |
mpiEventLoop(); |
62 |
|
|
|
63 |
|
|
} |
64 |
|
|
|
65 |
chuckv |
131 |
|
66 |
chuckv |
128 |
void SimSetup::testMe(void){ |
67 |
|
|
bassDiag* dumpMe = new bassDiag(globals,stamps); |
68 |
|
|
dumpMe->dumpStamps(); |
69 |
|
|
delete dumpMe; |
70 |
|
|
} |
71 |
chuckv |
131 |
#endif |
72 |
mmeineke |
176 |
|
73 |
mmeineke |
10 |
void SimSetup::createSim( void ){ |
74 |
|
|
|
75 |
|
|
MakeStamps *the_stamps; |
76 |
|
|
Globals* the_globals; |
77 |
mmeineke |
202 |
int i, j; |
78 |
mmeineke |
10 |
|
79 |
|
|
// get the stamps and globals; |
80 |
|
|
the_stamps = stamps; |
81 |
|
|
the_globals = globals; |
82 |
|
|
|
83 |
|
|
// set the easy ones first |
84 |
|
|
simnfo->target_temp = the_globals->getTargetTemp(); |
85 |
|
|
simnfo->dt = the_globals->getDt(); |
86 |
|
|
simnfo->run_time = the_globals->getRunTime(); |
87 |
|
|
|
88 |
|
|
// get the ones we know are there, yet still may need some work. |
89 |
|
|
n_components = the_globals->getNComponents(); |
90 |
|
|
strcpy( force_field, the_globals->getForceField() ); |
91 |
|
|
strcpy( ensemble, the_globals->getEnsemble() ); |
92 |
chuckv |
124 |
|
93 |
mmeineke |
10 |
if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF(); |
94 |
|
|
else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); |
95 |
|
|
else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); |
96 |
chuckv |
215 |
else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); |
97 |
mmeineke |
10 |
else{ |
98 |
mmeineke |
176 |
sprintf( painCave.errMsg, |
99 |
|
|
"SimSetup Error. Unrecognized force field -> %s\n", |
100 |
|
|
force_field ); |
101 |
|
|
painCave.isFatal = 1; |
102 |
|
|
simError(); |
103 |
mmeineke |
10 |
} |
104 |
|
|
|
105 |
mmeineke |
176 |
#ifdef IS_MPI |
106 |
|
|
strcpy( checkPointMsg, "ForceField creation successful" ); |
107 |
|
|
MPIcheckPoint(); |
108 |
|
|
#endif // is_mpi |
109 |
|
|
|
110 |
mmeineke |
10 |
// get the components and calculate the tot_nMol and indvidual n_mol |
111 |
|
|
the_components = the_globals->getComponents(); |
112 |
|
|
components_nmol = new int[n_components]; |
113 |
|
|
comp_stamps = new MoleculeStamp*[n_components]; |
114 |
chuckv |
124 |
|
115 |
mmeineke |
10 |
if( !the_globals->haveNMol() ){ |
116 |
chuckv |
124 |
// we don't have the total number of molecules, so we assume it is |
117 |
mmeineke |
10 |
// given in each component |
118 |
|
|
|
119 |
|
|
tot_nmol = 0; |
120 |
|
|
for( i=0; i<n_components; i++ ){ |
121 |
chuckv |
124 |
|
122 |
mmeineke |
10 |
if( !the_components[i]->haveNMol() ){ |
123 |
|
|
// we have a problem |
124 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
125 |
|
|
"SimSetup Error. No global NMol or component NMol" |
126 |
|
|
" given. Cannot calculate the number of atoms.\n" ); |
127 |
|
|
painCave.isFatal = 1; |
128 |
|
|
simError(); |
129 |
mmeineke |
10 |
} |
130 |
|
|
|
131 |
|
|
tot_nmol += the_components[i]->getNMol(); |
132 |
|
|
components_nmol[i] = the_components[i]->getNMol(); |
133 |
|
|
} |
134 |
|
|
} |
135 |
|
|
else{ |
136 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
137 |
|
|
"SimSetup error.\n" |
138 |
|
|
"\tSorry, the ability to specify total" |
139 |
|
|
" nMols and then give molfractions in the components\n" |
140 |
|
|
"\tis not currently supported." |
141 |
|
|
" Please give nMol in the components.\n" ); |
142 |
|
|
painCave.isFatal = 1; |
143 |
|
|
simError(); |
144 |
|
|
|
145 |
|
|
|
146 |
|
|
// tot_nmol = the_globals->getNMol(); |
147 |
|
|
|
148 |
|
|
// //we have the total number of molecules, now we check for molfractions |
149 |
|
|
// for( i=0; i<n_components; i++ ){ |
150 |
|
|
|
151 |
|
|
// if( !the_components[i]->haveMolFraction() ){ |
152 |
|
|
|
153 |
|
|
// if( !the_components[i]->haveNMol() ){ |
154 |
|
|
// //we have a problem |
155 |
|
|
// std::cerr << "SimSetup error. Neither molFraction nor " |
156 |
|
|
// << " nMol was given in component |
157 |
|
|
|
158 |
|
|
} |
159 |
chuckv |
124 |
|
160 |
mmeineke |
189 |
#ifdef IS_MPI |
161 |
|
|
strcpy( checkPointMsg, "Have the number of components" ); |
162 |
|
|
MPIcheckPoint(); |
163 |
|
|
#endif // is_mpi |
164 |
chuckv |
124 |
|
165 |
mmeineke |
10 |
// make an array of molecule stamps that match the components used. |
166 |
mmeineke |
198 |
// also extract the used stamps out into a separate linked list |
167 |
mmeineke |
10 |
|
168 |
mmeineke |
198 |
simnfo->nComponents = n_components; |
169 |
|
|
simnfo->componentsNmol = components_nmol; |
170 |
|
|
simnfo->compStamps = comp_stamps; |
171 |
|
|
simnfo->headStamp = new LinkedMolStamp(); |
172 |
|
|
|
173 |
|
|
char* id; |
174 |
|
|
LinkedMolStamp* headStamp = simnfo->headStamp; |
175 |
|
|
LinkedMolStamp* currentStamp = NULL; |
176 |
mmeineke |
10 |
for( i=0; i<n_components; i++ ){ |
177 |
|
|
|
178 |
mmeineke |
198 |
id = the_components[i]->getType(); |
179 |
|
|
comp_stamps[i] = NULL; |
180 |
|
|
|
181 |
|
|
// check to make sure the component isn't already in the list |
182 |
|
|
|
183 |
|
|
comp_stamps[i] = headStamp->match( id ); |
184 |
|
|
if( comp_stamps[i] == NULL ){ |
185 |
|
|
|
186 |
|
|
// extract the component from the list; |
187 |
|
|
|
188 |
|
|
currentStamp = the_stamps->extractMolStamp( id ); |
189 |
|
|
if( currentStamp == NULL ){ |
190 |
|
|
sprintf( painCave.errMsg, |
191 |
|
|
"SimSetup error: Component \"%s\" was not found in the " |
192 |
|
|
"list of declared molecules\n" |
193 |
|
|
id ); |
194 |
|
|
painCave.isFatal = 1; |
195 |
|
|
simError(); |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
headStamp->add( currentStamp ); |
199 |
|
|
comp_stamps[i] = headStamp->match( id ); |
200 |
|
|
} |
201 |
mmeineke |
10 |
} |
202 |
|
|
|
203 |
mmeineke |
198 |
#ifdef IS_MPI |
204 |
|
|
strcpy( checkPointMsg, "Component stamps successfully extracted\n" ); |
205 |
|
|
MPIcheckPoint(); |
206 |
|
|
#endif // is_mpi |
207 |
|
|
|
208 |
mmeineke |
10 |
|
209 |
chuckv |
124 |
|
210 |
mmeineke |
198 |
|
211 |
mmeineke |
10 |
// caclulate the number of atoms, bonds, bends and torsions |
212 |
|
|
|
213 |
|
|
tot_atoms = 0; |
214 |
|
|
tot_bonds = 0; |
215 |
|
|
tot_bends = 0; |
216 |
|
|
tot_torsions = 0; |
217 |
|
|
for( i=0; i<n_components; i++ ){ |
218 |
mmeineke |
202 |
|
219 |
|
|
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
220 |
|
|
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
221 |
|
|
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
222 |
mmeineke |
10 |
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
223 |
|
|
} |
224 |
chuckv |
124 |
|
225 |
mmeineke |
10 |
tot_SRI = tot_bonds + tot_bends + tot_torsions; |
226 |
chuckv |
124 |
|
227 |
mmeineke |
10 |
simnfo->n_atoms = tot_atoms; |
228 |
|
|
simnfo->n_bonds = tot_bonds; |
229 |
|
|
simnfo->n_bends = tot_bends; |
230 |
|
|
simnfo->n_torsions = tot_torsions; |
231 |
|
|
simnfo->n_SRI = tot_SRI; |
232 |
chuckv |
195 |
simnfo->n_mol = tot_nmol; |
233 |
mmeineke |
10 |
|
234 |
chuckv |
195 |
|
235 |
|
|
#ifdef IS_MPI |
236 |
|
|
|
237 |
chuckv |
194 |
// divide the molecules among processors here. |
238 |
chuckv |
195 |
|
239 |
chuckv |
215 |
mpiSim = new mpiSimulation( simnfo ); |
240 |
chuckv |
195 |
|
241 |
mmeineke |
202 |
mpiSim->divideLabor(); |
242 |
chuckv |
194 |
|
243 |
mmeineke |
202 |
// set up the local variables |
244 |
|
|
|
245 |
mmeineke |
205 |
int localMol, allMol; |
246 |
mmeineke |
202 |
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
247 |
|
|
|
248 |
mmeineke |
205 |
allMol = 0; |
249 |
mmeineke |
202 |
localMol = 0; |
250 |
|
|
local_atoms = 0; |
251 |
|
|
local_bonds = 0; |
252 |
|
|
local_bends = 0; |
253 |
|
|
local_torsions = 0; |
254 |
|
|
for( i=0; i<n_components; i++ ){ |
255 |
|
|
|
256 |
|
|
for( j=0; j<components_nmol[i]; j++ ){ |
257 |
|
|
|
258 |
mmeineke |
205 |
if( mpiSim->getMyMolStart() <= allMol && |
259 |
|
|
allMol <= mpiSim->getMyMolEnd() ){ |
260 |
mmeineke |
202 |
|
261 |
|
|
local_atoms += comp_stamps[i]->getNAtoms(); |
262 |
|
|
local_bonds += comp_stamps[i]->getNBonds(); |
263 |
|
|
local_bends += comp_stamps[i]->getNBends(); |
264 |
|
|
local_torsions += comp_stamps[i]->getNTorsions(); |
265 |
|
|
localMol++; |
266 |
|
|
} |
267 |
mmeineke |
205 |
allMol++; |
268 |
mmeineke |
202 |
} |
269 |
|
|
} |
270 |
mmeineke |
205 |
local_SRI = local_bonds + local_bends + local_torsions; |
271 |
mmeineke |
202 |
|
272 |
|
|
|
273 |
|
|
simnfo->n_atoms = mpiSim->getMyNlocal(); |
274 |
|
|
|
275 |
mmeineke |
205 |
if( local_atoms != simnfo->n_atoms ){ |
276 |
|
|
sprintf( painCave.errMsg, |
277 |
|
|
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
278 |
|
|
" localAtom (%d) are note equal.\n", |
279 |
|
|
simnfo->n_atoms, |
280 |
|
|
local_atoms ); |
281 |
|
|
painCave.isFatal = 1; |
282 |
|
|
simError(); |
283 |
|
|
} |
284 |
mmeineke |
202 |
|
285 |
mmeineke |
205 |
simnfo->n_bonds = local_bonds; |
286 |
|
|
simnfo->n_bends = local_bends; |
287 |
|
|
simnfo->n_torsions = local_torsions; |
288 |
|
|
simnfo->n_SRI = local_SRI; |
289 |
|
|
simnfo->n_mol = localMol; |
290 |
|
|
|
291 |
|
|
strcpy( checkPointMsg, "Passed nlocal consistency check." ); |
292 |
|
|
MPIcheckPoint(); |
293 |
|
|
|
294 |
|
|
|
295 |
chuckv |
195 |
#endif // is_mpi |
296 |
|
|
|
297 |
chuckv |
194 |
|
298 |
mmeineke |
10 |
// create the atom and short range interaction arrays |
299 |
chuckv |
124 |
|
300 |
chuckv |
195 |
Atom::createArrays(simnfo->n_atoms); |
301 |
|
|
the_atoms = new Atom*[simnfo->n_atoms]; |
302 |
|
|
the_molecules = new Molecule[simnfo->n_mol]; |
303 |
chuckv |
124 |
|
304 |
|
|
|
305 |
chuckv |
195 |
if( simnfo->n_SRI ){ |
306 |
|
|
the_sris = new SRI*[simnfo->n_SRI]; |
307 |
|
|
the_excludes = new ex_pair[simnfo->n_SRI]; |
308 |
mmeineke |
10 |
} |
309 |
|
|
|
310 |
|
|
// set the arrays into the SimInfo object |
311 |
|
|
|
312 |
|
|
simnfo->atoms = the_atoms; |
313 |
|
|
simnfo->sr_interactions = the_sris; |
314 |
|
|
simnfo->n_exclude = tot_SRI; |
315 |
|
|
simnfo->excludes = the_excludes; |
316 |
|
|
|
317 |
chuckv |
124 |
|
318 |
mmeineke |
10 |
// initialize the arrays |
319 |
chuckv |
124 |
|
320 |
mmeineke |
10 |
the_ff->setSimInfo( simnfo ); |
321 |
chuckv |
124 |
|
322 |
mmeineke |
10 |
makeAtoms(); |
323 |
|
|
|
324 |
|
|
if( tot_bonds ){ |
325 |
|
|
makeBonds(); |
326 |
|
|
} |
327 |
|
|
|
328 |
|
|
if( tot_bends ){ |
329 |
|
|
makeBends(); |
330 |
|
|
} |
331 |
|
|
|
332 |
|
|
if( tot_torsions ){ |
333 |
|
|
makeTorsions(); |
334 |
|
|
} |
335 |
|
|
|
336 |
|
|
|
337 |
|
|
// get some of the tricky things that may still be in the globals |
338 |
|
|
|
339 |
|
|
if( simnfo->n_dipoles ){ |
340 |
|
|
|
341 |
|
|
if( !the_globals->haveRRF() ){ |
342 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
343 |
|
|
"SimSetup Error, system has dipoles, but no rRF was set.\n"); |
344 |
|
|
painCave.isFatal = 1; |
345 |
|
|
simError(); |
346 |
mmeineke |
10 |
} |
347 |
|
|
if( !the_globals->haveDielectric() ){ |
348 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
349 |
|
|
"SimSetup Error, system has dipoles, but no" |
350 |
|
|
" dielectric was set.\n" ); |
351 |
|
|
painCave.isFatal = 1; |
352 |
|
|
simError(); |
353 |
mmeineke |
10 |
} |
354 |
|
|
|
355 |
|
|
simnfo->rRF = the_globals->getRRF(); |
356 |
|
|
simnfo->dielectric = the_globals->getDielectric(); |
357 |
|
|
} |
358 |
|
|
|
359 |
mmeineke |
189 |
#ifdef IS_MPI |
360 |
|
|
strcpy( checkPointMsg, "rRf and dielectric check out" ); |
361 |
|
|
MPIcheckPoint(); |
362 |
|
|
#endif // is_mpi |
363 |
|
|
|
364 |
mmeineke |
10 |
if( the_globals->haveBox() ){ |
365 |
|
|
simnfo->box_x = the_globals->getBox(); |
366 |
|
|
simnfo->box_y = the_globals->getBox(); |
367 |
|
|
simnfo->box_z = the_globals->getBox(); |
368 |
|
|
} |
369 |
|
|
else if( the_globals->haveDensity() ){ |
370 |
chuckv |
124 |
|
371 |
mmeineke |
10 |
double vol; |
372 |
|
|
vol = (double)tot_nmol / the_globals->getDensity(); |
373 |
|
|
simnfo->box_x = pow( vol, ( 1.0 / 3.0 ) ); |
374 |
|
|
simnfo->box_y = simnfo->box_x; |
375 |
|
|
simnfo->box_z = simnfo->box_x; |
376 |
|
|
} |
377 |
|
|
else{ |
378 |
|
|
if( !the_globals->haveBoxX() ){ |
379 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
380 |
|
|
"SimSetup error, no periodic BoxX size given.\n" ); |
381 |
|
|
painCave.isFatal = 1; |
382 |
|
|
simError(); |
383 |
mmeineke |
10 |
} |
384 |
|
|
simnfo->box_x = the_globals->getBoxX(); |
385 |
|
|
|
386 |
|
|
if( !the_globals->haveBoxY() ){ |
387 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
388 |
|
|
"SimSetup error, no periodic BoxY size given.\n" ); |
389 |
|
|
painCave.isFatal = 1; |
390 |
|
|
simError(); |
391 |
mmeineke |
10 |
} |
392 |
|
|
simnfo->box_y = the_globals->getBoxY(); |
393 |
|
|
|
394 |
|
|
if( !the_globals->haveBoxZ() ){ |
395 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
396 |
|
|
"SimSetup error, no periodic BoxZ size given.\n" ); |
397 |
|
|
painCave.isFatal = 1; |
398 |
|
|
simError(); |
399 |
mmeineke |
10 |
} |
400 |
|
|
simnfo->box_z = the_globals->getBoxZ(); |
401 |
|
|
} |
402 |
|
|
|
403 |
mmeineke |
189 |
#ifdef IS_MPI |
404 |
|
|
strcpy( checkPointMsg, "Box size set up" ); |
405 |
|
|
MPIcheckPoint(); |
406 |
|
|
#endif // is_mpi |
407 |
chuckv |
124 |
|
408 |
mmeineke |
189 |
|
409 |
|
|
|
410 |
chuckv |
206 |
if( the_globals->haveInitialConfig() ){ |
411 |
|
|
|
412 |
|
|
InitializeFromFile* fileInit; |
413 |
|
|
#ifdef IS_MPI // is_mpi |
414 |
|
|
if( worldRank == 0 ){ |
415 |
|
|
#endif //is_mpi |
416 |
|
|
fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); |
417 |
|
|
#ifdef IS_MPI |
418 |
|
|
}else fileInit = new InitializeFromFile( NULL ); |
419 |
|
|
#endif |
420 |
|
|
fileInit->read_xyz( simnfo ); // default velocities on |
421 |
chuckv |
124 |
|
422 |
chuckv |
206 |
delete fileInit; |
423 |
|
|
} |
424 |
|
|
else{ |
425 |
chuckv |
124 |
|
426 |
chuckv |
195 |
#ifdef IS_MPI |
427 |
|
|
|
428 |
|
|
// no init from bass |
429 |
|
|
|
430 |
|
|
sprintf( painCave.errMsg, |
431 |
|
|
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
432 |
|
|
painCave.isFatal; |
433 |
|
|
simError(); |
434 |
|
|
|
435 |
|
|
#else |
436 |
|
|
|
437 |
mmeineke |
189 |
initFromBass(); |
438 |
chuckv |
195 |
|
439 |
chuckv |
206 |
|
440 |
|
|
#endif |
441 |
|
|
} |
442 |
|
|
|
443 |
mmeineke |
189 |
#ifdef IS_MPI |
444 |
chuckv |
195 |
strcpy( checkPointMsg, "Successfully read in the initial configuration" ); |
445 |
mmeineke |
189 |
MPIcheckPoint(); |
446 |
|
|
#endif // is_mpi |
447 |
mmeineke |
10 |
|
448 |
|
|
|
449 |
mmeineke |
189 |
|
450 |
|
|
|
451 |
|
|
|
452 |
chuckv |
206 |
|
453 |
mmeineke |
189 |
|
454 |
mmeineke |
184 |
#ifdef IS_MPI |
455 |
mmeineke |
189 |
if( worldRank == 0 ){ |
456 |
mmeineke |
184 |
#endif // is_mpi |
457 |
mmeineke |
189 |
|
458 |
|
|
if( the_globals->haveFinalConfig() ){ |
459 |
|
|
strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
460 |
|
|
} |
461 |
|
|
else{ |
462 |
|
|
strcpy( simnfo->finalName, inFileName ); |
463 |
|
|
char* endTest; |
464 |
|
|
int nameLength = strlen( simnfo->finalName ); |
465 |
|
|
endTest = &(simnfo->finalName[nameLength - 5]); |
466 |
|
|
if( !strcmp( endTest, ".bass" ) ){ |
467 |
|
|
strcpy( endTest, ".eor" ); |
468 |
mmeineke |
184 |
} |
469 |
mmeineke |
189 |
else if( !strcmp( endTest, ".BASS" ) ){ |
470 |
|
|
strcpy( endTest, ".eor" ); |
471 |
|
|
} |
472 |
mmeineke |
184 |
else{ |
473 |
mmeineke |
189 |
endTest = &(simnfo->finalName[nameLength - 4]); |
474 |
|
|
if( !strcmp( endTest, ".bss" ) ){ |
475 |
mmeineke |
184 |
strcpy( endTest, ".eor" ); |
476 |
|
|
} |
477 |
mmeineke |
189 |
else if( !strcmp( endTest, ".mdl" ) ){ |
478 |
mmeineke |
184 |
strcpy( endTest, ".eor" ); |
479 |
|
|
} |
480 |
|
|
else{ |
481 |
mmeineke |
189 |
strcat( simnfo->finalName, ".eor" ); |
482 |
mmeineke |
184 |
} |
483 |
|
|
} |
484 |
mmeineke |
189 |
} |
485 |
|
|
|
486 |
|
|
// make the sample and status out names |
487 |
|
|
|
488 |
|
|
strcpy( simnfo->sampleName, inFileName ); |
489 |
|
|
char* endTest; |
490 |
|
|
int nameLength = strlen( simnfo->sampleName ); |
491 |
|
|
endTest = &(simnfo->sampleName[nameLength - 5]); |
492 |
|
|
if( !strcmp( endTest, ".bass" ) ){ |
493 |
|
|
strcpy( endTest, ".dump" ); |
494 |
|
|
} |
495 |
|
|
else if( !strcmp( endTest, ".BASS" ) ){ |
496 |
|
|
strcpy( endTest, ".dump" ); |
497 |
|
|
} |
498 |
|
|
else{ |
499 |
|
|
endTest = &(simnfo->sampleName[nameLength - 4]); |
500 |
|
|
if( !strcmp( endTest, ".bss" ) ){ |
501 |
mmeineke |
184 |
strcpy( endTest, ".dump" ); |
502 |
|
|
} |
503 |
mmeineke |
189 |
else if( !strcmp( endTest, ".mdl" ) ){ |
504 |
mmeineke |
184 |
strcpy( endTest, ".dump" ); |
505 |
|
|
} |
506 |
|
|
else{ |
507 |
mmeineke |
189 |
strcat( simnfo->sampleName, ".dump" ); |
508 |
mmeineke |
184 |
} |
509 |
mmeineke |
189 |
} |
510 |
|
|
|
511 |
|
|
strcpy( simnfo->statusName, inFileName ); |
512 |
|
|
nameLength = strlen( simnfo->statusName ); |
513 |
|
|
endTest = &(simnfo->statusName[nameLength - 5]); |
514 |
|
|
if( !strcmp( endTest, ".bass" ) ){ |
515 |
|
|
strcpy( endTest, ".stat" ); |
516 |
|
|
} |
517 |
|
|
else if( !strcmp( endTest, ".BASS" ) ){ |
518 |
|
|
strcpy( endTest, ".stat" ); |
519 |
|
|
} |
520 |
|
|
else{ |
521 |
|
|
endTest = &(simnfo->statusName[nameLength - 4]); |
522 |
|
|
if( !strcmp( endTest, ".bss" ) ){ |
523 |
mmeineke |
184 |
strcpy( endTest, ".stat" ); |
524 |
|
|
} |
525 |
mmeineke |
189 |
else if( !strcmp( endTest, ".mdl" ) ){ |
526 |
mmeineke |
184 |
strcpy( endTest, ".stat" ); |
527 |
|
|
} |
528 |
|
|
else{ |
529 |
mmeineke |
189 |
strcat( simnfo->statusName, ".stat" ); |
530 |
mmeineke |
184 |
} |
531 |
mmeineke |
189 |
} |
532 |
|
|
|
533 |
mmeineke |
184 |
#ifdef IS_MPI |
534 |
mmeineke |
189 |
} |
535 |
mmeineke |
184 |
#endif // is_mpi |
536 |
mmeineke |
189 |
|
537 |
mmeineke |
10 |
// set the status, sample, and themal kick times |
538 |
mmeineke |
189 |
|
539 |
mmeineke |
10 |
if( the_globals->haveSampleTime() ){ |
540 |
chuckv |
124 |
simnfo->sampleTime = the_globals->getSampleTime(); |
541 |
mmeineke |
10 |
simnfo->statusTime = simnfo->sampleTime; |
542 |
|
|
simnfo->thermalTime = simnfo->sampleTime; |
543 |
|
|
} |
544 |
|
|
else{ |
545 |
chuckv |
124 |
simnfo->sampleTime = the_globals->getRunTime(); |
546 |
mmeineke |
10 |
simnfo->statusTime = simnfo->sampleTime; |
547 |
|
|
simnfo->thermalTime = simnfo->sampleTime; |
548 |
|
|
} |
549 |
|
|
|
550 |
|
|
if( the_globals->haveStatusTime() ){ |
551 |
|
|
simnfo->statusTime = the_globals->getStatusTime(); |
552 |
|
|
} |
553 |
|
|
|
554 |
|
|
if( the_globals->haveThermalTime() ){ |
555 |
|
|
simnfo->thermalTime = the_globals->getThermalTime(); |
556 |
|
|
} |
557 |
|
|
|
558 |
|
|
// check for the temperature set flag |
559 |
|
|
|
560 |
|
|
if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); |
561 |
chuckv |
124 |
|
562 |
|
|
|
563 |
mmeineke |
10 |
// make the longe range forces and the integrator |
564 |
chuckv |
124 |
|
565 |
mmeineke |
10 |
new AllLong( simnfo ); |
566 |
chuckv |
124 |
|
567 |
mmeineke |
10 |
if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo ); |
568 |
|
|
if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo ); |
569 |
|
|
if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo ); |
570 |
|
|
} |
571 |
|
|
|
572 |
|
|
void SimSetup::makeAtoms( void ){ |
573 |
chuckv |
124 |
|
574 |
mmeineke |
10 |
int i, j, k, index; |
575 |
|
|
double ux, uy, uz, uSqr, u; |
576 |
|
|
AtomStamp* current_atom; |
577 |
|
|
DirectionalAtom* dAtom; |
578 |
mmeineke |
205 |
int molIndex, molStart, molEnd, nMemb, lMolIndex; |
579 |
mmeineke |
10 |
|
580 |
mmeineke |
205 |
lMolIndex = 0; |
581 |
mmeineke |
117 |
molIndex = 0; |
582 |
mmeineke |
10 |
index = 0; |
583 |
|
|
for( i=0; i<n_components; i++ ){ |
584 |
chuckv |
124 |
|
585 |
mmeineke |
10 |
for( j=0; j<components_nmol[i]; j++ ){ |
586 |
chuckv |
124 |
|
587 |
mmeineke |
205 |
#ifdef IS_MPI |
588 |
chuckv |
215 |
if( mpiSim->getMyMolStart() <= molIndex && |
589 |
|
|
molIndex <= mpiSim->getMyMolEnd() ){ |
590 |
mmeineke |
205 |
#endif // is_mpi |
591 |
chuckv |
124 |
|
592 |
mmeineke |
205 |
molStart = index; |
593 |
|
|
nMemb = comp_stamps[i]->getNAtoms(); |
594 |
|
|
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
595 |
|
|
|
596 |
|
|
current_atom = comp_stamps[i]->getAtom( k ); |
597 |
|
|
if( current_atom->haveOrientation() ){ |
598 |
|
|
|
599 |
|
|
dAtom = new DirectionalAtom(index); |
600 |
|
|
simnfo->n_oriented++; |
601 |
|
|
the_atoms[index] = dAtom; |
602 |
|
|
|
603 |
|
|
ux = current_atom->getOrntX(); |
604 |
|
|
uy = current_atom->getOrntY(); |
605 |
|
|
uz = current_atom->getOrntZ(); |
606 |
|
|
|
607 |
|
|
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
608 |
|
|
|
609 |
|
|
u = sqrt( uSqr ); |
610 |
|
|
ux = ux / u; |
611 |
|
|
uy = uy / u; |
612 |
|
|
uz = uz / u; |
613 |
|
|
|
614 |
|
|
dAtom->setSUx( ux ); |
615 |
|
|
dAtom->setSUy( uy ); |
616 |
|
|
dAtom->setSUz( uz ); |
617 |
|
|
} |
618 |
|
|
else{ |
619 |
|
|
the_atoms[index] = new GeneralAtom(index); |
620 |
|
|
} |
621 |
|
|
the_atoms[index]->setType( current_atom->getType() ); |
622 |
|
|
the_atoms[index]->setIndex( index ); |
623 |
|
|
|
624 |
|
|
// increment the index and repeat; |
625 |
|
|
index++; |
626 |
mmeineke |
10 |
} |
627 |
mmeineke |
205 |
|
628 |
|
|
molEnd = index -1; |
629 |
|
|
the_molecules[lMolIndex].setNMembers( nMemb ); |
630 |
|
|
the_molecules[lMolIndex].setStartAtom( molStart ); |
631 |
|
|
the_molecules[lMolIndex].setEndAtom( molEnd ); |
632 |
|
|
the_molecules[lMolIndex].setStampID( i ); |
633 |
|
|
lMolIndex++; |
634 |
chuckv |
124 |
|
635 |
mmeineke |
205 |
#ifdef IS_MPI |
636 |
mmeineke |
10 |
} |
637 |
mmeineke |
205 |
#endif //is_mpi |
638 |
|
|
|
639 |
mmeineke |
117 |
molIndex++; |
640 |
mmeineke |
10 |
} |
641 |
|
|
} |
642 |
chuckv |
124 |
|
643 |
mmeineke |
10 |
the_ff->initializeAtoms(); |
644 |
|
|
} |
645 |
|
|
|
646 |
|
|
void SimSetup::makeBonds( void ){ |
647 |
|
|
|
648 |
mmeineke |
205 |
int i, j, k, index, offset, molIndex; |
649 |
mmeineke |
10 |
bond_pair* the_bonds; |
650 |
|
|
BondStamp* current_bond; |
651 |
|
|
|
652 |
|
|
the_bonds = new bond_pair[tot_bonds]; |
653 |
|
|
index = 0; |
654 |
|
|
offset = 0; |
655 |
chuckv |
215 |
molIndex = 0;g1 |
656 |
|
|
|
657 |
mmeineke |
10 |
for( i=0; i<n_components; i++ ){ |
658 |
chuckv |
124 |
|
659 |
mmeineke |
10 |
for( j=0; j<components_nmol[i]; j++ ){ |
660 |
chuckv |
124 |
|
661 |
mmeineke |
205 |
#ifdef IS_MPI |
662 |
chuckv |
215 |
if( mpiSim->getMyMolStart() <= molIndex && |
663 |
|
|
molIndex <= mpiSim->getMyMolEnd() ){ |
664 |
mmeineke |
205 |
#endif // is_mpi |
665 |
|
|
|
666 |
|
|
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
667 |
|
|
|
668 |
|
|
current_bond = comp_stamps[i]->getBond( k ); |
669 |
|
|
the_bonds[index].a = current_bond->getA() + offset; |
670 |
|
|
the_bonds[index].b = current_bond->getB() + offset; |
671 |
|
|
|
672 |
|
|
the_excludes[index].i = the_bonds[index].a; |
673 |
|
|
the_excludes[index].j = the_bonds[index].b; |
674 |
|
|
|
675 |
|
|
// increment the index and repeat; |
676 |
|
|
index++; |
677 |
|
|
} |
678 |
|
|
offset += comp_stamps[i]->getNAtoms(); |
679 |
|
|
|
680 |
|
|
#ifdef IS_MPI |
681 |
mmeineke |
10 |
} |
682 |
mmeineke |
205 |
#endif is_mpi |
683 |
|
|
|
684 |
|
|
molIndex++; |
685 |
|
|
} |
686 |
mmeineke |
10 |
} |
687 |
chuckv |
124 |
|
688 |
mmeineke |
10 |
the_ff->initializeBonds( the_bonds ); |
689 |
|
|
} |
690 |
|
|
|
691 |
|
|
void SimSetup::makeBends( void ){ |
692 |
|
|
|
693 |
mmeineke |
205 |
int i, j, k, index, offset, molIndex; |
694 |
mmeineke |
10 |
bend_set* the_bends; |
695 |
|
|
BendStamp* current_bend; |
696 |
|
|
|
697 |
|
|
the_bends = new bend_set[tot_bends]; |
698 |
|
|
index = 0; |
699 |
|
|
offset = 0; |
700 |
mmeineke |
205 |
molIndex = 0; |
701 |
mmeineke |
10 |
for( i=0; i<n_components; i++ ){ |
702 |
chuckv |
124 |
|
703 |
mmeineke |
10 |
for( j=0; j<components_nmol[i]; j++ ){ |
704 |
chuckv |
124 |
|
705 |
mmeineke |
205 |
#ifdef IS_MPI |
706 |
chuckv |
215 |
if( mpiSim->getMyMolStart() <= molIndex && |
707 |
|
|
molIndex <= mpiSim->getMyMolEnd() ){ |
708 |
mmeineke |
205 |
#endif // is_mpi |
709 |
chuckv |
124 |
|
710 |
mmeineke |
205 |
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
711 |
|
|
|
712 |
|
|
current_bend = comp_stamps[i]->getBend( k ); |
713 |
|
|
the_bends[index].a = current_bend->getA() + offset; |
714 |
|
|
the_bends[index].b = current_bend->getB() + offset; |
715 |
|
|
the_bends[index].c = current_bend->getC() + offset; |
716 |
|
|
|
717 |
|
|
the_excludes[index + tot_bonds].i = the_bends[index].a; |
718 |
|
|
the_excludes[index + tot_bonds].j = the_bends[index].c; |
719 |
|
|
|
720 |
|
|
// increment the index and repeat; |
721 |
|
|
index++; |
722 |
|
|
} |
723 |
|
|
offset += comp_stamps[i]->getNAtoms(); |
724 |
|
|
|
725 |
|
|
#ifdef IS_MPI |
726 |
|
|
} |
727 |
|
|
#endif //is_mpi |
728 |
mmeineke |
10 |
|
729 |
mmeineke |
205 |
molIndex++; |
730 |
mmeineke |
10 |
} |
731 |
|
|
} |
732 |
chuckv |
124 |
|
733 |
mmeineke |
10 |
the_ff->initializeBends( the_bends ); |
734 |
|
|
} |
735 |
|
|
|
736 |
|
|
void SimSetup::makeTorsions( void ){ |
737 |
|
|
|
738 |
mmeineke |
205 |
int i, j, k, index, offset, molIndex; |
739 |
mmeineke |
10 |
torsion_set* the_torsions; |
740 |
|
|
TorsionStamp* current_torsion; |
741 |
|
|
|
742 |
|
|
the_torsions = new torsion_set[tot_torsions]; |
743 |
|
|
index = 0; |
744 |
|
|
offset = 0; |
745 |
mmeineke |
205 |
molIndex = 0; |
746 |
mmeineke |
10 |
for( i=0; i<n_components; i++ ){ |
747 |
chuckv |
124 |
|
748 |
mmeineke |
10 |
for( j=0; j<components_nmol[i]; j++ ){ |
749 |
chuckv |
124 |
|
750 |
mmeineke |
205 |
#ifdef IS_MPI |
751 |
chuckv |
215 |
if( mpiSim->getMyMolStart() <= molIndex && |
752 |
|
|
molIndex <= mpiSim->getMyMolEnd() ){ |
753 |
mmeineke |
205 |
#endif // is_mpi |
754 |
|
|
|
755 |
mmeineke |
10 |
for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
756 |
chuckv |
124 |
|
757 |
mmeineke |
10 |
current_torsion = comp_stamps[i]->getTorsion( k ); |
758 |
|
|
the_torsions[index].a = current_torsion->getA() + offset; |
759 |
|
|
the_torsions[index].b = current_torsion->getB() + offset; |
760 |
|
|
the_torsions[index].c = current_torsion->getC() + offset; |
761 |
|
|
the_torsions[index].d = current_torsion->getD() + offset; |
762 |
|
|
|
763 |
|
|
the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a; |
764 |
|
|
the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d; |
765 |
|
|
|
766 |
|
|
// increment the index and repeat; |
767 |
|
|
index++; |
768 |
|
|
} |
769 |
|
|
offset += comp_stamps[i]->getNAtoms(); |
770 |
mmeineke |
205 |
|
771 |
|
|
#ifdef IS_MPI |
772 |
|
|
} |
773 |
|
|
#endif //is_mpi |
774 |
|
|
|
775 |
|
|
molIndex++; |
776 |
mmeineke |
10 |
} |
777 |
|
|
} |
778 |
chuckv |
124 |
|
779 |
mmeineke |
10 |
the_ff->initializeTorsions( the_torsions ); |
780 |
|
|
} |
781 |
|
|
|
782 |
|
|
void SimSetup::initFromBass( void ){ |
783 |
|
|
|
784 |
|
|
int i, j, k; |
785 |
|
|
int n_cells; |
786 |
|
|
double cellx, celly, cellz; |
787 |
|
|
double temp1, temp2, temp3; |
788 |
|
|
int n_per_extra; |
789 |
|
|
int n_extra; |
790 |
|
|
int have_extra, done; |
791 |
|
|
|
792 |
|
|
temp1 = (double)tot_nmol / 4.0; |
793 |
|
|
temp2 = pow( temp1, ( 1.0 / 3.0 ) ); |
794 |
|
|
temp3 = ceil( temp2 ); |
795 |
|
|
|
796 |
|
|
have_extra =0; |
797 |
|
|
if( temp2 < temp3 ){ // we have a non-complete lattice |
798 |
|
|
have_extra =1; |
799 |
|
|
|
800 |
|
|
n_cells = (int)temp3 - 1; |
801 |
|
|
cellx = simnfo->box_x / temp3; |
802 |
|
|
celly = simnfo->box_y / temp3; |
803 |
|
|
cellz = simnfo->box_z / temp3; |
804 |
|
|
n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); |
805 |
|
|
temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); |
806 |
|
|
n_per_extra = (int)ceil( temp1 ); |
807 |
|
|
|
808 |
|
|
if( n_per_extra > 4){ |
809 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
810 |
|
|
"SimSetup error. There has been an error in constructing" |
811 |
|
|
" the non-complete lattice.\n" ); |
812 |
|
|
painCave.isFatal = 1; |
813 |
|
|
simError(); |
814 |
mmeineke |
10 |
} |
815 |
|
|
} |
816 |
|
|
else{ |
817 |
|
|
n_cells = (int)temp3; |
818 |
|
|
cellx = simnfo->box_x / temp3; |
819 |
|
|
celly = simnfo->box_y / temp3; |
820 |
|
|
cellz = simnfo->box_z / temp3; |
821 |
|
|
} |
822 |
chuckv |
124 |
|
823 |
mmeineke |
10 |
current_mol = 0; |
824 |
|
|
current_comp_mol = 0; |
825 |
|
|
current_comp = 0; |
826 |
|
|
current_atom_ndx = 0; |
827 |
chuckv |
124 |
|
828 |
mmeineke |
10 |
for( i=0; i < n_cells ; i++ ){ |
829 |
|
|
for( j=0; j < n_cells; j++ ){ |
830 |
|
|
for( k=0; k < n_cells; k++ ){ |
831 |
chuckv |
124 |
|
832 |
mmeineke |
10 |
makeElement( i * cellx, |
833 |
|
|
j * celly, |
834 |
|
|
k * cellz ); |
835 |
chuckv |
124 |
|
836 |
mmeineke |
10 |
makeElement( i * cellx + 0.5 * cellx, |
837 |
|
|
j * celly + 0.5 * celly, |
838 |
|
|
k * cellz ); |
839 |
chuckv |
124 |
|
840 |
mmeineke |
10 |
makeElement( i * cellx, |
841 |
|
|
j * celly + 0.5 * celly, |
842 |
|
|
k * cellz + 0.5 * cellz ); |
843 |
chuckv |
124 |
|
844 |
mmeineke |
10 |
makeElement( i * cellx + 0.5 * cellx, |
845 |
|
|
j * celly, |
846 |
|
|
k * cellz + 0.5 * cellz ); |
847 |
|
|
} |
848 |
|
|
} |
849 |
|
|
} |
850 |
|
|
|
851 |
|
|
if( have_extra ){ |
852 |
|
|
done = 0; |
853 |
chuckv |
124 |
|
854 |
mmeineke |
10 |
int start_ndx; |
855 |
|
|
for( i=0; i < (n_cells+1) && !done; i++ ){ |
856 |
|
|
for( j=0; j < (n_cells+1) && !done; j++ ){ |
857 |
chuckv |
124 |
|
858 |
mmeineke |
10 |
if( i < n_cells ){ |
859 |
chuckv |
124 |
|
860 |
mmeineke |
10 |
if( j < n_cells ){ |
861 |
|
|
start_ndx = n_cells; |
862 |
|
|
} |
863 |
|
|
else start_ndx = 0; |
864 |
|
|
} |
865 |
|
|
else start_ndx = 0; |
866 |
chuckv |
124 |
|
867 |
mmeineke |
10 |
for( k=start_ndx; k < (n_cells+1) && !done; k++ ){ |
868 |
chuckv |
124 |
|
869 |
mmeineke |
10 |
makeElement( i * cellx, |
870 |
|
|
j * celly, |
871 |
|
|
k * cellz ); |
872 |
|
|
done = ( current_mol >= tot_nmol ); |
873 |
chuckv |
124 |
|
874 |
mmeineke |
10 |
if( !done && n_per_extra > 1 ){ |
875 |
|
|
makeElement( i * cellx + 0.5 * cellx, |
876 |
|
|
j * celly + 0.5 * celly, |
877 |
|
|
k * cellz ); |
878 |
|
|
done = ( current_mol >= tot_nmol ); |
879 |
|
|
} |
880 |
chuckv |
124 |
|
881 |
mmeineke |
10 |
if( !done && n_per_extra > 2){ |
882 |
|
|
makeElement( i * cellx, |
883 |
|
|
j * celly + 0.5 * celly, |
884 |
|
|
k * cellz + 0.5 * cellz ); |
885 |
|
|
done = ( current_mol >= tot_nmol ); |
886 |
|
|
} |
887 |
chuckv |
124 |
|
888 |
mmeineke |
10 |
if( !done && n_per_extra > 3){ |
889 |
|
|
makeElement( i * cellx + 0.5 * cellx, |
890 |
|
|
j * celly, |
891 |
|
|
k * cellz + 0.5 * cellz ); |
892 |
|
|
done = ( current_mol >= tot_nmol ); |
893 |
|
|
} |
894 |
|
|
} |
895 |
|
|
} |
896 |
|
|
} |
897 |
|
|
} |
898 |
chuckv |
124 |
|
899 |
|
|
|
900 |
mmeineke |
10 |
for( i=0; i<simnfo->n_atoms; i++ ){ |
901 |
|
|
simnfo->atoms[i]->set_vx( 0.0 ); |
902 |
|
|
simnfo->atoms[i]->set_vy( 0.0 ); |
903 |
|
|
simnfo->atoms[i]->set_vz( 0.0 ); |
904 |
|
|
} |
905 |
|
|
} |
906 |
|
|
|
907 |
|
|
void SimSetup::makeElement( double x, double y, double z ){ |
908 |
|
|
|
909 |
|
|
int k; |
910 |
|
|
AtomStamp* current_atom; |
911 |
|
|
DirectionalAtom* dAtom; |
912 |
|
|
double rotMat[3][3]; |
913 |
|
|
|
914 |
|
|
for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ |
915 |
chuckv |
124 |
|
916 |
mmeineke |
10 |
current_atom = comp_stamps[current_comp]->getAtom( k ); |
917 |
|
|
if( !current_atom->havePosition() ){ |
918 |
mmeineke |
189 |
sprintf( painCave.errMsg, |
919 |
|
|
"SimSetup:initFromBass error.\n" |
920 |
|
|
"\tComponent %s, atom %s does not have a position specified.\n" |
921 |
|
|
"\tThe initialization routine is unable to give a start" |
922 |
|
|
" position.\n", |
923 |
|
|
comp_stamps[current_comp]->getID(), |
924 |
|
|
current_atom->getType() ); |
925 |
|
|
painCave.isFatal = 1; |
926 |
|
|
simError(); |
927 |
mmeineke |
10 |
} |
928 |
chuckv |
124 |
|
929 |
mmeineke |
10 |
the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); |
930 |
|
|
the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() ); |
931 |
|
|
the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() ); |
932 |
chuckv |
124 |
|
933 |
mmeineke |
10 |
if( the_atoms[current_atom_ndx]->isDirectional() ){ |
934 |
chuckv |
124 |
|
935 |
mmeineke |
10 |
dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx]; |
936 |
chuckv |
124 |
|
937 |
mmeineke |
10 |
rotMat[0][0] = 1.0; |
938 |
|
|
rotMat[0][1] = 0.0; |
939 |
|
|
rotMat[0][2] = 0.0; |
940 |
|
|
|
941 |
|
|
rotMat[1][0] = 0.0; |
942 |
|
|
rotMat[1][1] = 1.0; |
943 |
|
|
rotMat[1][2] = 0.0; |
944 |
|
|
|
945 |
|
|
rotMat[2][0] = 0.0; |
946 |
|
|
rotMat[2][1] = 0.0; |
947 |
|
|
rotMat[2][2] = 1.0; |
948 |
|
|
|
949 |
|
|
dAtom->setA( rotMat ); |
950 |
|
|
} |
951 |
|
|
|
952 |
|
|
current_atom_ndx++; |
953 |
|
|
} |
954 |
chuckv |
124 |
|
955 |
mmeineke |
10 |
current_mol++; |
956 |
|
|
current_comp_mol++; |
957 |
|
|
|
958 |
|
|
if( current_comp_mol >= components_nmol[current_comp] ){ |
959 |
chuckv |
124 |
|
960 |
mmeineke |
10 |
current_comp_mol = 0; |
961 |
|
|
current_comp++; |
962 |
|
|
} |
963 |
|
|
} |