Changeset cb7676 for src/Actions/FillAction/FillSphericalSurfaceAction.cpp
- Timestamp:
- Apr 6, 2012, 11:44:09 AM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, Candidate_v1.7.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 4187a7
- Parents:
- 93eae36
- git-author:
- Frederik Heber <heber@…> (04/04/12 11:16:14)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:44:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FillAction/FillSphericalSurfaceAction.cpp
r93eae36 rcb7676 20 20 #include "CodePatterns/MemDebug.hpp" 21 21 22 #include "Atom/atom.hpp" 23 #include "Atom/CopyAtoms/CopyAtoms_Simple.hpp" 22 #include "Atom/CopyAtoms/CopyAtoms_withBonds.hpp" 24 23 #include "CodePatterns/Log.hpp" 25 24 #include "Filling/Cluster.hpp" 26 25 #include "Filling/Filler.hpp" 27 26 #include "Filling/Inserter/Inserter.hpp" 28 #include "Filling/Inserter/S impleInserter.hpp"27 #include "Filling/Inserter/SurfaceInserter.hpp" 29 28 #include "Filling/Mesh/MeshAdaptor.hpp" 30 29 #include "Filling/Predicates/IsVoidNode_FillPredicate.hpp" 30 #include "molecule.hpp" 31 31 #include "Shapes/BaseShapes.hpp" 32 32 #include "World.hpp" … … 49 49 /** =========== define the function ====================== */ 50 50 Action::state_ptr FillSphericalSurfaceAction::performCall() { 51 typedef std::vector<atom*> AtomVector;52 53 51 // obtain information 54 52 getParametersfromValueStorage(); 55 53 56 54 // check for selected atoms 57 std::vector<atom *> atoms(World::getInstance().getSelectedAtoms()); 58 if (atoms.size() == 0) { 59 ELOG(1, "There are no atoms selected."); 55 // get the filler molecule and move to origin 56 const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules(); 57 if (molecules.size() != 1) { 58 ELOG(1, "No exactly one molecule selected, aborting,"); 60 59 return Action::failure; 61 60 } 62 AtomIdSet atomIds; 63 BOOST_FOREACH(atom * const _atom, atoms) { 64 atomIds.insert( _atom ); 61 molecule *filler = *(molecules.begin()); 62 LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms."); 63 64 // center filler's tip at origin 65 Vector max; 66 filler->CenterEdge(&max); 67 68 // determine center with respect to alignment axis 69 Vector sum = zeroVec; 70 for (molecule::iterator it2=filler->begin();it2 !=filler->end();++it2) { 71 const Vector helper = (**it2).getPosition().partition(params.AlignedAxis).second; 72 sum += helper; 73 } 74 sum *= 1./filler->size(); 75 76 // translate molecule's closest atom to origin (such that is resides on the filler spot) 77 LOG(1, "DEBUG: molecule is off Alignment axis by " << sum << ", shifting ..."); 78 { 79 Vector translater = -1.*sum; 80 filler->Translate(&translater); 65 81 } 66 82 … … 78 94 Mesh *mesh = new MeshAdaptor(func); 79 95 Inserter *inserter = new Inserter( 80 Inserter::impl_ptr(new S impleInserter));96 Inserter::impl_ptr(new SurfaceInserter(s, params.AlignedAxis))); 81 97 82 98 // fill 83 99 { 84 100 Filler *fillerFunction = new Filler(*mesh, *voidnode_predicate, *inserter); 85 ClusterInterface::Cluster_impl cluster( new Cluster( atomIds.getAtomIds(), Sphere()) ); //TODO: calculate true bounding box of atomIds86 CopyAtoms_ SimplecopyMethod;101 ClusterInterface::Cluster_impl cluster( new Cluster( filler->getAtomIds(), filler->getBoundingShape() ) ); 102 CopyAtoms_withBonds copyMethod; 87 103 successflag = (*fillerFunction)(copyMethod, cluster); 88 104 delete fillerFunction;
Note:
See TracChangeset
for help on using the changeset viewer.
