henniggroup / MPInterfaces

Python package that enables high throughput analysis of interfaces(two dimensional materials, hetero-structures, nanoparticles with and without ligands/solvents).
http://henniggroup.github.io/MPInterfaces/
MIT License
71 stars 48 forks source link

fix the calculation of fermi velocity #19

Open yw-fang opened 5 years ago

yw-fang commented 5 years ago

Hi, developers

In the master branch, dk of 'get_fermi_velocities' function in analysis.py is defined as follows

                dk = np.sqrt((kpoints[i+1].cart_coords[0]
                              - kpoints[i].cart_coords[0])**2
                             + (kpoints[i+1].cart_coords[1]
                                - kpoints[i].cart_coords[1])**2)

However, kpoints are points in 3D k-space, hence they have the form of (kx, ky, kz). Hence, the distance between two points in k-space should be corrected as

                dk = np.sqrt((kpoints[i+1].cart_coords[0]
                              - kpoints[i].cart_coords[0])**2
                             + (kpoints[i+1].cart_coords[1]
                                - kpoints[i].cart_coords[1])**2
                             + (kpoints[i+1].cart_coords[2]
                                - kpoints[i].cart_coords[2])**2)

Please let me know if I miss something. Thank you very much!

Yuewen

ashtonmv commented 3 years ago

Hi @yw-fang, thanks for your contribution! get_fermi_velocities belongs to MPInterface's 2D materials submodule, where all kpoints are required to have the same reciprocal-z coordinate. So while it won't do any harm to add the delta z term like you did, it also won't make any difference for 2D materials.

I'm 50/50 about including it here, but this function should probably be moved into the main mpinterfaces module if non-2D users are making use of it. In that case it would definitely need to be included.