Ignore:
Timestamp:
Aug 7, 2010, 12:07:04 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:
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).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Legacy/oldmenu.cpp

    r8d6d31 r8f4df1  
    8989        first = World::getInstance().createAtom();
    9090        std::vector<element *> elements;
    91         dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false);
     91        dialog->queryVector("Please enter coordinates: ",&first->AtomicPosition,World::getInstance().getDomain(), false);
    9292        dialog->queryElement("Please choose element: ",&elements);
    9393        if(dialog->display()){
    9494          if (elements.size() == 1) {
    95             first->type = elements.at(0);
     95            first->setType(elements.at(0));
    9696            mol->AddAtom(first);  // add to molecule
    9797          } else {
     
    113113          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    114114          dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true);
    115           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     115          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    116116          if((aborted = !dialog->display())){
    117117            continue;
    118118          }
    119           first->x += x;
    120         } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->x)));
     119          first->AtomicPosition += x;
     120        } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
    121121        if(!aborted){
    122           first->type = periode->AskElement();  // give type
     122          first->AtomicElement = periode->AskElement();  // give type
    123123          mol->AddAtom(first);  // add to molecule
    124124        }
     
    136136          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    137137          second = mol->AskAtom("Enter atom number: ");
    138           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     138          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    139139          dialog->display();
    140140          for (int i=NDIM;i--;) {
    141             first->x[i] += second->x[i];
     141            first->AtomicPosition[i] += second->AtomicPosition[i];
    142142          }
    143         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    144         first->type = periode->AskElement();  // give type
     143        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     144        first->AtomicElement = periode->AskElement();  // give type
    145145        mol->AddAtom(first);  // add to molecule
    146146      }
     
    152152        do {
    153153          if (!valid) {
    154             eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     154            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->AtomicPosition << endl;
    155155          }
    156156          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     
    185185          */
    186186          // calc axis vector
    187           x= second->x - third->x;
     187          x= second->AtomicPosition - third->AtomicPosition;
    188188          x.Normalize();
    189189          Log() << Verbose(0) << "x: " << x << endl;
    190           z = Plane(second->x,third->x,fourth->x).getNormal();
     190          z = Plane(second->AtomicPosition,third->AtomicPosition,fourth->AtomicPosition).getNormal();
    191191          Log() << Verbose(0) << "z: " << z << endl;
    192192          y = Plane(x,z,0).getNormal();
     
    194194
    195195          // rotate vector around first angle
    196           first->x = x;
    197           first->x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);
    198           Log() << Verbose(0) << "Rotated vector: " << first->x << endl,
     196          first->AtomicPosition = x;
     197          first->AtomicPosition = Line(zeroVec,z).rotateVector(first->AtomicPosition,b - M_PI);
     198          Log() << Verbose(0) << "Rotated vector: " << first->AtomicPosition << endl,
    199199          // remove the projection onto the rotation plane of the second angle
    200200          n = y;
    201           n.Scale(first->x.ScalarProduct(y));
     201          n.Scale(first->AtomicPosition.ScalarProduct(y));
    202202          Log() << Verbose(0) << "N1: " << n << endl;
    203           first->x -= n;
    204           Log() << Verbose(0) << "Subtracted vector: " << first->x << endl;
     203          first->AtomicPosition -= n;
     204          Log() << Verbose(0) << "Subtracted vector: " << first->AtomicPosition << endl;
    205205          n = z;
    206           n.Scale(first->x.ScalarProduct(z));
     206          n.Scale(first->AtomicPosition.ScalarProduct(z));
    207207          Log() << Verbose(0) << "N2: " << n << endl;
    208           first->x -= n;
    209           Log() << Verbose(0) << "2nd subtracted vector: " << first->x << endl;
     208          first->AtomicPosition -= n;
     209          Log() << Verbose(0) << "2nd subtracted vector: " << first->AtomicPosition << endl;
    210210
    211211          // rotate another vector around second angle
     
    215215
    216216          // add the two linear independent vectors
    217           first->x += n;
    218           first->x.Normalize();
    219           first->x.Scale(a);
    220           first->x += second->x;
    221 
    222           Log() << Verbose(0) << "resulting coordinates: " << first->x << endl;
    223         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    224         first->type = periode->AskElement();  // give type
     217          first->AtomicPosition += n;
     218          first->AtomicPosition.Normalize();
     219          first->AtomicPosition.Scale(a);
     220          first->AtomicPosition += second->AtomicPosition;
     221
     222          Log() << Verbose(0) << "resulting coordinates: " << first->AtomicPosition << endl;
     223        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     224        first->AtomicElement = periode->AskElement();  // give type
    225225        mol->AddAtom(first);  // add to molecule
    226226        break;
     
    239239          if (j != -1) {
    240240            second = mol->FindAtom(j);
    241             atoms[i++] = &(second->x);
     241            atoms[i++] = &(second->AtomicPosition);
    242242          }
    243243        } while ((j != -1) && (i<128));
    244244        if (i >= 2) {
    245           LSQdistance(first->x,(const Vector **)atoms, i);
    246 
    247           Log() << Verbose(0) << first->x;
    248           first->type = periode->AskElement();  // give type
     245          LSQdistance(first->AtomicPosition,(const Vector **)atoms, i);
     246
     247          Log() << Verbose(0) << first->AtomicPosition;
     248          first->AtomicElement = periode->AskElement();  // give type
    249249          mol->AddAtom(first);  // add to molecule
    250250        } else {
     
    338338      third = mol->AskAtom("Enter third atom: ");
    339339
    340       n = Plane(first->x,second->x,third->x).getNormal();
     340      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    341341      break;
    342342    case 'b': // normal vector of mirror plane
     
    354354      second = mol->AskAtom("Enter second atom: ");
    355355
    356       n = first->x - second->x;
     356      n = first->AtomicPosition - second->AtomicPosition;
    357357      n.Normalize();
    358358      break;
     
    405405      third = mol->AskAtom("Enter third atom: ");
    406406
    407       n = Plane(first->x,second->x,third->x).getNormal();
     407      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    408408      break;
    409409    case 'b': // normal vector of mirror plane
     
    421421      second = mol->AskAtom("Enter second atom: ");
    422422
    423       n = first->x - second->x;
     423      n = first->AtomicPosition - second->AtomicPosition;
    424424      n.Normalize();
    425425      break;
     
    464464        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    465465          runner = iter++;
    466           if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
     466          if ((*runner)->AtomicPosition.DistanceSquared((*runner)->AtomicPosition) > tmp1*tmp1) // distance to first above radius ...
    467467            mol->RemoveAtom((*runner));
    468468        }
     
    479479      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    480480        runner = iter++;
    481         if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
     481        if (((*runner)->AtomicPosition[axis] < tmp1) || ((*runner)->AtomicPosition[axis] > tmp2)) {// out of boundary ...
    482482          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    483483          mol->RemoveAtom((*runner));
     
    526526
    527527      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    528         Z = (*iter)->type->Z;
     528        Z = (*iter)->getType()->Z;
    529529        tmp1 = 0.;
    530530        if (first != (*iter)) {
    531           x = first->x - (*iter)->x;
     531          x = first->AtomicPosition - (*iter)->AtomicPosition;
    532532          tmp1 = x.Norm();
    533533        }
     
    536536      }
    537537      for (int i=MAX_ELEMENTS;i--;)
    538         if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
     538        if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->getType()->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
    539539      break;
    540540
     
    544544      for (int i=NDIM;i--;)
    545545        min[i] = 0.;
    546       x = first->x - second->x;
     546      x = first->AtomicPosition - second->AtomicPosition;
    547547      tmp1 = x.Norm();
    548548      Log() << Verbose(1) << "Distance vector is " << x << "." << "/n"
     
    556556      third  = mol->AskAtom("Enter last atom: ");
    557557      tmp1 = tmp2 = tmp3 = 0.;
    558       x = first->x - second->x;
    559       y = third->x - second->x;
     558      x = first->AtomicPosition - second->AtomicPosition;
     559      y = third->AtomicPosition - second->AtomicPosition;
    560560      Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    561561      Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
     
    695695        minBond = 0.;
    696696        for (int i=NDIM;i--;)
    697           minBond += (first->x[i]-second->x[i])*(first->x[i] - second->x[i]);
     697          minBond += (first->AtomicPosition[i]-second->AtomicPosition[i])*(first->AtomicPosition[i] - second->AtomicPosition[i]);
    698698        minBond = sqrt(minBond);
    699         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
     699        Log() << Verbose(0) << "Current Bond length between " << first->getType()->name << " Atom " << first->nr << " and " << second->getType()->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    700700        Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
    701701        cin >> bond;
    702702        for (int i=NDIM;i--;) {
    703           second->x[i] -= (second->x[i]-first->x[i])/minBond*(minBond-bond);
     703          second->AtomicPosition[i] -= (second->AtomicPosition[i]-first->AtomicPosition[i])/minBond*(minBond-bond);
    704704        }
    705705        //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
     
    757757        cin >> Z;
    758758        first->setType(Z);
    759         Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
     759        Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->getType()->name << "." << endl;
    760760      }
    761761      break;
     
    785785      j = 0;
    786786      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    787         Elements[j] = (*iter)->type;
    788         vectors[j] = &(*iter)->x;
     787        Elements[j] = (*iter)->AtomicElement;
     788        vectors[j] = &(*iter)->AtomicPosition;
    789789        j++;
    790790      }
     
    798798        for (int k=count;k--;) { // go through every atom of the original cell
    799799          first = World::getInstance().createAtom(); // create a new body
    800           first->x = (*vectors[k]) + x;  // use coordinate of original atom
    801           first->type = Elements[k];  // insert original element
     800          first->AtomicPosition = (*vectors[k]) + x;  // use coordinate of original atom
     801          first->AtomicElement = Elements[k];  // insert original element
    802802          mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
    803803        }
Note: See TracChangeset for help on using the changeset viewer.