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"
43
44class Coordinate_3D
45{
46 public:
47 double x = 0;
48 double y = 0;
49 double z = 0;
50
51 Coordinate_3D(double x = 0.0, double y = 0.0, double z = 0.0) : x(x), y(y), z(z)
52 {
53 }
54
55 bool operator<(const Coordinate_3D& other) const
56 {
57 const double threshold = 1e-8;
58 if (std::abs(x - other.x) >= threshold)
59 return x < other.x;
60 if (std::abs(y - other.y) >= threshold)
61 return y < other.y;
62 return std::abs(z - other.z) >= threshold && z < other.z;
63 }
64};
65
66class toWannier90_LCAO : public toWannier90
67{
68 public:
69 toWannier90_LCAO(const bool& out_wannier_mmn,
70 const bool& out_wannier_amn,
71 const bool& out_wannier_unk,
72 const bool& out_wannier_eig,
73 const bool& out_wannier_wvfn_formatted,
74 const std::string& nnkpfile,
75 const std::string& wannier_spin,
76 const LCAO_Orbitals& orb
77 );
78 ~toWannier90_LCAO();
79
80 void calculate(const UnitCell& ucell,
81 const Grid_Driver& gd,
82 const ModuleBase::matrix& ekb,
83 const K_Vectors& kv,
84 const psi::Psi<std::complex<double>>& psi,
85 const Parallel_Orbitals* pv);
86
87 void calculate(const UnitCell& ucell,
88 const Grid_Driver& gd,
89 const ModuleBase::matrix& ekb,
90 const K_Vectors& kv,
91 const psi::Psi<double>& psi,
92 const Parallel_Orbitals* pv)
93 {
94 throw std::logic_error("The wave function of toWannier90_LCAO_IN_PW is generally a std::complex<double> type.");
95 }
96
97 void cal_Amn(const UnitCell& ucell, const K_Vectors& kv, const psi::Psi<std::complex<double>>& psi);
98 void cal_Mmn(const UnitCell& ucell, const K_Vectors& kv, const psi::Psi<std::complex<double>>& psi);
99 void out_unk(const psi::Psi<std::complex<double>>& psi);
100
101 protected:
102 // Radial section of trial orbitals
103 const int mesh_r = 1001; // unit is a.u.
104 const double dr = 0.01;
105 std::vector<std::vector<Numerical_Orbital_Lm>> A_orbs;
106
107 const LCAO_Orbitals& orb_;
108
109 // Use default element orbital information
110 int orb_r_ntype = 0;
111
113 ORB_gaunt_table MGT;
114 double kmesh_times = 1;
115
117 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> orbs;
118 std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>> center2_orb11_A;
119
120 std::vector<ModuleBase::Vector3<double>> R_coor_car;
121 std::vector<std::vector<std::vector<double>>> psi_psiA_R;
122
123 std::vector<int> iw2it;
124 std::vector<int> iw2ia;
125 std::vector<int> iw2iL;
126 std::vector<int> iw2iN;
127 std::vector<int> iw2im;
128 std::vector<int> iw2iorb;
129
130 const Parallel_Orbitals* ParaV;
131
132 void initialize_orb_table(const UnitCell& ucell);
133 void produce_basis_orb();
134 void set_R_coor(const UnitCell& ucell, const Grid_Driver& gd);
135 void count_delta_k(const UnitCell& ucell, const K_Vectors& kv);
136
137 std::vector<Coordinate_3D> delta_k_all;
138 std::map<Coordinate_3D, int> delta_k_all_index;
139
140 void unkdotkb(const UnitCell& ucell,
141 const K_Vectors& kv,
142 const psi::Psi<std::complex<double>>& psi_in,
143 const int& ik,
144 const int& ikb,
147
148 void produce_trial_in_lcao();
149 void construct_overlap_table_project();
150 void cal_orbA_overlap_R(const UnitCell& ucell);
151
152 void unkdotA(const K_Vectors& kv,
153 const psi::Psi<std::complex<double>>& psi_in,
154 const int& ik,
156
157 std::vector<FR_overlap<std::complex<double>>> FR;
158};
159#endif
160#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:17
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