ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Symplectic.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Symplectic.cpp (file contents):
Revision 482 by chuckv, Tue Apr 8 22:38:43 2003 UTC vs.
Revision 497 by chuckv, Mon Apr 14 21:16:37 2003 UTC

# Line 38 | Line 38 | Symplectic::Symplectic( SimInfo* the_entry_plug, Force
38    myES = the_es;
39    isFirst = 1;
40  
41  std::cerr<< "calling symplectic constructor\n";
42
41    molecules = entry_plug->molecules;
42    nMols = entry_plug->n_mol;
43  
# Line 172 | Line 170 | void Symplectic::integrate( void ){
170    double Tb[3];   // torque in the body frame
171    double angle;   // the angle through which to rotate the rotation matrix
172    double A[3][3]; // the rotation matrix
173 +  double press[9];
174  
175    int time;
176  
# Line 192 | Line 191 | void Symplectic::integrate( void ){
191    StatWriter*  e_out;
192    DumpWriter*  dump_out;
193  
195  std::cerr << "about to call new thermo\n";
196
194    tStats   = new Thermo( entry_plug );
195    e_out    = new StatWriter( entry_plug );
199
200  std::cerr << "calling dumpWriter \n";
196    dump_out = new DumpWriter( entry_plug );
202  std::cerr << "called dumpWriter \n";
197  
198    Atom** atoms = entry_plug->atoms;
199    DirectionalAtom* dAtom;
# Line 242 | Line 236 | void Symplectic::integrate( void ){
236  
237      for( tl=0; tl < n_loops; tl++ ){
238  
245      if (!strcasecmp( entry_plug->ensemble, "NVT"))
246        myES->NoseHooverNVT( dt / 2.0 , tStats->getKinetic() );
239        
240        for( j=0; j<nAtoms; j++ ){
241  
# Line 342 | Line 334 | void Symplectic::integrate( void ){
334          }
335        }
336        
337 +      if (!strcasecmp( entry_plug->ensemble, "NVT"))
338 +        myES->NoseHooverNVT( dt / 2.0 , tStats->getKinetic() );
339 +
340        // calculate the forces
341        
342        myFF->doForces(calcPot, calcStress);
# Line 413 | Line 408 | void Symplectic::integrate( void ){
408        if (!strcasecmp( entry_plug->ensemble, "NVT"))
409          myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() );
410  
411 <      if (!strcasecmp( entry_plug->ensemble, "NPT") )
411 >      if (!strcasecmp( entry_plug->ensemble, "NPT") ) {
412 >        tStats->getPressureTensor(press);
413          myES->NoseHooverAndersonNPT( dt,
414                                       tStats->getKinetic(),
415 <                                     tStats->getPressure());
415 >                                     press);
416 >      }
417  
418        time = tl + 1;
419        
# Line 426 | Line 423 | void Symplectic::integrate( void ){
423        if( !(time % sample_n) ) dump_out->writeDump( time * dt );
424        if( !((time+1) % status_n) ) {
425          calcPot = 1;
426 <        // bitwise masking in case we need it for NPT
430 <        calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 1;
426 >        calcStress = 1;
427        }
428        if( !(time % status_n) ){
429          e_out->writeStat( time * dt );
430          calcPot = 0;
431 <        // bitwise masking in case we need it for NPT
432 <        calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 0;
431 >        if (!strcasecmp(entry_plug->ensemble, "NPT")) calcStress = 1;
432 >        else calcStress = 0;
433        }
434      }
435    }
# Line 445 | Line 441 | void Symplectic::integrate( void ){
441        rot_kE= 0.0;
442        trans_kE = 0.0;
443  
448      if (!strcasecmp( entry_plug->ensemble, "NVT"))
449        myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() );
450      
444        for( i=0; i<nAtoms; i++ ){
445          
446          // velocity half step
# Line 532 | Line 525 | void Symplectic::integrate( void ){
525            dAtom->setJz( ji[2] );
526          }
527        }
528 +
529 +      if (!strcasecmp( entry_plug->ensemble, "NVT"))
530 +        myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() );
531        
532 +      
533        // calculate the forces
534        
535        myFF->doForces(calcPot,calcStress);
# Line 585 | Line 582 | void Symplectic::integrate( void ){
582            dAtom->setJx( ji[0] );
583            dAtom->setJy( ji[1] );
584            dAtom->setJz( ji[2] );
585 <        }
585 >        }
586 >
587        }
588      
589        if (!strcasecmp( entry_plug->ensemble, "NVT"))
590          myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() );
591  
592 <      if (!strcasecmp( entry_plug->ensemble, "NPT") )
592 >      if (!strcasecmp( entry_plug->ensemble, "NPT") ) {
593 >        tStats->getPressureTensor(press);
594          myES->NoseHooverAndersonNPT( dt,
595                                       tStats->getKinetic(),
596 <                                     tStats->getPressure());
596 >                                     press);
597 >      }
598    
599        time = tl + 1;
600        
# Line 604 | Line 604 | void Symplectic::integrate( void ){
604        if( !(time % sample_n) ) dump_out->writeDump( time * dt );
605        if( !((time+1) % status_n) ) {
606          calcPot = 1;
607 <        // bitwise masking in case we need it for NPT
608 <        calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 1;
607 >        calcStress = 1;
608        }
609        if( !(time % status_n) ){
610          e_out->writeStat( time * dt );
611          calcPot = 0;
612 <        // bitwise masking in case we need it for NPT
613 <        calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 0;
612 >        if (!strcasecmp(entry_plug->ensemble, "NPT")) calcStress = 1;
613 >        else calcStress = 0;
614        }      
615      }
616    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines