GQCP
Loading...
Searching...
No Matches
Molecule.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
23#include <boost/format.hpp>
24
25#include <cstdlib>
26
27
28namespace GQCP {
29
30
34class Molecule {
35private:
36 size_t N; // the number of electrons
37 NuclearFramework nuclear_framework; // the underlying nuclear framework
38
39
40public:
41 // CONSTRUCTORS
42
50 Molecule(const NuclearFramework& nuclear_framework, const int charge = 0);
51
59 Molecule(const std::vector<Nucleus>& nuclei, const int charge = 0);
60
61
62 // NAMED CONSTRUCTORS
63
71 static Molecule HChain(const size_t n, const double spacing, const int charge = 0, const CartesianDirection axis = CartesianDirection::z);
72
81 static Molecule H2Chain(const size_t n, const double a, const double b, const int charge = 0, const CartesianDirection axis = CartesianDirection::z);
82
89 static Molecule HRingFromDistance(const size_t n, const double distance, const int charge = 0);
90
97 static Molecule HRingFromRadius(const size_t n, const double radius, const int charge = 0);
98
108 static Molecule ReadXYZ(const std::string& xyz_filename, const int charge = 0);
109
110
111 // OPERATORS
112
119 friend std::ostream& operator<<(std::ostream& os, const Molecule& molecule);
120
121
122 // PUBLIC METHODS
123
130 double calculateInternuclearDistanceBetween(const size_t index1, const size_t index2) const { return this->nuclearFramework().calculateInternuclearDistanceBetween(index1, index2); }
131
135 int charge() const;
136
140 std::string description() const {
141
142 std::string molecule_string = (boost::format("Number of electrons: %s \n") % this->numberOfElectrons()).str();
143 molecule_string += this->nuclearFramework().description();
144
145 return molecule_string;
146 }
147
151 const NuclearFramework& nuclearFramework() const { return this->nuclear_framework; }
152
156 size_t numberOfAtoms() const { return this->nuclear_framework.numberOfNuclei(); }
157
161 size_t numberOfElectronPairs() const { return this->numberOfElectrons() / 2; /* this floors to zero */ }
162
166 size_t numberOfElectrons() const { return this->N; }
167
171 size_t totalNucleicCharge() const { return this->nuclear_framework.totalNucleicCharge(); }
172};
173
174
175} // namespace GQCP
Definition: Molecule.hpp:34
size_t numberOfElectronPairs() const
Definition: Molecule.hpp:161
static Molecule HRingFromRadius(const size_t n, const double radius, const int charge=0)
Definition: Molecule.cpp:108
int charge() const
Definition: Molecule.cpp:154
friend std::ostream & operator<<(std::ostream &os, const Molecule &molecule)
Definition: Molecule.cpp:139
size_t numberOfElectrons() const
Definition: Molecule.hpp:166
size_t numberOfAtoms() const
Definition: Molecule.hpp:156
static Molecule HChain(const size_t n, const double spacing, const int charge=0, const CartesianDirection axis=CartesianDirection::z)
Definition: Molecule.cpp:70
size_t totalNucleicCharge() const
Definition: Molecule.hpp:171
const NuclearFramework & nuclearFramework() const
Definition: Molecule.hpp:151
double calculateInternuclearDistanceBetween(const size_t index1, const size_t index2) const
Definition: Molecule.hpp:130
static Molecule ReadXYZ(const std::string &xyz_filename, const int charge=0)
Definition: Molecule.cpp:123
static Molecule HRingFromDistance(const size_t n, const double distance, const int charge=0)
Definition: Molecule.cpp:96
std::string description() const
Definition: Molecule.hpp:140
static Molecule H2Chain(const size_t n, const double a, const double b, const int charge=0, const CartesianDirection axis=CartesianDirection::z)
Definition: Molecule.cpp:84
Definition: NuclearFramework.hpp:35
std::string description() const
Definition: NuclearFramework.hpp:119
size_t numberOfNuclei() const
Definition: NuclearFramework.hpp:138
size_t totalNucleicCharge() const
Definition: NuclearFramework.cpp:277
double calculateInternuclearDistanceBetween(const size_t index1, const size_t index2) const
Definition: NuclearFramework.cpp:263
Definition: BaseOneElectronIntegralBuffer.hpp:25
CartesianDirection
Definition: CartesianDirection.hpp:27
@ z
Definition: CartesianDirection.hpp:30