Any possible ways to reduce the memory and compuational time for the d4? #203
-
Dear SSCHA developers, I am doing a TMD monolayer calculation with a 771 supercell and there are about 150 atoms in total. I want to have a look whether the fourth order correction d4 is different from d3. It seems like the memory required to calculate d4 is more than 512 Gb and the compuation time is very long (the main issue is the large momery). Is it possible we only calculate the first few modes we are interested in or any other way to reduce the momory required? Best wishes, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, You can use the tdscha calculation and compute the static limit w->0 of the phonon green function, which coincides with the free energy Hessian. The TDSCHA uses an entirely different algorithm that scales much better with the system size (although with a bigger prefactor) and does not require storing almost anything in memory. You must change only the variables defined at the beginning of the script to match your case. If you also add a final lanczos.save_status("final_spectrum.npz") It will save the final status. Then, you can get the frequency of the free energy hessian by typing in the terminal: $ tdscha-convergence-analysis.py final_spectrum.npz It will automatically compute the spectral function of the chosen mode and plot it as a function of the number of iterations of the Lanczos algorithm to compute the dynamical green function. To load the result directly and analyze the final Hessian frequency directly, you can do like import tdscha, tdscha.DynamicalLanczos as DL
import cellconstructor as CC, cellconstructor.Units
lanczos = DL.Lanczos()
lanczos.load_status("final_spectrum.npz")
# Get the Green function only at w = 0
freq = np.array([0.0])
green_function = lanczos.get_green_function_continued_fraction(freq)
# Get the free energy Hessian as the inverse of the static Green Function
hessian = 1 / np.real(green_function[0])
# The phonon frequency is the square root of the free energy hessian
freq = np.sqrt(np.abs(hessian)) * np.sign(hessian)
# Convert from Ry to cm-1
freq *= CC.Units.RY_TO_CM
print("The static hessian frequency of the simualated mode is: {} cm-1".format(freq)) |
Beta Was this translation helpful? Give feedback.
Hi,
Yes, the d4 calculation is very heavy when there are more than 100 atoms.
There is a shortcut, especially if you only need a few phonons.
You can use the tdscha calculation and compute the static limit w->0 of the phonon green function, which coincides with the free energy Hessian. The TDSCHA uses an entirely different algorithm that scales much better with the system size (although with a bigger prefactor) and does not require storing almost anything in memory.
In particular, an example in the directory Examples/Templates/run_local.py performs the calculation.
https://github.com/SSCHAcode/tdscha/blob/Fast_LANCZOS/Examples/Templates/run_local.py
You must change only the variables defi…