11#include " sltk_atom_arrange.h"
2+
3+ #include " module_base/timer.h"
24#include " module_parameter/parameter.h"
35#include " sltk_grid.h"
46#include " sltk_grid_driver.h"
5- #include " module_base/timer.h"
67
7- // update the followig class in near future
8+ // update the followig class in near future
89#include " module_cell/unitcell.h"
910
1011atom_arrange::atom_arrange ()
@@ -15,92 +16,81 @@ atom_arrange::~atom_arrange()
1516{
1617}
1718
18- double atom_arrange::set_sr_NL (
19- std::ofstream &ofs_in,
20- const std::string &output_level,
21- const double &rcutmax_Phi,
22- const double &rcutmax_Beta,
23- const bool gamma_only_local)
19+ double atom_arrange::set_sr_NL (std::ofstream& ofs_in,
20+ const std::string& output_level,
21+ const double & rcutmax_Phi,
22+ const double & rcutmax_Beta,
23+ const bool gamma_only_local)
2424{
25- ModuleBase::TITLE (" atom_arrange" ," set_sr_NL" );
26-
27- if (output_level != " m" ) // xiaohui add 'output_level', 2015-09-16
28- {
29- ofs_in << " \n\n\n\n " ;
30- ofs_in << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl;
31- ofs_in << " | |" << std::endl;
32- ofs_in << " | Search adjacent atoms: |" << std::endl;
33- ofs_in << " | Set the adjacent atoms for each atom and set the periodic boundary |" << std::endl;
34- ofs_in << " | condition for the atoms on real space FFT grid. For k-dependent |" << std::endl;
35- ofs_in << " | algorithm, we also need to set the sparse H and S matrix element |" << std::endl;
36- ofs_in << " | for each atom. |" << std::endl;
37- ofs_in << " | |" << std::endl;
38- ofs_in << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
39- ofs_in << " \n\n\n\n " ;
40- }
41-
42-
43- // xiaohui add 'output_level' line, 2015-09-16
44- if (output_level != " m" ) { ofs_in << " \n SETUP SEARCHING RADIUS FOR PROGRAM TO SEARCH ADJACENT ATOMS" << std::endl;
45- }
46- if (output_level != " m" ) { ofs_in << std::setprecision (3 );
47- }
48- if (output_level != " m" ) { ModuleBase::GlobalFunc::OUT (ofs_in," longest orb rcut (Bohr)" ,rcutmax_Phi);
49- }
25+ ModuleBase::TITLE (" atom_arrange" , " set_sr_NL" );
26+
27+ if (output_level != " m" ) // xiaohui add 'output_level', 2015-09-16
28+ {
29+ ofs_in << " \n\n\n\n " ;
30+ ofs_in << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl;
31+ ofs_in << " | |" << std::endl;
32+ ofs_in << " | Search adjacent atoms: |" << std::endl;
33+ ofs_in << " | Set the adjacent atoms for each atom and set the periodic boundary |" << std::endl;
34+ ofs_in << " | condition for the atoms on real space FFT grid. For k-dependent |" << std::endl;
35+ ofs_in << " | algorithm, we also need to set the sparse H and S matrix element |" << std::endl;
36+ ofs_in << " | for each atom. |" << std::endl;
37+ ofs_in << " | |" << std::endl;
38+ ofs_in << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
39+ ofs_in << " \n\n\n\n " ;
40+ ofs_in << " \n SETUP SEARCHING RADIUS FOR PROGRAM TO SEARCH ADJACENT ATOMS" << std::endl;
41+ ofs_in << std::setprecision (3 );
42+ ModuleBase::GlobalFunc::OUT (ofs_in, " longest orb rcut (Bohr)" , rcutmax_Phi);
43+ ModuleBase::GlobalFunc::OUT (ofs_in, " longest nonlocal projector rcut (Bohr)" , rcutmax_Beta);
44+ }
5045
51- // std::cout << " LONGEST NL PROJ RCUT : " << longest_nl_proj_rcut << std::endl;
52- if (output_level != " m" ) { ModuleBase::GlobalFunc::OUT (ofs_in," longest nonlocal projector rcut (Bohr)" , rcutmax_Beta);
53- }
46+ // check in use_overlap_matrix,
47+ double sr = 0.0 ;
48+ if (gamma_only_local)
49+ {
50+ sr = 2 * rcutmax_Phi + 0.01 ;
51+ }
52+ else
53+ {
54+ sr = 2 * (rcutmax_Phi + rcutmax_Beta) + 0.01 ; // 0.01 is added to make safe.
55+ // sr = 2 * longest_orb_rcut + 0.01;
56+ }
5457
55- // check in use_overlap_matrix,
56- double sr = 0.0 ;
57- if (gamma_only_local)
58- {
59- sr = 2 * rcutmax_Phi + 0.01 ;
60- }
61- else
62- {
63- sr = 2 * (rcutmax_Phi +rcutmax_Beta) + 0.01 ; // 0.01 is added to make safe.
64- // sr = 2 * longest_orb_rcut + 0.01;
65- }
66-
67- return sr;
58+ return sr;
6859}
6960
70- void atom_arrange::search (
71- const bool pbc_flag,
72- std::ofstream &ofs_in,
73- Grid_Driver &grid_d,
74- const UnitCell &ucell,
75- const double &search_radius_bohr,
76- const int &test_atom_in,
77- const bool test_only)
61+ void atom_arrange::search (const bool pbc_flag,
62+ std::ofstream& ofs_in,
63+ Grid_Driver& grid_d,
64+ const UnitCell& ucell,
65+ const double & search_radius_bohr,
66+ const int & test_atom_in,
67+ const bool test_only)
7868{
79- ModuleBase::TITLE (" atom_arrange" , " search" );
80- ModuleBase::timer::tick (" atom_arrange" ," search" );
81- assert ( search_radius_bohr > 0.0 );
69+ ModuleBase::TITLE (" atom_arrange" , " search" );
70+ ModuleBase::timer::tick (" atom_arrange" , " search" );
71+ assert (search_radius_bohr > 0.0 );
8272
83- ModuleBase::GlobalFunc::OUT (ofs_in," searching radius is (Bohr))" , search_radius_bohr);
84- ModuleBase::GlobalFunc::OUT (ofs_in," searching radius unit is (Bohr))" ,ucell.lat0 );
73+ ModuleBase::GlobalFunc::OUT (ofs_in, " searching radius is (Bohr))" , search_radius_bohr);
74+ ModuleBase::GlobalFunc::OUT (ofs_in, " searching radius unit is (Bohr))" , ucell.lat0 );
8575
86- assert (ucell.nat > 0 );
76+ assert (ucell.nat > 0 );
8777
88- const double radius_lat0unit = search_radius_bohr / ucell.lat0 ;
78+ const double radius_lat0unit = search_radius_bohr / ucell.lat0 ;
8979
9080 ModuleBase::timer::tick (" atom_arrange" , " grid_d.init" );
9181
92- grid_d.init (ofs_in, ucell, radius_lat0unit, pbc_flag);
82+ grid_d.init (ofs_in, ucell, radius_lat0unit, pbc_flag);
9383 ModuleBase::timer::tick (" atom_arrange" , " grid_d.init" );
9484
9585 ModuleBase::timer::tick (" atom_arrange" , " search" );
9686
97- // test the adjacent atoms and the box.
98- if (test_only)
99- {
100- std::cout << " radius_lat0unit = " << radius_lat0unit << std::endl;
101- std::cout << " search_radius_bohr = " << search_radius_bohr << std::endl;
87+ // test the adjacent atoms and the box.
88+ if (test_only)
89+ {
90+ std::cout << " radius_lat0unit = " << radius_lat0unit << std::endl;
91+ std::cout << " search_radius_bohr = " << search_radius_bohr << std::endl;
10292
103- ofs_in << " " << std::setw (5 ) << " Type" << std::setw (5 ) << " Atom" << std::setw (8 ) << " AdjNum" << std::endl;
93+ ofs_in << " " << std::setw (5 ) << " Type" << std::setw (5 ) << " Atom" << std::setw (8 ) << " AdjNum" << std::endl;
10494 std::cout << std::setw (8 ) << " Labels" << std::setw (15 ) << " tau.x" << std::setw (15 ) << " tau.y" << std::setw (15 )
10595 << " tau.z" << std::setw (8 ) << " box.x" << std::setw (8 ) << " box.y" << std::setw (8 ) << " box.z"
10696 << std::endl;
0 commit comments