@@ -70,15 +70,15 @@ void toWannier90::calculate()
7070{
7171}
7272
73- void toWannier90::read_nnkp (const K_Vectors& kv)
73+ void toWannier90::read_nnkp (const UnitCell& ucell, const K_Vectors& kv)
7474{
7575 // read *.nnkp file
7676 GlobalV::ofs_running << " reading the " << wannier_file_name << " .nnkp file." << std::endl;
7777
7878 bool read_success = false ;
7979 if (GlobalV::MY_RANK == 0 )
8080 {
81- read_success = try_read_nnkp (kv);
81+ read_success = try_read_nnkp (ucell, kv);
8282 }
8383
8484#ifdef __MPI
@@ -87,7 +87,7 @@ void toWannier90::read_nnkp(const K_Vectors& kv)
8787
8888 if (GlobalV::MY_RANK != 0 && read_success)
8989 {
90- read_success = try_read_nnkp (kv);
90+ read_success = try_read_nnkp (ucell, kv);
9191 }
9292
9393#ifdef __MPI
@@ -129,7 +129,7 @@ void toWannier90::cal_Mmn()
129129{
130130}
131131
132- bool toWannier90::try_read_nnkp (const K_Vectors& kv)
132+ bool toWannier90::try_read_nnkp (const UnitCell& ucell, const K_Vectors& kv)
133133{
134134 std::ifstream nnkp_read (nnkpfile.c_str (), std::ios::in);
135135
@@ -144,17 +144,17 @@ bool toWannier90::try_read_nnkp(const K_Vectors& kv)
144144 nnkp_read >> real_lattice_nnkp.e11 >> real_lattice_nnkp.e12 >> real_lattice_nnkp.e13 >> real_lattice_nnkp.e21
145145 >> real_lattice_nnkp.e22 >> real_lattice_nnkp.e23 >> real_lattice_nnkp.e31 >> real_lattice_nnkp.e32
146146 >> real_lattice_nnkp.e33 ;
147- real_lattice_nnkp = real_lattice_nnkp / GlobalC:: ucell.lat0_angstrom ;
148-
149- if (std::abs (real_lattice_nnkp.e11 - GlobalC:: ucell.latvec .e11 ) > 1.0e-4
150- || std::abs (real_lattice_nnkp.e12 - GlobalC:: ucell.latvec .e12 ) > 1.0e-4
151- || std::abs (real_lattice_nnkp.e13 - GlobalC:: ucell.latvec .e13 ) > 1.0e-4
152- || std::abs (real_lattice_nnkp.e21 - GlobalC:: ucell.latvec .e21 ) > 1.0e-4
153- || std::abs (real_lattice_nnkp.e22 - GlobalC:: ucell.latvec .e22 ) > 1.0e-4
154- || std::abs (real_lattice_nnkp.e23 - GlobalC:: ucell.latvec .e23 ) > 1.0e-4
155- || std::abs (real_lattice_nnkp.e31 - GlobalC:: ucell.latvec .e31 ) > 1.0e-4
156- || std::abs (real_lattice_nnkp.e32 - GlobalC:: ucell.latvec .e32 ) > 1.0e-4
157- || std::abs (real_lattice_nnkp.e33 - GlobalC:: ucell.latvec .e33 ) > 1.0e-4 )
147+ real_lattice_nnkp = real_lattice_nnkp / ucell.lat0_angstrom ;
148+
149+ if (std::abs (real_lattice_nnkp.e11 - ucell.latvec .e11 ) > 1.0e-4
150+ || std::abs (real_lattice_nnkp.e12 - ucell.latvec .e12 ) > 1.0e-4
151+ || std::abs (real_lattice_nnkp.e13 - ucell.latvec .e13 ) > 1.0e-4
152+ || std::abs (real_lattice_nnkp.e21 - ucell.latvec .e21 ) > 1.0e-4
153+ || std::abs (real_lattice_nnkp.e22 - ucell.latvec .e22 ) > 1.0e-4
154+ || std::abs (real_lattice_nnkp.e23 - ucell.latvec .e23 ) > 1.0e-4
155+ || std::abs (real_lattice_nnkp.e31 - ucell.latvec .e31 ) > 1.0e-4
156+ || std::abs (real_lattice_nnkp.e32 - ucell.latvec .e32 ) > 1.0e-4
157+ || std::abs (real_lattice_nnkp.e33 - ucell.latvec .e33 ) > 1.0e-4 )
158158 {
159159 ModuleBase::WARNING_QUIT (" toWannier90::read_nnkp" , " Error real_lattice in *.nnkp file" );
160160 }
@@ -170,18 +170,18 @@ bool toWannier90::try_read_nnkp(const K_Vectors& kv)
170170 nnkp_read >> recip_lattice_nnkp.e11 >> recip_lattice_nnkp.e12 >> recip_lattice_nnkp.e13
171171 >> recip_lattice_nnkp.e21 >> recip_lattice_nnkp.e22 >> recip_lattice_nnkp.e23 >> recip_lattice_nnkp.e31
172172 >> recip_lattice_nnkp.e32 >> recip_lattice_nnkp.e33 ;
173- const double tpiba_angstrom = ModuleBase::TWO_PI / GlobalC:: ucell.lat0_angstrom ;
173+ const double tpiba_angstrom = ModuleBase::TWO_PI / ucell.lat0_angstrom ;
174174 recip_lattice_nnkp = recip_lattice_nnkp / tpiba_angstrom;
175175
176- if (std::abs (recip_lattice_nnkp.e11 - GlobalC:: ucell.G .e11 ) > 1.0e-4
177- || std::abs (recip_lattice_nnkp.e12 - GlobalC:: ucell.G .e12 ) > 1.0e-4
178- || std::abs (recip_lattice_nnkp.e13 - GlobalC:: ucell.G .e13 ) > 1.0e-4
179- || std::abs (recip_lattice_nnkp.e21 - GlobalC:: ucell.G .e21 ) > 1.0e-4
180- || std::abs (recip_lattice_nnkp.e22 - GlobalC:: ucell.G .e22 ) > 1.0e-4
181- || std::abs (recip_lattice_nnkp.e23 - GlobalC:: ucell.G .e23 ) > 1.0e-4
182- || std::abs (recip_lattice_nnkp.e31 - GlobalC:: ucell.G .e31 ) > 1.0e-4
183- || std::abs (recip_lattice_nnkp.e32 - GlobalC:: ucell.G .e32 ) > 1.0e-4
184- || std::abs (recip_lattice_nnkp.e33 - GlobalC:: ucell.G .e33 ) > 1.0e-4 )
176+ if (std::abs (recip_lattice_nnkp.e11 - ucell.G .e11 ) > 1.0e-4
177+ || std::abs (recip_lattice_nnkp.e12 - ucell.G .e12 ) > 1.0e-4
178+ || std::abs (recip_lattice_nnkp.e13 - ucell.G .e13 ) > 1.0e-4
179+ || std::abs (recip_lattice_nnkp.e21 - ucell.G .e21 ) > 1.0e-4
180+ || std::abs (recip_lattice_nnkp.e22 - ucell.G .e22 ) > 1.0e-4
181+ || std::abs (recip_lattice_nnkp.e23 - ucell.G .e23 ) > 1.0e-4
182+ || std::abs (recip_lattice_nnkp.e31 - ucell.G .e31 ) > 1.0e-4
183+ || std::abs (recip_lattice_nnkp.e32 - ucell.G .e32 ) > 1.0e-4
184+ || std::abs (recip_lattice_nnkp.e33 - ucell.G .e33 ) > 1.0e-4 )
185185 {
186186 ModuleBase::WARNING_QUIT (" toWannier90::read_nnkp" , " Error recip_lattice in *.nnkp file" );
187187 }
@@ -313,7 +313,7 @@ bool toWannier90::try_read_nnkp(const K_Vectors& kv)
313313
314314 for (int i = 0 ; i < num_wannier; i++)
315315 {
316- R_centre[i] = R_centre[i] * GlobalC:: ucell.latvec ;
316+ R_centre[i] = R_centre[i] * ucell.latvec ;
317317 m[i] = m[i] - 1 ;
318318 }
319319
0 commit comments