Changeset 8f4df1 for src/atom.cpp


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, Candidate_v1.7.0, 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/atom.cpp

    r8d6d31 r8f4df1  
    2828atom::atom() :
    2929  father(this), sort(&nr), mol(0)
    30 {
    31   node = &x;  // TesselPoint::x can only be referenced from here
    32 };
     30{};
    3331
    3432/** Constructor of class atom.
     
    3735    ParticleInfo(pointer),father(pointer), sort(&nr)
    3836{
    39   type = pointer->type;  // copy element of atom
    40   x = pointer->x; // copy coordination
    41   v = pointer->v; // copy velocity
     37  setType(pointer->getType());  // copy element of atom
     38  setPosition(pointer->getPosition()); // copy coordination
     39  AtomicVelocity = pointer->AtomicVelocity; // copy velocity
    4240  FixedIon = pointer->FixedIon;
    43   node = &x;
    4441  mol = 0;
    4542};
     
    4946  res->father = this;
    5047  res->sort = &res->nr;
    51   res->type = type;
    52   res->x = this->x;
    53   res->v = this->v;
     48  res->setType(getType());
     49  res->setPosition(this->getPosition());
     50  res->AtomicVelocity = this->AtomicVelocity;
    5451  res->FixedIon = FixedIon;
    55   res->node = &x;
    5652  res->mol = 0;
    5753  World::getInstance().registerAtom(res);
     
    121117bool atom::IsInShape(const Shape& shape) const
    122118{
    123   return shape.isInside(*node);
     119  return shape.isInside(getPosition());
    124120};
    125121
     
    146142  if (out != NULL) {
    147143    *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"  << fixed << setprecision(9) << showpoint;
    148     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     144    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    149145    *out << "\t" << FixedIon;
    150     if (v.Norm() > MYEPSILON)
    151       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     146    if (AtomicVelocity.Norm() > MYEPSILON)
     147      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    152148    if (comment != NULL)
    153149      *out << " # " << comment << endl;
     
    168164bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
    169165{
    170   AtomNo[type->Z]++;  // increment number
    171   if (out != NULL) {
    172     cout << "Looking for atom with element " << *type << endl;
    173     ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    174     *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    175     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     166  AtomNo[getType()->Z]++;  // increment number
     167  if (out != NULL) {
     168    const element *elemental = getType();
     169    cout << "Looking for atom with element " << *elemental << endl;
     170    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
     171    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     172    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    176173    *out << "\t" << FixedIon;
    177     if (v.Norm() > MYEPSILON)
    178       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     174    if (AtomicVelocity.Norm() > MYEPSILON)
     175      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    179176    if (comment != NULL)
    180177      *out << " # " << comment << endl;
     
    193190{
    194191  if (out != NULL) {
    195     *out << type->symbol << "\t" << x[0] << "\t" << x[1] << "\t" << x[2] << "\t" << endl;
     192    *out << getType()->symbol << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
    196193    return true;
    197194  } else
     
    208205bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
    209206{
    210   AtomNo[type->Z]++;
    211   if (out != NULL) {
    212     *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     207  AtomNo[getType()->Z]++;
     208  if (out != NULL) {
     209    *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    213210    *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
    214211    *out << "\t" << FixedIon;
     
    231228{
    232229  if (out != NULL) {
    233     *out << type->symbol << "\t";
     230    *out << getType()->symbol << "\t";
    234231    *out << Trajectory.R.at(step)[0] << "\t";
    235232    *out << Trajectory.R.at(step)[1] << "\t";
     
    247244void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const
    248245{
    249   *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl;
     246  Vector recentered(getPosition());
     247  recentered -= *center;
     248  *out << "\t\t" << getType()->symbol << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
    250249  if (AtomNo != NULL)
    251250    *AtomNo++;
     
    270269double atom::DistanceSquaredToVector(const Vector &origin) const
    271270{
    272   return origin.DistanceSquared(x);
     271  return DistanceSquared(origin);
    273272};
    274273
     
    279278double atom::DistanceToVector(const Vector &origin) const
    280279{
    281   return origin.distance(x);
     280  return distance(origin);
    282281};
    283282
     
    294293};
    295294
     295std::ostream & atom::operator << (std::ostream &ost) const
     296{
     297  ParticleInfo::operator<<(ost);
     298  ost << "," << getPosition();
     299  return ost;
     300}
     301
     302std::ostream & operator << (std::ostream &ost, const atom &a)
     303{
     304  a.ParticleInfo::operator<<(ost);
     305  ost << "," << a.getPosition();
     306  return ost;
     307}
    296308
    297309bool operator < (atom &a, atom &b)
Note: See TracChangeset for help on using the changeset viewer.