GQCP
Loading...
Searching...
No Matches
Nucleus.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GQCG-GQCP is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
22#include "Molecule/elements.hpp"
23
24#include <cstdlib>
25#include <functional>
26#include <iomanip>
27#include <iostream>
28
29
30namespace GQCP {
31
32
36class Nucleus {
37private:
38 size_t Z; // atomic number, i.e. the charge
39 Vector<double, 3> R; // in bohr
40
41
42public:
43 // CONSTRUCTORS
44
51 Nucleus(const size_t Z, const double x, const double y, const double z);
52
57 Nucleus(const size_t Z, const Vector<double, 3>& position);
58
62 Nucleus();
63
64
65 /*
66 * OPERATORS
67 */
68
77 friend std::ostream& operator<<(std::ostream& os, const Nucleus& nucleus);
78
79
80 // STATIC PUBLIC METHODS
81
85 static std::function<bool(const Nucleus&, const Nucleus&)> sortComparer(const double tolerance = 1.0e-08);
86
90 static std::function<bool(const Nucleus&, const Nucleus&)> equalityComparer(const double tolerance = 1.0e-08);
91
92
93 // PUBLIC METHODS
94
100 double calculateDistanceWith(const Nucleus& other) const;
101
105 std::string description() const {
106
107 std::ostringstream os;
108 os << std::left << std::setw(3) << this->element() << '(' << this->position().x() << ", " << this->position().y() << ", " << this->position().z() << ")\n";
109
110 return os.str();
111 }
112
116 std::string element() const { return elements::atomicNumberToElement(this->charge()); }
117
121 size_t charge() const { return this->Z; }
122
126 const Vector<double, 3>& position() const { return this->R; }
127};
128
129
130} // namespace GQCP
Definition: Matrix.hpp:47
Definition: Nucleus.hpp:36
const Vector< double, 3 > & position() const
Definition: Nucleus.hpp:126
Nucleus()
Definition: Nucleus.cpp:58
std::string description() const
Definition: Nucleus.hpp:105
std::string element() const
Definition: Nucleus.hpp:116
static std::function< bool(const Nucleus &, const Nucleus &)> sortComparer(const double tolerance=1.0e-08)
Definition: Nucleus.cpp:90
double calculateDistanceWith(const Nucleus &other) const
Definition: Nucleus.cpp:139
size_t charge() const
Definition: Nucleus.hpp:121
friend std::ostream & operator<<(std::ostream &os, const Nucleus &nucleus)
Definition: Nucleus.cpp:75
static std::function< bool(const Nucleus &, const Nucleus &)> equalityComparer(const double tolerance=1.0e-08)
Definition: Nucleus.cpp:117
const std::string & atomicNumberToElement(const size_t atomic_number)
Definition: elements.cpp:188
Definition: BaseOneElectronIntegralBuffer.hpp:25
@ z
Definition: CartesianDirection.hpp:30
@ x
Definition: CartesianDirection.hpp:28
@ y
Definition: CartesianDirection.hpp:29