# | Line 26 | Line 26 | SimInfo::SimInfo(){ | |
---|---|---|
26 | SimInfo::SimInfo(){ | |
27 | excludes = NULL; | |
28 | n_constraints = 0; | |
29 | + | nZconstraints = 0; |
30 | n_oriented = 0; | |
31 | n_dipoles = 0; | |
32 | ndf = 0; | |
33 | ndfRaw = 0; | |
34 | + | nZconstraints = 0; |
35 | the_integrator = NULL; | |
36 | setTemp = 0; | |
37 | thermalTime = 0.0; | |
38 | currentTime = 0.0; | |
39 | rCut = 0.0; | |
40 | + | origRcut = -1.0; |
41 | ecr = 0.0; | |
42 | + | origEcr = -1.0; |
43 | est = 0.0; | |
44 | oldEcr = 0.0; | |
45 | oldRcut = 0.0; | |
# | Line 54 | Line 58 | SimInfo::SimInfo(){ | |
58 | useGB = 0; | |
59 | useEAM = 0; | |
60 | ||
61 | + | myConfiguration = new SimState(); |
62 | + | |
63 | wrapMeSimInfo( this ); | |
64 | } | |
65 | ||
66 | + | |
67 | SimInfo::~SimInfo(){ | |
68 | ||
69 | + | delete myConfiguration; |
70 | + | |
71 | map<string, GenericData*>::iterator i; | |
72 | ||
73 | for(i = properties.begin(); i != properties.end(); i++) | |
74 | delete (*i).second; | |
75 | < | |
67 | < | |
75 | > | |
76 | } | |
77 | ||
78 | void SimInfo::setBox(double newBox[3]) { | |
# | Line 302 | Line 310 | void SimInfo::calcBoxL( void ){ | |
310 | dsq = dx*dx + dy*dy + dz*dz; | |
311 | boxL[2] = sqrt( dsq ); | |
312 | if( (0.5 * boxL[2]) < maxCutoff ) maxCutoff = 0.5 * boxL[2]; | |
313 | + | |
314 | + | checkCutOffs(); |
315 | ||
316 | } | |
317 | ||
# | Line 356 | Line 366 | int SimInfo::getNDF(){ | |
366 | ndf = ndf_local; | |
367 | #endif | |
368 | ||
369 | < | ndf = ndf - 3; |
369 | > | ndf = ndf - 3 - nZconstraints; |
370 | ||
371 | return ndf; | |
372 | } | |
# | Line 375 | Line 385 | int SimInfo::getNDFraw() { | |
385 | ||
386 | return ndfRaw; | |
387 | } | |
388 | < | |
388 | > | |
389 | > | int SimInfo::getNDFtranslational() { |
390 | > | int ndfTrans_local, ndfTrans; |
391 | > | |
392 | > | ndfTrans_local = 3 * n_atoms - n_constraints; |
393 | > | |
394 | > | #ifdef IS_MPI |
395 | > | MPI_Allreduce(&ndfTrans_local,&ndfTrans,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); |
396 | > | #else |
397 | > | ndfTrans = ndfTrans_local; |
398 | > | #endif |
399 | > | |
400 | > | ndfTrans = ndfTrans - 3 - nZconstraints; |
401 | > | |
402 | > | return ndfTrans; |
403 | > | } |
404 | > | |
405 | void SimInfo::refreshSim(){ | |
406 | ||
407 | simtype fInfo; | |
# | Line 431 | Line 457 | void SimInfo::refreshSim(){ | |
457 | ||
458 | this->ndf = this->getNDF(); | |
459 | this->ndfRaw = this->getNDFraw(); | |
460 | < | |
460 | > | this->ndfTrans = this->getNDFtranslational(); |
461 | } | |
462 | ||
463 | ||
# | Line 468 | Line 494 | void SimInfo::checkCutOffs( void ){ | |
494 | ||
495 | int cutChanged = 0; | |
496 | ||
497 | + | |
498 | + | |
499 | if( boxIsInit ){ | |
500 | ||
501 | //we need to check cutOffs against the box | |
502 | < | |
503 | < | if( maxCutoff > rCut ){ |
502 | > | |
503 | > | if(( maxCutoff > rCut )&&(usePBC)){ |
504 | if( rCut < origRcut ){ | |
505 | rCut = origRcut; | |
506 | if (rCut > maxCutoff) rCut = maxCutoff; | |
# | Line 488 | Line 516 | void SimInfo::checkCutOffs( void ){ | |
516 | ||
517 | if( maxCutoff > ecr ){ | |
518 | if( ecr < origEcr ){ | |
519 | < | rCut = origEcr; |
519 | > | ecr = origEcr; |
520 | if (ecr > maxCutoff) ecr = maxCutoff; | |
521 | ||
522 | sprintf( painCave.errMsg, | |
# | Line 501 | Line 529 | void SimInfo::checkCutOffs( void ){ | |
529 | } | |
530 | ||
531 | ||
532 | < | if (rCut > maxCutoff) { |
532 | > | if ((rCut > maxCutoff)&&(usePBC)) { |
533 | sprintf( painCave.errMsg, | |
534 | "New Box size is setting the long range cutoff radius " | |
535 | "to %lf\n", | |
# | Line 521 | Line 549 | void SimInfo::checkCutOffs( void ){ | |
549 | ecr = maxCutoff; | |
550 | } | |
551 | ||
552 | < | |
553 | < | } |
526 | < | |
552 | > | |
553 | > | if( (oldEcr != ecr) || ( oldRcut != rCut ) ) cutChanged = 1; |
554 | ||
555 | < | if( (oldEcr != ecr) || ( oldRcut != rCut ) ) cutChanged = 1; |
529 | < | |
530 | < | // rlist is the 1.0 plus max( rcut, ecr ) |
531 | < | |
532 | < | ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
533 | < | |
534 | < | if( cutChanged ){ |
555 | > | // rlist is the 1.0 plus max( rcut, ecr ) |
556 | ||
557 | < | notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
557 | > | ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
558 | > | |
559 | > | if( cutChanged ){ |
560 | > | |
561 | > | notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
562 | > | } |
563 | > | |
564 | > | oldEcr = ecr; |
565 | > | oldRcut = rCut; |
566 | > | |
567 | > | } else { |
568 | > | // initialize this stuff before using it, OK? |
569 | > | sprintf( painCave.errMsg, |
570 | > | "Trying to check cutoffs without a box. Be smarter.\n" ); |
571 | > | painCave.isFatal = 1; |
572 | > | simError(); |
573 | } | |
574 | ||
539 | – | oldEcr = ecr; |
540 | – | oldRcut = rCut; |
575 | } | |
576 | ||
577 | void SimInfo::addProperty(GenericData* prop){ | |
# | Line 587 | Line 621 | vector<GenericData*> SimInfo::getProperties(){ | |
621 | return result; | |
622 | } | |
623 | ||
624 | + | double SimInfo::matTrace3(double m[3][3]){ |
625 | + | double trace; |
626 | + | trace = m[0][0] + m[1][1] + m[2][2]; |
627 | ||
628 | + | return trace; |
629 | + | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |