GithubHelp home page GithubHelp logo

hungpham2017 / mcu Goto Github PK

View Code? Open in Web Editor NEW
41.0 8.0 20.0 88 MB

Modeling and Crystallographic Utilities

Home Page: https://hungqpham.com/mcu/index.html

License: Apache License 2.0

Python 100.00%
vasp band-structure dos crystallography wavefunction

mcu's People

Contributors

hungpham2017 avatar yw-fang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcu's Issues

Spin Texture

Hello, I've been trying to calculate the spin-texture using mcu. I've followed what Is presented in the page for the MoS2 case but when I try to run my case I get the following:

ValueError: cannot reshape array of size 0 into shape (3,8,8)

Any idea?,

Regards,

Merging band structures

  • Band structures for up and down states on the same plot.
  • Band structures of different materials with the same BZ?

Can I use mcu to calculate the matrix element <m|d/dk n> along a custom k-space path?

For the cell-periodic parts |m>, |n> of Bloch wavefunctions, along some custom k-space path, I want to calculate the matrix element <m|d/dk n> = <m|dH/dk|n>/Enm (where Enm = En - Em for eigenvalues En,Em). I did this using finite differences for models with analytical Hamiltonians using MATLAB, Python, etc. In these models, I have that |m> and |n> are orthonormal instantaneous energy eigenstates.
But I wish to try it using VASP as well. I would ideally get at least the wavefunction for each band, and the derivative, so that I can do a finite difference to calculate the matrix element along the k-space path. However, it has been hard for me to achieve this. VASP itself offers LPEAD and LEPSILON, but they each give me an issue. For instance, LPEAD does not support a custom k-space path; while I do not know how to read the data from LEPSILON. I have limited experience with these techniques.

Is mcu capable of giving me an array of wavefunctions and derivatives? I noticed that cder gives a derivative.

Thanks for your help!

PDOS Plot suggestions

Hi!

First of all, this is not an issue report, but an improvement suggestion.

I find mcu very useful for quick plots of PDOS obtained from VASP calculations. However, as I had to plot individual or grouped atomic PDOS, I needed to change the code a little bit. You can find the description of these changes below. If you think they would be an improvement for the package, please let me know.

  1. I've modified the mcu/vasp/vasprun.py file so the mcu.plot_dos() function can accept atom list as an argument in lm argument, without losing existing functionalities.

Example:

    mcu.plot_dos(lm=['Pt:d','[1]:p','[2,3,4]:s,p'])

    # should plot the DOS of
    #     - the sum of Platinum 'd' orbitals
    #     - the atom with index 1 'p' orbitals
    #     - the sum of atoms with indexes [2,3,4] 's' and 'p' orbitals
  1. I also added a new boolean argument in mcu.plot_dos() function called totaldos, which allows to select if TDOS should be plotted (True) or not (False).

Thanks!

Installation problem

Hi,
I just tried installing the package but it seems there is some problem. After git clone ..., I issued the command ''python setup.py install" but it gives an error.

byte-compiling build/bdist.linux-x86_64/egg/mcu/vasp/vasprun.py to vasprun.cpython-37.pyc
File "build/bdist.linux-x86_64/egg/mcu/vasp/vasprun.py", line 805
<<<<<<< HEAD
^
SyntaxError: invalid syntax

See below image also.

Can you please advice how to resolve this?

Thanks,
Screenshot from 2020-03-03 16-13-50

ValueError: could not convert string to float: '**********'

Hi,

I have tried to use mcu to plot spin polarized band structure. My vasprun.xml and OUTCAR were generated with VASP 5.4.4. When I type
import mcu
mymcu=mcu.VASP()
It showed error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/polyucmp/.local/lib/python3.10/site-packages/mcu/vasp/vasprun.py", line 47, in __init__ self.get_info(self.vasprun) File "/home/polyucmp/.local/lib/python3.10/site-packages/mcu/vasp/vasprun.py", line 89, in get_info self.get_efermi() File "/home/polyucmp/.local/lib/python3.10/site-packages/mcu/vasp/vasprun.py", line 117, in get_efermi tdos, pdos, efermi = self.vasprun.get_dos() File "/home/polyucmp/.local/lib/python3.10/site-packages/mcu/vasp/vasp_io.py", line 400, in get_dos total_out.append(self.extract_vec(spin)) File "/home/polyucmp/.local/lib/python3.10/site-packages/mcu/vasp/vasp_io.py", line 579, in extract_vec vec = np.float64(vec) ValueError: could not convert string to float: '**********'
Is there something wrong wih vasprun.xml? I do not know what happened. Hope you can help me.

2D Band and spin texture

Hi,

First of all, thank you for developing the mcu. I am using mcu, it's really nice and has good features.

I have few questions.

  1. Am I able to plot a particular band in a 2D plane? Right now it is offering me both CB and VB. In my case both are far away from each other, so they are looking flat in nature. Or it is possible to set the energy range.
  2. Is it possible to plot the spin texture on the 2D bands? As both are using the same modules.
  3. How to obtain data files from each calculation, so that I can use other sources to plot them?

