@@ -76,48 +76,61 @@ torch::Tensor Potential::get_potential(const int istru,
7676 torch::Tensor potential = 5 . / 3 . * F;
7777
7878 // semi-local potential terms
79- if (this ->ml_gamma )
79+ if (this ->ml_gamma ) {
8080 potential += this ->potGammaTerm (data.gamma [istru], gradient);
81- if (this ->ml_p )
81+ }
82+ if (this ->ml_p ) {
8283 potential += this ->potPTerm1 (data.p [istru], gradient);
83- if (this ->ml_q )
84+ }
85+ if (this ->ml_q ) {
8486 potential += this ->potQTerm1 (data.q [istru], gradient);
85- if (this ->ml_xi )
87+ }
88+ if (this ->ml_xi ) {
8689 potential += this ->potXiTerm1 (data.rho [istru], data.xi , gradient);
87- if (this ->ml_tanhxi )
90+ }
91+ if (this ->ml_tanhxi ) {
8892 potential += this ->potTanhxiTerm1 (data.rho [istru], data.xi , data.tanhxi , gradient);
89- if (this ->ml_tanhp )
93+ }
94+ if (this ->ml_tanhp ) {
9095 potential += this ->potTanhpTerm1 (data.p [istru], data.tanhp [istru], gradient);
91- if (this ->ml_tanhq )
96+ }
97+ if (this ->ml_tanhq ) {
9298 potential += this ->potTanhqTerm1 (data.q [istru], data.tanhq [istru], gradient);
99+ }
93100 potential *= data.tau_tf [istru] / data.rho [istru];
94101
95102 // non-local potential terms
96- if (this ->ml_gammanl )
103+ if (this ->ml_gammanl ) {
97104 potential += this ->potGammanlTerm (data.rho [istru], data.gamma [istru], kernels, data.tau_tf [istru], gradient);
98- if (this ->ml_p || this ->ml_pnl )
105+ }
106+ if (this ->ml_p || this ->ml_pnl ) {
99107 potential += this ->potPPnlTerm (data.rho [istru],
100108 data.nablaRho [istru],
101109 data.p [istru],
102110 kernels,
103111 data.tau_tf [istru],
104112 gradient,
105113 grid.fft_grid [istru]);
106- if (this ->ml_q || this ->ml_qnl )
114+ }
115+ if (this ->ml_q || this ->ml_qnl ) {
107116 potential += this ->potQQnlTerm (data.rho [istru],
108117 data.q [istru],
109118 kernels,
110119 data.tau_tf [istru],
111120 gradient,
112121 grid.fft_gg [istru]);
113- if (this ->ml_xi )
122+ }
123+ if (this ->ml_xi ) {
114124 potential += this ->potXinlTerm (data.rho [istru], kernels, data.tau_tf [istru], gradient);
115- if (this ->ml_tanhxi )
125+ }
126+ if (this ->ml_tanhxi ) {
116127 potential += this ->potTanhxinlTerm (data.rho [istru], data.tanhxi , kernels, data.tau_tf [istru], gradient);
117- if (this ->ml_tanhxi_nl )
128+ }
129+ if (this ->ml_tanhxi_nl ) {
118130 potential
119131 += this ->potTanhxi_nlTerm (data.rho [istru], data.xi , data.tanhxi , kernels, data.tau_tf [istru], gradient);
120- if ((this ->ml_tanhp || this ->ml_tanhp_nl ) && !this ->ml_tanh_pnl )
132+ }
133+ if ((this ->ml_tanhp || this ->ml_tanhp_nl ) && !this ->ml_tanh_pnl ) {
121134 potential += this ->potTanhpTanhp_nlTerm (data.rho [istru],
122135 data.nablaRho [istru],
123136 data.p [istru],
@@ -126,15 +139,17 @@ torch::Tensor Potential::get_potential(const int istru,
126139 data.tau_tf [istru],
127140 gradient,
128141 grid.fft_grid [istru]);
129- if ((this ->ml_tanhq || this ->ml_tanhq_nl ) && !this ->ml_tanh_qnl )
142+ }
143+ if ((this ->ml_tanhq || this ->ml_tanhq_nl ) && !this ->ml_tanh_qnl ) {
130144 potential += this ->potTanhqTanhq_nlTerm (data.rho [istru],
131145 data.q [istru],
132146 data.tanhq [istru],
133147 kernels,
134148 data.tau_tf [istru],
135149 gradient,
136150 grid.fft_gg [istru]);
137- if (this ->ml_tanh_pnl )
151+ }
152+ if (this ->ml_tanh_pnl ) {
138153 potential += this ->potTanhpTanh_pnlTerm (data.rho [istru],
139154 data.nablaRho [istru],
140155 data.p [istru],
@@ -144,7 +159,8 @@ torch::Tensor Potential::get_potential(const int istru,
144159 data.tau_tf [istru],
145160 gradient,
146161 grid.fft_grid [istru]);
147- if (this ->ml_tanh_qnl )
162+ }
163+ if (this ->ml_tanh_qnl ) {
148164 potential += this ->potTanhqTanh_qnlTerm (data.rho [istru],
149165 data.q [istru],
150166 data.tanhq [istru],
@@ -153,6 +169,7 @@ torch::Tensor Potential::get_potential(const int istru,
153169 data.tau_tf [istru],
154170 gradient,
155171 grid.fft_gg [istru]);
172+ }
156173
157174 // Input::print("get potential done");
158175 return potential;
@@ -235,14 +252,16 @@ torch::Tensor Potential::potPPnlTerm(const torch::Tensor &rho,
235252 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
236253 * nablaRho[i] / rho * /* Ha to Ry*/ 2 .
237254 : torch::zeros_like (nablaRho[i]);
238- if (this ->ml_pnl )
255+ if (this ->ml_pnl ) {
239256 temp[i] += -this ->pqcoef * 2 . * nablaRho[i] / torch::pow (rho, 8 . / 3 .) * dFdpnl_nl;
257+ }
240258 }
241259 // std::cout << torch::slice(temp[0][0][0], 0, 0, 10);
242260 torch::Tensor result = this ->divergence (temp, grid);
243261
244- if (this ->ml_pnl )
262+ if (this ->ml_pnl ) {
245263 result += -8 . / 3 . * p / rho * dFdpnl_nl;
264+ }
246265 // std::cout << torch::slice(result[0][0], 0, 20) << std::endl;
247266
248267 // std::cout << "potPPnlTerm done" << std::endl;
@@ -275,12 +294,14 @@ torch::Tensor Potential::potQQnlTerm(const torch::Tensor &rho,
275294 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
276295 * /* Ha2Ry*/ 2 .
277296 : torch::zeros_like (q);
278- if (this ->ml_qnl )
297+ if (this ->ml_qnl ) {
279298 temp += this ->pqcoef / torch::pow (rho, 5 . / 3 .) * dFdqnl_nl;
299+ }
280300 torch::Tensor result = this ->Laplacian (temp, gg);
281301
282- if (this ->ml_qnl )
302+ if (this ->ml_qnl ) {
283303 result += -5 . / 3 . * q / rho * dFdqnl_nl;
304+ }
284305
285306 // std::cout << "potQQnlTerm done" << std::endl;
286307 return result;
@@ -439,13 +460,15 @@ torch::Tensor Potential::potTanhpTanh_pnlTerm(const torch::Tensor &rho,
439460 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
440461 * this ->dtanh (tanhp, this ->chi_p ) * nablaRho[i] / rho * /* Ha to Ry*/ 2 .
441462 : torch::zeros_like (nablaRho[i]);
442- if (this ->ml_tanh_pnl )
463+ if (this ->ml_tanh_pnl ) {
443464 temp[i] += -this ->pqcoef * 2 . * nablaRho[i] / torch::pow (rho, 8 . / 3 .) * dFdpnl_nl;
465+ }
444466 }
445467 torch::Tensor result = this ->divergence (temp, grid);
446468
447- if (this ->ml_tanh_pnl )
469+ if (this ->ml_tanh_pnl ) {
448470 result += -8 . / 3 . * p / rho * dFdpnl_nl;
471+ }
449472
450473 return result;
451474}
@@ -478,12 +501,14 @@ torch::Tensor Potential::potTanhqTanh_qnlTerm(const torch::Tensor &rho,
478501 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
479502 * this ->dtanh (tanhq, this ->chi_q ) * /* Ha2Ry*/ 2 .
480503 : torch::zeros_like (q);
481- if (this ->ml_tanh_qnl )
504+ if (this ->ml_tanh_qnl ) {
482505 temp += this ->pqcoef / torch::pow (rho, 5 . / 3 .) * dFdqnl_nl;
506+ }
483507 torch::Tensor result = this ->Laplacian (temp, gg);
484508
485- if (this ->ml_tanh_qnl )
509+ if (this ->ml_tanh_qnl ) {
486510 result += -5 . / 3 . * q / rho * dFdqnl_nl;
511+ }
487512
488513 return result;
489514}
@@ -519,13 +544,15 @@ torch::Tensor Potential::potTanhpTanhp_nlTerm(const torch::Tensor &rho,
519544 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
520545 * this ->dtanh (tanhp, this ->chi_p ) * nablaRho[i] / rho * /* Ha to Ry*/ 2 .
521546 : torch::zeros_like (nablaRho[i]);
522- if (this ->ml_tanhp_nl )
547+ if (this ->ml_tanhp_nl ) {
523548 temp[i] += -this ->pqcoef * 2 . * nablaRho[i] / torch::pow (rho, 8 . / 3 .) * dFdpnl_nl;
549+ }
524550 }
525551 torch::Tensor result = this ->divergence (temp, grid);
526552
527- if (this ->ml_tanhp_nl )
553+ if (this ->ml_tanhp_nl ) {
528554 result += -8 . / 3 . * p / rho * dFdpnl_nl;
555+ }
529556
530557 return result;
531558}
@@ -557,12 +584,14 @@ torch::Tensor Potential::potTanhqTanhq_nlTerm(const torch::Tensor &rho,
557584 .reshape ({this ->fftdim , this ->fftdim , this ->fftdim })
558585 * this ->dtanh (tanhq, this ->chi_q ) * /* Ha2Ry*/ 2 .
559586 : torch::zeros_like (q);
560- if (this ->ml_tanhq_nl )
587+ if (this ->ml_tanhq_nl ) {
561588 temp += this ->pqcoef / torch::pow (rho, 5 . / 3 .) * dFdqnl_nl;
589+ }
562590 torch::Tensor result = this ->Laplacian (temp, gg);
563591
564- if (this ->ml_tanhq_nl )
592+ if (this ->ml_tanhq_nl ) {
565593 result += -5 . / 3 . * q / rho * dFdqnl_nl;
594+ }
566595
567596 return result;
568597}
0 commit comments