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 271 by mmeineke, Fri Feb 14 21:53:47 2003 UTC vs.
Revision 363 by mmeineke, Tue Mar 18 21:27:53 2003 UTC

# Line 81 | Line 81 | void SimSetup::createSim( void ){
81    n_components = the_globals->getNComponents();
82    strcpy( force_field, the_globals->getForceField() );
83    strcpy( ensemble, the_globals->getEnsemble() );
84 +  strcpy( simnfo->ensemble, ensemble );
85  
86 +  strcpy( simnfo->mixingRule, the_globals->getMixingRule() );
87 +  simnfo->usePBC = the_globals->getPBC();
88 +          
89 +
90 +
91    if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF();
92    else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF();
93    else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
# Line 98 | Line 104 | void SimSetup::createSim( void ){
104    strcpy( checkPointMsg, "ForceField creation successful" );
105    MPIcheckPoint();
106   #endif // is_mpi
107 +
108 +  
109  
110    // get the components and calculate the tot_nMol and indvidual n_mol
111    the_components = the_globals->getComponents();
# Line 300 | 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    }
314 +  else{
315 +    the_excludes = new int;
316 +    simnfo->globalExcludes = new int;
317 +  }
318  
319    // set the arrays into the SimInfo object
320  
321    simnfo->atoms = the_atoms;
322    simnfo->sr_interactions = the_sris;
323    simnfo->n_exclude = tot_SRI;
324 +  simnfo->nGlobalExcludes = 0;
325    simnfo->excludes = the_excludes;
326  
327  
# Line 388 | Line 402 | void SimSetup::createSim( void ){
402    the_ff->setSimInfo( simnfo );
403  
404    makeAtoms();
405 <  //
405 >  simnfo->identArray = new int[simnfo->n_atoms];
406 >  for(i=0; i<simnfo->n_atoms; i++){
407 >    simnfo->identArray[i] = the_atoms[i]->getIdent();
408 >  }
409 >  
410    if( tot_bonds ){
411      makeBonds();
412    }
# Line 567 | Line 585 | void SimSetup::createSim( void ){
585    if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo, the_ff );
586    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff );
587    if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
588 +
589 +
590 +
591 +  // initialize the Fortran
592 +  
593 +  simnfo->refreshSim();
594 +  
595 +  if( !stcmp( simnfo->mixingRule, "standard") ){
596 +    the_ff->initForceField( LB_MIXING_RULE );
597 +  }
598 +  else if( !stcmp( simnfo->mixingRule, "explicit") ){
599 +    the_ff->initForceField( EXPLICIT_MIXING_RULE );
600 +  }
601 +  else{
602 +    sprintf( painCave.errMsg,
603 +             "SimSetup Error: unknown mixing rule -> \"%s\"\n",
604 +             simnfo->mixingRule );
605 +    painCave.isFatal = 1;
606 +    simError();
607 +  }
608  
609 +
610 + #ifdef IS_MPI
611 +  strcpy( checkPointMsg,
612 +          "Successfully intialized the mixingRule for Fortran." );
613 +  MPIcheckPoint();
614 + #endif // is_mpi
615   }
616  
617   void SimSetup::makeAtoms( void ){
# Line 575 | Line 619 | void SimSetup::makeAtoms( void ){
619    int i, j, k, index;
620    double ux, uy, uz, uSqr, u;
621    AtomStamp* current_atom;
622 +
623    DirectionalAtom* dAtom;
624    int molIndex, molStart, molEnd, nMemb, lMolIndex;
625  
# Line 677 | Line 722 | void SimSetup::makeBonds( void ){
722            current_bond = comp_stamps[i]->getBond( k );
723            the_bonds[index].a = current_bond->getA() + offset;
724            the_bonds[index].b = current_bond->getB() + offset;
725 +
726 +          exI = the_bonds[index].a;
727 +          exJ = the_bonds[index].b;
728 +
729 +          // exclude_I must always be the smaller of the pair
730 +          if( exI > exJ ){
731 +            tempEx = exI;
732 +            exI = exJ;
733 +            exJ = tempEx;
734 +          }
735 +
736            
737 <          the_excludes[index].i = the_bonds[index].a;
738 <          the_excludes[index].j = the_bonds[index].b;
737 > #ifdef IS_MPI
738 >
739 >          the_excludes[index*2] =    
740 >            the_atoms[exI]->getGlobalIndex() + 1;
741 >          the_excludes[index*2 + 1] =
742 >            the_atoms[exJ]->getGlobalIndex() + 1;
743 >
744 > #else  // isn't MPI
745            
746 +          the_excludes[index*2] =     exI + 1;
747 +          the_excludes[index*2 + 1] = exJ + 1;
748 +          // fortran index from 1 (hence the +1 in the indexing)
749 + #endif  //is_mpi
750 +          
751            // increment the index and repeat;
752            index++;
753          }
# Line 699 | Line 766 | void SimSetup::makeBends( void ){
766  
767   void SimSetup::makeBends( void ){
768  
769 <  int i, j, k, index, offset, molIndex;
769 >  int i, j, k, index, offset, molIndex, exI, exJ;
770    bend_set* the_bends;
771    BendStamp* current_bend;
772 +  LinkedAssign* extras;
773 +  LinkedAssign* current_extra;
774 +  
775  
776    the_bends = new bend_set[tot_bends];
777    index = 0;
# Line 723 | Line 793 | void SimSetup::makeBends( void ){
793            the_bends[index].b = current_bend->getB() + offset;
794            the_bends[index].c = current_bend->getC() + offset;
795            
796 <          the_excludes[index + tot_bonds].i = the_bends[index].a;
797 <          the_excludes[index + tot_bonds].j = the_bends[index].c;
796 >          if( current_bend->haveExtras() ){
797 >            
798 >            extras = current_bend->getExtras();
799 >            current_extra = extras;
800 >            
801 >            while( current_extra != NULL ){
802 >              if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){
803 >                
804 >                switch( current_extra->getType() ){
805 >                  
806 >                case 0:
807 >                  the_bends[index].ghost =
808 >                    current_extra->getInt() + offset;
809 >                  the_bends[index].isGhost = 1;
810 >                  break;
811 >                  
812 >                case 1:
813 >                  the_bends[index].ghost =
814 >                    (int)current_extra->getDouble() + offset;
815 >                  the_bends[index].isGhost = 1;
816 >                  break;
817 >                  
818 >                default:
819 >                  sprintf( painCave.errMsg,
820 >                           "SimSetup Error: ghostVectorSource was neiter a "
821 >                           "double nor an int.\n"
822 >                           "-->Bend[%d] in %s\n",
823 >                           k, comp_stamps[i]->getID() );
824 >                  painCave.isFatal = 1;
825 >                  simError();
826 >                }
827 >              }
828 >              
829 >              else{
830 >                
831 >                sprintf( painCave.errMsg,
832 >                         "SimSetup Error: unhandled bend assignment:\n"
833 >                         "    -->%s in Bend[%d] in %s\n",
834 >                         current_extra->getlhs(),
835 >                         k, comp_stamps[i]->getID() );
836 >                painCave.isFatal = 1;
837 >                simError();
838 >              }
839 >              
840 >              current_extra = current_extra->getNext();
841 >            }
842 >          }
843            
844 +          if( !the_bends[index].isGhost ){
845 +            
846 +            exI = the_bends[index].a;
847 +            exJ = the_bends[index].c;
848 +          }
849 +          else{
850 +            
851 +            exI = the_bends[index].a;
852 +            exJ = the_bends[index].b;
853 +          }
854 +          
855 +          // exclude_I must always be the smaller of the pair
856 +          if( exI > exJ ){
857 +            tempEx = exI;
858 +            exI = exJ;
859 +            exJ = tempEx;
860 +          }
861 +
862 +
863 + #ifdef IS_MPI
864 +
865 +          the_excludes[(index + tot_bonds)*2] =    
866 +            the_atoms[exI]->getGlobalIndex() + 1;
867 +          the_excludes[(index + tot_bonds)*2 + 1] =
868 +            the_atoms[exJ]->getGlobalIndex() + 1;
869 +          
870 + #else  // isn't MPI
871 +          
872 +          the_excludes[(index + tot_bonds)*2] =     exI + 1;
873 +          the_excludes[(index + tot_bonds)*2 + 1] = exJ + 1;
874 +          // fortran index from 1 (hence the +1 in the indexing)
875 + #endif  //is_mpi
876 +          
877 +          
878            // increment the index and repeat;
879            index++;
880          }
# Line 739 | Line 888 | void SimSetup::makeBends( void ){
888      }
889    }
890  
891 + #ifdef IS_MPI
892 +  sprintf( checkPointMsg,
893 +           "Successfully created the bends list.\n" );
894 +  MPIcheckPoint();
895 + #endif // is_mpi
896 +  
897 +
898    the_ff->initializeBends( the_bends );
899   }
900  
901   void SimSetup::makeTorsions( void ){
902  
903 <  int i, j, k, index, offset, molIndex;
903 >  int i, j, k, index, offset, molIndex, exI, exJ, tempEx;
904    torsion_set* the_torsions;
905    TorsionStamp* current_torsion;
906  
# Line 769 | Line 925 | void SimSetup::makeTorsions( void ){
925          the_torsions[index].c = current_torsion->getC() + offset;
926          the_torsions[index].d = current_torsion->getD() + offset;
927  
928 <        the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a;
929 <        the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d;
928 >        exI = the_torsions[index].a;
929 >        exJ = the_torsions[index].d;
930  
931 +        
932 +        // exclude_I must always be the smaller of the pair
933 +        if( exI > exJ ){
934 +          tempEx = exI;
935 +          exI = exJ;
936 +          exJ = tempEx;
937 +        }
938 +
939 +
940 + #ifdef IS_MPI
941 +        
942 +        the_excludes[(index + tot_bonds + tot_bends)*2] =    
943 +          the_atoms[exI]->getGlobalIndex() + 1;
944 +        the_excludes[(index + tot_bonds + tot_bends)*2 + 1] =
945 +          the_atoms[exJ]->getGlobalIndex() + 1;
946 +        
947 + #else  // isn't MPI
948 +        
949 +        the_excludes[(index + tot_bonds + tot_bends)*2] =     exI + 1;
950 +        the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = exJ + 1;
951 +        // fortran indexes from 1 (hence the +1 in the indexing)
952 + #endif  //is_mpi
953 +        
954 +
955          // increment the index and repeat;
956          index++;
957        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines