ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
to_w90_lcao.h
Go to the documentation of this file.
1#ifndef TO_W90_LCAO_H
2#define TO_W90_LCAO_H
3
9#include "source_base/timer.h"
11#include "source_base/vector3.h"
12#include "source_base/ylm.h"
17#include "source_cell/klist.h"
22#include "source_psi/psi.h"
23#include "to_w90.h"
24
25#include <algorithm>
26#include <cmath>
27#include <cstdlib>
28#include <iostream>
29#include <map>
30#include <set>
31#include <vector>
32
33#ifdef __LCAO
34#include "fr_overlap.h"
36
37struct Coordinate_3D
38{
39 double x = 0;
40 double y = 0;
41 double z = 0;
42
43 Coordinate_3D(double x = 0.0, double y = 0.0, double z = 0.0) : x(x), y(y), z(z)
44 {
45 }
46
47 bool operator<(const Coordinate_3D& other) const
48 {
49 const double threshold = 1e-8;
50 if (std::abs(x - other.x) >= threshold)
51 return x < other.x;
52 if (std::abs(y - other.y) >= threshold)
53 return y < other.y;
54 return std::abs(z - other.z) >= threshold && z < other.z;
55 }
56};
57
58class toW90_LCAO : public toW90
59{
60 public:
61 toW90_LCAO(const bool& out_wannier_mmn,
62 const bool& out_wannier_amn,
63 const bool& out_wannier_unk,
64 const bool& out_wannier_eig,
65 const bool& out_wannier_wvfn_formatted,
66 const std::string& nnkpfile,
67 const std::string& wannier_spin,
68 const int& nspin,
69 const int& nbands,
70 const int& nqx,
71 const double& dq,
72 const int& npol,
73 const LCAO_Orbitals& orb
74 );
75 ~toW90_LCAO();
76
77 void calculate(const UnitCell& ucell,
78 const Grid_Driver& gd,
79 const ModuleBase::matrix& ekb,
80 const K_Vectors& kv,
81 const psi::Psi<std::complex<double>>& psi,
82 const Parallel_Orbitals* pv);
83
84 void calculate(const UnitCell& ucell,
85 const Grid_Driver& gd,
86 const ModuleBase::matrix& ekb,
87 const K_Vectors& kv,
88 const psi::Psi<double>& psi,
89 const Parallel_Orbitals* pv)
90 {
91 ModuleBase::WARNING_QUIT("toW90_LCAO::calculate",
92 "The wave function is real (double type), indicating 'gamma_only = 1'. "
93 "The Wannier90 interface does not support Gamma-only calculations. "
94 "Please set 'gamma_only 0' in your input file.");
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 template <typename TK, typename TR>
100 void write_spn(const psi::Psi<TK>& psi, const hamilt::HContainer<TR>& sr, const K_Vectors& kv,
101 const std::string& out_dir, std::ostream& log) const;
102 void out_unk(const psi::Psi<std::complex<double>>& psi);
103
104 protected:
105 // Radial section of trial orbitals
106 const int mesh_r = 1001; // unit is a.u.
107 const double dr = 0.01;
108 std::vector<std::vector<Numerical_Orbital_Lm>> A_orbs;
109
110 const LCAO_Orbitals& orb_;
111
112 // Use default element orbital information
113 int orb_r_ntype = 0;
114
115 ModuleBase::Sph_Bessel_Recursive::D2* psb_ = nullptr;
116 ORB_gaunt_table mgt_;
117 double kmesh_times = 1;
118
119 Numerical_Orbital_Lm orb_r;
120 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> orbs;
121 std::map<size_t, std::map<size_t, std::map<size_t, Center2_Orb::Orb11>>> center2_orb11_A;
122
123 std::vector<ModuleBase::Vector3<double>> R_coor_car;
124 std::vector<std::vector<std::vector<double>>> psi_psiA_R;
125
126 std::vector<int> iw2it;
127 std::vector<int> iw2ia;
128 std::vector<int> iw2iL;
129 std::vector<int> iw2iN;
130 std::vector<int> iw2im;
131 std::vector<int> iw2iorb;
132
133 const Parallel_Orbitals* ParaV = nullptr;
134
135 void initialize_orb_table(const UnitCell& ucell);
136 void produce_basis_orb();
137 void set_R_coor(const UnitCell& ucell, const Grid_Driver& gd);
138 void count_delta_k(const UnitCell& ucell, const K_Vectors& kv);
139
140 std::vector<Coordinate_3D> delta_k_all;
141 std::map<Coordinate_3D, int> delta_k_all_index;
142
143 void unkdotkb(const UnitCell& ucell,
144 const K_Vectors& kv,
145 const psi::Psi<std::complex<double>>& psi_in,
146 const int& ik,
147 const int& ikb,
148 const ModuleBase::Vector3<double> G,
149 ModuleBase::ComplexMatrix& Mmn);
150
151 void produce_trial_in_lcao();
152 void construct_overlap_table_project();
153 void cal_orbA_overlap_R(const UnitCell& ucell);
154
155 void unkdotA(const K_Vectors& kv,
156 const psi::Psi<std::complex<double>>& psi_in,
157 const int& ik,
158 ModuleBase::ComplexMatrix& Amn);
159
160 std::vector<FR_overlap<std::complex<double>>> FR;
161};
162#endif
163#endif
bool operator<(const Abfs::Vector3_Order< T > &v1, const Abfs::Vector3_Order< T > &v2)
Definition to_w90.h:18
void cal_Amn()
Definition to_w90.cpp:108
void cal_Mmn()
Definition to_w90.cpp:112
void calculate()
Definition to_w90.cpp:57
void out_unk()
Definition to_w90.cpp:104
double x[440]
Definition sincos.cpp:28
void WARNING_QUIT(const std::string &, const std::string &)
Combine the functions of WARNING and QUIT.
Definition test_delley.cpp:15
Grid_Driver class for neighbor search interface.
#define threshold
Definition sph_bessel_rec_test.cpp:4