Skip to content

Commit 1f80e9f

Browse files
committed
Minor change
1 parent 61b3197 commit 1f80e9f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

anphon/scph.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,9 +2207,9 @@ void Scph::compute_anharmonic_frequency(std::complex<double> ***v4_array_all, do
22072207
VectorXd eval_tmp(ns);
22082208
MatrixXcd Fmat(ns, ns);
22092209

2210-
double diff;
2210+
double diff, diff_prev = 1.0e10;
22112211
const double conv_tol = tolerance_scph;
2212-
const double alpha = mixalpha;
2212+
double alpha = mixalpha;
22132213

22142214
// Use Eigen types for better memory management and performance
22152215
MatrixXd eval_interpolate(nk, ns);
@@ -2278,6 +2278,11 @@ void Scph::compute_anharmonic_frequency(std::complex<double> ***v4_array_all, do
22782278

22792279
// Mixing dmat
22802280
if (iloop > 0) {
2281+
// if (diff > diff_prev) {
2282+
// alpha = std::max(alpha * 0.7, 0.02);
2283+
// } else {
2284+
// alpha = std::min(alpha * 1.1, 1.0);
2285+
// }
22812286
for (ik = 0; ik < nk; ++ik) {
22822287
dmat_convert[ik] = alpha * dmat_convert[ik] + (1.0 - alpha) * dmat_convert_old[ik];
22832288
}
@@ -2317,7 +2322,7 @@ void Scph::compute_anharmonic_frequency(std::complex<double> ***v4_array_all, do
23172322
cmat_convert,
23182323
omega_now);
23192324

2320-
// Check convergence
2325+
// Check convergence on the coarse k points
23212326
if (check_convergence(omega_now, omega_old, conv_tol, verbosity, iloop, diff)) {
23222327
break;
23232328
}
@@ -2327,6 +2332,7 @@ void Scph::compute_anharmonic_frequency(std::complex<double> ***v4_array_all, do
23272332
for (ik = 0; ik < nk; ++ik) {
23282333
dmat_convert_old[ik] = dmat_convert[ik];
23292334
}
2335+
diff_prev = diff;
23302336
} // end loop iteration
23312337

23322338
if (std::sqrt(diff) < conv_tol) {
@@ -2451,7 +2457,7 @@ void Scph::compute_anharmonic_frequency_diis_perkpoint(std::complex<double> ***v
24512457
dymat_harm_short, dymat_harm_long);
24522458

24532459
// Initialize per-k-point DIIS mixer
2454-
const int diis_history = std::min(5, static_cast<int>(maxiter / 3));
2460+
const int diis_history = std::min(3, static_cast<int>(maxiter / 3));
24552461
GDIIS_PerKpoint gdiis_mixer_perkpoint(nk, diis_history, mixalpha, verbosity);
24562462

24572463
int icount = 0;

0 commit comments

Comments
 (0)