Changeset b453f9 for src/atom.cpp


Ignore:
Timestamp:
Oct 27, 2009, 8:54:44 AM (16 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:
70ff32
Parents:
831a14
Message:

Begun with ticket #38 (make const what is const).

  • basically all changes to member function that now state that they do not change member attributes.
  • in molecule_template.hpp all member functions are declared const, as we only need start and end from molecule and these are never changed (lots of overloaded templates removed thereby).
  • Vector::Distance...() and ...DistanceSquared() are const now too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/atom.cpp

    r831a14 rb453f9  
    4343  sort = &nr;
    4444  node = &x;
    45 }
     45};
    4646
    4747
     
    8383 * \param **res return value (only set if atom::father is equal to \a *ptr)
    8484 */
    85 void atom::EqualsFather ( atom *ptr, atom **res )
     85void atom::EqualsFather ( const atom *ptr, const atom **res ) const
    8686{
    8787  if ( ptr == father )
     
    9494 * \return true - is inside, false - is not
    9595 */
    96 bool atom::IsInParallelepiped(Vector offset, double *parallelepiped)
     96bool atom::IsInParallelepiped(const Vector offset, const double *parallelepiped) const
    9797{
    9898  return (node->IsInParallelepiped(offset, parallelepiped));
     
    110110};
    111111
    112 /** Output of a single atom.
     112/** Output of a single atom with given numbering.
    113113 * \param ElementNo cardinal number of the element
    114114 * \param AtomNo cardinal number among these atoms of the same element
     
    117117  * \return true - \a *out present, false - \a *out is NULL
    118118 */
    119 bool atom::Output(ofstream *out, int ElementNo, int AtomNo, const char *comment) const
     119bool atom::OutputIndexed(ofstream *out, const int ElementNo, const int AtomNo, const char *comment) const
    120120{
    121121  if (out != NULL) {
     
    133133    return false;
    134134};
    135 bool atom::Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment)
     135
     136/** Output of a single atom with numbering from array according to atom::type.
     137 * \param *ElementNo cardinal number of the element
     138 * \param *AtomNo cardinal number among these atoms of the same element
     139 * \param *out stream to output to
     140 * \param *comment commentary after '#' sign
     141  * \return true - \a *out present, false - \a *out is NULL
     142 */
     143bool atom::OutputArrayIndexed(ofstream *out, const int *ElementNo, int *AtomNo, const char *comment) const
    136144{
    137145  AtomNo[type->Z]++;  // increment number
     
    171179  * \return true - \a *out present, false - \a *out is NULL
    172180 */
    173 bool atom::OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const
     181bool atom::OutputTrajectory(ofstream *out, const int *ElementNo, int *AtomNo, const int step) const
    174182{
    175183  AtomNo[type->Z]++;
     
    193201 * \return true - \a *out present, false - \a *out is NULL
    194202 */
    195 bool atom::OutputTrajectoryXYZ(ofstream *out, int step) const
     203bool atom::OutputTrajectoryXYZ(ofstream *out, const int step) const
    196204{
    197205  if (out != NULL) {
     
    210218 * \param *AtomNo pointer to atom counter that is increased by one
    211219 */
    212 void atom::OutputMPQCLine(ofstream *out, Vector *center, int *AtomNo = NULL) const
     220void atom::OutputMPQCLine(ofstream *out, const Vector *center, int *AtomNo = NULL) const
    213221{
    214222  *out << "\t\t" << type->symbol << " [ " << x.x[0]-center->x[0] << "\t" << x.x[1]-center->x[1] << "\t" << x.x[2]-center->x[2] << " ]" << endl;
     
    217225};
    218226
    219 ostream & operator << (ostream &ost, const ParticleInfo &a)
    220 {
    221   ost << "[" << a.Name << "|" << &a << "]";
    222   return ost;
    223 };
    224 
    225 ostream & ParticleInfo::operator << (ostream &ost)
    226 {
    227   ost << "[" << Name << "|" << this << "]";
    228   return ost;
    229 };
    230 
    231227/** Compares the indices of \a this atom with a given \a ptr.
    232228 * \param ptr atom to compare index against
    233229 * \return true - this one's is smaller, false - not
    234230 */
    235 bool atom::Compare(const atom &ptr)
     231bool atom::Compare(const atom &ptr) const
    236232{
    237233  if (nr < ptr.nr)
     
    245241 * \return distance squared
    246242 */
    247 double atom::DistanceSquaredToVector(Vector &origin)
     243double atom::DistanceSquaredToVector(const Vector &origin) const
    248244{
    249245  return origin.DistanceSquared(&x);
     
    254250 * \return distance
    255251 */
    256 double atom::DistanceToVector(Vector &origin)
     252double atom::DistanceToVector(const Vector &origin) const
    257253{
    258254  return origin.Distance(&x);
Note: See TracChangeset for help on using the changeset viewer.