ToAmano / smallcodes_ALAMODE

several utilities for ALAMODE
0 stars 0 forks source link

The calc_pes. py script cannot be used #1

Closed Lamed-git closed 2 months ago

Lamed-git commented 3 months ago

Dear developer: I found that when calc_pes. py script is used, there will be errors. First of all, the position of main function should be at the end of the document rather than in the front. Secondly, some variables in main function lack definition and obtaining methods, such as maxorder, u0, etc. If you have a modified version, can you update or modify it? Thank you for your help!

ToAmano commented 3 months ago

Thank you for your bug report. I somewhere have a modified version, but I need time to search for it. Please wait for a week.

Lamed-git commented 3 months ago

Thank you for your bug report. I somewhere have a modified version, but I need time to search for it. Please wait for a week.

Thanks for your kind help! I tried my best to modify it according to my understanding but failed. I could output the result but it was quite different from the result calculated by DFT. Looking forward to your good news.

ToAmano commented 3 months ago

Hi, I've finally updated calc_pes.py script along with the sample in sample/2_calcpes. This version was used for the published paper and should work fine. Please feel free to ask questions if you have any. Thanks.

Lamed-git commented 3 months ago

Thank you for your detailed reply, but I still have two problems here. The first is about the parameter Maxorder. When I set Maxorder to 6, the script will only output 4 energy values, which is consistent with the example of TiO2, and I am not quite clear about the specific corresponding relationship. image If it is the potential energy up to the second to 6-th order in eV unit then there should be a total of six columns (including the maximum displacement), but there are only five columns. And the script does not output energy value when I set Maxorder to 2. The second problem is that even though I used as accurate a force constant file as possible (the training error is less than 5%) to test, the output energy of this script is still much different from the energy calculated by the DFT. I'm not sure about the possible source of the error. Looking for your reply! Thanks for your generous help.

ToAmano commented 2 months ago

Thank you for your report!

The first problem was just a bug in the code (It only outputted maxorder-1 energies)... Sorry for that. I've fixed it. The maxorder is the order of the Taylor expansion, and the resultant energies are from second to maxorder-th.

For the second one, here are the common possibilities.

If there is something you are not sure about, please feel free to ask me.

Lamed-git commented 2 months ago

I appreciate your prompt response, and I am now able to use the script properly. However, I'm not quite sure why POSCAR of the unitcell is needed, as the displace.py (Version 1.2.1) that I'm currently using seems to only induce atomic displacements in the supercell not unitcell. Also, could you please explain the principle behind this calculation? Looking for your reply!

ToAmano commented 2 months ago

Thank you for your replay.

why POSCAR of the unitcell is needed.

This is just because of computational cost. In principle, we can calculate the energy of the entire supercell energy using the Taylor expansion. (See Eq. (1) of the alamode documentation.)

However, I was just interested in the calculation of the Gamma point phonon, which only requires the unitcell structure, and you know, it is much cheaper for DFT calculations. Therefore, in my code, I used the unitcell as an input, expanded it to supercell, calculated the constructed supercell energy using the anharmonic phonon model, and got the unitcell energy dividing the supercell energy by the number of the unitcell in it.

the displace.py (Version 1.2.1) that I'm currently using seems to only induce atomic displacements in the supercell not unitcell.

I think you can get the unitcell structures if you specify the unitcell POSCAR for input. (If it is not correct, please notify me... )

Lamed-git commented 2 months ago

Thanks to your help, I can fully understand this principle!