/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /** \file element.cpp * * Function implementations for the class element. * */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include #include #include "CodePatterns/Assert.hpp" #include "CodePatterns/Log.hpp" #include "element.hpp" using namespace std; /************************************* Functions for class element **********************************/ /** Constructor of class element. */ element::element() : mass(0), CovalentRadius(0), Electronegativity(0.), VanDerWaalsRadius(0), Z(0), period(""), group(""), block(""), Valence(0), NoValenceOrbitals(0), name(""), symbol("") { for (size_t i =0; i<3;++i) color[i] = (unsigned char)0; for (size_t i =0; i<3;++i) HBondDistance[i] = 0.; for (size_t i =0; i<3;++i) HBondAngle[i] = 0.; }; element::element(const element &src) : mass(src.mass), CovalentRadius(src.CovalentRadius), Electronegativity(src.Electronegativity), VanDerWaalsRadius(src.VanDerWaalsRadius), Z(src.Z), period(src.period), group(src.group), block(src.block), Valence(src.Valence), NoValenceOrbitals(src.NoValenceOrbitals), name(src.name), symbol(src.symbol) { for (size_t i =0; i<3;++i) color[i] = src.color[i]; for (size_t i =0; i<3;++i) HBondDistance[i] = src.HBondDistance[i]; for (size_t i =0; i<3;++i) HBondAngle[i] = src.HBondAngle[i]; } /** Destructor of class element. */ element::~element() {}; element &element::operator=(const element &src){ if(this!=&src){ mass=src.mass; CovalentRadius=src.CovalentRadius; Electronegativity=src.Electronegativity; VanDerWaalsRadius=src.VanDerWaalsRadius; Z=src.Z; period = src.period; group = src.group; block = src.block; Valence=src.Valence; NoValenceOrbitals=src.NoValenceOrbitals; for (size_t i =0; i<3;++i) color[i] = src.color[i]; for (size_t i =0; i<3;++i) HBondDistance[i] = src.HBondDistance[i]; for (size_t i =0; i<3;++i) HBondAngle[i] = src.HBondAngle[i]; name=src.name; symbol=src.symbol; } return *this; } /** Prints element data to \a *out. * \param *out outstream */ bool element::Output(ostream * const out) const { if (out != NULL) { *out << name << "\t" << symbol << "\t" << period << "\t" << group << "\t" << block << "\t" << Z << "\t" << mass << "\t" << CovalentRadius << "\t" << VanDerWaalsRadius << endl; //*out << Z << "\t" << fixed << setprecision(11) << showpoint << mass << "g/mol\t" << name << "\t" << symbol << "\t" << endl; return true; } else return false; }; /** Prints element data to \a *out. * \param *out outstream * \param No cardinal number of element * \param NoOfAtoms total number of atom of this element type */ bool element::Checkout(ostream * const out, const int Number, const int NoOfAtoms) const { if (out != NULL) { *out << "Ion_Type" << Number << "\t" << NoOfAtoms << "\t" << Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << mass << "\t" << name << "\t" << symbol <