romerogroup / pyprocar

A Python library for electronic structure pre/post-processing
GNU General Public License v3.0
171 stars 75 forks source link

Spin Texture problem Quantum Espresso (kpdos.in) #104

Open cardenas97 opened 1 year ago

cardenas97 commented 1 year ago

Hello,

I am trying to run Spin texture as recommended in the tutorial. I've prepared the files with the same structure as the tutorial, however when you run the "projwfc.x" you mentioned that is necessary the flag "sigma=.true.", but this flag is not used in Quantum Espresso and the output obtained in the "atomic_proj.xml" is different that the shown in the tutorial. Do you have to use other flag? How can I solve this problem?

Thank you in advance, Best regards, Jorge.

lllangWV commented 1 year ago

Hello Jorge,

the "savesigma=.true. " flag is used in a branch of quantum espresso. In the master branch of quantum espresso, they do not give access to the spin texture components. We worked with one of the developers to allow this functionality, but you have to be on that branch of the code.

Instructions to access this branch can be found at the bottom of https://romerogroup.github.io/pyprocar/dftprep/qe.html.

Follow these steps to install the qe branch:

  1. git clone git@gitlab.com:pietrodelugas/q-e.git
  2. cd q-e
  3. git checkout new_proj
  4. Install package.
  5. Set PATH to the bin directory in side q-e

Now, to perform the calculations set noncolin = .true. and lspinorb = .true. in the input of the PW input files (scf.in,nscf.in,bands.in,).

Also, set savesigma=.true. in the PROJWFC input files (kpdos.in,pdos.in).

Let me know if you did this or not. Otherwise, it might be a different issue entirely

Logan Lang

cardenas97 commented 1 year ago

Dear Logan,

Thank you for your answer, following the steps recommended I could obtain the outputs expected, however I am facing another trouble. Using VASP or QE I have the same output problem (with a compound) once I run the spin texture: """""""""""" isovalue, V_matrix, algorithm, interpolation_factor, padding, transform_matrix, boundaries) 139 supercell_surface.clip(origin=center, normal=normal, inplace=True) 141 if len(supercell_surface.points) == 0: --> 142 raise Exception("Clippping destroyed mesh.") 144 verts = supercell_surface.points 145 faces = supercell_surface.faces

Exception: Clippping destroyed mesh. """"""

Can you help me with this?

lllangWV commented 1 year ago

Sure!

Is this the Fe example or is this another material? If it is another material could you share the outputs in a zip file?

This problem is usually caused by the position of the kmesh. For the algorithm to work properly, the kpoints need to be in between (-0.5,0.5]. If not, its something I need to look into in more detail.

cardenas97 commented 1 year ago

VASP.zip It's another material (HfSn2). Please find attached VASP output and QE output. Thank you for take a look at the outputs. QE.zip

lllangWV commented 1 year ago

I have been looking into the issue and I think it is related to when we apply symmetry operations.

To test this, could you rerun the VASP calculation and set ISYM=-1.

Then when you plot the fermi surface set apply_symmetry=False, fermiHandler = pyprocar.FermiHandler( code=code, dirname=data_dir, apply_symmetry=False, )

Can you also send me the output of this calculation?

cardenas97 commented 1 year ago

VASP_hfsn2.zip

Please find attached the outputs from VASP. I've tried the recommended and still can not obtain the spin texture, the output that I receive is: File ~/anaconda3/lib/python3.10/site-packages/pyprocar/io/vasp.py:111, in Outcar.rotations(self) 109 rotations.append(rotation.T) 110 else: --> 111 operators = np.zeros((end_table-begin_table, 9)) 112 for i, line in enumerate(txt[begin_table:end_table]): 113 str_list = line.split()

UnboundLocalError: local variable 'begin_table' referenced before assignmen

lllangWV commented 1 year ago

Hello!

The problem now is that the parser is trying to get the symmetry rotations despite none. I can't fix this immediately, I will try to make the changes today.

A hotfix would be going to pyprocar.io.parser.py and replacing: line 195: poscar = vasp.Poscar(poscar,rotations = outcar.rotations) with

try: poscar = vasp.Poscar(poscar,rotations = outcar.rotations) except: poscar = vasp.Poscar(poscar,rotations = None)

Could you send me the PROCAR? It was not in the VASP_hfsn2.zip?

Logan Lang

cardenas97 commented 1 year ago

Dear, https://drive.google.com/file/d/17dDhOCKmIx2ODxbwnWasxHJ4M8jsadpM/view?usp=sharing In this link you can download the data with the PROCAR, the zip file is too big for github I'll try the recommended.

Thanks

lllangWV commented 1 year ago

Good news! With that PROCAR I was able to generate the fermi surface, so that means the symmetry was definitely the issue.

Now bear with me as I try to sort out the issue with symmetry. I'll send you an update when I have

image

Logan Lang

cardenas97 commented 1 year ago

Dear, That's are great news! Please let me know how can I fix this problem. https://drive.google.com/file/d/16xLGDqOkGNzyJyxz0S9to88mqMD1Zk48/view?usp=sharing Please find attached the updated link with all the information for spin texture, can you try it with the spin_texture mode too? Thank you for your time

cardenas97 commented 1 year ago

I tried the recommended before and I am having this output problem:

File ~/anaconda3/lib/python3.10/site-packages/pyvista/core/datasetattributes.py:752, in DataSetAttributes._prepare_array(self, data, name, deep_copy) 750 data = tmparray 751 if data.shape[0] != array_len: --> 752 raise ValueError(f'data length of ({data.shape[0]}) != required length ({array_len})') 754 # reset data association 755 if name in self.dataset._association_bitarray_names[self.association.name]:

ValueError: data length of (7350) != required length (7349)

Did you solve it? Or it's something else that I need to change in parser.py

lllangWV commented 1 year ago

Hey! I just fixed this issue and pushed it to GitHub.

When generating the surface, you have to do it by band. At the end we combine all the band surfaces into one. The default method that does this will combine points if they are close enough.

To fix this I replaced line 209 of pyprocar.core.fermisurface3D.py full_isosurface += isosurface_band_copy with full_isosurface.merge(isosurface_band_copy, merge_points=False, inplace=True)

cardenas97 commented 1 year ago

It finally works! Thank you a lot for the time!!!

cardenas97 commented 1 year ago

Dear,

Thank you for the help solving the issues related to the spin texture, however, I am still having some problems with it, the Fermi surface plotted is correctly however the spin texture plotted around the Fermi surface is not respecting the symmetry required. I've been trying to use the "apply symmetry =True" flag, however this is not working. My space group is 180 P6_222 , the C2 axis are visualized, however the C6 or the TRS of the system is not observed. Is there any way to solve this in pyprocar? Thank you in advance.

lllangWV commented 1 year ago

Hey, sorry for the late response.

Currently, we are having problems with the symmetry. I just updated the docs to tell users to turn off symmetry for fermi surface calculations and when initializing "apply_symmetry=False".

Sorry for the inconvenience, we are trying to solve the symmetry issue as fast as we can. I will keep you updated.

Logan Lang

lllangWV commented 1 year ago

Hey cardenas97,

sorry for the late response. I finally found the why apply_symmetry was not working. The symmetrization in pyprocar is work as it was suppose to. The reason why your calculation the symmetry was not working was because you were using a monkhorst pack grid and it did not contain gamma.

When vasp applies symmetrization using shifted meshed (monkhorst pack), it can have problems reducing the mesh to the irreducible mesh. They recommend Gamma centered meshes for hexagonal systems

Below is a snippit from their documentation where they recommend the mesh for a given crystal system (https://www.vasp.at/wiki/index.php/KPOINTS) image

cardenas97 commented 1 year ago

Dear Logan,

I've tried the recommended, however the Fermi surface is shifted from the Brillouin zone, and the symmetry of the spins are still missing, here is my data:

https://drive.google.com/drive/folders/1yzwZwGGOeyiikQeDbIx6q60qCL06Y0nG?usp=sharing

image
lllangWV commented 1 year ago

Hey cardenas97,

I briefly looked into the issue. The symmetrization is working correctly. It appears the issue is using an odd vs even gamma-centered mesh. I would say the issue is related to having the kpoints evenly sampled on the interval [0.5,0.5). If you use an even gamma-centered mesh it won't be evenly centered on the interval.

This can probably be fixed by changing how we generate the iso-surface. I can't do this until Thursday or Friday. In the meantime use odd gamma centered-meshes.

Here is a gamma center 11 11 11. image

Here is a gamma center 14 14 16. I did some testing it looks like the centering is slight improved for even meshes useing denser points image

cardenas97 commented 1 year ago

Dear Logan,

Thank you for your suggestion, whit the recommended the FermiSurface is center in the BZ, however, I can not still observe the C6$_2$ axis from the space group 180 (P6$_2$22). As you can see in the imagen generated with my pyprocar version (6.0.0). I've tried using ISYM =2 and ISYM =-1 and I still obtain the same results, do you know how can I fix this problem?

image

My data is here for ISYM=2 (SYM_2) and ISYM =-1 (SYM_n1) https://drive.google.com/drive/folders/1yzwZwGGOeyiikQeDbIx6q60qCL06Y0nG?usp=sharing

Also I want to ask you a couple of question regarding to the spin texture en pyprocar:

  1. The magnitude of the spin texture plotted in the colorbar ([0.749-0.856]; blue - green-red), which magnitude is plotting? I can not understand which magnitude is projected onto the Fermi surface, can you help me to clarify this?

  2. If there is any way to plot just the spin with no Fermi surface in the BZ? I saw the flag only_spin=True, but this works for parametric mode. I want it to check that the symmetry is respected for my system.

Thank you for your time and attention into this problem