@@ -15,15 +15,21 @@ void Fcoef::create(const int i1, const int i2, const int i3)
1515 ind1 = i1;
1616 ind4 = i2;
1717 ind5 = i3;
18+
1819 if (this ->p != nullptr )
1920 {
2021 delete[] this ->p ;
2122 this ->p = nullptr ;
2223 }
24+
2325 int tot = ind1 * ind2 * ind3 * ind4 * ind5;
26+
2427 this ->p = new std::complex <double >[tot];
28+
2529 for (int i = 0 ; i < tot; i++)
30+ {
2631 this ->p [i] = std::complex <double >(0.0 , 0.0 );
32+ }
2733 }
2834 else
2935 {
@@ -57,9 +63,13 @@ SocBase::~SocBase()
5763double SocBase::spinor (const int l, const double j, const int m, const int spin) const
5864{
5965 if (spin != 0 && spin != 1 )
66+ {
6067 ModuleBase::WARNING_QUIT (" spinor" , " spin direction unknown" );
68+ }
6169 if (m < -l - 1 || m > l)
70+ {
6271 ModuleBase::WARNING_QUIT (" spinor" , " m not allowed" );
72+ }
6373
6474 double den = 1.0 / (2.0 * l + 1.0 ); // denominator
6575
@@ -86,9 +96,13 @@ double SocBase::spinor(const int l, const double j, const int m, const int spin)
8696 else
8797 {
8898 if (spin == 0 )
99+ {
89100 spinor0 = sqrt ((l - m + 1.0 ) * den);
101+ }
90102 if (spin == 1 )
103+ {
91104 spinor0 = -sqrt ((l + m) * den);
105+ }
92106 }
93107 }
94108 else
@@ -147,9 +161,13 @@ int SocBase::sph_ind(const int l, const double j, const int m, const int spin) c
147161 if (fabs (j - l - 0.5 ) < 1e-8 )
148162 {
149163 if (spin == 0 )
164+ {
150165 sph_ind0 = m;
166+ }
151167 if (spin == 1 )
168+ {
152169 sph_ind0 = m + 1 ;
170+ }
153171 }
154172 else if (fabs (j - l + 0.5 ) < 1e-8 )
155173 {
@@ -201,4 +219,4 @@ void SocBase::set_fcoef(const int &l1,
201219 coeff += rotylm (m1, mi) * spinor (l1, j1, m, is1) * conj (rotylm (m2, mj)) * spinor (l2, j2, m, is2);
202220 }
203221 this ->fcoef (it, is1, is2, ip1, ip2) = coeff;
204- }
222+ }
0 commit comments