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

Comparing trunk/OOPSE_old/src/mdtools/libmdCode/SimSetup.cpp (file contents):
Revision 290 by chuckv, Thu Feb 27 21:25:47 2003 UTC vs.
Revision 368 by chuckv, Thu Mar 20 00:02:39 2003 UTC

# Line 308 | Line 308 | void SimSetup::createSim( void ){
308  
309    if( simnfo->n_SRI ){
310      the_sris = new SRI*[simnfo->n_SRI];
311 <    the_excludes = new ex_pair[simnfo->n_SRI];
311 >    the_excludes = new int[2 * simnfo->n_SRI];
312 >    simnfo->globalExcludes = new int;
313 >    simnfo->n_exclude = tot_SRI;
314    }
315 +  else{
316 +    
317 +    the_excludes = new int[2];
318 +    the_excludes[0] = 0;
319 +    the_excludes[1] = 0;
320 +    simnfo->globalExcludes = new int;
321 +    simnfo->globalExcludes[0] = 0;
322  
323 +    simnfo->n_exclude = 1;
324 +  }
325 +
326    // set the arrays into the SimInfo object
327  
328    simnfo->atoms = the_atoms;
329    simnfo->sr_interactions = the_sris;
330 <  simnfo->n_exclude = tot_SRI;
330 >  simnfo->nGlobalExcludes = 0;
331    simnfo->excludes = the_excludes;
332  
333  
# Line 396 | Line 408 | void SimSetup::createSim( void ){
408    the_ff->setSimInfo( simnfo );
409  
410    makeAtoms();
411 <  //
411 >  simnfo->identArray = new int[simnfo->n_atoms];
412 >  for(i=0; i<simnfo->n_atoms; i++){
413 >    simnfo->identArray[i] = the_atoms[i]->getIdent();
414 >  }
415 >  
416    if( tot_bonds ){
417      makeBonds();
418    }
# Line 576 | Line 592 | void SimSetup::createSim( void ){
592    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff );
593    if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
594  
595 +
596 +
597 +  // initialize the Fortran
598 +  
599 +  simnfo->refreshSim();
600 +  
601 +  if( !strcmp( simnfo->mixingRule, "standard") ){
602 +    the_ff->initForceField( LB_MIXING_RULE );
603 +  }
604 +  else if( !strcmp( simnfo->mixingRule, "explicit") ){
605 +    the_ff->initForceField( EXPLICIT_MIXING_RULE );
606 +  }
607 +  else{
608 +    sprintf( painCave.errMsg,
609 +             "SimSetup Error: unknown mixing rule -> \"%s\"\n",
610 +             simnfo->mixingRule );
611 +    painCave.isFatal = 1;
612 +    simError();
613 +  }
614 +
615 +
616 + #ifdef IS_MPI
617 +  strcpy( checkPointMsg,
618 +          "Successfully intialized the mixingRule for Fortran." );
619 +  MPIcheckPoint();
620 + #endif // is_mpi
621   }
622  
623   void SimSetup::makeAtoms( void ){
# Line 583 | Line 625 | void SimSetup::makeAtoms( void ){
625    int i, j, k, index;
626    double ux, uy, uz, uSqr, u;
627    AtomStamp* current_atom;
628 +
629    DirectionalAtom* dAtom;
630    int molIndex, molStart, molEnd, nMemb, lMolIndex;
631  
# Line 662 | Line 705 | void SimSetup::makeBonds( void ){
705  
706   void SimSetup::makeBonds( void ){
707  
708 <  int i, j, k, index, offset, molIndex;
708 >  int i, j, k, index, offset, molIndex, exI, exJ, tempEx;
709    bond_pair* the_bonds;
710    BondStamp* current_bond;
711  
# Line 685 | Line 728 | void SimSetup::makeBonds( void ){
728            current_bond = comp_stamps[i]->getBond( k );
729            the_bonds[index].a = current_bond->getA() + offset;
730            the_bonds[index].b = current_bond->getB() + offset;
731 +
732 +          exI = the_bonds[index].a;
733 +          exJ = the_bonds[index].b;
734 +
735 +          // exclude_I must always be the smaller of the pair
736 +          if( exI > exJ ){
737 +            tempEx = exI;
738 +            exI = exJ;
739 +            exJ = tempEx;
740 +          }
741 +
742            
743 <          the_excludes[index].i = the_bonds[index].a;
744 <          the_excludes[index].j = the_bonds[index].b;
743 > #ifdef IS_MPI
744 >
745 >          the_excludes[index*2] =    
746 >            the_atoms[exI]->getGlobalIndex() + 1;
747 >          the_excludes[index*2 + 1] =
748 >            the_atoms[exJ]->getGlobalIndex() + 1;
749 >
750 > #else  // isn't MPI
751            
752 +          the_excludes[index*2] =     exI + 1;
753 +          the_excludes[index*2 + 1] = exJ + 1;
754 +          // fortran index from 1 (hence the +1 in the indexing)
755 + #endif  //is_mpi
756 +          
757            // increment the index and repeat;
758            index++;
759          }
# Line 707 | Line 772 | void SimSetup::makeBends( void ){
772  
773   void SimSetup::makeBends( void ){
774  
775 <  int i, j, k, index, offset, molIndex;
775 >  int i, j, k, index, offset, molIndex, exI, exJ, tempEx;
776    bend_set* the_bends;
777    BendStamp* current_bend;
778 +  LinkedAssign* extras;
779 +  LinkedAssign* current_extra;
780 +  
781  
782    the_bends = new bend_set[tot_bends];
783    index = 0;
# Line 731 | Line 799 | void SimSetup::makeBends( void ){
799            the_bends[index].b = current_bend->getB() + offset;
800            the_bends[index].c = current_bend->getC() + offset;
801            
802 <          the_excludes[index + tot_bonds].i = the_bends[index].a;
803 <          the_excludes[index + tot_bonds].j = the_bends[index].c;
802 >          if( current_bend->haveExtras() ){
803 >            
804 >            extras = current_bend->getExtras();
805 >            current_extra = extras;
806 >            
807 >            while( current_extra != NULL ){
808 >              if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){
809 >                
810 >                switch( current_extra->getType() ){
811 >                  
812 >                case 0:
813 >                  the_bends[index].ghost =
814 >                    current_extra->getInt() + offset;
815 >                  the_bends[index].isGhost = 1;
816 >                  break;
817 >                  
818 >                case 1:
819 >                  the_bends[index].ghost =
820 >                    (int)current_extra->getDouble() + offset;
821 >                  the_bends[index].isGhost = 1;
822 >                  break;
823 >                  
824 >                default:
825 >                  sprintf( painCave.errMsg,
826 >                           "SimSetup Error: ghostVectorSource was neiter a "
827 >                           "double nor an int.\n"
828 >                           "-->Bend[%d] in %s\n",
829 >                           k, comp_stamps[i]->getID() );
830 >                  painCave.isFatal = 1;
831 >                  simError();
832 >                }
833 >              }
834 >              
835 >              else{
836 >                
837 >                sprintf( painCave.errMsg,
838 >                         "SimSetup Error: unhandled bend assignment:\n"
839 >                         "    -->%s in Bend[%d] in %s\n",
840 >                         current_extra->getlhs(),
841 >                         k, comp_stamps[i]->getID() );
842 >                painCave.isFatal = 1;
843 >                simError();
844 >              }
845 >              
846 >              current_extra = current_extra->getNext();
847 >            }
848 >          }
849 >          
850 >          if( !the_bends[index].isGhost ){
851 >            
852 >            exI = the_bends[index].a;
853 >            exJ = the_bends[index].c;
854 >          }
855 >          else{
856 >            
857 >            exI = the_bends[index].a;
858 >            exJ = the_bends[index].b;
859 >          }
860 >          
861 >          // exclude_I must always be the smaller of the pair
862 >          if( exI > exJ ){
863 >            tempEx = exI;
864 >            exI = exJ;
865 >            exJ = tempEx;
866 >          }
867 >
868 >
869 > #ifdef IS_MPI
870 >
871 >          the_excludes[(index + tot_bonds)*2] =    
872 >            the_atoms[exI]->getGlobalIndex() + 1;
873 >          the_excludes[(index + tot_bonds)*2 + 1] =
874 >            the_atoms[exJ]->getGlobalIndex() + 1;
875            
876 + #else  // isn't MPI
877 +          
878 +          the_excludes[(index + tot_bonds)*2] =     exI + 1;
879 +          the_excludes[(index + tot_bonds)*2 + 1] = exJ + 1;
880 +          // fortran index from 1 (hence the +1 in the indexing)
881 + #endif  //is_mpi
882 +          
883 +          
884            // increment the index and repeat;
885            index++;
886          }
# Line 747 | Line 894 | void SimSetup::makeBends( void ){
894      }
895    }
896  
897 + #ifdef IS_MPI
898 +  sprintf( checkPointMsg,
899 +           "Successfully created the bends list.\n" );
900 +  MPIcheckPoint();
901 + #endif // is_mpi
902 +  
903 +
904    the_ff->initializeBends( the_bends );
905   }
906  
907   void SimSetup::makeTorsions( void ){
908  
909 <  int i, j, k, index, offset, molIndex;
909 >  int i, j, k, index, offset, molIndex, exI, exJ, tempEx;
910    torsion_set* the_torsions;
911    TorsionStamp* current_torsion;
912  
# Line 777 | Line 931 | void SimSetup::makeTorsions( void ){
931          the_torsions[index].c = current_torsion->getC() + offset;
932          the_torsions[index].d = current_torsion->getD() + offset;
933  
934 <        the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a;
935 <        the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d;
934 >        exI = the_torsions[index].a;
935 >        exJ = the_torsions[index].d;
936  
937 +        
938 +        // exclude_I must always be the smaller of the pair
939 +        if( exI > exJ ){
940 +          tempEx = exI;
941 +          exI = exJ;
942 +          exJ = tempEx;
943 +        }
944 +
945 +
946 + #ifdef IS_MPI
947 +        
948 +        the_excludes[(index + tot_bonds + tot_bends)*2] =    
949 +          the_atoms[exI]->getGlobalIndex() + 1;
950 +        the_excludes[(index + tot_bonds + tot_bends)*2 + 1] =
951 +          the_atoms[exJ]->getGlobalIndex() + 1;
952 +        
953 + #else  // isn't MPI
954 +        
955 +        the_excludes[(index + tot_bonds + tot_bends)*2] =     exI + 1;
956 +        the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = exJ + 1;
957 +        // fortran indexes from 1 (hence the +1 in the indexing)
958 + #endif  //is_mpi
959 +        
960 +
961          // increment the index and repeat;
962          index++;
963        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines