Kindfield
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Properties
Friends
Pages
src
electronsystems
electronsystem.cpp
Go to the documentation of this file.
1
#include "
electronsystem.h
"
2
8
ElectronSystem::ElectronSystem
() :
9
m_nParticlesDownSet(false),
10
m_nParticlesDown(0)
11
{
12
}
13
14
uint
ElectronSystem::nParticlesUp
() {
15
return
nParticles
() -
nParticlesDown
();
16
}
17
18
uint
ElectronSystem::nParticlesDown
() {
19
if
(m_nParticlesDownSet) {
20
if
(m_nParticlesDown >
nParticles
()) {
21
std::cerr <<
"Error: More particles set to down than the number of particles in the system."
<< std::endl;
22
throw
std::logic_error(
""
);
23
}
24
return
m_nParticlesDown;
25
}
else
{
26
return
nParticles
() / 2;
27
}
28
}
29
30
void
ElectronSystem::setNParticlesDown
(uint nParticlesDown)
31
{
32
if
(nParticlesDown >
nParticles
()) {
33
std::cout <<
"WARNING: The number of particles set to down is currently more than the number of particles in the system."
<< std::endl;
34
}
35
m_nParticlesDown =
nParticlesDown
;
36
m_nParticlesDownSet =
true
;
37
}
Generated on Sun Jun 22 2014 14:02:46 for Kindfield by
1.8.4