[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[97ebf8] | 8 | /*
|
---|
| 9 | * MolecularVolumeAction.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: May 12, 2010
|
---|
| 12 | * Author: heber
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[bf3817] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[ad011c] | 20 | #include "CodePatterns/MemDebug.hpp"
|
---|
[112b09] | 21 |
|
---|
[97ebf8] | 22 | #include "boundary.hpp"
|
---|
| 23 | #include "config.hpp"
|
---|
| 24 | #include "molecule.hpp"
|
---|
| 25 | #include "linkedcell.hpp"
|
---|
[ad011c] | 26 | #include "CodePatterns/Log.hpp"
|
---|
| 27 | #include "CodePatterns/Verbose.hpp"
|
---|
[34c43a] | 28 | #include "PointCloudAdaptor.hpp"
|
---|
[88b400] | 29 | #include "tesselation.hpp"
|
---|
[97ebf8] | 30 | #include "World.hpp"
|
---|
| 31 |
|
---|
| 32 | #include <iostream>
|
---|
| 33 | #include <string>
|
---|
| 34 |
|
---|
| 35 | using namespace std;
|
---|
| 36 |
|
---|
[0b2ce9] | 37 | #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
|
---|
[5cb3cb] | 38 |
|
---|
[0b2ce9] | 39 | // and construct the stuff
|
---|
[9ee38b] | 40 | #include "MolecularVolumeAction.def"
|
---|
[0b2ce9] | 41 | #include "Action_impl_pre.hpp"
|
---|
[97ebf8] | 42 |
|
---|
[0b2ce9] | 43 | /** =========== define the function ====================== */
|
---|
[9ee38b] | 44 | Action::state_ptr AnalysisMolecularVolumeAction::performCall() {
|
---|
[0c9cc3] | 45 | // obtain information
|
---|
[0b2ce9] | 46 | getParametersfromValueStorage();
|
---|
[97ebf8] | 47 |
|
---|
[0c9cc3] | 48 | // execute action
|
---|
| 49 | for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
|
---|
| 50 | molecule *mol = iter->second;
|
---|
[97ebf8] | 51 | class Tesselation *TesselStruct = NULL;
|
---|
| 52 | const LinkedCell *LCList = NULL;
|
---|
| 53 | DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
|
---|
[caa06ef] | 54 | PointCloudAdaptor< molecule > cloud(mol, mol->name);
|
---|
[34c43a] | 55 | LCList = new LinkedCell(cloud, 10.);
|
---|
[97ebf8] | 56 | config * const configuration = World::getInstance().getConfig();
|
---|
[25b9d2] | 57 | //Boundaries *BoundaryPoints = NULL;
|
---|
[bdc91e] | 58 | //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
|
---|
[97ebf8] | 59 | FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL);
|
---|
| 60 | //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
|
---|
| 61 | double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, NULL);
|
---|
| 62 | double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
|
---|
| 63 | DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
|
---|
| 64 | DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
|
---|
| 65 | delete(TesselStruct);
|
---|
| 66 | delete(LCList);
|
---|
| 67 | }
|
---|
[0c9cc3] | 68 | return Action::success;
|
---|
[97ebf8] | 69 | }
|
---|
| 70 |
|
---|
[9ee38b] | 71 | Action::state_ptr AnalysisMolecularVolumeAction::performUndo(Action::state_ptr _state) {
|
---|
[0c9cc3] | 72 | return Action::success;
|
---|
[97ebf8] | 73 | }
|
---|
| 74 |
|
---|
[9ee38b] | 75 | Action::state_ptr AnalysisMolecularVolumeAction::performRedo(Action::state_ptr _state){
|
---|
[0c9cc3] | 76 | return Action::success;
|
---|
[97ebf8] | 77 | }
|
---|
| 78 |
|
---|
[9ee38b] | 79 | bool AnalysisMolecularVolumeAction::canUndo() {
|
---|
[0c9cc3] | 80 | return true;
|
---|
[97ebf8] | 81 | }
|
---|
| 82 |
|
---|
[9ee38b] | 83 | bool AnalysisMolecularVolumeAction::shouldUndo() {
|
---|
[0c9cc3] | 84 | return true;
|
---|
[97ebf8] | 85 | }
|
---|
[0b2ce9] | 86 | /** =========== end of function ====================== */
|
---|