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 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 120 | Line 120 | int main(int argc, char *argv []) {
120    vector<Vector3d> orientations = nanoParticle.getOrientations();
121  
122  
123 <  std::vector<int> vacancyTargets;
123 >  std::vector<std::size_t> vacancyTargets;
124    vector<bool> isVacancy;
125    
126    Vector3d myLoc;
# Line 131 | Line 131 | int main(int argc, char *argv []) {
131  
132    if (args_info.vacancyPercent_given) {
133      if (args_info.vacancyPercent_arg < 0.0 || args_info.vacancyPercent_arg > 100.0) {
134 <      sprintf(painCave.errMsg, "vacancyPercent was set to a non-sensical value.");
134 >      sprintf(painCave.errMsg,
135 >              "vacancyPercent was set to a non-sensical value.");
136        painCave.isFatal = 1;
137        simError();
138      } else {
# Line 150 | Line 151 | int main(int argc, char *argv []) {
151        }
152        if (vIR >= 0.0 && vOR <= particleRadius && vOR >= vIR) {
153          
154 <        for (unsigned int i = 0; i < sites.size(); i++) {
154 >        for (std::size_t i = 0; i < sites.size(); i++) {
155            myLoc = sites[i];
156            myR = myLoc.length();
157            if (myR >= vIR && myR <= vOR) {
# Line 167 | Line 168 | int main(int argc, char *argv []) {
168                  "\tsites between %lf and %lf.", (int) vacancyTargets.size(),
169                  vIR, vOR);
170          painCave.isFatal = 0;
171 +        painCave.severity = OPENMD_INFO;
172          simError();
173  
174          isVacancy.clear();
175 <        for (unsigned int i = 0; i < sites.size(); i++) {
175 >        for (std::size_t i = 0; i < sites.size(); i++) {
176            bool vac = false;
177 <          for (unsigned int j = 0; j < vacancyTargets.size(); j++) {
177 >          for (std::size_t j = 0; j < vacancyTargets.size(); j++) {
178              if (i == vacancyTargets[j]) vac = true;
179            }
180            isVacancy.push_back(vac);
# Line 188 | Line 190 | int main(int argc, char *argv []) {
190    }
191  
192    /* Get number of lattice sites */
193 <  int nSites = sites.size() - vacancyTargets.size();
193 >  std::size_t nSites = sites.size() - vacancyTargets.size();
194  
195    std::vector<Component*> components = simParams->getComponents();
196    std::vector<RealType> molFractions;
# Line 269 | Line 271 | int main(int argc, char *argv []) {
271        totalFraction += molFractions.at(i);
272      }
273      if (abs(totalFraction - 1.0) > 1e-6) {
274 <      sprintf(painCave.errMsg, "The sum of molFractions was not close enough to 1.0");
274 >      sprintf(painCave.errMsg,
275 >              "The sum of molFractions was not close enough to 1.0");
276        painCave.isFatal = 1;
277        simError();
278      }
# Line 283 | Line 286 | int main(int argc, char *argv []) {
286      
287      // recompute actual mol fractions and perform final sanity check:
288      
289 <    int totalMolecules = 0;
289 >    std::size_t totalMolecules = 0;
290      for (int i=0; i < nComponents; i++) {
291        molFractions[i] = (RealType)(nMol.at(i))/(RealType)nSites;
292        totalMolecules += nMol.at(i);
293      }
294      
295      if (totalMolecules != nSites) {
296 <      sprintf(painCave.errMsg, "Computed total number of molecules is not equal "
296 >      sprintf(painCave.errMsg,
297 >              "Computed total number of molecules is not equal "
298                "to the number of lattice sites!");
299        painCave.isFatal = 1;
300        simError();
# Line 299 | Line 303 | int main(int argc, char *argv []) {
303  
304      for (unsigned int i = 0; i < shellRadii.size(); i++) {
305        if (shellRadii.at(i) > particleRadius + 1e-6 ) {
306 <        sprintf(painCave.errMsg, "One of the shellRadius values exceeds the particle Radius.");
306 >        sprintf(painCave.errMsg,
307 >                "One of the shellRadius values exceeds the particle Radius.");
308          painCave.isFatal = 1;
309          simError();
310        }
311        if (shellRadii.at(i) <= 0.0 ) {
312 <        sprintf(painCave.errMsg, "One of the shellRadius values is smaller than zero!");
312 >        sprintf(painCave.errMsg,
313 >                "One of the shellRadius values is smaller than zero!");
314          painCave.isFatal = 1;
315          simError();
316        }
# Line 315 | Line 321 | int main(int argc, char *argv []) {
321    if ((int)args_info.molFraction_given){
322      sprintf(painCave.errMsg, "Creating a randomized spherical nanoparticle.");
323      painCave.isFatal = 0;
324 +    painCave.severity = OPENMD_INFO;
325      simError();
326      /* Random particle is the default case*/
327  
# Line 326 | Line 333 | int main(int argc, char *argv []) {
333    } else{
334      sprintf(painCave.errMsg, "Creating a core-shell spherical nanoparticle.");
335      painCave.isFatal = 0;
336 +    painCave.severity = OPENMD_INFO;
337      simError();
338  
339      RealType smallestSoFar;
# Line 428 | Line 436 | int main(int argc, char *argv []) {
436    sprintf(painCave.errMsg, "A new OpenMD file called \"%s\" has been "
437            "generated.\n", outputFileName.c_str());
438    painCave.isFatal = 0;
439 +  painCave.severity = OPENMD_INFO;
440    simError();
441    return 0;
442   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines