--- trunk/src/applications/staticProps/NanoVolume.cpp 2010/01/15 20:46:49 1404 +++ trunk/src/applications/staticProps/NanoVolume.cpp 2013/11/05 18:33:42 1942 @@ -34,21 +34,23 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [4] , Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). * * - * * NanoVolume.cpp * * Created by Charles F. Vardeman II on 14 Dec 2006. * @author Charles F. Vardeman II - * @version $Id: NanoVolume.cpp,v 1.10 2009-11-25 20:01:59 gezelter Exp $ + * @version $Id$ * */ #include "applications/staticProps/NanoVolume.hpp" +#if defined(HAVE_QHULL) #include "math/ConvexHull.hpp" #include "math/AlphaHull.hpp" +#endif #include "utils/simError.h" #include "io/DumpReader.hpp" #include "primitives/Molecule.hpp" @@ -59,35 +61,33 @@ NanoVolume::NanoVolume(SimInfo* info, NanoVolume::NanoVolume(SimInfo* info, const std::string& filename, const std::string& sele) - : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info) { + : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), + seleMan_(info) { + setOutputName(getPrefix(filename) + ".avol"); + + osq.open(getOutputFileName().c_str()); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } frameCounter_ = 0; - totalVolume_ = 0.0; } void NanoVolume::process() { #if defined(HAVE_QHULL) Molecule* mol; - Atom* atom; RigidBody* rb; - int myIndex; SimInfo::MoleculeIterator mi; Molecule::RigidBodyIterator rbIter; - Molecule::AtomIterator ai; StuntDouble* sd; Vector3d vec; - int i,j; + int i; -#ifdef HAVE_QHULL - //ConvexHull* thishull = new ConvexHull(); - AlphaHull* thishull = new AlphaHull(2.0); -#endif - + AlphaHull* thishull = new AlphaHull(2.0); + //ConvexHull* thishull = new ConvexHull(); + DumpReader reader(info_, dumpFilename_); int nFrames = reader.getNFrames(); frameCounter_ = 0; @@ -98,6 +98,7 @@ void NanoVolume::process() { reader.readFrame(istep); frameCounter_++; currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); + RealType time = currentSnapshot_->getTime(); // Clear pos vector between each frame. theAtoms_.clear(); @@ -106,7 +107,7 @@ void NanoVolume::process() { seleMan_.setSelectionSet(evaluator_.evaluate()); } - // update the positions of atoms which belong to the rigidbodies + // update the positions of atoms which belong to the rigid bodies for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { @@ -119,43 +120,35 @@ void NanoVolume::process() { // outer loop is over the selected StuntDoubles: for (sd = seleMan_.beginSelected(i); sd != NULL; - sd = seleMan_.nextSelected(i)) { - - theAtoms_.push_back(sd); - myIndex = sd->getGlobalIndex(); - + sd = seleMan_.nextSelected(i)) { + theAtoms_.push_back(sd); } - /* + /* variant below for signle atoms, not StuntDoubles: 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); - } - } + 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. thishull->computeHull(theAtoms_); - // totalVolume_ += hull->getVolume(); - } - //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()){ - osq << avgVolume << std::endl; + RealType volume = thishull->getVolume(); + osq.precision(7); + if (osq.is_open()){ + osq << time << "\t" << volume << std::endl; + } } osq.close(); -*/ + #else sprintf(painCave.errMsg, "NanoVolume: qhull support was not compiled in!\n"); painCave.isFatal = 1; simError(); - #endif }