Changeset bce72c


Ignore:
Timestamp:
Feb 24, 2011, 4:30:56 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:
54b42e
Parents:
c864a8
git-author:
Frederik Heber <heber@…> (02/07/11 18:35:30)
git-committer:
Frederik Heber <heber@…> (02/24/11 16:30:56)
Message:

AtomicInfo::AtomicVelocity and ::AtomicForce are now private.

  • Access is granted via getters and setters.
Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/AtomicInfo.cpp

    rc864a8 rbce72c  
    3535    Position(_atom.getPosition()),
    3636    Type(_atom.getType()),
    37     Velocity(_atom.AtomicVelocity),
     37    Velocity(_atom.getAtomicVelocity()),
    3838    Father(_atom.father),
    3939    Mol(_atom.getMolecule()),
     
    5151  _atom.father = const_cast<atom *>(Father); // TODO: Actually, atom::father should be const atom *!
    5252  _atom.setMolecule(const_cast<molecule *>(Mol)); // this is ok, mol is const within AtomicInfo, but not outside (atoms need to register)
    53   _atom.AtomicVelocity = Velocity;
     53  _atom.setAtomicVelocity(Velocity);
    5454  if (_atom.getId() == Id)
    5555    return true;
  • src/Parser/PcpParser.cpp

    rc864a8 rbce72c  
    558558    *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
    559559    *file << "\t" << (*AtomRunner)->FixedIon;
    560     if ((*AtomRunner)->AtomicVelocity.Norm() > MYEPSILON)
    561       *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->AtomicVelocity[0] << "\t" << (*AtomRunner)->AtomicVelocity[1] << "\t" << (*AtomRunner)->AtomicVelocity[2] << "\t";
     560    if ((*AtomRunner)->getAtomicVelocity().Norm() > MYEPSILON)
     561      *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->getAtomicVelocity()[0] << "\t" << (*AtomRunner)->getAtomicVelocity()[1] << "\t" << (*AtomRunner)->getAtomicVelocity()[2] << "\t";
    562562    *file << " # molecule nr " << nr++ << endl;
    563563  }
  • src/Parser/TremoloParser.cpp

    rc864a8 rbce72c  
    188188      case TremoloKey::u :
    189189        // for the moment, assume there are always three dimensions
    190         DoLog(3) && (Log() << Verbose(3) << "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->AtomicVelocity << std::endl);
    191         *file << currentAtom->AtomicVelocity[0] << "\t";
    192         *file << currentAtom->AtomicVelocity[1] << "\t";
    193         *file << currentAtom->AtomicVelocity[2] << "\t";
     190        DoLog(3) && (Log() << Verbose(3) << "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocity() << std::endl);
     191        *file << currentAtom->getAtomicVelocity()[0] << "\t";
     192        *file << currentAtom->getAtomicVelocity()[1] << "\t";
     193        *file << currentAtom->getAtomicVelocity()[2] << "\t";
    194194        break;
    195195      case TremoloKey::Type :
     
    343343          ASSERT(tok_iter != tokens.end(), "TremoloParser::readAtomDataLine() - no value for u["+toString(i)+"]!");
    344344          //DoLog(1) && (Log() << Verbose(1) << "INFO: Parsing key " << keyName << " with next token " << *tok_iter << std::endl);
    345           newAtom->AtomicVelocity[i] = toDouble(*tok_iter);
     345          newAtom->getAtomicVelocity()[i] = toDouble(*tok_iter);
    346346          tok_iter++;
    347347        }
  • src/Parser/unittests/ParserTremoloUnitTest.cpp

    rc864a8 rbce72c  
    151151  input << Tremolo_velocity;
    152152  testParser->load(&input);
    153   CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->AtomicVelocity[0] == 3.0);
     153  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->getAtomicVelocity()[0] == 3.0);
    154154  input.clear();
    155155}
  • src/atom.cpp

    rc864a8 rbce72c  
    5454  setType(pointer->getType());  // copy element of atom
    5555  setPosition(pointer->getPosition()); // copy coordination
    56   AtomicVelocity = pointer->AtomicVelocity; // copy velocity
     56  setAtomicVelocity(pointer->getAtomicVelocity()); // copy velocity
    5757  FixedIon = pointer->FixedIon;
    5858};
     
    153153    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    154154    *out << "\t" << FixedIon;
    155     if (AtomicVelocity.Norm() > MYEPSILON)
    156       *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
     155    if (getAtomicVelocity().Norm() > MYEPSILON)
     156      *out << "\t" << scientific << setprecision(6) << getAtomicVelocity()[0] << "\t" << getAtomicVelocity()[1] << "\t" << getAtomicVelocity()[2] << "\t";
    157157    if (comment != NULL)
    158158      *out << " # " << comment << endl;
     
    180180    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    181181    *out << "\t" << FixedIon;
    182     if (AtomicVelocity.Norm() > MYEPSILON)
    183       *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
     182    if (getAtomicVelocity().Norm() > MYEPSILON)
     183      *out << "\t" << scientific << setprecision(6) << getAtomicVelocity()[0] << "\t" << getAtomicVelocity()[1] << "\t" << getAtomicVelocity()[2] << "\t";
    184184    if (comment != NULL)
    185185      *out << " # " << comment << endl;
  • src/atom_atominfo.cpp

    rc864a8 rbce72c  
    8383}
    8484
     85Vector& AtomInfo::getAtomicVelocity()
     86{
     87  return AtomicVelocity;
     88}
     89
     90const Vector& AtomInfo::getAtomicVelocity() const
     91{
     92  return AtomicVelocity;
     93}
     94
     95void AtomInfo::setAtomicVelocity(const Vector &_newvelocity)
     96{
     97  AtomicVelocity = _newvelocity;
     98}
     99
     100const Vector& AtomInfo::getAtomicForce() const
     101{
     102  return AtomicForce;
     103}
     104
     105void AtomInfo::setAtomicForce(const Vector &_newforce)
     106{
     107  AtomicForce = _newforce;
     108}
     109
    85110void AtomInfo::setPosition(const Vector& _vector)
    86111{
  • src/atom_atominfo.hpp

    rc864a8 rbce72c  
    3333
    3434public:
    35   Vector AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
    36   Vector AtomicForce;       //!< Force vector of atom, giving last force within cell
    37 
    3835  AtomInfo();
    3936  AtomInfo(const AtomInfo &_atom);
     
    4138  virtual ~AtomInfo();
    4239
     40  /** Getter for AtomicElement.
     41   *
     42   * @return constant reference to AtomicElement
     43   */
    4344  const element *getType() const;
    44   void setType(const element *);
    45   void setType(const int);
     45  /** Setter for AtomicElement.
     46   *
     47   * @param _type new element by pointer to set
     48   */
     49  void setType(const element *_type);
     50  /** Setter for AtomicElement.
     51   *
     52   * @param _typenr new element by index to set
     53   */
     54  void setType(const int _typenr);
     55
     56  /** Getter for AtomicVelocity.
     57   *
     58   * @return constant reference to AtomicVelocity
     59   */
     60  Vector& getAtomicVelocity();
     61  /** Getter for AtomicVelocity.
     62   *
     63   * @return constant reference to AtomicVelocity
     64   */
     65  const Vector& getAtomicVelocity() const;
     66  /** Setter for AtomicVelocity.
     67   *
     68   * @param _newvelocity new velocity to set
     69   */
     70  void setAtomicVelocity(const Vector &_newvelocity);
     71
     72  /** Getter for AtomicForce.
     73   *
     74   * @return constant reference to AtomicForce
     75   */
     76  const Vector& getAtomicForce() const;
     77  /** Setter for AtomicForce.
     78   *
     79   * @param _newvelocity new force vector to set
     80   */
     81  void setAtomicForce(const Vector &_newforce);
    4682
    4783  ///// manipulation of the atomic position
     
    80116private:
    81117  Vector AtomicPosition;       //!< coordinate vector of atom, giving last position within cell
     118  Vector AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
     119  Vector AtomicForce;       //!< Force vector of atom, giving last force within cell
     120
    82121  const element *AtomicElement;  //!< pointing to element
    83122};
  • src/config.cpp

    rc864a8 rbce72c  
    543543
    544544            // parse velocities if present
    545             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], 1,optional))
    546               neues->AtomicVelocity[0] = 0.;
    547             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], 1,optional))
    548               neues->AtomicVelocity[1] = 0.;
    549             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], 1,optional))
    550               neues->AtomicVelocity[2] = 0.;
     545            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->getAtomicVelocity()[0], 1,optional))
     546              neues->getAtomicVelocity()[0] = 0.;
     547            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->getAtomicVelocity()[1], 1,optional))
     548              neues->getAtomicVelocity()[1] = 0.;
     549            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->getAtomicVelocity()[2], 1,optional))
     550              neues->getAtomicVelocity()[2] = 0.;
    551551            for (int d=0;d<NDIM;d++)
    552               neues->Trajectory.U.at(repetition)[d] = neues->AtomicVelocity[d];
     552              neues->Trajectory.U.at(repetition)[d] = neues->getAtomicVelocity()[d];
    553553
    554554            // parse forces if present
     
    608608          neues->setPosition(position);
    609609          ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical);
    610           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], repetition,optional))
    611             neues->AtomicVelocity[0] = 0.;
    612           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], repetition,optional))
    613             neues->AtomicVelocity[1] = 0.;
    614           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], repetition,optional))
    615             neues->AtomicVelocity[2] = 0.;
     610          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->getAtomicVelocity()[0], repetition,optional))
     611            neues->getAtomicVelocity()[0] = 0.;
     612          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->getAtomicVelocity()[1], repetition,optional))
     613            neues->getAtomicVelocity()[1] = 0.;
     614          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->getAtomicVelocity()[2], repetition,optional))
     615            neues->getAtomicVelocity()[2] = 0.;
    616616          // here we don't care if forces are present (last in trajectories is always equal to current position)
    617617          neues->setType(elementhash[i]); // find element type
  • src/molecule.cpp

    rc864a8 rbce72c  
    364364      FirstOtherAtom = World::getInstance().createAtom();    // new atom
    365365      FirstOtherAtom->setType(1);  // element is Hydrogen
    366       FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     366      FirstOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    367367      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    368368      if (TopReplacement->getType()->getAtomicNumber() == 1) { // neither rescale nor replace if it's already hydrogen
     
    429429      FirstOtherAtom->setType(1);
    430430      SecondOtherAtom->setType(1);
    431       FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     431      FirstOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    432432      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    433       SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     433      SecondOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    434434      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    435435      FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
     
    484484      SecondOtherAtom->setType(1);
    485485      ThirdOtherAtom->setType(1);
    486       FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     486      FirstOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    487487      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    488       SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     488      SecondOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    489489      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    490       ThirdOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
     490      ThirdOtherAtom->setAtomicVelocity(TopReplacement->getAtomicVelocity()); // copy velocity
    491491      ThirdOtherAtom->FixedIon = TopReplacement->FixedIon;
    492492      FirstOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
Note: See TracChangeset for help on using the changeset viewer.