@@ -28,84 +28,56 @@ int Center2_Orb::get_rmesh(const double& R1, const double& R2, const double dr)
2828 return rmesh;
2929}
3030
31- // Peize Lin update 2016-01-26
32- void Center2_Orb::init_Lmax (const int orb_num,
33- const int mode,
34- int & Lmax_used,
35- int & Lmax,
36- const int & Lmax_exx,
37- const int lmax_orb,
38- const int lmax_beta)
31+ // used in <Phi|Phi> or <Beta|Phi>
32+ std::pair<int ,int > Center2_Orb::init_Lmax_2_1 (const int lmax_orb, const int lmax_beta)
3933{
34+ const int Lmax = std::max ({-1 , lmax_orb, lmax_beta});
35+ const int Lmax_used = 2 * Lmax + 1 ;
36+ assert (Lmax_used >= 1 );
37+ return {Lmax_used, Lmax};
38+ }
4039
41- Lmax = -1 ;
40+ // used in <jY|jY> or <Abfs|Abfs>
41+ std::pair<int ,int > Center2_Orb::init_Lmax_2_2 (const int & lmax_exx)
42+ {
43+ const int Lmax = std::max (-1 , lmax_exx);
44+ const int Lmax_used = 2 * Lmax + 1 ;
45+ assert (Lmax_used >= 1 );
46+ return {Lmax_used, Lmax};
47+ }
4248
43- switch (orb_num)
44- {
45- case 2 :
46- switch (mode)
47- {
48- case 1 : // used in <Phi|Phi> or <Beta|Phi>
49- Lmax = std::max ({Lmax, lmax_orb, lmax_beta});
50- // use 2lmax+1 in dS
51- Lmax_used = 2 * Lmax + 1 ;
52- break ;
53- case 2 : // used in <jY|jY> or <Abfs|Abfs>
54- Lmax = std::max (Lmax, Lmax_exx);
55- Lmax_used = 2 * Lmax + 1 ;
56- break ;
57- case 3 : // used in berryphase by jingan
58- Lmax = std::max (Lmax, lmax_orb);
59- Lmax++;
60- Lmax_used = 2 * Lmax + 1 ;
61- break ;
62- default :
63- throw std::invalid_argument (" Center2_Orb::init_Lmax orb_num=2, mode error" );
64- break ;
65- }
66- break ;
67- case 3 :
68- switch (mode)
69- {
70- case 1 : // used in <jY|PhiPhi> or <Abfs|PhiPhi>
71- Lmax = std::max (Lmax, lmax_orb);
72- Lmax_used = 2 * Lmax + 1 ;
73- Lmax = std::max (Lmax, Lmax_exx);
74- Lmax_used += Lmax_exx;
75- break ;
76- default :
77- throw std::invalid_argument (" Center2_Orb::init_Lmax orb_num=3, mode error" );
78- break ;
79- }
80- break ;
81- case 4 :
82- switch (mode)
83- {
84- case 1 : // used in <PhiPhi|PhiPhi>
85- Lmax = std::max (Lmax, lmax_orb);
86- Lmax_used = 2 * (2 * Lmax + 1 );
87- break ;
88- default :
89- throw std::invalid_argument (" Center2_Orb::init_Lmax orb_num=4, mode error" );
90- break ;
91- }
92- break ;
93- default :
94- throw std::invalid_argument (" Center2_Orb::init_Lmax orb_num error" );
95- break ;
96- }
49+ // used in berryphase by jingan
50+ std::pair<int ,int > Center2_Orb::init_Lmax_2_3 (const int lmax_orb)
51+ {
52+ int Lmax = std::max (-1 , lmax_orb);
53+ Lmax++;
54+ const int Lmax_used = 2 * Lmax + 1 ;
55+ assert (Lmax_used >= 1 );
56+ return {Lmax_used, Lmax};
57+ }
58+
59+ // used in <jY|PhiPhi> or <Abfs|PhiPhi>
60+ std::pair<int ,int > Center2_Orb::init_Lmax_3_1 (const int & lmax_exx, const int lmax_orb)
61+ {
62+ int Lmax = std::max (-1 , lmax_orb);
63+ int Lmax_used = 2 * Lmax + 1 ;
64+ Lmax = std::max (Lmax, lmax_exx);
65+ Lmax_used += lmax_exx;
66+ assert (Lmax_used >= 1 );
67+ return {Lmax_used, Lmax};
68+ }
9769
70+ // used in <PhiPhi|PhiPhi>
71+ std::pair<int ,int > Center2_Orb::init_Lmax_4_1 (const int lmax_orb)
72+ {
73+ const int Lmax = std::max (-1 , lmax_orb);
74+ const int Lmax_used = 2 * (2 * Lmax + 1 );
9875 assert (Lmax_used >= 1 );
76+ return {Lmax_used, Lmax};
9977}
10078
10179// Peize Lin update 2016-01-26
102- void Center2_Orb::init_Table_Spherical_Bessel (const int orb_num,
103- const int mode,
104- int & Lmax_used,
105- int & Lmax,
106- const int & Lmax_exx,
107- const int lmax_orb,
108- const int lmax_beta,
80+ void Center2_Orb::init_Table_Spherical_Bessel (const int Lmax_used,
10981 const double dr,
11082 const double dk,
11183 const int kmesh,
@@ -114,8 +86,6 @@ void Center2_Orb::init_Table_Spherical_Bessel(const int orb_num,
11486{
11587 ModuleBase::TITLE (" Center2_Orb" , " init_Table_Spherical_Bessel" );
11688
117- init_Lmax (orb_num, mode, Lmax_used, Lmax, Lmax_exx, lmax_orb, lmax_beta); // Peize Lin add 2016-01-26
118-
11989 for (auto & sb: ModuleBase::Sph_Bessel_Recursive_Pool::D2::sb_pool)
12090 {
12191 if (dr * dk == sb.get_dx ())
0 commit comments