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

Comparing trunk/OOPSE/utils/sysbuilder/latticeBilayer.cpp (file contents):
Revision 855 by mmeineke, Thu Nov 6 22:01:37 2003 UTC vs.
Revision 943 by mmeineke, Wed Jan 14 16:28:37 2004 UTC

# Line 549 | Line 549 | int main(int argC,char* argV[]){
549    simInit->setSimInfo( mainInfo );
550    simInit->suspendInit();
551    simInit->parseFile( inName );
552 <   simInit->createSim();
552 >  simInit->createSim();
553  
554    delete simInit;
555  
# Line 581 | Line 581 | int buildLatticeBilayer(double aLat,
581    double *posX, *posY, *posZ;
582    double pos[3], posA[3], posB[3];
583  
584 <  const double waterFudge = 5.0;
584 >  const double waterFudge = 6.0;
585  
586    int i,j,k,l;
587    int nAtoms, atomIndex, molIndex, molID;
# Line 597 | Line 597 | int buildLatticeBilayer(double aLat,
597    int targetWaters;
598    
599    Atom** atoms;
600  SimInfo* simnfo;
600    SimInfo* testInfo;
601    coord testSite;
602    SimState* theConfig;
# Line 612 | Line 611 | int buildLatticeBilayer(double aLat,
611    int targetNlipids, targetNwaters;
612    double targetWaterLipidRatio;
613    double maxZ, minZ, zHeight;
615  double maxY, minY;
616  double maxX, minX;
614    
615    molStart = NULL;
616  
620  // create the simInfo objects
621
622  simnfo = new SimInfo;
623
617    // set the the lipidStamp
618  
619    foundLipid = 0;
# Line 694 | Line 687 | int buildLatticeBilayer(double aLat,
687    }
688    zHeight = maxZ - minZ;
689      
690 <  nCells = (int) sqrt( (double)targetNlipids * bLat / (4.0 * aLat) );
690 >  std::cerr << "aLat = " << aLat << "; bLat = " << bLat << "\n";
691 >
692 >  nCells = (int)ceil( sqrt( (double)targetNlipids * bLat / (4.0 * aLat) ));
693  
694    nx = nCells;
695    ny = (int) ((double)nCells  * aLat / bLat);
696  
697 +  std::cerr << "nx = " << nx << "; ny = " << ny << "\n";
698 +
699    boxX = nx * aLat;
700    boxY = ny * bLat;  
701  
# Line 789 | Line 786 | int buildLatticeBilayer(double aLat,
786  
787    atoms[0]->getPos( myPos );
788  
792  maxX = myPos[0];
793  minX = myPos[0];
794
795  maxY = myPos[1];
796  minY = myPos[1];
797
789    maxZ = myPos[2];
790    minZ = myPos[2];
791  
792    for(i=0;i<nAtoms;i++){
793      atoms[i]->getPos( myPos );
803    minX = (minX > myPos[0]) ? myPos[0] : minX;
804    maxX = (maxX < myPos[0]) ? myPos[0] : maxX;
794  
806    minY = (minY > myPos[1]) ? myPos[1] : minY;
807    maxY = (maxY < myPos[1]) ? myPos[1] : maxY;
808
795      minZ = (minZ > myPos[2]) ? myPos[2] : minZ;
796      maxZ = (maxZ < myPos[2]) ? myPos[2] : maxZ;
797    }
798  
813  boxX = (maxX - minX)+2.0;
814  boxY = (maxY - minY)+2.0;
799    boxZ = (maxZ - minZ)+2.0;
800  
801    double centerX, centerY, centerZ;
802    
803 <  centerX = ((maxX - minX) / 2.0) + minX;
804 <  centerY = ((maxY - minY) / 2.0) + minY;
803 >  centerX = (boxX / 2.0);
804 >  centerY = (boxY / 2.0);
805    centerZ = ((maxZ - minZ) / 2.0) + minZ;
806  
807    // set up water coordinates
# Line 904 | Line 888 | int buildLatticeBilayer(double aLat,
888    
889    // create the real Atom arrays
890  
891 <  theConfig = simnfo->getConfiguration();
891 >  delete[] (mainInfo->atoms);
892 >  theConfig = mainInfo->getConfiguration();
893    theConfig->createArrays( nAtoms );
894 <  simnfo->atoms = new Atom*[nAtoms];
895 <  simnfo->n_atoms = nAtoms;
896 <  atoms = simnfo->atoms;
894 >  mainInfo->atoms = new Atom*[nAtoms];
895 >  mainInfo->n_atoms = nAtoms;
896 >  atoms = mainInfo->atoms;
897  
898    // wrap back to <0,0,0> as center
899  
# Line 927 | Line 912 | int buildLatticeBilayer(double aLat,
912    Hmat[2][2] = boxZ;
913    
914    mainInfo->setBoxM( Hmat );
930  simnfo->setBoxM( Hmat );
915  
916    for(j=0;j<nLipids;j++){
917  
# Line 935 | Line 919 | int buildLatticeBilayer(double aLat,
919      lipidSites[j].pos[1] -= centerY;
920      lipidSites[j].pos[2] -= centerZ;
921  
922 <    simnfo->wrapVector( lipidSites[j].pos );
922 >    mainInfo->wrapVector( lipidSites[j].pos );
923    }
924  
925    for(j=0;j<nWaters;j++){
# Line 944 | Line 928 | int buildLatticeBilayer(double aLat,
928      waterSites[j].pos[1] -= centerY;
929      waterSites[j].pos[2] -= centerZ;
930  
931 <    simnfo->wrapVector( waterSites[j].pos );
931 >    mainInfo->wrapVector( waterSites[j].pos );
932    }
933  
934    // initialize lipid positions
# Line 966 | Line 950 | int buildLatticeBilayer(double aLat,
950      molIndex++;
951    }
952  
969  strcpy( simnfo->sampleName, mainInfo->sampleName );
970  strcpy( simnfo->finalName, mainInfo->finalName );
971
953    // set up the writer and write out
954    
955 <  writer = new DumpWriter( simnfo );
955 >  writer = new DumpWriter( mainInfo );
956    writer->writeFinal( 0.0 );
957  
958    std::cout << "\n"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines