--- trunk/src/applications/staticProps/NanoVolume.cpp 2007/12/06 20:40:38 1199 +++ trunk/src/applications/staticProps/NanoVolume.cpp 2008/09/14 01:32:26 1293 @@ -45,12 +45,13 @@ * * Created by Charles F. Vardeman II on 14 Dec 2006. * @author Charles F. Vardeman II - * @version $Id: NanoVolume.cpp,v 1.5 2007-12-06 20:40:30 chuckv Exp $ + * @version $Id: NanoVolume.cpp,v 1.7 2008-09-14 01:32:23 chuckv Exp $ * */ #include "applications/staticProps/NanoVolume.hpp" #include "math/ConvexHull.hpp" +//#include "math/AlphaShape.hpp" #include "utils/simError.h" #include "io/DumpReader.hpp" #include "primitives/Molecule.hpp" @@ -86,17 +87,18 @@ void NanoVolume::process() { int i,j; #ifdef HAVE_QHULL - ConvexHull* hull = new ConvexHull(); + ConvexHull* thishull = new ConvexHull(); #endif #ifdef HAVE_CGAL - AlphaShape* hull = new AlphaShape(); + // AlphaShape* hull = new AlphaShape(); + ConvexHull* thishull = new ConvexHull(); #endif DumpReader reader(info_, dumpFilename_); int nFrames = reader.getNFrames(); frameCounter_ = 0; - pos_.reserve(info_->getNGlobalAtoms()); + theAtoms_.reserve(info_->getNGlobalAtoms()); for (int istep = 0; istep < nFrames; istep += step_) { reader.readFrame(istep); @@ -104,7 +106,7 @@ void NanoVolume::process() { currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); // Clear pos vector between each frame. - pos_.clear(); + theAtoms_.clear(); if (evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); @@ -121,22 +123,31 @@ void NanoVolume::process() { } // outer loop is over the selected StuntDoubles: - + /* for (sd = seleMan_.beginSelected(i); sd != NULL; - sd = seleMan_.nextSelected(i)) { + sd = seleMan_.nextSelected(i)) { pos_.push_back(sd->getPos()); myIndex = sd->getGlobalIndex(); } + */ + for (mol = info_->beginMolecule(mi); mol != NULL; + mol = info_->nextMolecule(mi)) { + for (atom = mol->beginAtom(ai); atom != NULL; + atom = mol->nextAtom(ai)) { + theAtoms_.push_back(atom); + } + } + // Generate convex hull for this frame. - hull->genHull(pos_); - totalVolume_ += hull->getVolume(); + thishull->computeHull(theAtoms_); + // totalVolume_ += hull->getVolume(); } - RealType avgVolume = totalVolume_/(RealType) frameCounter_; + //RealType avgVolume = totalVolume_/(RealType) frameCounter_; //std::cout.precision(7); //std::cout << avgVolume << std::endl; - +/* std::ofstream osq(getOutputFileName().c_str()); osq.precision(7); if (osq.is_open()){ @@ -144,9 +155,12 @@ void NanoVolume::process() { } osq.close(); +*/ #else sprintf(painCave.errMsg, "NanoVolume: Neither CGAL nor qhull support was compiled in!\n"); painCave.isFatal = 1; simError(); + #endif + }