Ignore:
Timestamp:
Jun 11, 2012, 9:53:19 AM (13 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:
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)
Message:

disastrously big and ugly commit

  • using new Parameter<T> classes:
    • Actions
    • Queries (all UIs)
  • TODO:
    • actions crash cause Value is unset
    • no query<BoxVector>
Location:
src/Actions/AtomAction
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AtomAction/AddAction.cpp

    rb9c69d rf10b0c  
    4343  // execute action
    4444  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());
    4747  LOG(1, "Adding new atom with element " << first->getType()->getName() << " at " << (first->getPosition()) << ".");
    4848  // TODO: remove when all of World's atoms are stored.
     
    6868
    6969  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() << ".");
    7373  // TODO: remove when all of World's atoms are stored.
    7474  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
  • src/Actions/AtomAction/AddAction.def

    rb9c69d rf10b0c  
    77
    88// all includes and forward declarations necessary for non-integral types below
    9 #include "LinearAlgebra/BoxVector.hpp"
     9#include "LinearAlgebra/Vector.hpp"
    1010#include "World.hpp"
    1111class element;
     
    1414// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1515// "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)
    1718#define paramtokens ("add-atom")("domain-position")
    1819#define paramdescriptions ("element of new atom")("position within current domain")
  • src/Actions/AtomAction/ChangeElementAction.cpp

    rb9c69d rf10b0c  
    5454  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
    5555    first = iter->second;
    56     LOG(1, "Changing atom " << *first << " to element " << *params.elemental << ".");
     56    LOG(1, "Changing atom " << *first << " to element " << *params.elemental.get() << ".");
    5757    mol = first->getMolecule();
    5858    first->removeFromMolecule(); // remove atom
    59     first->setType(params.elemental);
     59    first->setType(params.elemental.get());
    6060    mol->AddAtom(first);  // add atom to ensure correctness of formula
    6161  }
     
    8888    mol = first->getMolecule();
    8989    first->removeFromMolecule(); // remove atom
    90     first->setType(state->params.elemental);
     90    first->setType(state->params.elemental.get());
    9191    mol->AddAtom(first);  // add atom to ensure correctness of formula
    9292  }
  • src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp

    rb9c69d rf10b0c  
    4444
    4545  // check whether Axis is valid
    46   if (params.Axis.IsZero())
     46  if (params.Axis.get().IsZero())
    4747    return Action::failure;
    4848
    4949  // convert from degrees to radian
    50   params.angle *= M_PI/180.;
     50  params.angle.set(params.angle.get() * M_PI/180.);
    5151
    5252  // 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());
    5454
    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() << ".");
    5656  // TODO: use AtomSet::rotate?
    5757  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()));
    5959  }
    6060  LOG(0, "done.");
     
    6666
    6767  // 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());
    6969
    7070  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()));
    7272  }
    7373
     
    7979
    8080  // 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());
    8282
    8383  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()));
    8585  }
    8686
  • src/Actions/AtomAction/SaveSelectedAtomsAction.cpp

    rb9c69d rf10b0c  
    3838/** =========== define the function ====================== */
    3939Action::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() << ".");
    4141
    4242  // extract suffix
    4343  std::string FilenameSuffix;
    4444  std::string FilenamePrefix;
    45   if (params.filename.has_filename()) {
     45  if (params.filename.get().has_filename()) {
    4646    // get suffix
    4747#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();
    5050#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();
    5353#endif
    5454  } else {
     
    6060  // parse the file
    6161  boost::filesystem::ofstream output;
    62   output.open(params.filename);
     62  output.open(params.filename.get());
    6363  if (!output.fail()) {
    6464    FormatParserStorage::getInstance().saveSelectedAtoms(output, FilenameSuffix);
    6565  } else {
    66     ELOG(1, "Could not open file " << params.filename << ".");
     66    ELOG(1, "Could not open file " << params.filename.get() << ".");
    6767  }
    6868  output.close();
  • src/Actions/AtomAction/TranslateAction.cpp

    rb9c69d rf10b0c  
    4444  // TODO: use AtomSet::translate
    4545  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())
    4848      (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition()));
    4949  }
     
    5757
    5858  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())
    6161      (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition()));
    6262  }
     
    7070
    7171  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())
    7474      (*iter)->setPosition(domain.enforceBoundaryConditions((*iter)->getPosition()));
    7575  }
Note: See TracChangeset for help on using the changeset viewer.