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 1077 by gezelter, Wed Oct 18 19:35:07 2006 UTC vs.
Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
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, 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 64 | Line 65 | using namespace std;
65   #include "utils/StringUtils.hpp"
66  
67   using namespace std;
68 < using namespace oopse;
68 > using namespace OpenMD;
69   void createMdFile(const std::string&oldMdFileName,
70                    const std::string&newMdFileName,
71                    std::vector<int> numMol);
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 170 | Line 164 | int main(int argc, char *argv []) {
164          
165                    
166          sprintf(painCave.errMsg, "Removing %d atoms from randomly-selected\n"
167 <                "\tsites between %lf and %lf.", vacancyTargets.size(),
167 >                "\tsites between %lf and %lf.", (int) vacancyTargets.size(),
168                  vIR, vOR);
169          painCave.isFatal = 0;
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 434 | Line 425 | int main(int argc, char *argv []) {
425    delete writer;
426  
427    // cleanup a by calling sim error.....
428 <  sprintf(painCave.errMsg, "A new OOPSE MD file called \"%s\" has been "
428 >  sprintf(painCave.errMsg, "A new OpenMD file called \"%s\" has been "
429            "generated.\n", outputFileName.c_str());
430    painCave.isFatal = 0;
431    simError();
# 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 1077 by gezelter, Wed Oct 18 19:35:07 2006 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