GithubHelp home page GithubHelp logo

py4vasp's People

Contributors

dependabot[bot] avatar e-kwsm avatar henriquemiranda avatar jonathan271828 avatar martin-schlipf avatar michaelwolloch avatar mt-huebsch avatar orest-d avatar shibu778 avatar sudarshanv01 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  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

py4vasp's Issues

search help about py4vasp on Mac jupyter

Dear developer,
I encountered a problem when using py4vasp on jupyter installed on Mac OS 10.15, when reading .h5 file, it said there was no access, while this file can be read on Linux jupyter. I dont know why
image

Type annotations

For public API it would be good to have type annotations to document the code better

Add basic instructions

README file should document how to install the package. And how to use the repository.

Integration tests

By separating the packages more clearly, it is easier to develop them, but it also introduces a fault line, where the individual parts work, but the combination of both does not.

py4vasp.exceptions.exceptions.FileAccessError when trying to plot phonon_dos

When trying to plot the phonon density of states with the following code:

import py4vasp
mycalc = py4vasp.Calculation.from_path( ".")
mycalc.phonon_band.plot()
mycalc.phonon_dos.plot()

I get the following error

Traceback (most recent call last):
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/raw/_access.py", line 75, in _get_source
    return schema.sources[quantity][source]
KeyError: 'default'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/henrique/software/workshop/phonons/e06_mgo2-dispersion/supercell_2x2x2/read.py", line 4, in <module>
    mycalc.phonon_dos.plot()
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/data/_base.py", line 19, in func_with_access
    with self._data_context:
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/data/_base.py", line 180, in __enter__
    self.data = self._stack.enter_context(context)
  File "/Users/henrique/miniconda3/lib/python3.9/contextlib.py", line 448, in enter_context
    result = _cm_type.__enter__(cm)
  File "/Users/henrique/miniconda3/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/raw/_access.py", line 41, in _access
    yield state.access(quantity, source)
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/raw/_access.py", line 64, in access
    source = self._get_source(quantity, source)
  File "/Users/henrique/software/py4vasp/master/src/py4vasp/raw/_access.py", line 82, in _get_source
    raise exception.FileAccessError(message)
py4vasp.exceptions.exceptions.FileAccessError: phonon_dos/default is not available in the HDF5 file. Please check the spelling of the arguments. Perhaps the version of py4vasp (0.4.0) is not up to date with the documentation.

The error is triggered only in mycalc.phonon_dos.plot()
I traced the problem down to the schema in src/py4vasp/raw/_definition.py
while schema.add(raw.PhononBand,[...]) uses name="default"
schema.add(raw.PhononDos,[...]) uses name="phonon"
if I change the latter to name="default" then it works.
I don't understand why because the error message above seems to indicate that it did not find the 'default' key in the schema.

This FileAccessError message should probably be re-worked because if it ever appears it is too difficult for the user to understand what is going on. It seems to be referring to variable names in the hdf5 file (or at least I assumed so) but I guess that's not the case.

Error is reported when "from py4vasp import Calculation" in jupyter

Hello,

I install py4vasp, and then run the command "python - c" import py4vasp; print (py4vasp. version) ". It indicates that the installation is successful, but an error is reported when running in jupyter. I don't know why.

After running "from py4vasp import calculation", an error is reported as follows:

Output exceeds the size limit. Open the full output data in a text editor

AttributeError Traceback (most recent call last)
Cell In[15], line 1
----> 1 from py4vasp import Calculation

File /work/huangxl/codes/anaconda3/lib/python3.8/site-packages/py4vasp/init.py:3
1 # Copyright © VASP Software GmbH,
2 # Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
----> 3 from .calculation import Calculation
4 from py4vasp._third_party.interactive import set_error_handling
6 version = "0.4.0"

File /work/huangxl/codes/anaconda3/lib/python3.8/site-packages/py4vasp/calculation.py:16
3 """Provide the tools to manage VASP calculations.
4
5 This is the main user interface if you want to simply investigate the results of VASP
(...)
13 >>> calc.structure.print() # to print the structure in a POSCAR format
14 """
15 import inspect
---> 16 import py4vasp.data
17 import py4vasp.exceptions as exception
18 import py4vasp.control

File /work/huangxl/codes/anaconda3/lib/python3.8/site-packages/py4vasp/data/init.py:33
...
52 if self._ready:
53 return
---> 54 super().ipython_display(**kwargs)

AttributeError: 'super' object has no attribute 'ipython_display'

structure plot function not work

Hi,
When I use the calculation.structure.plot to plot the CONTCAR or POSCAR, it gives out NGLWidget() but not a 3D view of a structure.
Any help would be appreciated.
Yi

Style of DOS curves

Can I specify the color of different groups of curves, for example, I want d orbital (up and down) to be red and p orbital (up and down) to be blue. Dont know how to add a kwarg
image

FileAccessError when reading force constants

I stumbled upon an issue when reading the force constants from the attached vaspout.h5 file using the latest master version 1d15d75.

import py4vasp
supercell = py4vasp.Calculation.from_path( ".")
fc = supercell.force_constant.to_dict()

Returns the following error:


Traceback (most recent call last):
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/raw/_access.py", line 72, in _get_source
    return schema.sources[quantity][source]
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "readfc.py", line 6, in <module>
    fc = supercell.force_constant.to_dict()
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/data/_base.py", line 19, in func_with_access
    with self._data_context:
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/data/_base.py", line 180, in __enter__
    self.data = self._stack.enter_context(context)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 425, in enter_context
    result = _cm_type.__enter__(cm)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/raw/_access.py", line 39, in _access
    yield state.access(quantity, source)
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/raw/_access.py", line 62, in access
    source = self._get_source(quantity, source)
  File "/Users/henriquemiranda/software/py4vasp/vasp-master/src/py4vasp/raw/_access.py", line 79, in _get_source
    raise exception.FileAccessError(message)
py4vasp.exceptions.exceptions.FileAccessError: force_constant/None is not available in the HDF5 file. Please check the spelling of the arguments. Perhaps the version of py4vasp (0.4.0) is not up to date with the documentation.

When using 576c5c2 the code above works.

Rewrite of the viewer logic

The viewer should follow more closely the logic that is used for Graph. Specifically, the relevant py4vasp routines have a routine to_viewer and a wrapper plot that calls it. The viewer than contains all data required to produce the 3d view with attributes to set quantities.
Note that we should discuss specifics with Manuel. He might want to write a javascript library that generates the figures with Babylon or Three.JS directly. A preliminary step may be to rewrite the NGL interface but we should not invest to much time if the JS library gets developed.

Check read() for consistency

Revisit the read functionality of the various Refinery classes and make sure they behave in a consistent manner. Make a decision when elements are included as None and when they are skipped. A general idea could be that data that is added via a selection input is added whereas if it depends on the VASP setup it is set to None.

Decide on Fermi energy for DOS and Band

For metals it should be more transparent how the Fermi energy in VASP is selected. The issue is that when the band structure is plotted a new Fermi energy is computed but it may be less accurate then the original one because the mesh is coarser.

Possible solutions: Add an optional argument to the plot routine that sets the Fermi energy manually. The documentation needs to be very clear so that it is transparent what the default shift is.

Function of integration of DOS

Whether there is a function to integrate DOS in py4vasp, which will be very convenient to take a quick look at the contribution of certain atom or orbital. Such as integration of Ni 3d in the range of (-2,0) eV to see its contribution to the occupied orbitals.

Set a default height for the graph, expose width and height to the user

The height of the Graph in Jupyter notebook is rather small so that the plots do not look pleasing on typical desktop computers. We should set a higher default height (around 500px) to make them look better.
We can also make width and height attributes of the Graph object, so that users can set them to their liking.

Think about exposing all Graph attributes via kwargs to the user, e.g., you could allow

calc.dos.plot(xlabel="...")

and this would have the same effect as

graph = calc.dos.plot()
graph.xlabel = "..."

Error in importing MLFFErrorAnalysis from py4vasp

I am encountering error while importing MLFFErrorAnalysis.
"ImportError: cannot import name 'MLFFErrorAnalysis' from 'py4vasp' (c:\ProgramData\miniconda3\Lib\site-packages\py4vasp_init_.py)"

i am using is py4vasp through Miniconda.
import py4vasp print (py4vasp.__version__) is showing 0.7.4 that means it should import easily, right ?

Clean API and update documentation

  • Prepare py4vasp for a version 1.0 release by deciding which parts of the API are available.
  • Add more documentation for the public part of the API in particular examples.
  • Rename classes and methods in the generated documentation, so that they are called Calculation.dos.plot instead of data.Dos.plot
  • Write introductory documentation that explains the basics of py4vasp similar to the workshop tutorial
  • Change calculations to batch

Check read() for consistency

read() functions should fulfill the following properties:

  • provide all the necessary data to plot (check that plot uses read)
  • does not contain a lot of extra information over that
  • elements that are not used in some cases will be set to None instead of not being present

mpirun parameters

Correct mpirun settings can significantly speed up VASP calculations, there are some common concerns many users have:

  • KPAR: set KPAR=number of Kpoint in IBZKPT can achieve maximum speed, but this can not be done BEFORE calculation, because we prepare KPOINTS file instead of IBZKPT for most cases.
  • NCORE: set NCORE as high as possible can speed up calculations for most cases, but it's ignored in openMP/MPI hybrid version, which seems to be slower than pure MPI version with high NCORE.
  • Modify code with AMD toolchain support, currently we can build and run VASP with AOCC+AOCL toolchain on AMD CPU machine, but to be honest, it performs slower than VASP built with intel oneAPI on AMD CPU machine.

How can we set KPAR from KPOINTS file (usually use Monkhorst theme to generate K-point grid) before running VASP?

How can we maximize calculation efficiency with openMP/MPI hybrid version?

Is it possible to do some modification to better run VASP on AMD CPU?

Error while doing poetry run pytest

While doing 'poetry run pytest`, I encountered following error.

(py4vasp-env) PS <path>\py4vasp> poetry run pytest
Traceback (most recent call last):
  File "<some_path>\.conda\envs\py4vasp_pymatgne\lib\site-packages\requests\compat.py", line 11, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant' 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<some_path>\.conda\envs\py4vasp_pymatgne\lib\site-packages\requests\compat.py", line 11, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  <some info>
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  <some info>
AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import)

Change behaviour of bool and complex in VaspData

  • Behave such that VaspData provides numpy.complex_ and np.bool_ if the underlying provided array is actually a complex or bool respectively. Currently integers are used to represent bool and a (..., 2) shape array is used to represent complex.

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.