Changeset e6317b for src/Actions/AtomAction
- Timestamp:
- Jun 16, 2010, 12:24:21 PM (15 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, 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:
- 492279
- Parents:
- f8e486 (diff), 980dd6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Actions/AtomAction
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/AddAction.cpp
rf8e486 re6317b 9 9 10 10 #include "Actions/AtomAction/AddAction.hpp" 11 #include "CommandLineParser.hpp"12 11 #include "atom.hpp" 13 12 #include "element.hpp" 14 13 #include "log.hpp" 15 #include " periodentafel.hpp"14 #include "molecule.hpp" 16 15 #include "vector.hpp" 17 16 #include "verbose.hpp" … … 38 37 Action::state_ptr AtomAddAction::performCall() { 39 38 Dialog *dialog = UIFactory::getInstance().makeDialog(); 40 int Z = -1;39 std::vector<element *> elements; 41 40 Vector position; 42 41 43 dialog->query Int(NAME, &Z, MapOfActions::getInstance().getDescription(NAME));42 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 44 43 dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position")); 44 cout << "pre-dialog" << endl; 45 45 46 46 if(dialog->display()) { 47 cout << "post-dialog" << endl; 47 48 delete dialog; 48 atom * first = World::getInstance().createAtom();49 first->type = World::getInstance().getPeriode()->FindElement(Z);50 first->x = position;51 if (first->type != NULL) {49 if (elements.size() == 1) { 50 atom * first = World::getInstance().createAtom(); 51 first->type = *(elements.begin()); 52 first->x = position; 52 53 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl); 54 // TODO: remove when all of World's atoms are stored. 55 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); 56 if (!molecules.empty()) { 57 std::vector<molecule *>::iterator iter = molecules.begin(); 58 (*iter)->AddAtom(first); 59 } 53 60 return Action::success; 54 61 } else { 55 62 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 56 World::getInstance().destroyAtom(first);57 63 return Action::failure; 58 64 } -
src/Actions/AtomAction/ChangeElementAction.cpp
rf8e486 re6317b 9 9 10 10 #include "Actions/AtomAction/ChangeElementAction.hpp" 11 #include "CommandLineParser.hpp"12 11 #include "atom.hpp" 13 12 #include "log.hpp" … … 36 35 Action::state_ptr AtomChangeElementAction::performCall() { 37 36 Dialog *dialog = UIFactory::getInstance().makeDialog(); 38 int Z = -1;39 37 atom *first = NULL; 40 element *elemental = NULL;38 std::vector<element *> elements; 41 39 42 dialog->query Element(NAME, (const element **) &elemental, MapOfActions::getInstance().getDescription(NAME));43 dialog->query Atom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id"));40 dialog->queryAtom(NAME, &first, MapOfActions::getInstance().getDescription(NAME)); 41 dialog->queryElement("element", &elements, MapOfActions::getInstance().getDescription("element")); 44 42 45 43 if(dialog->display()) { 46 44 delete dialog; 47 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental << "." << endl); 48 if (elemental != NULL) { 49 first->type = elemental; 45 ASSERT(elements.size() == 1, "Unequal to one element specified when changing an atom's element"); 46 ASSERT(first != NULL, "No valid atom specified"); 47 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elements.at(0) << "." << endl); 48 if (elements.at(0) != NULL) { 49 first->type = elements.at(0); 50 50 return Action::success; 51 51 } else -
src/Actions/AtomAction/RemoveAction.cpp
rf8e486 re6317b 9 9 10 10 #include "Actions/AtomAction/RemoveAction.hpp" 11 #include "CommandLineParser.hpp"12 11 #include "atom.hpp" 13 12 #include "Descriptors/AtomDescriptor.hpp" 14 13 #include "log.hpp" 14 #include "molecule.hpp" 15 15 #include "verbose.hpp" 16 16 #include "World.hpp" … … 43 43 delete dialog; 44 44 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << first->getId() << "." << endl); 45 // TODO: this is not necessary when atoms and their storing to file are handled by the World 46 // simply try to erase in every molecule found 47 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); 48 for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) { 49 (*iter)->erase(first); 50 } 45 51 World::getInstance().destroyAtom(first); 46 52 return Action::success;
Note:
See TracChangeset
for help on using the changeset viewer.