18 #ifndef __TROTTERSUZUKI_H 19 #define __TROTTERSUZUKI_H 22 #define _USE_MATH_DEFINES 38 double length_x, length_y;
39 double delta_x, delta_y;
41 int global_no_halo_dim_x, global_no_halo_dim_y;
42 int global_dim_x, global_dim_y;
44 string coordinate_system;
50 int inner_start_x, inner_start_y;
51 int inner_end_x, inner_end_y;
52 int mpi_coords[2], mpi_dims[2];
74 Lattice1D(
int dim,
double length,
bool periodic_x_axis =
false,
string coordinate_system =
"cartesian");
96 bool periodic_x_axis =
false,
bool periodic_y_axis =
false,
97 double angular_velocity = 0.,
string coordinate_system =
"cartesian");
110 Lattice2D(
int dim_x,
double length_x,
int dim_y,
double length_y,
111 bool periodic_x_axis =
false,
bool periodic_y_axis =
false,
112 double angular_velocity = 0.,
string coordinate_system =
"cartesian");
114 void init(
int dim_x,
double length_x,
int dim_y,
double length_y,
115 bool periodic_x_axis =
false,
bool periodic_y_axis =
false,
116 double angular_velocity = 0.,
string coordinate_system =
"cartesian");
138 State(Lattice *grid,
int angular_momentum = 0,
double *p_real = 0,
double *p_imag = 0);
141 void init_state(complex<double> (*ini_state)(
double x) );
142 void init_state(complex<double> (*ini_state)(
double x,
double y) );
143 void loadtxt(
char *file_name);
145 void imprint(complex<double> (*
function)(
double x) );
146 void imprint(complex<double> (*
function)(
double x,
double y) );
147 double *get_particle_density(
double *density = 0 );
148 double *get_phase(
double *phase = 0 );
149 double get_expected_value(
string _operator);
150 double get_squared_norm(
void);
151 double get_mean_x(
void);
152 double get_mean_xx(
void);
153 double get_mean_y(
void);
154 double get_mean_yy(
void);
155 double get_mean_px(
void);
156 double get_mean_pxpx(
void);
157 double get_mean_py(
void);
158 double get_mean_pypy(
void);
159 double get_mean_angular_momentum(
void);
161 void write_to_file(
string fileprefix );
162 void write_particle_density(
string fileprefix );
163 void write_phase(
string fileprefix );
168 void calculate_expected_values(
void);
195 BesselState(
Lattice1D *grid,
int angular_momentum = 0,
int zeros = 1,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
209 BesselState(
Lattice2D *grid,
int angular_momentum = 0,
int zeros = 1,
int n_y = 0,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
217 complex<double> bessel_state1D(
double x);
218 complex<double> bessel_state2D(
double x,
double y);
238 ExponentialState(
Lattice1D *grid,
int n_x = 1,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
251 ExponentialState(
Lattice2D *grid,
int n_x = 1,
int n_y = 1,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
256 complex<double> exp_state(
double x,
double y);
278 double *p_real = 0,
double *p_imag = 0);
293 GaussianState(
Lattice2D *grid,
double omega_x,
double omega_y = -1.,
double mean_x = 0,
double mean_y = 0,
double norm = 1,
double phase = 0,
294 double *p_real = 0,
double *p_imag = 0);
303 complex<double> gauss_state(
double x,
double y);
323 SinusoidState(
Lattice1D *grid,
int n_x = 1,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
336 SinusoidState(
Lattice2D *grid,
int n_x = 1,
int n_y = 1,
double norm = 1,
double phase = 0,
double *p_real = 0,
double *p_imag = 0);
341 complex<double> sinusoid_state(
double x,
double y);
358 Potential(Lattice *grid,
char *filename);
365 Potential(Lattice *grid,
double *external_pot = 0);
372 Potential(Lattice *grid,
double (*potential_function)(
double x,
double y));
379 Potential(Lattice *grid,
double (*potential_function)(
double x,
double y,
double t),
int t = 0);
381 virtual double get_value(
int x);
382 virtual double get_value(
int x,
int y);
383 bool update(
double t);
384 bool updated_potential_matrix;
387 double (*static_potential)(
double x,
double y);
388 double (*evolving_potential)(
double x,
double y,
double t);
412 double get_value(
int x,
int y);
432 double azimuthal_potential(
double x,
int angular_momentum);
446 Hamiltonian(Lattice *grid,
Potential *potential = 0,
double mass = 1.,
double coupling_a = 0.,
double LeeHuangYang_coupling_a = 0.,
447 double angular_velocity = 0.,
448 double rot_coord_x = 0,
double rot_coord_y = 0);
468 double azimuthal_potential_b(
double x,
int angular_momentum);
489 double mass = 1.,
double mass_b = 1.,
490 double coupling_a = 0.,
double coupling_ab = 0.,
491 double coupling_b = 0.,
492 double omega_r = 0,
double omega_i = 0,
493 double angular_velocity = 0.,
494 double rot_coord_x = 0,
495 double rot_coord_y = 0);
502 class ITrotterKernel {
504 virtual ~ITrotterKernel() {};
505 virtual void run_kernel() = 0;
506 virtual void run_kernel_on_halo() = 0;
507 virtual void wait_for_completion() = 0;
508 virtual void get_sample(
size_t dest_stride,
size_t x,
size_t y,
size_t width,
size_t height,
double * dest_real,
double * dest_imag,
double * dest_real2 = 0,
double * dest_imag2 = 0)
const = 0;
509 virtual void normalization() = 0;
510 virtual void rabi_coupling(
double var,
double delta_t) = 0;
511 virtual double calculate_squared_norm(
bool global =
true)
const = 0;
512 virtual bool runs_in_place()
const = 0;
513 virtual string get_name()
const = 0;
514 virtual void update_potential(
double *_external_pot_real,
double *_external_pot_imag,
int which) = 0;
515 virtual void cpy_first_positive_to_first_negative() = 0;
517 virtual void start_halo_exchange() = 0;
518 virtual void finish_halo_exchange() = 0;
542 string kernel_type =
"cpu");
555 double delta_t,
string kernel_type =
"cpu");
557 void evolve(
int iterations,
bool imag_time =
false);
558 void update_parameters();
559 double get_total_energy(
void);
560 double get_squared_norm(
size_t which = 3 );
561 double get_kinetic_energy(
size_t which = 3 );
562 double get_potential_energy(
size_t which = 3 );
563 double get_rotational_energy(
size_t which = 3 );
564 double get_intra_species_energy(
size_t which = 3 );
565 double get_LeeHuangYang_energy(
void);
566 double get_inter_species_energy(
void);
567 double get_rabi_energy(
void);
568 void set_exp_potential(
double *real,
int real_length,
double *imag,
569 int imag_length,
int which);
579 void initialize_exp_potential(
double time_single_it,
int which);
582 double kinetic_energy[2];
584 double potential_energy[2];
586 double rotational_energy[2];
588 double intra_species_energy[2];
595 void calculate_energy_expected_values(
void);
599 double const_potential(
double x);
600 double const_potential(
double x,
double y);
601 void map_lattice_to_coordinate_space(Lattice *grid,
int x_in,
double *x_out);
602 void map_lattice_to_coordinate_space(Lattice *grid,
int x_in,
int y_in,
double *x_out,
double *y_out);
603 #endif // __TROTTERSUZUKI_H double coupling_b
Coupling constant of the intra-particles interaction of the second component.
Definition: trottersuzuki.h:463
double omega_y
Gaussian coefficient.
Definition: trottersuzuki.h:300
double LeeHuangYang_energy
LeeHuangYang energy term.
Definition: trottersuzuki.h:590
double tot_potential_energy
Total potential energy of the system.
Definition: trottersuzuki.h:585
double mean_y
Y coordinate of the gaussian function's center.
Definition: trottersuzuki.h:298
double mean_angular_momentum
Expected value of the L_z operator.
Definition: trottersuzuki.h:173
int n_y
First and second quantum number.
Definition: trottersuzuki.h:254
double phase
Norm and phase of the state.
Definition: trottersuzuki.h:255
double rot_coord_y
Y coordinate of the center of rotation.
Definition: trottersuzuki.h:431
double * p_imag
Imaginary part of the wave function.
Definition: trottersuzuki.h:126
double * p_real
Real part of the wave function.
Definition: trottersuzuki.h:125
This class defines the Hamiltonian of a single component system.
Definition: trottersuzuki.h:423
State * state
State of the first component.
Definition: trottersuzuki.h:528
double current_evolution_time
Amount of time evolved since the beginning of the evolution.
Definition: trottersuzuki.h:386
double tot_intra_species_energy
Total intra-particles interaction energy of the system.
Definition: trottersuzuki.h:589
This class defines a quantum state with gaussian like wave function.
Definition: trottersuzuki.h:264
double ** external_pot_real
Real part of the evolution operator regarding the external potential.
Definition: trottersuzuki.h:572
double current_evolution_time
Amount of time evolved since the beginning of the evolution.
Definition: trottersuzuki.h:531
double zero
radial coordinate of the last zero.
Definition: trottersuzuki.h:214
This class defines the external potential that is used for Hamiltonian class.
Definition: trottersuzuki.h:347
Potential * potential_b
External potential for the second component.
Definition: trottersuzuki.h:467
This class defines the 2D lattice structure over which the state and potential matrices are defined...
Definition: trottersuzuki.h:83
State * state_b
State of the second component.
Definition: trottersuzuki.h:529
double * matrix
Matrix storing the potential.
Definition: trottersuzuki.h:350
bool self_init
Whether the external potential matrix has been initialized from the Potential constructor or not...
Definition: trottersuzuki.h:389
double LeeHuangYang_coupling_a
Coupling constant of the Lee-Huang-Yang term.
Definition: trottersuzuki.h:428
double omega_i
Imaginary part of the Rabi coupling.
Definition: trottersuzuki.h:466
Lattice * grid
Object that defines the lattice structure.
Definition: trottersuzuki.h:127
Hamiltonian * hamiltonian
Hamiltonian of the system; either single component or two components.
Definition: trottersuzuki.h:530
Lattice * grid
Lattice object.
Definition: trottersuzuki.h:527
double norm
Norm of the state.
Definition: trottersuzuki.h:301
double mean_PxPx
Expected values of the P_x and P_x^2 operators.
Definition: trottersuzuki.h:171
bool expected_values_updated
Whether the expected values of the state object are updated with respect to the last evolution...
Definition: trottersuzuki.h:164
double coupling_ab
Coupling constant of the inter-particles interaction.
Definition: trottersuzuki.h:462
double delta_t
A single evolution iteration, evolves the state for this time.
Definition: trottersuzuki.h:574
This class defines a quantum state with Bessel function of the first kind, along the radial coordinat...
Definition: trottersuzuki.h:182
bool energy_expected_values_updated
Whether the expectation values are updated or not.
Definition: trottersuzuki.h:594
double tot_rotational_energy
Total Rotational energy of the system.
Definition: trottersuzuki.h:587
bool self_init
Whether the potential is initialized in the Hamiltonian constructor or not.
Definition: trottersuzuki.h:452
int n_y
First and second quantum number.
Definition: trottersuzuki.h:339
This class defines the quantum state.
Definition: trottersuzuki.h:123
ITrotterKernel * kernel
Pointer to the kernel object.
Definition: trottersuzuki.h:578
Lattice * grid
Object that defines the lattice structure.
Definition: trottersuzuki.h:349
double tot_kinetic_energy
Total kinetic energy of the system.
Definition: trottersuzuki.h:583
double phase
Norm and phase of the state.
Definition: trottersuzuki.h:340
double normalization
Variable used for the normalization of the state.
Definition: trottersuzuki.h:215
double ** external_pot_imag
Imaginary part of the evolution operator regarding the external potential.
Definition: trottersuzuki.h:573
double phase
Norm and phase of the state.
Definition: trottersuzuki.h:216
double mean_PyPy
Expected values of the P_y and P_y^2 operators.
Definition: trottersuzuki.h:172
double rot_coord_x
X coordinate of the center of rotation.
Definition: trottersuzuki.h:430
bool is_static
Whether the external potential is static or time-dependent.
Definition: trottersuzuki.h:390
int angular_momentum
Angular momentum when cylindrical coordinates are used.
Definition: trottersuzuki.h:128
bool single_component
Whether the system is single-component(true) or two-components(false).
Definition: trottersuzuki.h:576
This class defines the evolution tasks.
Definition: trottersuzuki.h:525
double mean_y
Minimum of the potential along x and y axis.
Definition: trottersuzuki.h:417
This class defines the external potential that is used for Hamiltonian class.
Definition: trottersuzuki.h:398
double mass
Mass of the particle.
Definition: trottersuzuki.h:426
string kernel_type
Which kernel are being used (cpu or gpu).
Definition: trottersuzuki.h:577
double omega_r
Real part of the Rabi coupling.
Definition: trottersuzuki.h:465
double mean_XX
Expected values of the X and X^2 operators.
Definition: trottersuzuki.h:169
bool imag_time
Whether the time of evolution is imaginary(true) or real(false).
Definition: trottersuzuki.h:571
int n_y
First and second quantum number.
Definition: trottersuzuki.h:213
This class defines the Hamiltonian of a two component system.
Definition: trottersuzuki.h:459
double angular_velocity
The frame of reference rotates with this angular velocity.
Definition: trottersuzuki.h:429
double omega_x
Gaussian coefficient.
Definition: trottersuzuki.h:299
double phase
Relative phase of the wave function.
Definition: trottersuzuki.h:302
double total_energy
Total energy of the system.
Definition: trottersuzuki.h:581
double inter_species_energy
Inter-particles interaction energy of the system.
Definition: trottersuzuki.h:591
double mean_YY
Expected values of the Y and Y^2 operators.
Definition: trottersuzuki.h:170
double mass_b
Mass of the second component.
Definition: trottersuzuki.h:461
bool has_parameters_changed
Keeps track whether the Hamiltonian parameters were changed.
Definition: trottersuzuki.h:593
double omegay
Frequencies along x and y axis.
Definition: trottersuzuki.h:415
This class defines the 1D lattice structure over which the state and potential are defined...
Definition: trottersuzuki.h:64
Lattice * grid
Lattice object.
Definition: trottersuzuki.h:453
double mass
Mass of the particle.
Definition: trottersuzuki.h:416
This class defines a quantum state with sinusoidal like wave function.
Definition: trottersuzuki.h:311
double mean_x
X coordinate of the gaussian function's center.
Definition: trottersuzuki.h:297
Potential * potential
Potential object.
Definition: trottersuzuki.h:425
bool self_init
Whether the p_real and p_imag matrices have been initialized from the State constructor or not...
Definition: trottersuzuki.h:167
double coupling_a
Coupling constant of intra-particle interaction.
Definition: trottersuzuki.h:427
int angular_momentum
Angular momentum.
Definition: trottersuzuki.h:212
This class defines a quantum state with exponential like wave function.
Definition: trottersuzuki.h:226
double rabi_energy
Rabi energy of the system.
Definition: trottersuzuki.h:592
double norm2
Squared norm of the state.
Definition: trottersuzuki.h:174