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
      
      
        
          | Last change
 on this file since bb4408 was             ae959a, checked in by Frederik Heber <heber@…>, 15 years ago | 
        
          | 
element::group, period, block converted from char[] to std::string.
 came up as test_all.sh showed strncpy to as undefined reference on -O1.
 | 
        
          | 
              
Property                 mode
 set to                 100755 | 
        
          | File size:
            2.8 KB | 
      
      
| Rev | Line |  | 
|---|
| [14de469] | 1 | /** \file element.cpp | 
|---|
|  | 2 | * | 
|---|
|  | 3 | * Function implementations for the class element. | 
|---|
|  | 4 | * | 
|---|
|  | 5 | */ | 
|---|
|  | 6 |  | 
|---|
| [bf3817] | 7 | // include config.h | 
|---|
|  | 8 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 9 | #include <config.h> | 
|---|
|  | 10 | #endif | 
|---|
|  | 11 |  | 
|---|
| [112b09] | 12 | #include "Helpers/MemDebug.hpp" | 
|---|
|  | 13 |  | 
|---|
| [cd4ccc] | 14 | #include <iomanip> | 
|---|
|  | 15 | #include <fstream> | 
|---|
|  | 16 |  | 
|---|
|  | 17 | #include "element.hpp" | 
|---|
| [14de469] | 18 |  | 
|---|
| [ead4e6] | 19 | using namespace std; | 
|---|
|  | 20 |  | 
|---|
| [14de469] | 21 | /************************************* Functions for class element **********************************/ | 
|---|
|  | 22 |  | 
|---|
|  | 23 | /** Constructor of class element. | 
|---|
|  | 24 | */ | 
|---|
| [d5af3e] | 25 | element::element() : | 
|---|
|  | 26 | mass(0), | 
|---|
|  | 27 | CovalentRadius(0), | 
|---|
|  | 28 | VanDerWaalsRadius(0), | 
|---|
|  | 29 | Z(-1), | 
|---|
|  | 30 | Valence(0), | 
|---|
|  | 31 | NoValenceOrbitals(0) | 
|---|
|  | 32 | { | 
|---|
| [27c6be] | 33 | }; | 
|---|
| [14de469] | 34 |  | 
|---|
| [2a76b0] | 35 | element::element(const element &src) : | 
|---|
|  | 36 | mass(src.mass), | 
|---|
|  | 37 | CovalentRadius(src.CovalentRadius), | 
|---|
|  | 38 | VanDerWaalsRadius(src.VanDerWaalsRadius), | 
|---|
|  | 39 | Z(src.Z), | 
|---|
|  | 40 | Valence(src.Valence), | 
|---|
|  | 41 | NoValenceOrbitals(src.NoValenceOrbitals), | 
|---|
|  | 42 | name(src.name), | 
|---|
|  | 43 | symbol(src.symbol) | 
|---|
|  | 44 | { | 
|---|
| [ae959a] | 45 | period = src.period; | 
|---|
|  | 46 | group = src.group; | 
|---|
|  | 47 | block = src.block; | 
|---|
| [2a76b0] | 48 | } | 
|---|
|  | 49 |  | 
|---|
| [14de469] | 50 | /** Destructor of class element. | 
|---|
|  | 51 | */ | 
|---|
|  | 52 | element::~element() {}; | 
|---|
|  | 53 |  | 
|---|
| [2a76b0] | 54 | element &element::operator=(const element &src){ | 
|---|
|  | 55 | if(this!=&src){ | 
|---|
|  | 56 | mass=src.mass; | 
|---|
|  | 57 | CovalentRadius=src.CovalentRadius; | 
|---|
|  | 58 | VanDerWaalsRadius=src.VanDerWaalsRadius; | 
|---|
|  | 59 | Z=src.Z; | 
|---|
|  | 60 | Valence=src.Valence; | 
|---|
|  | 61 | NoValenceOrbitals=src.NoValenceOrbitals; | 
|---|
|  | 62 | name=src.name; | 
|---|
|  | 63 | symbol=src.symbol; | 
|---|
| [ae959a] | 64 | period = src.period; | 
|---|
|  | 65 | group = src.group; | 
|---|
|  | 66 | block = src.block; | 
|---|
| [2a76b0] | 67 | } | 
|---|
|  | 68 | return *this; | 
|---|
|  | 69 | } | 
|---|
|  | 70 |  | 
|---|
| [14de469] | 71 | /** Prints element data to \a *out. | 
|---|
|  | 72 | * \param *out outstream | 
|---|
|  | 73 | */ | 
|---|
| [ead4e6] | 74 | bool element::Output(ostream * const out) const | 
|---|
| [14de469] | 75 | { | 
|---|
| [042f82] | 76 | if (out != NULL) { | 
|---|
|  | 77 | *out << name << "\t" << symbol << "\t" << period << "\t" << group << "\t" << block << "\t" << Z << "\t" << mass << "\t" << CovalentRadius << "\t" << VanDerWaalsRadius << endl; | 
|---|
|  | 78 | //*out << Z << "\t"  << fixed << setprecision(11) << showpoint << mass << "g/mol\t" << name << "\t" << symbol << "\t" << endl; | 
|---|
|  | 79 | return true; | 
|---|
|  | 80 | } else | 
|---|
|  | 81 | return false; | 
|---|
| [14de469] | 82 | }; | 
|---|
|  | 83 |  | 
|---|
|  | 84 | /** Prints element data to \a *out. | 
|---|
|  | 85 | * \param *out outstream | 
|---|
| [042f82] | 86 | * \param No  cardinal number of element | 
|---|
| [14de469] | 87 | * \param NoOfAtoms total number of atom of this element type | 
|---|
|  | 88 | */ | 
|---|
| [ead4e6] | 89 | bool element::Checkout(ostream * const out, const int Number, const int NoOfAtoms) const | 
|---|
| [14de469] | 90 | { | 
|---|
| [042f82] | 91 | if (out != NULL) { | 
|---|
|  | 92 | *out << "Ion_Type" << Number << "\t" << NoOfAtoms << "\t" << Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << mass << "\t" << name << "\t" << symbol <<endl; | 
|---|
|  | 93 | return true; | 
|---|
|  | 94 | } else | 
|---|
|  | 95 | return false; | 
|---|
| [14de469] | 96 | }; | 
|---|
| [ead4e6] | 97 |  | 
|---|
|  | 98 | atomicNumber_t element::getNumber() const{ | 
|---|
|  | 99 | return Z; | 
|---|
|  | 100 | } | 
|---|
|  | 101 |  | 
|---|
| [7e3fc94] | 102 | string &element::getSymbol(){ | 
|---|
|  | 103 | return symbol; | 
|---|
| [ead4e6] | 104 | } | 
|---|
| [e345e3] | 105 |  | 
|---|
| [7e3fc94] | 106 | const string &element::getSymbol() const{ | 
|---|
|  | 107 | return symbol; | 
|---|
| [ff6a10] | 108 | } | 
|---|
|  | 109 |  | 
|---|
| [7e3fc94] | 110 | std::string &element::getName(){ | 
|---|
|  | 111 | return name; | 
|---|
| [e345e3] | 112 | } | 
|---|
|  | 113 |  | 
|---|
| [7e3fc94] | 114 | const std::string &element::getName() const{ | 
|---|
|  | 115 | return name; | 
|---|
| [ff6a10] | 116 | } | 
|---|
|  | 117 |  | 
|---|
| [e345e3] | 118 | std::ostream &operator<<(std::ostream &ost,const element &elem){ | 
|---|
|  | 119 | ost << elem.getName() << "(" << elem.getNumber() << ")"; | 
|---|
|  | 120 | return ost; | 
|---|
|  | 121 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.