/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * MolecularVolumeAction.cpp * * Created on: May 12, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "config.hpp" #include "CodePatterns/Log.hpp" #include "CodePatterns/Verbose.hpp" #include "LinkedCell/linkedcell.hpp" #include "LinkedCell/PointCloudAdaptor.hpp" #include "molecule.hpp" #include "Tesselation/boundary.hpp" #include "Tesselation/tesselation.hpp" #include "World.hpp" #include #include #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" using namespace MoleCuilder; // and construct the stuff #include "MolecularVolumeAction.def" #include "Action_impl_pre.hpp" /** =========== define the function ====================== */ Action::state_ptr AnalysisMolecularVolumeAction::performCall() { // obtain information getParametersfromValueStorage(); // execute action for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { molecule *mol = iter->second; class Tesselation *TesselStruct = NULL; const LinkedCell_deprecated *LCList = NULL; LOG(0, "Evaluating volume of the convex envelope."); PointCloudAdaptor< molecule > cloud(mol, mol->name); LCList = new LinkedCell_deprecated(cloud, 10.); config * const configuration = World::getInstance().getConfig(); //Boundaries *BoundaryPoints = NULL; //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]); FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL); //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]); double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, NULL); double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); LOG(0, "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3."); LOG(0, "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3."); delete(TesselStruct); delete(LCList); } return Action::success; } Action::state_ptr AnalysisMolecularVolumeAction::performUndo(Action::state_ptr _state) { return Action::success; } Action::state_ptr AnalysisMolecularVolumeAction::performRedo(Action::state_ptr _state){ return Action::success; } bool AnalysisMolecularVolumeAction::canUndo() { return true; } bool AnalysisMolecularVolumeAction::shouldUndo() { return true; } /** =========== end of function ====================== */