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

Comparing trunk/src/applications/nanoparticleBuilder/nanoparticleBuilder.cpp (file contents):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <cstdlib>
# Line 71 | Line 72 | int main(int argc, char *argv []) {
72  
73   int main(int argc, char *argv []) {
74    
74  //register force fields
75  registerForceFields();
75    registerLattice();
76    
77    gengetopt_args_info args_info;
78    std::string latticeType;
79    std::string inputFileName;
80    std::string outputFileName;
82
81    MoLocator* locator;
82    int nComponents;
83    double latticeConstant;
86  std::vector<double> lc;
87
84    RealType particleRadius;
89
85    Mat3x3d hmat;
91  std::vector<Vector3d> latticePos;
92  std::vector<Vector3d> latticeOrt;
93
86    DumpWriter *writer;
87    
88    // Parse Command Line Arguments
# Line 126 | Line 118 | int main(int argc, char *argv []) {
118    /* Build a lattice and get lattice points for this lattice constant */
119    vector<Vector3d> sites = nanoParticle.getSites();
120    vector<Vector3d> orientations = nanoParticle.getOrientations();
121 +
122 +
123    std::vector<int> vacancyTargets;
124    vector<bool> isVacancy;
125    
126    Vector3d myLoc;
127    RealType myR;
128  
129 <  for (int i = 0; i < sites.size(); i++)
129 >  for (unsigned int i = 0; i < sites.size(); i++)
130      isVacancy.push_back(false);
131  
132    if (args_info.vacancyPercent_given) {
# Line 156 | Line 150 | int main(int argc, char *argv []) {
150        }
151        if (vIR >= 0.0 && vOR <= particleRadius && vOR >= vIR) {
152          
153 <        for (int i = 0; i < sites.size(); i++) {
153 >        for (unsigned int i = 0; i < sites.size(); i++) {
154            myLoc = sites[i];
155            myR = myLoc.length();
156            if (myR >= vIR && myR <= vOR) {
# Line 176 | Line 170 | int main(int argc, char *argv []) {
170          simError();
171  
172          isVacancy.clear();
173 <        for (int i = 0; i < sites.size(); i++) {
173 >        for (unsigned int i = 0; i < sites.size(); i++) {
174            bool vac = false;
175 <          for (int j = 0; j < vacancyTargets.size(); j++) {
175 >          for (unsigned int j = 0; j < vacancyTargets.size(); j++) {
176              if (i == vacancyTargets[j]) vac = true;
177            }
178            isVacancy.push_back(vac);
# Line 199 | Line 193 | int main(int argc, char *argv []) {
193    std::vector<Component*> components = simParams->getComponents();
194    std::vector<RealType> molFractions;
195    std::vector<RealType> shellRadii;
202  std::vector<RealType> molecularMasses;
196    std::vector<int> nMol;
197    std::map<int, int> componentFromSite;
198    nComponents = components.size();
# Line 304 | Line 297 | int main(int argc, char *argv []) {
297      }
298    } else {
299  
300 <    for (int i = 0; i < shellRadii.size(); i++) {
300 >    for (unsigned int i = 0; i < shellRadii.size(); i++) {
301        if (shellRadii.at(i) > particleRadius + 1e-6 ) {
302          sprintf(painCave.errMsg, "One of the shellRadius values exceeds the particle Radius.");
303          painCave.isFatal = 1;
# Line 325 | Line 318 | int main(int argc, char *argv []) {
318      simError();
319      /* Random particle is the default case*/
320  
321 <    for (int i = 0; i < sites.size(); i++)
321 >    for (unsigned int i = 0; i < sites.size(); i++)
322        if (!isVacancy[i]) ids.push_back(i);
323      
324      std::random_shuffle(ids.begin(), ids.end());
# Line 340 | Line 333 | int main(int argc, char *argv []) {
333      nMol.clear();
334      nMol.resize(nComponents);
335  
336 <    for (int i = 0; i < sites.size(); i++) {
336 >    for (unsigned int i = 0; i < sites.size(); i++) {
337        myLoc = sites[i];
338        myR = myLoc.length();
339        smallestSoFar = particleRadius;      
# Line 364 | Line 357 | int main(int argc, char *argv []) {
357    //creat new .md file on fly which corrects the number of molecule    
358    createMdFile(inputFileName, outputFileName, nMol);
359    
360 <  if (oldInfo != NULL)
368 <    delete oldInfo;
360 >  delete oldInfo;
361    
362    SimCreator newCreator;
363    SimInfo* NewInfo = newCreator.createSim(outputFileName, false);
# Line 376 | Line 368 | int main(int argc, char *argv []) {
368    mol = NewInfo->beginMolecule(mi);
369  
370    int l = 0;
379  int whichSite = 0;
371  
372    for (int i = 0; i < nComponents; i++){
373      locator = new MoLocator(NewInfo->getMoleculeStamp(i),
374                              NewInfo->getForceField());
375      
376      if (!args_info.molFraction_given) {
377 <      for (int n = 0; n < sites.size(); n++) {
377 >      for (unsigned int n = 0; n < sites.size(); n++) {
378          if (!isVacancy[n]) {
379            if (componentFromSite[n] == i) {
380              mol = NewInfo->getMoleculeByGlobalIndex(l);
# Line 454 | Line 445 | void createMdFile(const std::string&oldMdFileName,
445    newMdFile.open(newMdFileName.c_str());
446    oldMdFile.getline(buffer, MAXLEN);
447  
448 <  int i = 0;
448 >  unsigned int i = 0;
449    while (!oldMdFile.eof()) {
450  
451      //correct molecule number

Comparing trunk/src/applications/nanoparticleBuilder/nanoparticleBuilder.cpp (property svn:keywords):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines