Page 1 of 1

Different velocity information py4vasp vs outpu

Posted: Mon Jul 31, 2023 4:52 pm
by burakgurlek
Hi,

I am trying to read velocities via py4vasp. I use the flag VELOCITY=T in INCAR file.
When I compare the velocities obtained from py4vasp and .xml file they differ. This is also true for velocities in the CONTCAR file. Are the units ofthose different or cartesian vs direct ? or Am I missing a point? I would appriciate the help.

Regards,
Burak

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 9:33 am
by alexey.tal
Dear Burak,

Correct, the velocities in vasprun.xml are given in direct coordinates. However, in the CONTCAR and vaspout.h5 files, the velocities are represented in Cartesian coordinates.

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 9:41 am
by burakgurlek
Dear Alexey,

Thanks, however, in vasp 6.4.2 it seems the CONTCAR file also has direct coordinates. My problem is that CONTCAR, vasp.xml and vaspout.h5(py4vasp -1 slice) has different postions and velocity data. I am a bit puzzelled. Any idea?

Regards,
Burak

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 9:46 am
by alexey.tal
Let me have a look at your files. Could you please provide all relevant input and output files for your calculation according to the forum guidelines.

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 9:50 am
by burakgurlek
Dear Alexey,

you can reach files from https://www.dropbox.com/scl/fo/9gamlbra ... lkk8v&dl=0

it also seems that py4vasp does velocity rescaling (py4vasp/latest/data/velocity/#py4vasp.d ... ty_rescale), but I could not figure out how it works.

Thanks

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 10:31 am
by alexey.tal
Actually, I see that the velocities in your vaspout.h5 and CONTCAR are the same. Could it be something in your python script that performs rescaling? If I run this code, I get the same velocities as in CONTCAR.

Code: Select all

from py4vasp import Calculation
calc = Calculation.from_path(".")
calc.velocity[-1].read()

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 12:56 pm
by burakgurlek
Interesting! This is what I see from the py4vasp code (first three lines)
-0.00332693 -0.00275901 -0.00514225
0.00254728 -0.0111068 0.00614215
-0.00509531 5.80632e-05 0.00221705

This is what I see from CONTCAR file
-0.73006317E-03 -0.74797904E-03 -0.11889150E-02
-0.26207275E-02 0.68284580E-03 -0.24962973E-02
0.40995753E-02 0.49126433E-03 0.12660755E-02

Am I be looking to something different? I do not rescale the velocity except using the code piece you wrote

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 1:17 pm
by alexey.tal
I opened your vaspout.h5 file directly with h5dump (h5dump -d /results/positions/ion_velocities vaspout.h5) and the velocities perfectly match the ones from CONTCAR. Is it possible that the vaspout.h5 file that you read via py4vasp is different from the one you uploaded to the dropbox folder? Also, the velocities that you provided for the first three atoms from py4vasp and CONTCAR have different signs, which indicates that it is not a scaling issue.

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 2:22 pm
by burakgurlek
Dear Alexey,

many thanks, I was somehow looking into the different file. I have one more relatex question: If I read the positions and velocities and use to create a POSCAR file just stating the coordinates are Cartesian also valid for velocities?

Do you know why in py4vasp there is a thing for velocity rescaling (py4vasp/latest/data/velocity/#py4vasp.d ... ty_rescale)? Does py4vasp rescales or not?

Additionally, you wrote in the begining that the CONTCAR and vaspout.h5 are Cartesian coordinates, but it seems direct as I see from the CONTCAR file and from calc.structure[-1].to_POSCAR(). Is that correct?

Regards,

Re: Different velocity information py4vasp vs outpu

Posted: Tue Aug 01, 2023 3:45 pm
by alexey.tal
If the line before velocities is empty, the velocities are assumed in Cartesian coordinates (see POSCAR).
py4vasp uses velocity_rescale to rescale vectors when velocities are plotted.