Ignore:
Timestamp:
Oct 12, 2011, 2:10:48 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, 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:
220cf64
Parents:
b60804
git-author:
Frederik Heber <heber@…> (10/12/11 13:00:32)
git-committer:
Frederik Heber <heber@…> (10/12/11 14:10:48)
Message:

AtomInfo does not store ref to element anymore but only atomic number.

  • if we want to allow for elements to be changed, no refs may be stored at other places. Now we just store the atomic number and look up the element in the periodentafel on request.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/atom_atominfo.cpp

    rb60804 r35a25a  
    3535 */
    3636AtomInfo::AtomInfo() :
    37   AtomicElement(NULL),
     37  AtomicElement(-1),
    3838  FixedIon(false)
    3939{
     
    6060
    6161AtomInfo::AtomInfo(const VectorInterface &_v) :
    62     AtomicElement(NULL),
     62    AtomicElement(-1),
    6363    FixedIon(false)
    6464{
     
    8989const element *AtomInfo::getType() const
    9090{
    91   return AtomicElement;
     91  const element *elem = World::getInstance().getPeriode()->FindElement(AtomicElement);
     92  ASSERT(elem != NULL,
     93      "AtomInfo::getType() - there is not element stored under Z="+
     94      toString(AtomicElement)+" in the periodentafel.");
     95  return elem;
    9296}
    9397
     
    150154void AtomInfo::setType(const element* _type)
    151155{
    152   OBSERVE;
    153   NOTIFY(AtomObservable::ElementChanged);
    154   AtomicElement = _type;
     156  if (_type->getNumber() != AtomicElement) {
     157    OBSERVE;
     158    NOTIFY(AtomObservable::ElementChanged);
     159    AtomicElement = _type->getNumber();
     160  }
    155161}
    156162
    157163void AtomInfo::setType(const int Z)
    158164{
    159   OBSERVE;
    160   NOTIFY(AtomObservable::ElementChanged);
    161165  const element *elem = World::getInstance().getPeriode()->FindElement(Z);
    162   setType(elem);
     166  if (elem != NULL) {
     167    OBSERVE;
     168    NOTIFY(AtomObservable::ElementChanged);
     169    AtomicElement = Z;
     170  }
    163171}
    164172
     
    508516}
    509517
    510 double AtomInfo::getMass() const{
    511   return AtomicElement->getMass();
     518double AtomInfo::getMass() const
     519{
     520  return getType()->getMass();
    512521}
    513522
Note: See TracChangeset for help on using the changeset viewer.