How to plot optical transition probability from WAVEDER file obtained during optical run in VASP?

Dear Quang Pham, I installed the "NumPy, matplotlib, spglib, scipy" libraries in the Anaconda environment. When I run the mcu / mcu / vasp / utils.py program to process WAVEDER files, Pycharm prompts an error: " from ..utils.misc import check_exist; ImportError: attempted relative import with no known parent package ", I do nโ€™t know where the error occurred, thank you for your help.

Citation

Hi!

I'm not familiar with your Apache License, but in our upcoming publication I used your code to plot DOS and bands. So I can I cite it?

Yizhou

NameError in pywannier90_vasp.py

In the following line of "mcu/wannier90/pywannier90_vasp.py"

616 unk = self.wave.get_unk(spin=self.spin, kpt=k_id+1, band=n+1, ngrid=ngrid)

"n" and "ngrid" aren't defined before they are assgined to "band" and "ngrid", respectively.
It seems that this line should be corrected as:
unk = self.wave.get_unk(spin=self.spin, kpt=k_id+1, band=band+1,ngrid=grid)

After the above modification, it caused the following error:
line 634, in export_AME
self.export_unk(self, grid = grid)
TypeError: export_unk() got multiple values for argument 'grid'

Please check it.

Resolving error: No. of planewaves not consistent!

Do you have any advice on mitigating the following error?

Code (from https://hungqpham.com/mcu/plottingwfn.html):
import mcu mymcu = mcu.WAVECAR() unk = mymcu.get_unk() # Generate the unk

Error:
unk = mymcu.get_unk() # Generate the unk Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/software/mcu/mcu/vasp/wavecar.py", line 195, in get_unk gvec = self.get_gvec(kpt) - Gp File "/software/mcu/mcu/vasp/wavecar.py", line 148, in get_gvec assert Gvec.shape[0] == self.nplws[kpt] / n, 'No. of planewaves not consistent! %d %d %d' % \ AssertionError: No. of planewaves not consistent! 13681 27362 44573

I used a uniform G-centered k-grid.

Apologies if this is the wrong place to ask. Thanks!

Parameter "style" is not useful

Traceback (most recent call last):
File "/media/polyucmp/DATA/BIAN_Tieyuan/yinjun/plot/mcu/test/original+LORBIT/ICHARG2/plot.py", line 6, in
mymcu.plot_pband(style=1)
TypeError: main.plot_pband() got an unexpected keyword argument 'style'

Problem in 2D Band Structure Plotting

After a recent ubuntu update, it seems that there is now a problem in plotting 2D Band structure with mcu.
Kindly see attached screenshot and suggest how it can be resolved.
Screenshot from 2020-04-28 12-32-28

bug: AttributeError: module 'mcu' has no attribute 'VASP'

I used the code "$ git clone https://github.com/hungpham2017/mcu" to install mcu in the server with VASP and python on it. Then when I ran the code for plotting:
import mcu
import matplotlib.pyplot as plt
mymcu = mcu.VASP()

mymcu.plot_dos(spin='updown', style=1, efermi=5.0705, lm=['Ga:p','N:px'], elim=[-6, 8],yscale=0.05, save=True,fontsize=10, figname='Ga_updown', dpi=300)

plt.show()

It always shows "Traceback (most recent call last):
File "/vol01/homes/hy29793/SiC/mcuplot.py", line 3, in
mymcu = mcu.VASP()
AttributeError: module 'mcu' has no attribute 'VASP'
"

The code in the tutorial also used "import mcu
mymcu = mcu.VASP()".

What is the problem here and how to solve it?

ValueError: cannot reshape array of size 24883344 into shape (240,240,216)

I faced the following error while trying to use mcu utility for plotting the electrostatic potential:

locpot_data = np.float64(locpot_data).reshape(ngxyz, order='F')
ValueError: cannot reshape array of size 24883344 into shape (240,240,216)

using the same script provided in the examples:
import mcu
mymcu = mcu.LOCPOT()
mymcu.plot(axis='z', error=0.01)

My INCAR file:

ISTART = 1
ISPIN = 2
LREAL = Auto
ENCUT = 400
PREC = Normal
LWAVE = .TRUE.
LCHARG = .TRUE.
LAECHG = .TRUE.
ADDGRID = .TRUE.
LVTOT = .TRUE.
ISMEAR = -5
IBRION = -1
SIGMA = 0.05
LORBIT = 11
NEDOS = 2001
NELM = 60
EDIFF = 1E-05
NBANDS = 800
NSW = 0
LDIPOL = .TRUE.
IDIPOL = 3
POTIM = 0.5
GGA = PS
IVDW = 11

while KPOINTS:
0
Gamma
2 2 1
0.0 0.0 0.0

Any idea what is the source of this error? Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.