Changeset 83f176


Ignore:
Timestamp:
Aug 19, 2010, 3:23:37 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:
2a7457
Parents:
1ee380f
git-author:
Frederik Heber <heber@…> (08/17/10 17:21:25)
git-committer:
Frederik Heber <heber@…> (08/19/10 15:23:37)
Message:

Made all member variables of class element private, added accessor functions and periodentafel is friend.

Location:
src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    r1ee380f r83f176  
    7676      Vector x = (*iter)->getPosition();
    7777      x -= *CenterOfGravity;
    78       const double mass = (*iter)->getType()->mass;
     78      const double mass = (*iter)->getType()->getMass();
    7979      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
    8080      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
  • src/Actions/MapOfActions.cpp

    r1ee380f r83f176  
    808808  if (typeid(const element ) == *TypeMap[name]) {
    809809    std::ostringstream stream;
    810     stream << _T->Z;
     810    stream << _T->getAtomicNumber();
    811811    CurrentValue[name] = stream.str();
    812812  } else
     
    869869    std::ostringstream stream;
    870870    for (std::vector<const element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
    871       stream << (*iter)->Z << " ";
     871      stream << (*iter)->getAtomicNumber() << " ";
    872872    }
    873873    CurrentValue[name] = stream.str();
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    r1ee380f r83f176  
    9797      Vector x = (*iter)->getPosition();
    9898      x -= *CenterOfGravity;
    99       const double mass = (*iter)->getType()->mass;
     99      const double mass = (*iter)->getType()->getMass();
    100100      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
    101101      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     
    148148      Vector x = (*iter)->getPosition();
    149149      x -= *CenterOfGravity;
    150       const double mass = (*iter)->getType()->mass;
     150      const double mass = (*iter)->getType()->getMass();
    151151      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
    152152      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
  • src/Parser/PcpParser.cpp

    r1ee380f r83f176  
    505505  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
    506506  for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
    507     PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->NoValenceOrbitals;
     507    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals();
    508508  }
    509509  cout << PlaneWaveSpecifics.MaxPsiDouble << endl;
     
    540540  // insert all found elements into the map
    541541  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    542     Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->Z, 1));
     542    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1));
    543543    if (!Inserter.second) // increase if present
    544544      Inserter.first->second += 1;
     
    555555    const element * const elemental = World::getInstance().getPeriode()->FindElement(iter->first);
    556556    ZtoIndexMap.insert( pair<int,int> (iter->first, counter) );
    557     *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->mass << "\t" << elemental->getName() << "\t" << elemental->getSymbol() <<endl;
     557    *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->getAtomicNumber() << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->getMass() << "\t" << elemental->getName() << "\t" << elemental->getSymbol() <<endl;
    558558  }
    559559}
     
    571571  int nr = 0;
    572572  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    573     Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->Z, 1) );
     573    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) );
    574574    if (!Inserter.second)
    575575      Inserter.first->second += 1;
    576     const int Z = (*AtomRunner)->getType()->Z;
     576    const int Z = (*AtomRunner)->getType()->getAtomicNumber();
    577577    *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
    578578    *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
  • src/analysis_bonds.cpp

    r1ee380f r83f176  
    150150        molecule::iterator Runner = (*MolRunner)->begin();
    151151        for(;Runner!=(*MolRunner)->end();++Runner){
    152           if (((*Walker)->getType()->Z  == 8) && ((*Runner)->getType()->Z  == 8)) {
     152          if (((*Walker)->getType()->getAtomicNumber()  == 8) && ((*Runner)->getType()->getAtomicNumber()  == 8)) {
    153153            // check distance
    154154            const double distance = (*Runner)->DistanceSquared(*(*Walker));
     
    164164                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    165165                // if hydrogen, check angle to be greater(!) than 30 degrees
    166                 if (OtherAtom->getType()->Z == 1) {
     166                if (OtherAtom->getType()->getAtomicNumber() == 1) {
    167167                  const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition());
    168168                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
     
    189189                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
    190190                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    191                   if (OtherAtom->getType()->Z == 1) {
     191                  if (OtherAtom->getType()->getAtomicNumber() == 1) {
    192192                    // check angle
    193193                    if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
  • src/atom.cpp

    r1ee380f r83f176  
    180180bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
    181181{
    182   AtomNo[getType()->Z]++;  // increment number
     182  AtomNo[getType()->getAtomicNumber()]++;  // increment number
    183183  if (out != NULL) {
    184184    const element *elemental = getType();
    185185    cout << "Looking for atom with element " << *elemental << endl;
    186186    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    187     *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     187    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
    188188    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    189189    *out << "\t" << FixedIon;
     
    221221bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
    222222{
    223   AtomNo[getType()->Z]++;
    224   if (out != NULL) {
    225     *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     223  AtomNo[getType()->getAtomicNumber()]++;
     224  if (out != NULL) {
     225    *out << "Ion_Type" << ElementNo[getType()->getAtomicNumber()] << "_" << AtomNo[getType()->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
    226226    *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
    227227    *out << "\t" << FixedIon;
  • src/atom_bondedparticle.cpp

    r1ee380f r83f176  
    164164  NoBonds = CountBonds();
    165165  //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    166   if ((int)(getType()->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
     166  if ((int)(getType()->getNoValenceOrbitals()) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
    167167    for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
    168168      OtherWalker = (*Runner)->GetOtherAtom(this);
    169169      OtherNoBonds = OtherWalker->CountBonds();
    170170      //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
    171       if ((int)(OtherWalker->getType()->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
     171      if ((int)(OtherWalker->getType()->getNoValenceOrbitals()) > OtherNoBonds) { // check if possible candidate
    172172        if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
    173173          CandidateBond = (*Runner);
  • src/atom_trajectoryparticle.cpp

    r1ee380f r83f176  
    5050{
    5151  for (int i=NDIM;i--;)
    52     *temperature += getType()->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
     52    *temperature += getType()->getMass() * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
    5353};
    5454
     
    7777  for(int d=0;d<NDIM;d++) {
    7878    Trajectory.U.at(Step)[d] -= CoGVelocity->at(d);
    79     *ActualTemp += 0.5 * getType()->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
     79    *ActualTemp += 0.5 * getType()->getMass() * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
    8080  }
    8181};
     
    125125    Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d];
    126126    Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]);     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
    127     Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->mass);     // F = m * a and s =
     127    Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->getMass());     // F = m * a and s =
    128128  }
    129129  // Update U
    130130  for (int d=0; d<NDIM; d++) {
    131131    Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d];
    132     Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->mass); // v = F/m * t
     132    Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->getMass()); // v = F/m * t
    133133  }
    134134  // Update R (and F)
     
    149149void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const
    150150{
    151   *TotalMass += getType()->mass;  // sum up total mass
     151  *TotalMass += getType()->getMass();  // sum up total mass
    152152  for(int d=0;d<NDIM;d++) {
    153     TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->mass;
     153    TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->getMass();
    154154  }
    155155};
     
    166166    for (int d=0; d<NDIM; d++) {
    167167      U[d] *= ScaleTempFactor;
    168       *ekin += 0.5*getType()->mass * U[d]*U[d];
     168      *ekin += 0.5*getType()->getMass() * U[d]*U[d];
    169169    }
    170170};
     
    182182    for (int d=0; d<NDIM; d++) {
    183183      *G += U[d] * F[d];
    184       *E += U[d]*U[d]*getType()->mass;
     184      *E += U[d]*U[d]*getType()->getMass();
    185185    }
    186186};
     
    197197  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
    198198    for (int d=0; d<NDIM; d++) {
    199       U[d] += configuration->Deltat/getType()->mass * ( (G_over_E) * (U[d]*getType()->mass) );
    200       *ekin += getType()->mass * U[d]*U[d];
     199      U[d] += configuration->Deltat/getType()->getMass() * ( (G_over_E) * (U[d]*getType()->getMass()) );
     200      *ekin += getType()->getMass() * U[d]*U[d];
    201201    }
    202202};
     
    210210void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
    211211{
    212   double sigma  = sqrt(configuration->Thermostats->TargetTemp/getType()->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
     212  double sigma  = sqrt(configuration->Thermostats->TargetTemp/getType()->getMass()); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
    213213  Vector &U = Trajectory.U.at(Step);
    214214  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
     
    223223    }
    224224    for (int d=0; d<NDIM; d++)
    225       *ekin += 0.5*getType()->mass * U[d]*U[d];
     225      *ekin += 0.5*getType()->getMass() * U[d]*U[d];
    226226  }
    227227};
     
    239239    for (int d=0; d<NDIM; d++) {
    240240      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
    241       *ekin += 0.5*getType()->mass * U[d]*U[d];
     241      *ekin += 0.5*getType()->getMass() * U[d]*U[d];
    242242    }
    243243  }
     
    253253  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    254254    for (int d=0; d<NDIM; d++) {
    255       *delta_alpha += U[d]*U[d]*getType()->mass;
     255      *delta_alpha += U[d]*U[d]*getType()->getMass();
    256256    }
    257257  }
     
    268268  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    269269    for (int d=0; d<NDIM; d++) {
    270         U[d] += configuration->Deltat/getType()->mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass));
    271         *ekin += (0.5*getType()->mass) * U[d]*U[d];
     270        U[d] += configuration->Deltat/getType()->getMass() * (configuration->Thermostats->alpha * (U[d] * getType()->getMass()));
     271        *ekin += (0.5*getType()->getMass()) * U[d]*U[d];
    272272      }
    273273  }
  • src/bond.cpp

    r1ee380f r83f176  
    6363{
    6464  if ((left != NULL) && (right != NULL)) {
    65     if ((left->getType() != NULL) && (left->getType()->Z == 1))
     65    if ((left->getType() != NULL) && (left->getType()->getAtomicNumber() == 1))
    6666      HydrogenBond++;
    67     if ((right->getType() != NULL) && (right->getType()->Z == 1))
     67    if ((right->getType() != NULL) && (right->getType()->getAtomicNumber() == 1))
    6868      HydrogenBond++;
    6969  }
  • src/bondgraph.cpp

    r1ee380f r83f176  
    144144
    145145  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    146     if ((*iter)->getType()->CovalentRadius > max_distance)
    147       max_distance = (*iter)->getType()->CovalentRadius;
     146    if ((*iter)->getType()->getCovalentRadius() > max_distance)
     147      max_distance = (*iter)->getType()->getCovalentRadius();
    148148  }
    149149  max_distance *= 2.;
     
    161161void BondGraph::CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
    162162{
    163   MinDistance = OtherWalker->getType()->CovalentRadius + Walker->getType()->CovalentRadius;
     163  MinDistance = OtherWalker->getType()->getCovalentRadius() + Walker->getType()->getCovalentRadius();
    164164  MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    165165  MaxDistance = MinDistance + BondThreshold;
     
    182182    CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    183183  } else {
    184     MinDistance = GetBondLength(Walker->getType()->Z-1, OtherWalker->getType()->Z-1);
     184    MinDistance = GetBondLength(Walker->getType()->getAtomicNumber()-1, OtherWalker->getType()->getAtomicNumber()-1);
    185185    MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    186186    MaxDistance = MinDistance + BondThreshold;
  • src/boundary.cpp

    r1ee380f r83f176  
    717717  // sum up the atomic masses
    718718  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    719       totalmass += (*iter)->getType()->mass;
     719      totalmass += (*iter)->getType()->getMass();
    720720  }
    721721  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
  • src/config.cpp

    r1ee380f r83f176  
    484484      ParseForParameter(verbose,FileBuffer, name, 0, 2, 1, int_type, &Z, 1, critical);
    485485      elementhash[i] = periode->FindElement(Z);
    486       DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]->Z << " with " << No[i] << " ions." << endl);
     486      DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]->getAtomicNumber() << " with " << No[i] << " ions." << endl);
    487487      NoAtoms += No[i];
    488488    }
     
    13521352    AtomNo = 0;
    13531353    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
    1354       sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->Z]);
    1355       elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
     1354      sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]);
     1355      elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100;   // confine to two digits
    13561356      fprintf(f,
    13571357             "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    13641364             (*iter)->at(1),                 /* position Y in Angstroem */
    13651365             (*iter)->at(2),                 /* position Z in Angstroem */
    1366              (double)(*iter)->getType()->Valence,         /* occupancy */
    1367              (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
     1366             (double)(*iter)->getType()->getValence(),         /* occupancy */
     1367             (double)(*iter)->getType()->getNoValenceOrbitals(),          /* temperature factor */
    13681368             "0",            /* segment identifier */
    13691369             (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
     
    14051405  AtomNo = 0;
    14061406  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    1407     sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->Z]);
    1408     elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
     1407    sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]);
     1408    elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100;   // confine to two digits
    14091409    fprintf(f,
    14101410           "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    14171417           (*iter)->at(1),                 /* position Y in Angstroem */
    14181418           (*iter)->at(2),                 /* position Z in Angstroem */
    1419            (double)(*iter)->getType()->Valence,         /* occupancy */
    1420            (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
     1419           (double)(*iter)->getType()->getValence(),         /* occupancy */
     1420           (double)(*iter)->getType()->getNoValenceOrbitals(),          /* temperature factor */
    14211421           "0",            /* segment identifier */
    14221422           (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
     
    14641464    *output << 0 << "\t";
    14651465    *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
    1466     *output << static_cast<double>((*iter)->getType()->Valence) << "\t";
     1466    *output << static_cast<double>((*iter)->getType()->getValence()) << "\t";
    14671467    *output << (*iter)->getType()->getSymbol() << "\t";
    14681468    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
     
    15361536        *output << MolCounter+1 << "\t";
    15371537        *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
    1538         *output << (double)(*iter)->getType()->Valence << "\t";
     1538        *output << (double)(*iter)->getType()->getValence() << "\t";
    15391539        *output << (*iter)->getType()->getSymbol() << "\t";
    15401540        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
  • src/element.cpp

    r1ee380f r83f176  
    2222#include <fstream>
    2323
     24#include "Helpers/Assert.hpp"
    2425#include "element.hpp"
    2526
     
    107108}
    108109
     110double element::getMass() const
     111{
     112  return mass;
     113}
     114
     115double element::getCovalentRadius() const
     116{
     117  return CovalentRadius;
     118}
     119
     120double element::getVanDerWaalsRadius() const
     121{
     122  return VanDerWaalsRadius;
     123}
     124
     125int element::getAtomicNumber() const
     126{
     127  return Z;
     128}
     129
     130double element::getValence() const
     131{
     132  return Valence;
     133}
     134
     135int element::getNoValenceOrbitals() const
     136{
     137  return NoValenceOrbitals;
     138}
     139
     140double element::getHBondDistance(const int i) const
     141{
     142  ASSERT((i>=0) && (i<3), "Access to element::HBondDistance out of bounds.");
     143  return HBondDistance[i];
     144}
     145
     146double element::getHBondAngle(const int i) const
     147{
     148  ASSERT((i>=0) && (i<3), "Access to element::HBondAngle out of bounds.");
     149  return HBondAngle[i];
     150}
     151
    109152string &element::getSymbol(){
    110153  return symbol;
     
    113156const string &element::getSymbol() const{
    114157  return symbol;
     158}
     159
     160void element::setSymbol(const std::string &temp)
     161{
     162  symbol = temp;
    115163}
    116164
     
    123171}
    124172
     173void element::setName(const std::string &temp)
     174{
     175  name = temp;
     176}
     177
    125178std::ostream &operator<<(std::ostream &ost,const element &elem){
    126179  ost << elem.getName() << "(" << elem.getNumber() << ")";
  • src/element.hpp

    r1ee380f r83f176  
    2222#include "types.hpp"
    2323
     24class periodentafel;
     25
    2426/********************************************** declarations *******************************/
    2527
     
    2830 */
    2931class element {
     32  friend class periodentafel;
    3033  public:
     34    element();
     35    element(const element&);
     36    ~element();
     37
     38    element &operator=(const element&);
     39
     40    // accessor functions
     41    atomicNumber_t getNumber() const;
     42    double getMass() const;
     43    double getCovalentRadius() const;
     44    double getVanDerWaalsRadius() const;
     45    int getAtomicNumber() const;
     46    double getValence() const;
     47    int getNoValenceOrbitals() const;
     48    double getHBondDistance(const int i) const;
     49    double getHBondAngle(const int i) const;
     50
     51    std::string &getSymbol();
     52    const std::string &getSymbol() const;
     53    void setSymbol(const std::string &temp);
     54
     55    std::string &getName();
     56    const std::string &getName() const;
     57    void setName(const std::string &temp);
     58
     59    //> print element entries to screen
     60    bool Output(std::ostream * const out) const;
     61    bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const;
     62
     63  private:
    3164    double mass;    //!< mass in g/mol
    3265    double CovalentRadius;  //!< covalent radius
     
    4174    double HBondAngle[NDIM];     //!< typical angle for one, two, three bonded hydrogen (in degrees)
    4275
    43     element();
    44     element(const element&);
    45     ~element();
    46 
    47     element &operator=(const element&);
    48 
    49     // accessor functions
    50     atomicNumber_t getNumber() const;
    51     std::string &getSymbol();
    52     const std::string &getSymbol() const;
    53     std::string &getName();
    54     const std::string &getName() const;
    55 
    56     //> print element entries to screen
    57     bool Output(std::ostream * const out) const;
    58     bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const;
    59 
    60   private:
    61     std::string name;  //!< atom name, i.e. "Hydrogren"
     76    std::string name;  //!< atom name, i.e. "Hydrogen"
    6277    std::string symbol; //!< short form of the atom, i.e. "H"
    6378};
  • src/molecule.cpp

    r1ee380f r83f176  
    234234    pointer->sort = &pointer->nr;
    235235    if (pointer->getType() != NULL) {
    236       if (pointer->getType()->Z != 1)
     236      if (pointer->getType()->getAtomicNumber() != 1)
    237237        NoNonHydrogen++;
    238238      if(pointer->getName() == "Unknown"){
     
    262262    walker->nr = last_atom++;  // increase number within molecule
    263263    insert(walker);
    264     if ((pointer->getType() != NULL) && (pointer->getType()->Z != 1))
     264    if ((pointer->getType() != NULL) && (pointer->getType()->getAtomicNumber() != 1))
    265265      NoNonHydrogen++;
    266266    retval=walker;
     
    348348  // get typical bond length and store as scale factor for later
    349349  ASSERT(TopOrigin->getType() != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
    350   BondRescale = TopOrigin->getType()->HBondDistance[TopBond->BondDegree-1];
     350  BondRescale = TopOrigin->getType()->getHBondDistance(TopBond->BondDegree-1);
    351351  if (BondRescale == -1) {
    352352    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    365365      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    366366      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    367       if (TopReplacement->getType()->Z == 1) { // neither rescale nor replace if it's already hydrogen
     367      if (TopReplacement->getType()->getAtomicNumber() == 1) { // neither rescale nor replace if it's already hydrogen
    368368        FirstOtherAtom->father = TopReplacement;
    369369        BondRescale = bondlength;
     
    434434      FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
    435435      SecondOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
    436       bondangle = TopOrigin->getType()->HBondAngle[1];
     436      bondangle = TopOrigin->getType()->getHBondAngle(1);
    437437      if (bondangle == -1) {
    438438        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    510510
    511511      // create correct coordination for the three atoms
    512       alpha = (TopOrigin->getType()->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
     512      alpha = (TopOrigin->getType()->getHBondAngle(2))/180.*M_PI/2.;  // retrieve triple bond angle from database
    513513      l = BondRescale;        // desired bond length
    514514      b = 2.*l*sin(alpha);    // base length of isosceles triangle
     
    718718  atom1->RegisterBond(Binder);
    719719  atom2->RegisterBond(Binder);
    720   if ((atom1->getType() != NULL) && (atom1->getType()->Z != 1) && (atom2->getType() != NULL) && (atom2->getType()->Z != 1))
     720  if ((atom1->getType() != NULL) && (atom1->getType()->getAtomicNumber() != 1) && (atom2->getType() != NULL) && (atom2->getType()->getAtomicNumber() != 1))
    721721    NoNonBonds++;
    722722
     
    912912        ElementNo[i] = 0;
    913913      }
    914       SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1);
     914      for(molecule::iterator iter = begin(); iter != end(); ++iter) {
     915        ElementNo[(*iter)->getType()->getAtomicNumber()] = 1;
     916      }
    915917      int current=1;
    916918      for (int i=0;i<MAX_ELEMENTS;++i) {
     
    986988  for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
    987989    (*iter)->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
    988     if ((*iter)->getType()->Z != 1) // count non-hydrogen atoms whilst at it
     990    if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it
    989991      NoNonHydrogen++;
    990992    stringstream sstr;
  • src/molecule_fragmentation.cpp

    r1ee380f r83f176  
    463463      for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    464464    #ifdef ADDHYDROGEN
    465         if ((*iter)->getType()->Z != 1) // skip hydrogen
     465        if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    466466    #endif
    467467        {
     
    483483    for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    484484  #ifdef ADDHYDROGEN
    485       if ((*iter)->getType()->Z != 1) // skip hydrogen
     485      if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    486486  #endif
    487487      {
     
    892892  for (KeySet::iterator runner = Leaf->begin(); runner != Leaf->end(); runner++) {
    893893    Runner = FindAtom((*runner));
    894     if (Runner->getType()->Z != 1) { // skip all those added hydrogens when re-filling snake stack
     894    if (Runner->getType()->getAtomicNumber() != 1) { // skip all those added hydrogens when re-filling snake stack
    895895      if (ShortestPathList[(*runner)] > SP) {  // remove the oldest one with longest shortest path
    896896        SP = ShortestPathList[(*runner)];
     
    981981    ++iter;
    982982#ifdef ADDHYDROGEN
    983     while ((iter != Leaf->end()) && ((*iter)->getType()->Z == 1)){ // skip added hydrogen
     983    while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen
    984984      iter++;
    985985    }
     
    13591359        if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end())
    13601360  #ifdef ADDHYDROGEN
    1361          && (OtherWalker->getType()->Z != 1)
     1361         && (OtherWalker->getType()->getAtomicNumber() != 1)
    13621362  #endif
    13631363                                                              ) {  // skip hydrogens and restrict to fragment
  • src/molecule_geometry.cpp

    r1ee380f r83f176  
    186186  if (iter != end()) {   //list not empty?
    187187    for (; iter != end(); ++iter) {  // continue with second if present
    188       Num += (*iter)->getType()->mass;
    189       tmp = (*iter)->getType()->mass * (*iter)->getPosition();
     188      Num += (*iter)->getType()->getMass();
     189      tmp = (*iter)->getType()->getMass() * (*iter)->getPosition();
    190190      (*a) += tmp;
    191191    }
     
    299299    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    300300#ifdef ADDHYDROGEN
    301       if ((*iter)->getType()->Z != 1) {
     301      if ((*iter)->getType()->getAtomicNumber() != 1) {
    302302#endif
    303303        Testvector = inversematrix * (*iter)->getPosition();
     
    324324        // now also change all hydrogens
    325325        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    326           if ((*Runner)->GetOtherAtom((*iter))->getType()->Z == 1) {
     326          if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) {
    327327            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
    328328            Testvector += Translationvector;
  • src/molecule_graph.cpp

    r1ee380f r83f176  
    745745        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    746746#ifdef ADDHYDROGEN
    747         if (OtherAtom->getType()->Z != 1) {
     747        if (OtherAtom->getType()->getAtomicNumber() != 1) {
    748748#endif
    749749        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
  • src/moleculelist.cpp

    r1ee380f r83f176  
    347347    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    348348      //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    349       if (((*iter)->getType()->Z == 1) && (((*iter)->father == NULL)
    350           || ((*iter)->father->getType()->Z != 1))) { // if it's a hydrogen
     349      if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL)
     350          || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen
    351351        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
    352352          //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    353353          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    354354          Binder = *((*runner)->ListOfBonds.begin());
    355           if (((*runner)->getType()->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
     355          if (((*runner)->getType()->getAtomicNumber() == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
    356356            // 4. evaluate the morse potential for each matrix component and add up
    357357            distance = (*runner)->distance(*(*iter));
     
    836836        if (AtomMask[Father->nr]) // apply mask
    837837#ifdef ADDHYDROGEN
    838           if ((*iter)->getType()->Z != 1) // skip hydrogen
     838          if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
    839839#endif
    840840          RootStack[FragmentCounter].push_front((*iter)->nr);
  • src/periodentafel.cpp

    r1ee380f r83f176  
    310310    while (!input.eof()) {
    311311      element *neues = new element;
    312       input >> neues->getName();;
    313       //(*input) >> ws;
    314       input >> neues->getSymbol();
     312      input >> neues->name;
     313      //(*input) >> ws;
     314      input >> neues->symbol;
    315315      //(*input) >> ws;
    316316      input >> neues->period;
Note: See TracChangeset for help on using the changeset viewer.