Changeset f10b0c for src/Actions/AtomAction
- Timestamp:
- Jun 11, 2012, 9:53:19 AM (13 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:
- 95f965
- Parents:
- b9c69d
- git-author:
- Michael Ankele <ankele@…> (04/24/12 13:55:16)
- git-committer:
- Frederik Heber <heber@…> (06/11/12 09:53:19)
- Location:
- src/Actions/AtomAction
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/AddAction.cpp
rb9c69d rf10b0c 43 43 // execute action 44 44 atom * first = World::getInstance().createAtom(); 45 first->setType(params.elemental );46 first->setPosition(params.position );45 first->setType(params.elemental.get()); 46 first->setPosition(params.position.get()); 47 47 LOG(1, "Adding new atom with element " << first->getType()->getName() << " at " << (first->getPosition()) << "."); 48 48 // TODO: remove when all of World's atoms are stored. … … 68 68 69 69 atom * first = World::getInstance().createAtom(); 70 first->setType(state->params.elemental );71 first->setPosition(state->params.position );72 LOG(1, "Re-adding new atom with element " << state->params.elemental ->getName() << " at " << state->params.position<< ".");70 first->setType(state->params.elemental.get()); 71 first->setPosition(state->params.position.get()); 72 LOG(1, "Re-adding new atom with element " << state->params.elemental.get()->getName() << " at " << state->params.position.get() << "."); 73 73 // TODO: remove when all of World's atoms are stored. 74 74 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); -
src/Actions/AtomAction/AddAction.def
rb9c69d rf10b0c 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "LinearAlgebra/ BoxVector.hpp"9 #include "LinearAlgebra/Vector.hpp" 10 10 #include "World.hpp" 11 11 class element; … … 14 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 15 15 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 16 #define paramtypes (const element *)(BoxVector) 16 //#define paramtypes (const element *)(BoxVector) TODO: use a validator 17 #define paramtypes (const element *)(Vector) 17 18 #define paramtokens ("add-atom")("domain-position") 18 19 #define paramdescriptions ("element of new atom")("position within current domain") -
src/Actions/AtomAction/ChangeElementAction.cpp
rb9c69d rf10b0c 54 54 for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) { 55 55 first = iter->second; 56 LOG(1, "Changing atom " << *first << " to element " << *params.elemental << ".");56 LOG(1, "Changing atom " << *first << " to element " << *params.elemental.get() << "."); 57 57 mol = first->getMolecule(); 58 58 first->removeFromMolecule(); // remove atom 59 first->setType(params.elemental );59 first->setType(params.elemental.get()); 60 60 mol->AddAtom(first); // add atom to ensure correctness of formula 61 61 } … … 88 88 mol = first->getMolecule(); 89 89 first->removeFromMolecule(); // remove atom 90 first->setType(state->params.elemental );90 first->setType(state->params.elemental.get()); 91 91 mol->AddAtom(first); // add atom to ensure correctness of formula 92 92 } -
src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp
rb9c69d rf10b0c 44 44 45 45 // check whether Axis is valid 46 if (params.Axis. IsZero())46 if (params.Axis.get().IsZero()) 47 47 return Action::failure; 48 48 49 49 // convert from degrees to radian 50 params.angle *= M_PI/180.;50 params.angle.set(params.angle.get() * M_PI/180.); 51 51 52 52 // Creation Line that is the rotation axis 53 Line RotationAxis(Vector(0.,0.,0.), params.Axis );53 Line RotationAxis(Vector(0.,0.,0.), params.Axis.get()); 54 54 55 LOG(0, "Rotate around origin by " << params.angle << " radian, axis from origin to " << params.Axis<< ".");55 LOG(0, "Rotate around origin by " << params.angle.get() << " radian, axis from origin to " << params.Axis.get() << "."); 56 56 // TODO: use AtomSet::rotate? 57 57 for (std::vector<atom *>::iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter) { 58 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle ));58 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle.get())); 59 59 } 60 60 LOG(0, "done."); … … 66 66 67 67 // Creation Line that is the rotation axis 68 Line RotationAxis(Vector(0.,0.,0.), state->params.Axis );68 Line RotationAxis(Vector(0.,0.,0.), state->params.Axis.get()); 69 69 70 70 for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) { 71 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle ));71 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle.get())); 72 72 } 73 73 … … 79 79 80 80 // Creation Line that is the rotation axis 81 Line RotationAxis(Vector(0.,0.,0.), state->params.Axis );81 Line RotationAxis(Vector(0.,0.,0.), state->params.Axis.get()); 82 82 83 83 for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) { 84 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle ));84 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle.get())); 85 85 } 86 86 -
src/Actions/AtomAction/SaveSelectedAtomsAction.cpp
rb9c69d rf10b0c 38 38 /** =========== define the function ====================== */ 39 39 Action::state_ptr AtomSaveSelectedAtomsAction::performCall() { 40 LOG(1, "Storing selected atoms to file " << params.filename << ".");40 LOG(1, "Storing selected atoms to file " << params.filename.get() << "."); 41 41 42 42 // extract suffix 43 43 std::string FilenameSuffix; 44 44 std::string FilenamePrefix; 45 if (params.filename. has_filename()) {45 if (params.filename.get().has_filename()) { 46 46 // get suffix 47 47 #if BOOST_VERSION >= 104600 48 FilenameSuffix = params.filename. extension().string().substr(1); // remove the prefixed "."49 FilenamePrefix = params.filename. stem().string();48 FilenameSuffix = params.filename.get().extension().string().substr(1); // remove the prefixed "." 49 FilenamePrefix = params.filename.get().stem().string(); 50 50 #else 51 FilenameSuffix = params.filename. extension().substr(1); // remove the prefixed "."52 FilenamePrefix = params.filename. stem();51 FilenameSuffix = params.filename.get().extension().substr(1); // remove the prefixed "." 52 FilenamePrefix = params.filename.get().stem(); 53 53 #endif 54 54 } else { … … 60 60 // parse the file 61 61 boost::filesystem::ofstream output; 62 output.open(params.filename );62 output.open(params.filename.get()); 63 63 if (!output.fail()) { 64 64 FormatParserStorage::getInstance().saveSelectedAtoms(output, FilenameSuffix); 65 65 } else { 66 ELOG(1, "Could not open file " << params.filename << ".");66 ELOG(1, "Could not open file " << params.filename.get() << "."); 67 67 } 68 68 output.close(); -
src/Actions/AtomAction/TranslateAction.cpp
rb9c69d rf10b0c 44 44 // TODO: use AtomSet::translate 45 45 for (std::vector<atom *>::iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter) { 46 *(*iter) += params.x ;47 if (params.periodic )46 *(*iter) += params.x.get(); 47 if (params.periodic.get()) 48 48 (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition())); 49 49 } … … 57 57 58 58 for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) { 59 *(*iter) -= state->params.x ;60 if (state->params.periodic )59 *(*iter) -= state->params.x.get(); 60 if (state->params.periodic.get()) 61 61 (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition())); 62 62 } … … 70 70 71 71 for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) { 72 *(*iter) += state->params.x ;73 if (state->params.periodic )72 *(*iter) += state->params.x.get(); 73 if (state->params.periodic.get()) 74 74 (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition())); 75 75 }
Note:
See TracChangeset
for help on using the changeset viewer.