@@ -13,15 +13,15 @@ bool read_atom_species(std::ifstream& ifa,
13
13
UnitCell& ucell)
14
14
{
15
15
ModuleBase::TITLE (" UnitCell" ," read_atom_species" );
16
+
16
17
const int ntype = ucell.ntype ;
17
18
std::string word;
18
19
19
20
// ==========================================
20
21
// read in information of each type of atom
21
22
// ==========================================
22
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " ATOMIC_SPECIES" ) )
23
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " ATOMIC_SPECIES" ) )
23
24
{
24
- ifa.ignore (300 , ' \n ' );
25
25
ModuleBase::GlobalFunc::OUT (ofs_running," ntype" ,ntype);
26
26
for (int i = 0 ;i < ntype;i++)
27
27
{
@@ -51,7 +51,8 @@ bool read_atom_species(std::ifstream& ifa,
51
51
52
52
if (!end && ss >> one_string && one_string[0 ] != ' #' )
53
53
{
54
- if (one_string == " auto" || one_string == " upf" || one_string == " vwr" || one_string == " upf201" || one_string == " blps" )
54
+ if (one_string == " auto" || one_string == " upf"
55
+ || one_string == " vwr" || one_string == " upf201" || one_string == " blps" )
55
56
{
56
57
ucell.pseudo_type [i] = one_string;
57
58
}
@@ -61,15 +62,17 @@ bool read_atom_species(std::ifstream& ifa,
61
62
}
62
63
else
63
64
{
64
- GlobalV::ofs_warning << " unrecongnized pseudopotential type: " << one_string << " , check your STRU file." << std::endl;
65
+ GlobalV::ofs_warning << " unrecongnized pseudopotential type: "
66
+ << one_string << " , check your STRU file." << std::endl;
65
67
ModuleBase::WARNING_QUIT (" read_atom_species" , " unrecongnized pseudo type." );
66
68
}
67
69
}
68
70
69
71
// Peize Lin test for bsse 2021.04.07
70
72
const std::string bsse_label = " empty" ;
71
73
ucell.atoms [i].flag_empty_element =
72
- (search ( ucell.atom_label [i].begin (), ucell.atom_label [i].end (), bsse_label.begin (), bsse_label.end () ) != ucell.atom_label [i].end ())
74
+ (search ( ucell.atom_label [i].begin (), ucell.atom_label [i].end (),
75
+ bsse_label.begin (), bsse_label.end () ) != ucell.atom_label [i].end ())
73
76
? true : false ;
74
77
}
75
78
}
@@ -80,7 +83,7 @@ bool read_atom_species(std::ifstream& ifa,
80
83
||((PARAM.inp .basis_type == " pw" )&&(PARAM.inp .init_wfc .substr (0 , 3 ) == " nao" ))
81
84
|| PARAM.inp .onsite_radius > 0.0 )
82
85
{
83
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " NUMERICAL_ORBITAL" ) )
86
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " NUMERICAL_ORBITAL" ) )
84
87
{
85
88
for (int i=0 ; i<ntype; i++)
86
89
{
@@ -90,7 +93,7 @@ bool read_atom_species(std::ifstream& ifa,
90
93
// caoyu add 2021-03-16
91
94
if (PARAM.globalv .deepks_setorb )
92
95
{
93
- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " NUMERICAL_DESCRIPTOR" )) {
96
+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " NUMERICAL_DESCRIPTOR" )) {
94
97
ifa >> ucell.descriptor_file ;
95
98
}
96
99
}
@@ -105,7 +108,7 @@ bool read_atom_species(std::ifstream& ifa,
105
108
#ifdef __EXX
106
109
if ( GlobalC::exx_info.info_global .cal_exx || PARAM.inp .rpa )
107
110
{
108
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " ABFS_ORBITAL" ) )
111
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " ABFS_ORBITAL" ) )
109
112
{
110
113
for (int i=0 ; i<ntype; i++)
111
114
{
@@ -133,7 +136,7 @@ bool read_lattice_constant(std::ifstream& ifa,
133
136
double & lat0_angstrom =lat.lat0_angstrom ;
134
137
std::string& latName = lat.latName ;
135
138
ModuleBase::Matrix3& latvec = lat.latvec ;
136
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_CONSTANT" ) )
139
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_CONSTANT" ) )
137
140
{
138
141
ModuleBase::GlobalFunc::READ_VALUE (ifa, lat0);
139
142
if (lat0<=0.0 )
@@ -153,18 +156,23 @@ bool read_lattice_constant(std::ifstream& ifa,
153
156
154
157
if (latName==" none" )
155
158
{
156
- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa,
159
+ // check the existence of keyword "LATTICE_PARAMETERS"
160
+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa,
157
161
" LATTICE_PARAMETERS" ,
158
162
true ,
159
163
false ))
160
164
{
161
- ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ," do not use LATTICE_PARAMETERS without explicit specification of lattice type" );
165
+ ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ,
166
+ " do not use LATTICE_PARAMETERS without explicit specification of lattice type" );
162
167
}
163
- if ( !ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_VECTORS" ) )
168
+
169
+ // check the existence of keyword "LATTICE_VECTORS"
170
+ if ( !ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_VECTORS" ) )
164
171
{
165
- ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ," Please set LATTICE_VECTORS in STRU file" );
172
+ ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ,
173
+ " Please set LATTICE_VECTORS in STRU file" );
166
174
}
167
- else if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_VECTORS" ) )
175
+ else if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_VECTORS" ) )
168
176
{
169
177
// Reading lattice vectors. notice
170
178
// here that only one cpu read these
@@ -179,12 +187,13 @@ bool read_lattice_constant(std::ifstream& ifa,
179
187
}// supply lattice vectors
180
188
else
181
189
{
182
- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa,
190
+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa,
183
191
" LATTICE_VECTORS" ,
184
192
true ,
185
193
false ))
186
194
{
187
- ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ," do not use LATTICE_VECTORS along with explicit specification of lattice type" );
195
+ ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ,
196
+ " do not use LATTICE_VECTORS along with explicit specification of lattice type" );
188
197
}
189
198
if (latName==" sc" )
190
199
{// simple-cubic, ibrav = 1
@@ -210,7 +219,7 @@ bool read_lattice_constant(std::ifstream& ifa,
210
219
latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
211
220
latvec.e21 =-0.5 ; latvec.e22 = e22 ; latvec.e23 = 0.0 ;
212
221
latvec.e31 = 0.0 ; latvec.e32 = 0.0 ; latvec.e33 = 0.0 ;
213
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
222
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
214
223
{
215
224
ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
216
225
}
@@ -219,7 +228,7 @@ bool read_lattice_constant(std::ifstream& ifa,
219
228
{// trigonal, ibrav = 5
220
229
double t1 = 0.0 ;
221
230
double t2 = 0.0 ;
222
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
231
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
223
232
{
224
233
double cosab=0.0 ;
225
234
ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -239,15 +248,15 @@ bool read_lattice_constant(std::ifstream& ifa,
239
248
latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
240
249
latvec.e21 = 0.0 ; latvec.e22 = 1.0 ; latvec.e23 = 0.0 ;
241
250
latvec.e31 = 0.0 ; latvec.e32 = 0.0 ; latvec.e33 = 0.0 ;
242
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
251
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
243
252
{
244
253
ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
245
254
}
246
255
}
247
256
else if (latName==" bct" )
248
257
{// body-centered tetragonal, ibrav = 7
249
258
double cba = 0.0 ;
250
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
259
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
251
260
{
252
261
ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
253
262
cba = cba / 2.0 ;
@@ -261,7 +270,7 @@ bool read_lattice_constant(std::ifstream& ifa,
261
270
latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
262
271
latvec.e21 = 0.0 ; latvec.e22 = 0.0 ; latvec.e23 = 0.0 ;
263
272
latvec.e31 = 0.0 ; latvec.e32 = 0.0 ; latvec.e33 = 0.0 ;
264
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
273
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
265
274
{
266
275
ifa >> latvec.e22 ;
267
276
ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
@@ -272,7 +281,7 @@ bool read_lattice_constant(std::ifstream& ifa,
272
281
latvec.e11 = 0.5 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
273
282
latvec.e21 =-0.5 ; latvec.e22 = 0.0 ; latvec.e23 = 0.0 ;
274
283
latvec.e31 = 0.0 ; latvec.e32 = 0.0 ; latvec.e33 = 0.0 ;
275
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
284
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
276
285
{
277
286
ifa >> latvec.e12 ;
278
287
latvec.e12 = latvec.e12 / 2.0 ;
@@ -283,7 +292,7 @@ bool read_lattice_constant(std::ifstream& ifa,
283
292
else if (latName==" fco" )
284
293
{// face-centered orthorhombic, ibrav = 10
285
294
double bba = 0.0 ; double cba = 0.0 ;
286
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
295
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
287
296
{
288
297
ifa >> bba;
289
298
ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
@@ -296,7 +305,7 @@ bool read_lattice_constant(std::ifstream& ifa,
296
305
else if (latName==" bco" )
297
306
{// body-centered orthorhombic, ibrav = 11
298
307
double bba = 0.0 ; double cba = 0.0 ;
299
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
308
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
300
309
{
301
310
ifa >> bba;
302
311
ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
@@ -311,7 +320,7 @@ bool read_lattice_constant(std::ifstream& ifa,
311
320
double bba = 0.0 ; double cba = 0.0 ;
312
321
double cosab = 0.0 ;
313
322
double e21 = 0.0 ; double e22 = 0.0 ;
314
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
323
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
315
324
{
316
325
ifa >> bba >> cba;
317
326
ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -327,7 +336,7 @@ bool read_lattice_constant(std::ifstream& ifa,
327
336
double bba = 0.0 ; double cba = 0.0 ;
328
337
double cosab = 0.0 ;
329
338
double e21 = 0.0 ; double e22 = 0.0 ;
330
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
339
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
331
340
{
332
341
ifa >> bba >> cba;
333
342
ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -348,7 +357,7 @@ bool read_lattice_constant(std::ifstream& ifa,
348
357
double cosbc = 0.0 ;
349
358
double sinab = 0.0 ;
350
359
double term = 0.0 ;
351
- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
360
+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
352
361
{
353
362
ifa >> bba >> cba >> cosab >> cosac;
354
363
ModuleBase::GlobalFunc::READ_VALUE (ifa, cosbc);
@@ -363,7 +372,6 @@ bool read_lattice_constant(std::ifstream& ifa,
363
372
}
364
373
else
365
374
{
366
- std::cout << " latname is : " << latName << std::endl;
367
375
ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ," latname not supported!" );
368
376
}
369
377
}
@@ -383,4 +391,4 @@ bool read_lattice_constant(std::ifstream& ifa,
383
391
return true ;
384
392
}
385
393
386
- }
394
+ }
0 commit comments