Changeset 54b42e


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

AtomInfo::AtomicPosition, ::AtomicVelocity, ::AtomicForce are now a std:vector.

  • This is preparatory for trajectories.
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/atom_atominfo.cpp

    rbce72c r54b42e  
    2929AtomInfo::AtomInfo() :
    3030  AtomicElement(NULL)
    31 {};
     31{
     32  AtomicPosition.reserve(1);
     33  AtomicPosition.push_back(zeroVec);
     34  AtomicVelocity.reserve(1);
     35  AtomicVelocity.push_back(zeroVec);
     36  AtomicForce.reserve(1);
     37  AtomicForce.push_back(zeroVec);
     38};
    3239
    3340/** Copy constructor of class AtomInfo.
     
    3946
    4047AtomInfo::AtomInfo(const VectorInterface &_v) :
    41     AtomicPosition(_v.getPosition()),
    4248    AtomicElement(NULL)
    43 {};
     49{
     50  AtomicPosition[0] = _v.getPosition();
     51};
    4452
    4553/** Destructor of class AtomInfo.
     
    5664const double& AtomInfo::operator[](size_t i) const
    5765{
    58   return AtomicPosition[i];
     66  return AtomicPosition[0][i];
    5967}
    6068
    6169const double& AtomInfo::at(size_t i) const
    6270{
    63   return AtomicPosition.at(i);
     71  return AtomicPosition[0].at(i);
    6472}
    6573
    6674void AtomInfo::set(size_t i, const double value)
    6775{
    68   AtomicPosition.at(i) = value;
     76  AtomicPosition[0].at(i) = value;
    6977}
    7078
    7179const Vector& AtomInfo::getPosition() const
    7280{
    73   return AtomicPosition;
     81  return AtomicPosition[0];
    7482}
    7583
     
    8593Vector& AtomInfo::getAtomicVelocity()
    8694{
    87   return AtomicVelocity;
     95  return AtomicVelocity[0];
    8896}
    8997
    9098const Vector& AtomInfo::getAtomicVelocity() const
    9199{
    92   return AtomicVelocity;
     100  return AtomicVelocity[0];
    93101}
    94102
    95103void AtomInfo::setAtomicVelocity(const Vector &_newvelocity)
    96104{
    97   AtomicVelocity = _newvelocity;
     105  AtomicVelocity[0] = _newvelocity;
    98106}
    99107
    100108const Vector& AtomInfo::getAtomicForce() const
    101109{
    102   return AtomicForce;
     110  return AtomicForce[0];
    103111}
    104112
    105113void AtomInfo::setAtomicForce(const Vector &_newforce)
    106114{
    107   AtomicForce = _newforce;
     115  AtomicForce[0] = _newforce;
    108116}
    109117
    110118void AtomInfo::setPosition(const Vector& _vector)
    111119{
    112   AtomicPosition = _vector;
     120  AtomicPosition[0] = _vector;
    113121  //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
    114122}
     
    116124const VectorInterface& AtomInfo::operator+=(const Vector& b)
    117125{
    118   AtomicPosition += b;
     126  AtomicPosition[0] += b;
    119127  return *this;
    120128}
     
    122130const VectorInterface& AtomInfo::operator-=(const Vector& b)
    123131{
    124   AtomicPosition -= b;
     132  AtomicPosition[0] -= b;
    125133  return *this;
    126134}
     
    128136Vector const AtomInfo::operator+(const Vector& b) const
    129137{
    130   Vector a(AtomicPosition);
     138  Vector a(AtomicPosition[0]);
    131139  a += b;
    132140  return a;
     
    135143Vector const AtomInfo::operator-(const Vector& b) const
    136144{
    137   Vector a(AtomicPosition);
     145  Vector a(AtomicPosition[0]);
    138146  a -= b;
    139147  return a;
     
    142150double AtomInfo::distance(const Vector &point) const
    143151{
    144   return AtomicPosition.distance(point);
     152  return AtomicPosition[0].distance(point);
    145153}
    146154
    147155double AtomInfo::DistanceSquared(const Vector &y) const
    148156{
    149   return AtomicPosition.DistanceSquared(y);
     157  return AtomicPosition[0].DistanceSquared(y);
    150158}
    151159
    152160double AtomInfo::distance(const VectorInterface &_atom) const
    153161{
    154   return _atom.distance(AtomicPosition);
     162  return _atom.distance(AtomicPosition[0]);
    155163}
    156164
    157165double AtomInfo::DistanceSquared(const VectorInterface &_atom) const
    158166{
    159   return _atom.DistanceSquared(AtomicPosition);
     167  return _atom.DistanceSquared(AtomicPosition[0]);
    160168}
    161169
    162170VectorInterface &AtomInfo::operator=(const Vector& _vector)
    163171{
    164   AtomicPosition = _vector;
     172  AtomicPosition[0] = _vector;
    165173  return *this;
    166174}
     
    168176void AtomInfo::ScaleAll(const double *factor)
    169177{
    170   AtomicPosition.ScaleAll(factor);
     178  AtomicPosition[0].ScaleAll(factor);
    171179}
    172180
    173181void AtomInfo::ScaleAll(const Vector &factor)
    174182{
    175   AtomicPosition.ScaleAll(factor);
     183  AtomicPosition[0].ScaleAll(factor);
    176184}
    177185
    178186void AtomInfo::Scale(const double factor)
    179187{
    180   AtomicPosition.Scale(factor);
     188  AtomicPosition[0].Scale(factor);
    181189}
    182190
    183191void AtomInfo::Zero()
    184192{
    185   AtomicPosition.Zero();
     193  AtomicPosition[0].Zero();
    186194}
    187195
    188196void AtomInfo::One(const double one)
    189197{
    190   AtomicPosition.One(one);
     198  AtomicPosition[0].One(one);
    191199}
    192200
    193201void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
    194202{
    195   AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors);
     203  AtomicPosition[0].LinearCombinationOfVectors(x1,x2,x3,factors);
    196204}
    197205
  • src/atom_atominfo.hpp

    rbce72c r54b42e  
    1818#include <config.h>
    1919#endif
     20
     21#include <vector>
    2022
    2123#include "LinearAlgebra/Vector.hpp"
     
    115117
    116118private:
    117   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
     119  std::vector<Vector> AtomicPosition;       //!< coordinate vector of atom, giving last position within cell
     120  std::vector<Vector> AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
     121  std::vector<Vector> AtomicForce;       //!< Force vector of atom, giving last force within cell
    120122
    121123  const element *AtomicElement;  //!< pointing to element
Note: See TracChangeset for help on using the changeset viewer.