Changeset bae8b0 for src


Ignore:
Timestamp:
Oct 10, 2011, 4:58:24 PM (13 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:
d7d022
Parents:
f08ae7
git-author:
Frederik Heber <heber@…> (09/09/11 12:00:41)
git-committer:
Frederik Heber <heber@…> (10/10/11 16:58:24)
Message:

FIX: some smaller changes to class element.

  • removed those nonsense ref getter for symbol and name. Now, getter only return const ref.
  • NDIM -> 3 and removed inclusion of defs.hpp.
  • int -> size_t as we desire an array size.
  • initializing now some forgotten values in default cstor.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/element.cpp

    rf08ae7 rbae8b0  
    3535  mass(0),
    3636  CovalentRadius(0),
     37  Electronegativity(0.),
    3738  VanDerWaalsRadius(0),
    38         Z(-1),
     39        Z(0),
     40        period(""),
     41        group(""),
     42        block(""),
    3943        Valence(0),
    40         NoValenceOrbitals(0)
    41 {
     44        NoValenceOrbitals(0),
     45        name(""),
     46        symbol("")
     47{
     48  for (size_t i =0; i<3;++i)
     49    color[i] = (unsigned char)0;
     50  for (size_t i =0; i<3;++i)
     51    HBondDistance[i] = 0.;
     52  for (size_t i =0; i<3;++i)
     53    HBondAngle[i] = 0.;
    4254};
    4355
     
    4557  mass(src.mass),
    4658  CovalentRadius(src.CovalentRadius),
     59  Electronegativity(src.Electronegativity),
    4760  VanDerWaalsRadius(src.VanDerWaalsRadius),
    4861  Z(src.Z),
     62  period(src.period),
     63  group(src.group),
     64  block(src.block),
    4965  Valence(src.Valence),
    5066  NoValenceOrbitals(src.NoValenceOrbitals),
     
    5268  symbol(src.symbol)
    5369{
    54   period = src.period;
    55   group = src.group;
    56   block = src.block;
    5770  for (size_t i =0; i<3;++i)
    5871    color[i] = src.color[i];
     72  for (size_t i =0; i<3;++i)
     73    HBondDistance[i] = src.HBondDistance[i];
     74  for (size_t i =0; i<3;++i)
     75    HBondAngle[i] = src.HBondAngle[i];
    5976}
    6077
     
    6784    mass=src.mass;
    6885    CovalentRadius=src.CovalentRadius;
     86    Electronegativity=src.Electronegativity;
    6987    VanDerWaalsRadius=src.VanDerWaalsRadius;
    7088    Z=src.Z;
    71     Valence=src.Valence;
    72     NoValenceOrbitals=src.NoValenceOrbitals;
    73     name=src.name;
    74     symbol=src.symbol;
    75     for (size_t i =0; i<3;++i)
    76       color[i] = src.color[i];
    7789    period = src.period;
    7890    group = src.group;
    7991    block = src.block;
     92    Valence=src.Valence;
     93    NoValenceOrbitals=src.NoValenceOrbitals;
     94    for (size_t i =0; i<3;++i)
     95      color[i] = src.color[i];
     96    for (size_t i =0; i<3;++i)
     97      HBondDistance[i] = src.HBondDistance[i];
     98    for (size_t i =0; i<3;++i)
     99      HBondAngle[i] = src.HBondAngle[i];
     100    name=src.name;
     101    symbol=src.symbol;
    80102  }
    81103  return *this;
     
    153175}
    154176
    155 double element::getHBondDistance(const int i) const
    156 {
    157   ASSERT((i>=0) && (i<3), "Access to element::HBondDistance out of bounds.");
     177double element::getHBondDistance(const size_t i) const
     178{
     179  ASSERT((i<3), "Access to element::HBondDistance out of bounds.");
    158180  return HBondDistance[i];
    159181}
    160182
    161 double element::getHBondAngle(const int i) const
    162 {
    163   ASSERT((i>=0) && (i<3), "Access to element::HBondAngle out of bounds.");
     183double element::getHBondAngle(const size_t i) const
     184{
     185  ASSERT((i<3), "Access to element::HBondAngle out of bounds.");
    164186  return HBondAngle[i];
    165 }
    166 
    167 string &element::getSymbol(){
    168   return symbol;
    169187}
    170188
     
    176194{
    177195  symbol = temp;
    178 }
    179 
    180 std::string &element::getName(){
    181   return name;
    182196}
    183197
  • src/element.hpp

    rf08ae7 rbae8b0  
    1919#include <string>
    2020
    21 #include "LinearAlgebra/defs.hpp"
    2221#include "types.hpp"
     22
     23#include "boost/serialization/array.hpp"
     24#include "boost/serialization/string.hpp"
    2325
    2426class periodentafel;
     
    4850    double getValence() const;
    4951    int getNoValenceOrbitals() const;
    50     double getHBondDistance(const int i) const;
    51     double getHBondAngle(const int i) const;
     52    double getHBondDistance(const size_t i) const;
     53    double getHBondAngle(const size_t i) const;
    5254
    53     std::string &getSymbol();
    5455    const std::string &getSymbol() const;
    5556    void setSymbol(const std::string &temp);
    5657
    57     std::string &getName();
    5858    const std::string &getName() const;
    5959    void setName(const std::string &temp);
     
    7474    double Valence;   //!< number of valence electrons for this element
    7575    int NoValenceOrbitals;  //!< number of valence orbitals, used for determining bond degree in molecule::CreateConnectmatrix()
    76     double HBondDistance[NDIM]; //!< distance in Angstrom of this element to hydrogen  (for single, double and triple bonds)
    77     double HBondAngle[NDIM];     //!< typical angle for one, two, three bonded hydrogen (in degrees)
     76    double HBondDistance[3]; //!< distance in Angstrom of this element to hydrogen  (for single, double and triple bonds)
     77    double HBondAngle[3];     //!< typical angle for one, two, three bonded hydrogen (in degrees)
    7878    unsigned char color[3];   //!< typical color for this element (from Jmol)
    7979
  • src/periodentafel.cpp

    rf08ae7 rbae8b0  
    207207    cin >> tmp->mass;
    208208    DoLog(0) && (Log() << Verbose(0) << "Name [max 64 chars]: " << endl);
    209     cin >> tmp->getName();
     209    cin >> tmp->name;
    210210    DoLog(0) && (Log() << Verbose(0) << "Short form [max 3 chars]: " << endl);
    211     cin >> tmp->getSymbol();
     211    cin >> tmp->symbol;
    212212    AddElement(tmp);
    213213    return tmp;
Note: See TracChangeset for help on using the changeset viewer.