zhubonan / castepxbin

Reading binary files generated by CASTEP in Python
MIT License
10 stars 3 forks source link

castepxbin help needed #1

Closed sajidurehman closed 2 years ago

sajidurehman commented 3 years ago

Hi Bonan Zhu, First of all Happy New and stay blessed. I am a PhD student and using CASTEP interface in Materials Studio for my research. I want to study the projected band structure of heterostructures but unfortunately there is no such option in Materials Studio. Although, I can calculate the pdos by using OptaDOS of Materials Studio files ( .bands, .cell and .pdos_bin). In a similar way, I tried to use the .band and .cell (from spectral band structure calculation) and .pdos_bin (from pdos calculation because CASTEP interface in Materials Studio doesn't generate the .pdos_bin in spectral band structure calculation). But i got the following error. Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

May be there is some error while reading the .pdos_bin file. Then, I come to know with castepxbin we can read the .pdos_bin file. I am not much familiar with coding. So, i don't know how to use castepxbin to read the .pdos_bin file. Could you please help me in this regards? Thank you in advance. Looking forward to your kind response.

Best Wishes Sajid

zhubonan commented 3 years ago

I think all you need to do is to use the compute_pdos function:

https://github.com/zhubonan/castepxbin/blob/562595df69f5c6473b090924f3b44493a700ebd3/castepxbin/pdos.py#L166-L174

from castepxbin.compute_pdos

pdos_data = compute_pdos(pdos_bin, eigenvalues, kpoints_weights, bins)

It will give a raw non-broaden PDOS - e.g. number of (projected) electrons in each energy bin. You have to work out how to read eigenvalues and kpoints from the bands files and the number of bins to put the eigenvalues.

Actually, this package is meant to be a low-level interface. It is probably more useful to use sumo for plotting and get processed data. The default branch uses these packages to read the pdos and generate plots.

However, OptaDOS should always work for PDOS plotting, the only advantage of this package is it has lm projections. If you are getting errors, it is likely your bands and pdos_bin are not compatible if they are from different calculations. Can use just run CASTEP executables using the standard file interface? I don't use MS so I don't know how it works.

I am afraid a bit of programming is not avoidable. Consider this a good investment for your PhD ;)

sajidurehman commented 3 years ago

Thank you for prompt reply. I have also used the sumo for band structure and pdos calculation but unfortunately sumo can't calculate the projected band structure. May be there is a way to use the castepxbin to calculate the projected band structure. But I am not familiar with it. If there is any way please share with me. Thank you in advance.

One of the interesting thing is we use sumo for MS output files. But again problem for me is the projected band structure calculation.

I just explored that MS can generate the .pdos_bin for band structure calculation but still i am getting the same error. Now get more confuse because all data comes from same calculation. I will be very thankful to you if you can see MS calculated files. Si CASTEP Energy.zip

Again looking forward to your kind response

TonyWu20 commented 2 years ago

Thank you for prompt reply. I have also used the sumo for band structure and pdos calculation but unfortunately sumo can't calculate the projected band structure. May be there is a way to use the castepxbin to calculate the projected band structure. But I am not familiar with it. If there is any way please share with me. Thank you in advance.

One of the interesting thing is we use sumo for MS output files. But again problem for me is the projected band structure calculation.

I just explored that MS can generate the .pdos_bin for band structure calculation but still i am getting the same error. Now get more confuse because all data comes from same calculation. I will be very thankful to you if you can see MS calculated files. Si CASTEP Energy.zip

Again looking forward to your kind response

Excuse me, I would like to know how to let Materials Studio generate the pdos_bin file. So far I have only seen pdos_weight, and I don’t know it it is the same as pdos_bin yet

sajidurehman commented 2 years ago

Hi dear. you can generate it by selecting the pdos option and you can find it in the same folder where you calculate the DOS calculations. I hope this information will help you.

zhubonan commented 2 years ago

Sorry I forgot to reply to your request @sajidurehman. Hope that you have sorted it out. All you need is the pdos_calculate_weights tag in the param file input to CASTEP. I don't have access to Materials Studio so I am not able to help with any queries regardding that.

sajidurehman commented 2 years ago

Thank you for your kind reply @zhubonan. Yes I somehow sorted it out.

zhubonan commented 2 years ago

Great, then I will close the issue now.