@@ -13,15 +13,15 @@ bool read_atom_species(std::ifstream& ifa,
1313 UnitCell& ucell)
1414{
1515 ModuleBase::TITLE (" UnitCell" ," read_atom_species" );
16+
1617 const int ntype = ucell.ntype ;
1718 std::string word;
1819
1920 // ==========================================
2021 // read in information of each type of atom
2122 // ==========================================
22- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " ATOMIC_SPECIES" ) )
23+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " ATOMIC_SPECIES" ) )
2324 {
24- ifa.ignore (300 , ' \n ' );
2525 ModuleBase::GlobalFunc::OUT (ofs_running," ntype" ,ntype);
2626 for (int i = 0 ;i < ntype;i++)
2727 {
@@ -51,7 +51,8 @@ bool read_atom_species(std::ifstream& ifa,
5151
5252 if (!end && ss >> one_string && one_string[0 ] != ' #' )
5353 {
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" )
5556 {
5657 ucell.pseudo_type [i] = one_string;
5758 }
@@ -61,15 +62,17 @@ bool read_atom_species(std::ifstream& ifa,
6162 }
6263 else
6364 {
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;
6567 ModuleBase::WARNING_QUIT (" read_atom_species" , " unrecongnized pseudo type." );
6668 }
6769 }
6870
6971 // Peize Lin test for bsse 2021.04.07
7072 const std::string bsse_label = " empty" ;
7173 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 ())
7376 ? true : false ;
7477 }
7578 }
@@ -80,7 +83,7 @@ bool read_atom_species(std::ifstream& ifa,
8083 ||((PARAM.inp .basis_type == " pw" )&&(PARAM.inp .init_wfc .substr (0 , 3 ) == " nao" ))
8184 || PARAM.inp .onsite_radius > 0.0 )
8285 {
83- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " NUMERICAL_ORBITAL" ) )
86+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " NUMERICAL_ORBITAL" ) )
8487 {
8588 for (int i=0 ; i<ntype; i++)
8689 {
@@ -90,7 +93,7 @@ bool read_atom_species(std::ifstream& ifa,
9093 // caoyu add 2021-03-16
9194 if (PARAM.globalv .deepks_setorb )
9295 {
93- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " NUMERICAL_DESCRIPTOR" )) {
96+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " NUMERICAL_DESCRIPTOR" )) {
9497 ifa >> ucell.descriptor_file ;
9598 }
9699 }
@@ -105,7 +108,7 @@ bool read_atom_species(std::ifstream& ifa,
105108#ifdef __EXX
106109 if ( GlobalC::exx_info.info_global .cal_exx || PARAM.inp .rpa )
107110 {
108- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " ABFS_ORBITAL" ) )
111+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " ABFS_ORBITAL" ) )
109112 {
110113 for (int i=0 ; i<ntype; i++)
111114 {
@@ -133,7 +136,7 @@ bool read_lattice_constant(std::ifstream& ifa,
133136 double & lat0_angstrom =lat.lat0_angstrom ;
134137 std::string& latName = lat.latName ;
135138 ModuleBase::Matrix3& latvec = lat.latvec ;
136- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_CONSTANT" ) )
139+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_CONSTANT" ) )
137140 {
138141 ModuleBase::GlobalFunc::READ_VALUE (ifa, lat0);
139142 if (lat0<=0.0 )
@@ -153,18 +156,23 @@ bool read_lattice_constant(std::ifstream& ifa,
153156
154157 if (latName==" none" )
155158 {
156- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa,
159+ // check the existence of keyword "LATTICE_PARAMETERS"
160+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa,
157161 " LATTICE_PARAMETERS" ,
158162 true ,
159163 false ))
160164 {
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" );
162167 }
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" ) )
164171 {
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" );
166174 }
167- else if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_VECTORS" ) )
175+ else if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_VECTORS" ) )
168176 {
169177 // Reading lattice vectors. notice
170178 // here that only one cpu read these
@@ -179,12 +187,13 @@ bool read_lattice_constant(std::ifstream& ifa,
179187 }// supply lattice vectors
180188 else
181189 {
182- if (ModuleBase::GlobalFunc::SCAN_BEGIN (ifa,
190+ if (ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa,
183191 " LATTICE_VECTORS" ,
184192 true ,
185193 false ))
186194 {
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" );
188197 }
189198 if (latName==" sc" )
190199 {// simple-cubic, ibrav = 1
@@ -210,7 +219,7 @@ bool read_lattice_constant(std::ifstream& ifa,
210219 latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
211220 latvec.e21 =-0.5 ; latvec.e22 = e22 ; latvec.e23 = 0.0 ;
212221 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" ) )
214223 {
215224 ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
216225 }
@@ -219,7 +228,7 @@ bool read_lattice_constant(std::ifstream& ifa,
219228 {// trigonal, ibrav = 5
220229 double t1 = 0.0 ;
221230 double t2 = 0.0 ;
222- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
231+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
223232 {
224233 double cosab=0.0 ;
225234 ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -239,15 +248,15 @@ bool read_lattice_constant(std::ifstream& ifa,
239248 latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
240249 latvec.e21 = 0.0 ; latvec.e22 = 1.0 ; latvec.e23 = 0.0 ;
241250 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" ) )
243252 {
244253 ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
245254 }
246255 }
247256 else if (latName==" bct" )
248257 {// body-centered tetragonal, ibrav = 7
249258 double cba = 0.0 ;
250- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
259+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
251260 {
252261 ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
253262 cba = cba / 2.0 ;
@@ -261,7 +270,7 @@ bool read_lattice_constant(std::ifstream& ifa,
261270 latvec.e11 = 1.0 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
262271 latvec.e21 = 0.0 ; latvec.e22 = 0.0 ; latvec.e23 = 0.0 ;
263272 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" ) )
265274 {
266275 ifa >> latvec.e22 ;
267276 ModuleBase::GlobalFunc::READ_VALUE (ifa, latvec.e33 );
@@ -272,7 +281,7 @@ bool read_lattice_constant(std::ifstream& ifa,
272281 latvec.e11 = 0.5 ; latvec.e12 = 0.0 ; latvec.e13 = 0.0 ;
273282 latvec.e21 =-0.5 ; latvec.e22 = 0.0 ; latvec.e23 = 0.0 ;
274283 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" ) )
276285 {
277286 ifa >> latvec.e12 ;
278287 latvec.e12 = latvec.e12 / 2.0 ;
@@ -283,7 +292,7 @@ bool read_lattice_constant(std::ifstream& ifa,
283292 else if (latName==" fco" )
284293 {// face-centered orthorhombic, ibrav = 10
285294 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" ) )
287296 {
288297 ifa >> bba;
289298 ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
@@ -296,7 +305,7 @@ bool read_lattice_constant(std::ifstream& ifa,
296305 else if (latName==" bco" )
297306 {// body-centered orthorhombic, ibrav = 11
298307 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" ) )
300309 {
301310 ifa >> bba;
302311 ModuleBase::GlobalFunc::READ_VALUE (ifa, cba);
@@ -311,7 +320,7 @@ bool read_lattice_constant(std::ifstream& ifa,
311320 double bba = 0.0 ; double cba = 0.0 ;
312321 double cosab = 0.0 ;
313322 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" ) )
315324 {
316325 ifa >> bba >> cba;
317326 ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -327,7 +336,7 @@ bool read_lattice_constant(std::ifstream& ifa,
327336 double bba = 0.0 ; double cba = 0.0 ;
328337 double cosab = 0.0 ;
329338 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" ) )
331340 {
332341 ifa >> bba >> cba;
333342 ModuleBase::GlobalFunc::READ_VALUE (ifa, cosab);
@@ -348,7 +357,7 @@ bool read_lattice_constant(std::ifstream& ifa,
348357 double cosbc = 0.0 ;
349358 double sinab = 0.0 ;
350359 double term = 0.0 ;
351- if ( ModuleBase::GlobalFunc::SCAN_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
360+ if ( ModuleBase::GlobalFunc::SCAN_LINE_BEGIN (ifa, " LATTICE_PARAMETERS" ) )
352361 {
353362 ifa >> bba >> cba >> cosab >> cosac;
354363 ModuleBase::GlobalFunc::READ_VALUE (ifa, cosbc);
@@ -363,7 +372,6 @@ bool read_lattice_constant(std::ifstream& ifa,
363372 }
364373 else
365374 {
366- std::cout << " latname is : " << latName << std::endl;
367375 ModuleBase::WARNING_QUIT (" unitcell::read_lattice_constant" ," latname not supported!" );
368376 }
369377 }
@@ -383,4 +391,4 @@ bool read_lattice_constant(std::ifstream& ifa,
383391 return true ;
384392}
385393
386- }
394+ }
0 commit comments