279 |
|
//create SimInfo |
280 |
|
SimInfo * info = new SimInfo(ff, simParams); |
281 |
|
|
282 |
< |
//gather parameters (SimCreator only retrieves part of the parameters) |
282 |
> |
//gather parameters (SimCreator only retrieves part of the |
283 |
> |
//parameters) |
284 |
|
gatherParameters(info, mdFileName); |
285 |
|
|
286 |
|
//divide the molecules and determine the global index of molecules |
292 |
|
createMolecules(info); |
293 |
|
|
294 |
|
|
295 |
< |
//allocate memory for DataStorage(circular reference, need to break it) |
295 |
> |
//allocate memory for DataStorage(circular reference, need to |
296 |
> |
//break it) |
297 |
|
info->setSnapshotManager(new SimSnapshotManager(info)); |
298 |
|
|
299 |
< |
//set the global index of atoms, rigidbodies and cutoffgroups (only need to be set once, the |
300 |
< |
//global index will never change again). Local indices of atoms and rigidbodies are already set by |
301 |
< |
//MoleculeCreator class which actually delegates the responsibility to LocalIndexManager. |
299 |
> |
//set the global index of atoms, rigidbodies and cutoffgroups |
300 |
> |
//(only need to be set once, the global index will never change |
301 |
> |
//again). Local indices of atoms and rigidbodies are already set |
302 |
> |
//by MoleculeCreator class which actually delegates the |
303 |
> |
//responsibility to LocalIndexManager. |
304 |
|
setGlobalIndex(info); |
305 |
|
|
306 |
< |
//Alought addExculdePairs is called inside SimInfo's addMolecule method, at that point |
307 |
< |
//atoms don't have the global index yet (their global index are all initialized to -1). |
308 |
< |
//Therefore we have to call addExcludePairs explicitly here. A way to work around is that |
309 |
< |
//we can determine the beginning global indices of atoms before they get created. |
306 |
> |
//Although addExcludePairs is called inside SimInfo's addMolecule |
307 |
> |
//method, at that point atoms don't have the global index yet |
308 |
> |
//(their global index are all initialized to -1). Therefore we |
309 |
> |
//have to call addExcludePairs explicitly here. A way to work |
310 |
> |
//around is that we can determine the beginning global indices of |
311 |
> |
//atoms before they get created. |
312 |
|
SimInfo::MoleculeIterator mi; |
313 |
|
Molecule* mol; |
314 |
|
for (mol= info->beginMolecule(mi); mol != NULL; mol = info->nextMolecule(mi)) { |
352 |
|
|
353 |
|
#ifdef IS_MPI |
354 |
|
void SimCreator::divideMolecules(SimInfo *info) { |
355 |
< |
double numerator; |
356 |
< |
double denominator; |
357 |
< |
double precast; |
358 |
< |
double x; |
359 |
< |
double y; |
360 |
< |
double a; |
355 |
> |
RealType numerator; |
356 |
> |
RealType denominator; |
357 |
> |
RealType precast; |
358 |
> |
RealType x; |
359 |
> |
RealType y; |
360 |
> |
RealType a; |
361 |
|
int old_atoms; |
362 |
|
int add_atoms; |
363 |
|
int new_atoms; |
469 |
|
// Pacc(x) = exp(- a * x) |
470 |
|
// where a = penalty / (average atoms per molecule) |
471 |
|
|
472 |
< |
x = (double)(new_atoms - nTarget); |
472 |
> |
x = (RealType)(new_atoms - nTarget); |
473 |
|
y = myRandom->rand(); |
474 |
|
|
475 |
|
if (y < exp(- a * x)) { |