ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
to_wannier90_lcao.h
Go to the documentation of this file.
1#ifndef TOWannier90_LCAO_H
2#define TOWannier90_LCAO_H
3
12#include "source_base/timer.h"
13#include "source_base/vector3.h"
14#include "source_base/ylm.h"
19#include "source_cell/klist.h"
26#include "source_psi/psi.h"
27#include "single_R_io.h"
28#include "to_wannier90.h"
29
30#include <algorithm>
31#include <cmath>
32#include <cstdlib>
33#include <iostream>
34#include <map>
35#include <set>
36#include <vector>
37
38#ifdef __LCAO
39#include "fR_overlap.h"
44
45class Coordinate_3D
46{
47 public:
48 double x = 0;
49 double y = 0;
50 double z = 0;
51
52 Coordinate_3D(double x = 0.0, double y = 0.0, double z = 0.0) : x(x), y(y), z(z)
53 {
54 }
55
56 bool operator<(const Coordinate_3D& other) const
57 {
58 const double threshold = 1e-8;
59 if (std::abs(x - other.x) >= threshold)
60 return x < other.x;
61 if (std::abs(y - other.y) >= threshold)
62 return y < other.y;
63 return std::abs(z - other.z) >= threshold && z < other.z;
64 }
65};
66
67class toWannier90_LCAO : public toWannier90
68{
69 public:
70 toWannier90_LCAO(const bool& out_wannier_mmn,
71 const bool& out_wannier_amn,
72 const bool& out_wannier_unk,
73 const bool& out_wannier_eig,
74 const bool& out_wannier_wvfn_formatted,
75 const std::string& nnkpfile,
76 const std::string& wannier_spin,
77 const LCAO_Orbitals& orb
78 );
79 ~toWannier90_LCAO();
80
81 void calculate(const UnitCell& ucell,
82 const Grid_Driver& gd,
83 const ModuleBase::matrix& ekb,
84 const K_Vectors& kv,
85 const psi::Psi<std::complex<double>>& psi,
86 const Parallel_Orbitals* pv);
87
88 void calculate(const UnitCell& ucell,
89 const Grid_Driver& gd,
90 const ModuleBase::matrix& ekb,
91 const K_Vectors& kv,
92 const psi::Psi<double>& psi,
93 const Parallel_Orbitals* pv)
94 {
95 throw std::logic_error("The wave function of toWannier90_LCAO_IN_PW is generally a std::complex<double> type.");
96 }
97
98 void cal_Amn(const UnitCell& ucell, const K_Vectors& kv, const psi::Psi<std::complex<double>>& psi);
99 void cal_Mmn(const UnitCell& ucell, const K_Vectors& kv, const psi::Psi<std::complex<double>>& psi);
100 void out_unk(const psi::Psi<std::complex<double>>& psi);
101
102 protected:
103 // Radial section of trial orbitals
104 const int mesh_r = 1001; // unit is a.u.
105 const double dr = 0.01;
106 std::vector<std::vector<Numerical_Orbital_Lm>> A_orbs;
107
108 const LCAO_Orbitals& orb_;
109
110 // Use default element orbital information
111 int orb_r_ntype = 0;
112
114 ORB_gaunt_table MGT;
115 double kmesh_times = 1;
116
118 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> orbs;
119 std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>> center2_orb11_A;
120
121 std::vector<ModuleBase::Vector3<double>> R_coor_car;
122 std::vector<std::vector<std::vector<double>>> psi_psiA_R;
123
124 std::vector<int> iw2it;
125 std::vector<int> iw2ia;
126 std::vector<int> iw2iL;
127 std::vector<int> iw2iN;
128 std::vector<int> iw2im;
129 std::vector<int> iw2iorb;
130
131 const Parallel_Orbitals* ParaV;
132
133 void initialize_orb_table(const UnitCell& ucell);
134 void produce_basis_orb();
135 void set_R_coor(const UnitCell& ucell, const Grid_Driver& gd);
136 void count_delta_k(const UnitCell& ucell, const K_Vectors& kv);
137
138 std::vector<Coordinate_3D> delta_k_all;
139 std::map<Coordinate_3D, int> delta_k_all_index;
140
141 void unkdotkb(const UnitCell& ucell,
142 const K_Vectors& kv,
143 const psi::Psi<std::complex<double>>& psi_in,
144 const int& ik,
145 const int& ikb,
148
149 void produce_trial_in_lcao();
150 void construct_overlap_table_project();
151 void cal_orbA_overlap_R(const UnitCell& ucell);
152
153 void unkdotA(const K_Vectors& kv,
154 const psi::Psi<std::complex<double>>& psi_in,
155 const int& ik,
157
158 std::vector<FR_overlap<std::complex<double>>> FR;
159};
160#endif
161#endif
bool operator<(const Abfs::Vector3_Order< double > &v1, const Abfs::Vector3_Order< double > &v2)
Definition abfs-vector3_order.cpp:4
Definition sltk_grid_driver.h:43
Definition klist.h:13
Definition ORB_read.h:19
Definition complexmatrix.h:14
Definition sph_bessel_recursive.h:49
3 elements vector
Definition vector3.h:22
Definition matrix.h:19
Definition ORB_atomic_lm.h:22
Definition ORB_gaunt_table.h:9
Definition parallel_orbitals.h:9
Definition unitcell.h:16
Definition psi.h:37
Definition to_wannier90.h:23
void cal_Amn()
Definition to_wannier90.cpp:124
void cal_Mmn()
Definition to_wannier90.cpp:128
void out_unk()
Definition to_wannier90.cpp:120
void calculate()
Definition to_wannier90.cpp:69
double x[440]
Definition sincos.cpp:28
Definition exx_lip.h:23
#define threshold
Definition sph_bessel_recursive_test.cpp:4