Changeset 8f4df1 for src/Actions


Ignore:
Timestamp:
Aug 7, 2010, 12:07:04 PM (14 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:
2d292d
Parents:
8d6d31 (diff), d74077 (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.
Message:

Merge branch 'AtomicPositionEncapsulation' into stable

Conflicts:

src/Actions/AtomAction/ChangeElementAction.cpp
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
src/Makefile.am
src/UIElements/TextUI/TextDialog.cpp
src/analysis_correlation.hpp
src/atom.cpp
src/atom_atominfo.hpp
src/bond.cpp
src/boundary.cpp
src/molecule_geometry.cpp
src/tesselation.cpp
src/tesselationhelpers.cpp
src/triangleintersectionlist.cpp
src/unittests/Makefile.am

  • fixed #includes due to moves to Helpers and LinearAlgebra
  • moved VectorInterface.* and vector_ops.* to LinearAlgebra
  • no more direct access of atom::node, remapped to set/getPosition()
  • no more direct access to atom::type, remapped to set/getType() (also in atom due to derivation and atominfo::AtomicElement is private not protected).
Location:
src/Actions
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    r8d6d31 r8f4df1  
    6060    LCList = new LinkedCell(mol, 10.);
    6161    config * const configuration = World::getInstance().getConfig();
    62     Boundaries *BoundaryPoints = NULL;
    6362    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    6463    FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL);
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r8d6d31 r8f4df1  
    7070  double BinStart = 0.;
    7171  double BinWidth = 0.;
    72   molecule *Boundary = NULL;
    7372  string outputname;
    7473  string binoutputname;
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    r8d6d31 r8f4df1  
    7171  double BinStart = 0.;
    7272  double BinWidth = 0.;
    73   molecule *Boundary = NULL;
    7473  string outputname;
    7574  string binoutputname;
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    r8d6d31 r8f4df1  
    6262    // sum up inertia tensor
    6363    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    64       Vector x = (*iter)->x;
     64      Vector x = (*iter)->getPosition();
    6565      x -= *CenterOfGravity;
    66       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    67       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    68       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    69       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    70       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    71       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    72       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    73       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    74       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     66      const double mass = (*iter)->getType()->mass;
     67      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     68      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     69      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     70      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     71      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     72      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     73      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     74      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     75      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    7576    }
    7677    // print InertiaTensor for debugging
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    r8d6d31 r8f4df1  
    111111  // find biggest molecule
    112112  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    113   int counter  = molecules.size();
    114113  LCList = new LinkedCell(Boundary, LCWidth);
    115114  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
  • src/Actions/AtomAction/AddAction.cpp

    r8d6d31 r8f4df1  
    6161  // execute action
    6262  atom * first = World::getInstance().createAtom();
    63   first->type = elemental;
    64   first->x = position;
    65   DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl);
     63  first->setType(elemental);
     64  first->setPosition(position);
     65  DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->getType()->name << " at " << (first->getPosition()) << "." << endl);
    6666  // TODO: remove when all of World's atoms are stored.
    6767  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
  • src/Actions/AtomAction/ChangeElementAction.cpp

    r8d6d31 r8f4df1  
    6161    mol = first->getMolecule();
    6262    first->removeFromMolecule(); // remove atom
    63     first->type = elemental;
     63    first->setType(elemental);
    6464    mol->AddAtom(first);  // add atom to ensure correctness of formula
    6565  }
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    r8d6d31 r8f4df1  
    1010#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
    1111#include "Actions/ActionRegistry.hpp"
     12#include "Descriptors/MoleculeDescriptor.hpp"
     13
    1214#include "atom.hpp"
     15#include "bond.hpp"
     16#include "bondgraph.hpp"
    1317#include "config.hpp"
    1418#include "Helpers/Log.hpp"
    1519#include "molecule.hpp"
    16 #include "Descriptors/MoleculeDescriptor.hpp"
    1720#include "stackclass.hpp"
    1821#include "World.hpp"
     
    5356  // @TODO rather do the dissection afterwards
    5457  MoleculeListClass *molecules = World::getInstance().getMolecules();
    55   molecules->DissectMoleculeIntoConnectedSubgraphs(World::getInstance().getPeriode(), World::getInstance().getConfig());
     58  config * const configuration = World::getInstance().getConfig();
     59
     60  // 0a. remove all present molecules
     61  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     62  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
     63    molecules->erase(*MolRunner);
     64    World::getInstance().destroyMolecule(*MolRunner);
     65  }
     66
     67  // 0b. remove all bonds and construct a molecule with all atoms
     68  molecule *mol = World::getInstance().createMolecule();
     69  vector <atom *> allatoms = World::getInstance().getAllAtoms();
     70  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
     71    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
     72      delete(*BondRunner);
     73    mol->AddAtom(*AtomRunner);
     74  }
     75
     76  // 1. create the bond structure of the single molecule
     77  if (configuration->BG != NULL) {
     78    if (!configuration->BG->ConstructBondGraph(mol)) {
     79      World::getInstance().destroyMolecule(mol);
     80      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     81      return Action::failure;
     82    }
     83  } else {
     84    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
     85    return Action::failure;
     86  }
     87
     88  // 2. scan for connected subgraphs
     89  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
     90  class StackClass<bond *> *BackEdgeStack = NULL;
     91  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
     92  delete(BackEdgeStack);
     93  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     94    World::getInstance().destroyMolecule(mol);
     95    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
     96    return Action::failure;
     97  }
     98
     99  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     100  // the original one as parsed in)
     101  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
     102
     103  // 4a. create array of molecules to fill
     104  const int MolCount = Subgraphs->next->Count();
     105  char number[MAXSTRINGSIZE];
     106  molecule **moleculelist = new molecule *[MolCount];
     107  MoleculeLeafClass *MolecularWalker = Subgraphs;
     108  for (int i=0;i<MolCount;i++) {
     109    MolecularWalker = MolecularWalker->next;
     110    moleculelist[i] = World::getInstance().createMolecule();
     111    moleculelist[i]->ActiveFlag = true;
     112    strncpy(moleculelist[i]->name, mol->name, MAXSTRINGSIZE);
     113    if (MolCount > 1) {
     114      sprintf(number, "-%d", i+1);
     115      strncat(moleculelist[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     116    }
     117    DoLog(1) && (Log() << Verbose(1) << "MolName is " << moleculelist[i]->name << ", id is " << moleculelist[i]->getId() << endl);
     118    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
     119      DoLog(1) && (Log() << Verbose(1) << **iter << endl);
     120    }
     121    molecules->insert(moleculelist[i]);
     122  }
     123
     124  // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
     125  int FragmentCounter = 0;
     126  map<int, atom *> AtomToFragmentMap;
     127  MolecularWalker = Subgraphs;
     128  while (MolecularWalker->next != NULL) {
     129    MolecularWalker = MolecularWalker->next;
     130    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {
     131      atom * Walker = *iter;
     132      DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);
     133      MolecularWalker->Leaf->erase(iter);
     134      moleculelist[FragmentCounter]->AddAtom(Walker);    // counting starts at 1
     135    }
     136    FragmentCounter++;
     137  }
     138  // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms.
     139  // 4d. destroy the original molecule
     140  for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin())
     141    World::getInstance().destroyAtom(*AtomRunner);
     142  World::getInstance().destroyMolecule(mol);
     143
     144  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
     145  // TODO: check whether this is really not needed anymore
     146  // 4e. free Leafs
     147  MolecularWalker = Subgraphs;
     148  while (MolecularWalker->next != NULL) {
     149    MolecularWalker = MolecularWalker->next;
     150    delete(MolecularWalker->previous);
     151  }
     152  delete(MolecularWalker);
     153  delete[](moleculelist);
     154  DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
     155
    56156  return Action::success;
    57157}
  • src/Actions/MoleculeAction/RotateAroundOriginByAngleAction.cpp

    r8d6d31 r8f4df1  
    9191
    9292    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    93       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
     93      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
    9494    }
    9595  }
     
    109109
    110110    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    111       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), -state->alpha);
     111      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->alpha));
    112112    }
    113113  }
     
    127127
    128128    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    129       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), state->alpha);
     129      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->alpha));
    130130    }
    131131  }
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    r8d6d31 r8f4df1  
    9696
    9797  for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    98     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
     98    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
    9999  }
    100100  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     
    111111
    112112  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
    113     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), -state->alpha);
     113    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->alpha));
    114114  }
    115115
     
    125125
    126126  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
    127     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), state->alpha);
     127    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->alpha));
    128128  }
    129129
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    r8d6d31 r8f4df1  
    8383    // sum up inertia tensor
    8484    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    85       Vector x = (*iter)->x;
     85      Vector x = (*iter)->getPosition();
    8686      x -= *CenterOfGravity;
    87       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    88       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    89       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    90       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    91       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    92       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    93       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    94       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    95       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     87      const double mass = (*iter)->getType()->mass;
     88      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     89      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     90      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     91      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     92      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     93      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     94      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     95      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     96      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    9697    }
    9798    // print InertiaTensor for debugging
     
    121122
    122123    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    123       *((*iter)->node) -= *CenterOfGravity;
    124       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
    125       *((*iter)->node) += *CenterOfGravity;
     124      *(*iter) -= *CenterOfGravity;
     125      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
     126      *(*iter) += *CenterOfGravity;
    126127    }
    127128    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     
    133134    // sum up inertia tensor
    134135    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    135       Vector x = (*iter)->x;
     136      Vector x = (*iter)->getPosition();
    136137      x -= *CenterOfGravity;
    137       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    138       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    139       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    140       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    141       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    142       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    143       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    144       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    145       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     138      const double mass = (*iter)->getType()->mass;
     139      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     140      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     141      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     142      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     143      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     144      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     145      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     146      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     147      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    146148      // print InertiaTensor for debugging
    147149      DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    r8d6d31 r8f4df1  
    8484    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
    8585    LCList = new LinkedCell(mol, 100.);
    86     Boundaries *BoundaryPoints = NULL;
    8786    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    8887    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    r8d6d31 r8f4df1  
    6060  ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
    6161  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    62   Min = (*AtomRunner)->x;
    63   Max = (*AtomRunner)->x;
     62  Min = (*AtomRunner)->getPosition();
     63  Max = (*AtomRunner)->getPosition();
    6464  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6565    for (int i=0;i<NDIM;i++) {
    66       if ((*AtomRunner)->x[i] > Max[i])
    67         Max[i] = (*AtomRunner)->x[i];
    68       if ((*AtomRunner)->x[i] < Min[i])
    69         Min[i] = (*AtomRunner)->x[i];
     66      if ((*AtomRunner)->at(i) > Max[i])
     67        Max[i] = (*AtomRunner)->at(i);
     68      if ((*AtomRunner)->at(i) < Min[i])
     69        Min[i] = (*AtomRunner)->at(i);
    7070    }
    7171  }
     
    8484  AtomRunner = AllAtoms.begin();
    8585  for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
    86     (*AtomRunner)->x -= Min - boundary;
     86    *(*AtomRunner) -= Min - boundary;
    8787  return Action::success;
    8888}
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    r8d6d31 r8f4df1  
    5555  ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present.");
    5656  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    57   Min = (*AtomRunner)->x;
    58   Max = (*AtomRunner)->x;
     57  Min = (*AtomRunner)->getPosition();
     58  Max = (*AtomRunner)->getPosition();
    5959  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6060    for (int i=0;i<NDIM;i++) {
    61       if ((*AtomRunner)->x[i] > Max[i])
    62         Max[i] = (*AtomRunner)->x[i];
    63       if ((*AtomRunner)->x[i] < Min[i])
    64         Min[i] = (*AtomRunner)->x[i];
     61      if ((*AtomRunner)->at(i) > Max[i])
     62        Max[i] = (*AtomRunner)->at(i);
     63      if ((*AtomRunner)->at(i) < Min[i])
     64        Min[i] = (*AtomRunner)->at(i);
    6565    }
    6666  }
     
    7575  // translate all atoms, such that Min is aty (0,0,0)
    7676  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
    77     (*AtomRunner)->x -= Min;
     77    *(*AtomRunner) -= Min;
    7878
    7979  return Action::success;
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r8d6d31 r8f4df1  
    6262  vector<molecule *> molecules = World::getInstance().getAllMolecules();
    6363  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    64     if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ...
     64    if ((*AtomRunner)->DistanceSquared(point) > radius*radius) { // distance to first above radius ...
     65//      cout << "Removing " << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
    6566      // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save)
    6667      for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter)
     
    6869      World::getInstance().destroyAtom(*AtomRunner);
    6970    }
     71//    else {
     72//      cout << "Keeping" << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
     73//    }
    7074  }
    7175  return Action::success;
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r8d6d31 r8f4df1  
    2121#include <iostream>
    2222#include <string>
     23#include <vector>
    2324
    2425using namespace std;
     
    9091
    9192  molecule *newmol = NULL;
    92   Vector ** vectors = NULL;
     93  std::vector<Vector> vectors;
    9394  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
    9495    y[0] = n[0];
     
    105106          if (count != 0) {  // if there is more than none
    106107            Elements = new const element *[count];
    107             vectors = new Vector *[count];
     108            vectors.resize(count);
    108109            j = 0;
    109110            for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
    110               Elements[j] = (*AtomRunner)->type;
    111               vectors[j] = &(*AtomRunner)->x;
     111              Elements[j] = (*AtomRunner)->getType();
     112              vectors[j] = (*AtomRunner)->getPosition();
    112113              j++;
    113114            }
     
    120121            for (int k=count;k--;) { // go through every atom of the original cell
    121122              Walker = World::getInstance().createAtom(); // create a new body
    122               Walker->x = (*vectors[k]) + x;
    123               Walker->type = Elements[k];  // insert original element
     123              Walker->setPosition((vectors[k]) + x);
     124              Walker->setType(Elements[k]);  // insert original element
    124125              cout << "new atom is " << *Walker << endl;
    125126              newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
     
    127128            // free memory
    128129            delete[](Elements);
    129             delete[](vectors);
    130130          } else {
    131131            DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    r8d6d31 r8f4df1  
    6060  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
    6161  for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    62     (*AtomRunner)->x.ScaleAll(x);
     62    (*AtomRunner)->ScaleAll(x);
    6363  }
    6464
Note: See TracChangeset for help on using the changeset viewer.