Ignore:
Timestamp:
Jun 11, 2010, 3:07:11 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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, 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:
77b2d7
Parents:
9d2a92
Message:

Case 'R' is now handled by CommandLineUI.

  • again, for each atom to remove all molecules are gone through and it is tried to be erased (due to storing done molecule- not atom-wise)
  • TESTFIX: "--position" introduced
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r9d2a92 re2b47c  
    1010#include "Descriptors/AtomDescriptor.hpp"
    1111#include "log.hpp"
     12#include "molecule.hpp"
    1213#include "vector.hpp"
    1314#include "verbose.hpp"
     
    3536  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3637  double radius = 0.;
    37   atom *first = NULL;
     38  Vector point;
    3839
    3940  dialog->queryDouble(NAME, &radius, MapOfActions::getInstance().getDescription(NAME));
    40   dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id"));
     41  dialog->queryVector("position", &point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));
    4142
    4243  if(dialog->display()) {
    4344    delete dialog;
    44     DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << first->nr << " with radius " << radius << "." << endl);
     45    DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point << " with radius " << radius << "." << endl);
    4546    vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
    46     vector<atom*>::iterator AtomAdvancer = AllAtoms.begin();
    47     for (vector<atom*>::iterator AtomRunner = AtomAdvancer; AtomRunner != AllAtoms.end(); ) {
    48       ++AtomAdvancer;
    49       if (first != *AtomRunner) // dont't destroy reference ...
    50         if (first->x.DistanceSquared((*AtomRunner)->x) > radius*radius) // distance to first above radius ...
    51           World::getInstance().destroyAtom(*AtomRunner);
     47    vector<molecule *> molecules = World::getInstance().getAllMolecules();
     48    for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
     49      if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ...
     50        // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save)
     51        for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter)
     52          (*iter)->erase(*AtomRunner);
     53        World::getInstance().destroyAtom(*AtomRunner);
     54      }
    5255    }
    53     World::getInstance().destroyAtom(first);
    5456    return Action::success;
    5557  } else {
Note: See TracChangeset for help on using the changeset viewer.