Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/periodentafel.cpp

    r61745cc r389cc8  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79using namespace std;
     
    3032periodentafel::periodentafel()
    3133{
    32   bool status = true;
    33   status = LoadElementsDatabase(new stringstream(elementsDB,ios_base::in));
    34   ASSERT(status,  "General element initialization failed");
    35   status = LoadValenceDatabase(new stringstream(valenceDB,ios_base::in));
    36   ASSERT(status, "Valence entry of element initialization failed");
    37   status = LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in));
    38   ASSERT(status, "Orbitals entry of element initialization failed");
    39   status = LoadHBondAngleDatabase(new stringstream(HbondangleDB,ios_base::in));
    40   ASSERT(status, "HBond angle entry of element initialization failed");
    41   status = LoadHBondLengthsDatabase(new stringstream(HbonddistanceDB,ios_base::in));
    42   ASSERT(status, "HBond distance entry of element initialization failed");
     34  {
     35    stringstream input(elementsDB,ios_base::in);
     36    bool status = LoadElementsDatabase(&input);
     37    ASSERT(status,  "General element initialization failed");
     38  }
     39  {
     40    stringstream input(valenceDB,ios_base::in);
     41    bool status = LoadValenceDatabase(&input);
     42    ASSERT(status, "Valence entry of element initialization failed");
     43  }
     44  {
     45    stringstream input(orbitalsDB,ios_base::in);
     46    bool status = LoadOrbitalsDatabase(&input);
     47    ASSERT(status, "Orbitals entry of element initialization failed");
     48  }
     49  {
     50    stringstream input(HbondangleDB,ios_base::in);
     51    bool status = LoadHBondAngleDatabase(&input);
     52    ASSERT(status, "HBond angle entry of element initialization failed");
     53  }
     54  {
     55    stringstream input(HbonddistanceDB,ios_base::in);
     56    bool status = LoadHBondLengthsDatabase(&input);
     57    ASSERT(status, "HBond distance entry of element initialization failed");
     58  }
    4359};
    4460
     
    109125 * \return pointer to element
    110126 */
    111 element * const periodentafel::FindElement(const char * const shorthand) const
     127element * const periodentafel::FindElement(const string &shorthand) const
    112128{
    113129  element *res = 0;
     
    195211};
    196212
    197 /** Prints period table to given stream.
    198  * \param *output output stream
    199  * \param *checkliste elements table for this molecule
    200  */
    201 bool periodentafel::Checkout(ostream * const output, const int * const checkliste) const
    202 {
    203   bool result = true;
    204   int No = 1;
    205 
    206   if (output != NULL) {
    207     *output << "# Ion type data (PP = PseudoPotential, Z = atomic number)" << endl;
    208     *output << "#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol" << endl;
    209     for(const_iterator iter=elements.begin(); iter!=elements.end();++iter){
    210       if (((*iter).first < MAX_ELEMENTS) && (checkliste[(*iter).first])) {
    211         (*iter).second->No = No;
    212         result = result && (*iter).second->Checkout(output, No++, checkliste[(*iter).first]);
    213       }
    214     }
    215     return result;
    216   } else
    217     return false;
    218 };
    219 
    220213/** Loads element list from file.
    221214 * \param *path to to standard file names
     
    331324          ASSERT(Elemental != NULL, "element should be present but is not??");
    332325          *Elemental = *neues;
     326          delete(neues);
     327          neues = Elemental;
    333328        } else {
    334329          InserterTest = elements.insert(pair <atomicNumber_t,element*> (neues->getNumber(), neues));
     
    371366      (*input) >> elements[Z]->Valence;
    372367      (*input) >> ws;
    373       //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
     368      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl;
    374369    }
    375370    return true;
     
    394389      (*input) >> elements[Z]->NoValenceOrbitals;
    395390      (*input) >> ws;
    396       //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     391      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
    397392    }
    398393    return true;
Note: See TracChangeset for help on using the changeset viewer.