ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/LJ_FF.cpp
(Generate patch)

Comparing trunk/OOPSE_old/src/mdtools/libmdCode/LJ_FF.cpp (file contents):
Revision 294 by mmeineke, Thu Mar 6 17:04:09 2003 UTC vs.
Revision 348 by mmeineke, Fri Mar 14 21:33:10 2003 UTC

# Line 22 | Line 22 | namespace {
22  
23  
24  
25 < namespace {
25 > namespace LJ_NS{
26  
27    // Declare the structures that will be passed by the parser and  MPI
28    
# Line 45 | Line 45 | namespace {
45   #endif
46   }
47  
48 + using namespace LJ_NS;
49  
50   //****************************************************************
51   // begins the actual forcefield stuff.  
# Line 106 | Line 107 | LJ_FF::LJ_FF(){
107        
108        ffPath = getenv( ffPath_env );
109        if( ffPath == NULL ) {
110 <        sprintf( painCave.errMsg,
110 <                 "Error opening the force field parameter file: %s\n"
111 <                 "Have you tried setting the FORCE_PARAM_PATH environment "
112 <                 "vairable?\n",
113 <                 fileName );
114 <        painCave.isFatal = 1;
115 <        simError();
110 >        STR_DEFINE(ffPath, FRC_PATH );
111        }
112        
113        
# Line 273 | Line 268 | void LJ_FF::initializeAtoms( void ){
268        if( readLine[0] != '!' ){
269          
270          // the parser returns 0 if the line was blank
271 <        if( parseAtomLJ( readLine, lineNum, info ) ){
271 >        if( parseAtom( readLine, lineNum, info ) ){
272            info.ident = identNum;
273            headAtomType->add( info );;
274            identNum++;
# Line 336 | Line 331 | void LJ_FF::initializeAtoms( void ){
331    // call new A_types in fortran
332    
333    int isError;
334 +
335 +  // dummy variables
336 +  int isLJ = 1;
337 +  int isDipole = 0;
338 +  int isSSD = 0;
339 +  int isGB = 0;
340 +  double w0 = 0.0;
341 +  double v0 = 0.0;
342 +  double dipole = 0.0;
343 +  
344 +  
345    currentAtomType = headAtomType;
346    while( currentAtomType != NULL ){
347      
348      if( currentAtomType->name[0] != '\0' ){
349        isError = 0;
350 <          newLJtype( &(currentAtomType->ident),
351 <                 &(currentAtomType->mass),
352 <                 &(currentAtomType->epslon),
353 <                 &(currentAtomType->sigma),
354 <                 &isError );
350 >      makeAtype( &(currentAtomType->ident),
351 >                &(currentAtomType->mass),
352 >                &(currentAtomType->epslon),
353 >                &(currentAtomType->sigma),
354 >                &isLJ, &isSSD, &isDipole, &isGB, &w0, &v0, &dipole,
355 >                &isError );
356        if( isError ){
357          sprintf( painCave.errMsg,
358                   "Error initializing the \"%s\" atom type in fortran\n",
# Line 414 | Line 421 | void LJ_FF::initializeAtoms( void ){
421    MPIcheckPoint();
422   #endif // is_mpi
423  
424 <  initFortran();
424 >  this->initFortran();
425    entry_plug->refreshSim();
426 <
426 >  
427   }
428  
429   void LJ_FF::initializeBonds( bond_pair* the_bonds ){
# Line 461 | Line 468 | void LJ_FF::doForces( int calcPot ){
468  
469   }
470  
464 void LJ_FF::doForces( int calcPot ){
465
466  int i, isError;
467  double* frc;
468  double* pos;
469  double* tau;
470  short int passedCalcPot = (short int)calcPot;
471
472  // forces are zeroed here, before any are acumulated.
473  // NOTE: do not rezero the forces in Fortran.
474
475  for(i=0; i<entry_plug->n_atoms; i++){
476    entry_plug->atoms[i]->zeroForces();
477  }
478
479  frc = Atom::getFrcArray();
480  pos = Atom::getPosArray();
481  tau = entry_plug->tau;
482
483  isError = 0;
484  doLJfortran( pos, frc, &(entry_plug->lrPot), tau, &passedCalcPot, &isError );
485
486
487  if( isError ){
488    sprintf( painCave.errMsg,
489             "Error returned from the fortran force calculation.\n" );
490    painCave.isFatal = 1;
491    simError();
492  }
493
494 #ifdef IS_MPI
495  sprintf( checkPointMsg,
496           "returned from the force calculation.\n" );
497  MPIcheckPoint();
498 #endif // is_mpi
499
500 }
501  
502 void LJ_FF::initFortran( void ){
503  
504  int nLocal = entry_plug->n_atoms;
505  int *ident;
506  int isError;
507  int i;
508
509  ident = new int[nLocal];
510
511  for(i=0; i<nLocal; i++){
512    ident[i] = entry_plug->atoms[i]->getIdent();
513  }
514
515  isError = 0;
516  initLJfortran( &nLocal, ident, &isError );
517  
518  if(isError){
519    sprintf( painCave.errMsg,
520             "LJ_FF error: There was an error initializing the component list in fortran.\n" );
521    painCave.isFatal = 1;
522    simError();
523  }
524
525  
526 #ifdef IS_MPI
527  sprintf( checkPointMsg, "LJ_FF successfully initialized the fortran component list.\n" );
528  MPIcheckPoint();
529 #endif // is_mpi
530  
531  delete[] ident;
532
533 }
534
535  
471   void LJ_FF::fastForward( char* stopText, char* searchOwner ){
472  
473    int foundText = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines