Changeset 80ca29 for src/Actions/FillAction/FillSphericalSurfaceAction.cpp
- Timestamp:
- Apr 6, 2012, 11:44:51 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:
- 531f27
- Parents:
- 72e4c95
- git-author:
- Frederik Heber <heber@…> (04/05/12 15:42:12)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:44:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FillAction/FillSphericalSurfaceAction.cpp
r72e4c95 r80ca29 21 21 22 22 #include "Actions/UndoRedoHelpers.hpp" 23 #include "Atom/atom.hpp" 23 24 #include "Atom/AtomicInfo.hpp" 24 25 #include "Atom/CopyAtoms/CopyAtoms_withBonds.hpp" … … 54 55 getParametersfromValueStorage(); 55 56 56 // check for selected atoms 57 // get the filler molecule and move to origin 57 // get the filler molecule 58 58 const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules(); 59 std::vector<AtomicInfo> movedatoms; 59 60 if (molecules.size() != 1) { 60 61 ELOG(1, "No exactly one molecule selected, aborting,"); … … 62 63 } 63 64 molecule *filler = *(molecules.begin()); 65 for(molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter) 66 movedatoms.push_back( AtomicInfo(*(*iter)) ); 64 67 LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms."); 65 68 … … 84 87 85 88 // create predicate, mesh, and filler 86 std::vector<AtomicInfo> clonedatoms;89 FillSphericalSurfaceState *UndoState = NULL; 87 90 bool successflag = false; 88 91 { … … 108 111 delete fillerFunction; 109 112 110 // append each cluster's atoms to clonedatoms 113 // append each cluster's atoms to clonedatoms (however not selected ones) 114 std::vector<const atom *> clonedatoms; 115 std::vector<AtomicInfo> clonedatominfos; 111 116 for (Filler::ClusterVector_t::const_iterator iter = ClonedClusters.begin(); 112 117 iter != ClonedClusters.end(); ++iter) { … … 114 119 clonedatoms.reserve(clonedatoms.size()+atoms.size()); 115 120 for (AtomIdSet::const_iterator atomiter = atoms.begin(); atomiter != atoms.end(); ++atomiter) 116 clonedatoms.push_back( AtomicInfo(*(*atomiter)) ); 121 if (!filler->containsAtom(*atomiter)) { 122 clonedatoms.push_back( *atomiter ); 123 clonedatominfos.push_back( AtomicInfo(*(*atomiter)) ); 124 } 117 125 } 126 std::vector< BondInfo > clonedbonds; 127 StoreBondInformationFromAtoms(clonedatoms, clonedbonds); 128 LOG(2, "DEBUG: There are " << clonedatominfos.size() << " newly created atoms with " 129 << clonedbonds.size()/2 << " bonds."); 130 118 131 if (!successflag) { 119 ELOG(1, "Insertion failed, removing inserted clusters again.");120 RemoveAtomsFromAtomicInfo(clonedatom s);132 ELOG(1, "Insertion failed, removing inserted clusters, translating original one back"); 133 RemoveAtomsFromAtomicInfo(clonedatominfos); 121 134 clonedatoms.clear(); 135 SetAtomsFromAtomicInfo(movedatoms); 136 } else { 137 std::vector<Vector> MovedToVector(filler->size(), zeroVec); 138 std::transform(filler->begin(), filler->end(), MovedToVector.begin(), 139 boost::bind(&AtomInfo::getPosition, _1) ); 140 UndoState = new FillSphericalSurfaceState(clonedatominfos,clonedbonds,movedatoms,MovedToVector,params); 122 141 } 123 142 } 124 125 143 126 144 // remove … … 131 149 132 150 if (successflag) 133 return Action::state_ptr( new FillSphericalSurfaceState(clonedatoms,params));151 return Action::state_ptr(UndoState); 134 152 else 135 153 return Action::failure; … … 141 159 // remove all created atoms 142 160 RemoveAtomsFromAtomicInfo(state->clonedatoms); 161 // add the original cluster 162 SetAtomsFromAtomicInfo(state->movedatoms); 143 163 144 164 return Action::state_ptr(_state); … … 148 168 FillSphericalSurfaceState *state = assert_cast<FillSphericalSurfaceState*>(_state.get()); 149 169 150 if (AddAtomsFromAtomicInfo(state->clonedatoms)) 170 // place filler cluster again at new spot 171 ResetAtomPosition(state->movedatoms, state->MovedToVector); 172 173 // re-create all clusters 174 bool statusflag = AddAtomsFromAtomicInfo(state->clonedatoms); 175 176 // re-create the bonds 177 statusflag = statusflag && AddBondsFromBondInfo(state->clonedbonds); 178 if (statusflag) 151 179 return Action::state_ptr(_state); 152 180 else
Note:
See TracChangeset
for help on using the changeset viewer.
