Kindfield
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
electronsystem.cpp
Go to the documentation of this file.
1 #include "electronsystem.h"
2 
9  m_nParticlesDownSet(false),
10  m_nParticlesDown(0)
11 {
12 }
13 
15  return nParticles() - nParticlesDown();
16 }
17 
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 }