ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/applications/nanoparticleBuilder/nanorodBuilder.cpp
(Generate patch)

Comparing branches/development/src/applications/nanoparticleBuilder/nanorodBuilder.cpp (file contents):
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC vs.
Revision 1876 by gezelter, Fri May 17 17:10:11 2013 UTC

# Line 82 | Line 82 | int main(int argc, char *argv []) {
82    std::string latticeType;
83    std::string inputFileName;
84    std::string outputFileName;
85
85    MoLocator* locator;
86    int nComponents;
87    double latticeConstant;
89  std::vector<double> lc;
90
88    RealType rodRadius;
89    RealType rodLength;
93
90    Mat3x3d hmat;
95  std::vector<Vector3d> latticePos;
96  std::vector<Vector3d> latticeOrt;
97
91    DumpWriter *writer;
92    
93    // Parse Command Line Arguments
# Line 148 | Line 141 | int main(int argc, char *argv []) {
141    Vector3d myLoc;
142    RealType myR;
143  
144 <  for (int i = 0; i < sites.size(); i++)
144 >  for (unsigned int i = 0; i < sites.size(); i++)
145      isVacancy.push_back(false);
146 <
146 >  
147    // cerr << "checking vacancyPercent" << "\n";
148    if (args_info.vacancyPercent_given) {
149      // cerr << "vacancyPercent given" << "\n";
# Line 175 | Line 168 | int main(int argc, char *argv []) {
168        }
169        if (vIR >= 0.0 && vOR <= rodRadius && vOR >= vIR) {
170          
171 <        for (int i = 0; i < sites.size(); i++) {
171 >        for (unsigned int i = 0; i < sites.size(); i++) {
172            myLoc = sites[i];
173            myR = myLoc.length();
174            if (myR >= vIR && myR <= vOR) {
# Line 195 | Line 188 | int main(int argc, char *argv []) {
188          simError();
189  
190          isVacancy.clear();
191 <        for (int i = 0; i < sites.size(); i++) {
191 >        for (unsigned int i = 0; i < sites.size(); i++) {
192            bool vac = false;
193 <          for (int j = 0; j < vacancyTargets.size(); j++) {
193 >          for (unsigned int j = 0; j < vacancyTargets.size(); j++) {
194              if (i == vacancyTargets[j]) vac = true;
195            }
196            isVacancy.push_back(vac);
# Line 222 | Line 215 | int main(int argc, char *argv []) {
215    std::vector<Component*> components = simParams->getComponents();
216    std::vector<RealType> molFractions;
217    std::vector<RealType> shellRadii;
225  std::vector<RealType> molecularMasses;
218    std::vector<int> nMol;
219    std::map<int, int> componentFromSite;
220    nComponents = components.size();
# Line 327 | Line 319 | int main(int argc, char *argv []) {
319      }
320    } else {
321  
322 <    for (int i = 0; i < shellRadii.size(); i++) {
322 >    for (unsigned int i = 0; i < shellRadii.size(); i++) {
323        if (shellRadii.at(i) > rodRadius + 1e-6 ) {
324          sprintf(painCave.errMsg, "One of the shellRadius values exceeds the rod Radius.");
325          painCave.isFatal = 1;
# Line 349 | Line 341 | int main(int argc, char *argv []) {
341      simError();
342      /* Random rod is the default case*/
343  
344 <    for (int i = 0; i < sites.size(); i++)
344 >    for (unsigned int i = 0; i < sites.size(); i++)
345        if (!isVacancy[i]) ids.push_back(i);
346      
347      std::random_shuffle(ids.begin(), ids.end());
# Line 367 | Line 359 | int main(int argc, char *argv []) {
359      // cerr << "shellRadii[0] " << shellRadii[0] << "\n";
360      // cerr << "rodRadius " << rodRadius << "\n";
361  
362 <    for (int i = 0; i < sites.size(); i++) {
362 >    for (unsigned int i = 0; i < sites.size(); i++) {
363        myLoc = sites[i];
364        myR = myLoc.length();
365        // smallestSoFar = rodRadius;  
# Line 411 | Line 403 | int main(int argc, char *argv []) {
403  
404    int l = 0;
405  
406 <  for (int i = 0; i < nComponents; i++){
406 >  for (unsigned int i = 0; i < nComponents; i++){
407      locator = new MoLocator(NewInfo->getMoleculeStamp(i),
408                              NewInfo->getForceField());
409      
410      //   cerr << "nMol = " << nMol.at(i) << "\n";
411      if (!args_info.molFraction_given) {
412 <      for (int n = 0; n < sites.size(); n++) {
412 >      for (unsigned int n = 0; n < sites.size(); n++) {
413          if (!isVacancy[n]) {
414            if (componentFromSite[n] == i) {
415              mol = NewInfo->getMoleculeByGlobalIndex(l);
# Line 427 | Line 419 | int main(int argc, char *argv []) {
419          }
420        }
421      } else {
422 <      for (int n = 0; n < nMol.at(i); n++) {
422 >      for (unsigned int n = 0; n < nMol.at(i); n++) {
423          mol = NewInfo->getMoleculeByGlobalIndex(l);
424          locator->placeMol(sites[ids[l]], orientations[ids[l]], mol);
425          l++;
# Line 488 | Line 480 | void createMdFile(const std::string&oldMdFileName,
480    newMdFile.open(newMdFileName.c_str());
481    oldMdFile.getline(buffer, MAXLEN);
482  
483 <  int i = 0;
483 >  unsigned int i = 0;
484    while (!oldMdFile.eof()) {
485  
486      //correct molecule number

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines