QNANO
Main Page
Related Pages
Classes
Files
File List
include
manybody
Single_Particle_Spins.h
1
#ifndef QNANO_NEW_SINGLE_PARTICLE_SPINS_DEFINED_H
2
#define QNANO_NEW_SINGLE_PARTICLE_SPINS_DEFINED_H
3
4
#include "tools/Reader.h"
5
6
class
Single_Particle_Spins
{
7
public
:
8
int
nr;
9
10
std::complex<double> *s;
11
12
void
allocate(){
13
s=
new
std::complex<double>[3*nr*nr];
14
}
15
void
deallocate(){
16
delete
[] s;
17
}
18
void
resize(
int
nr_){
19
nr=nr_;
20
deallocate();
21
allocate();
22
}
23
24
std::complex<double> operator()(
int
i,
int
j,
int
k)
const
{
25
return
s[(k*nr+i)*nr+j];
26
}
27
std::complex<double> & operator()(
int
i,
int
j,
int
k){
28
return
s[(k*nr+i)*nr+j];
29
}
30
std::complex<double> get_sx(
int
i,
int
j)
const
{
return
s[i*nr+j]; }
31
std::complex<double> get_sy(
int
i,
int
j)
const
{
return
s[(nr+i)*nr+j]; }
32
std::complex<double> get_sz(
int
i,
int
j)
const
{
return
s[(2*nr+i)*nr+j]; }
33
34
void
read(
const
std::string &filename);
35
36
37
Single_Particle_Spins
(){
38
nr=0;
39
allocate();
40
}
41
Single_Particle_Spins
(
const
std::string &filename){
42
nr=0;
43
allocate();
44
read(filename);
45
}
46
};
47
48
#endif
Single_Particle_Spins
Definition:
Single_Particle_Spins.h:6
Generated by
1.8.11