vasp-dev / py4vasp Goto Github PK
View Code? Open in Web Editor NEWPython interface for VASP
Home Page: https://vasp.at/py4vasp/latest/
License: Apache License 2.0
Python interface for VASP
Home Page: https://vasp.at/py4vasp/latest/
License: Apache License 2.0
Old issue from Gitlab
Old issue from Gitlab
To simplify the installation of py4vasp
I created a conda-forge package https://anaconda.org/conda-forge/py4vasp
This can be installed with:
conda install -c conda-forge py4vasp
For public API it would be good to have type annotations to document the code better
Old issue from Gitlab
README file should document how to install the package. And how to use the repository.
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.
Old issue from Gitlab
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.
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:
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'
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
Old issue from Gitlab
Vasp writes s, p, d, f orbital to file even if only s, p, d is present.
Orbital moments have a different dimension to the spin moments because the s orbitals are always 0 and hence not written to the HDF5.
Schema should not be locked against modification after it is verified
I have recently (found | came across) this great Py4vasp
tool. I want to know if I can obtain the data to calculate the irreducible representations of electronic states from the result of VASP, say, used by irvsp
, irrep, or SpaceGroupIrep
?
Regards,
HZ
Old issue from Gitlab
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.
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.
Following this user request, we might add the possibility to read the ion_velocities from an MD run:
https://www.vasp.at/forum/viewtopic.php?f=4&t=18729
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.
Old issue from Gitlab
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.
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.
After Calculation,why not produced the h5 file? I use the latest version vasp! but produced xml file!
the py4vsp just reads h5 file?
Old issue from Gitlab
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 = "..."
Old issue from Gitlab
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 ?
calculations
to batch
read() functions should fulfill the following properties:
Old issue from Gitlab
Band structure does not set ticks, if no labels are specified.
Since the development of p4vasp has stopped, I suggest it would be very helpful to develop an alternative user interface based on py4vasp.
Old issue from Gitlab
Report if the calculation converged - either electronic or ionic convergence. Could be useful for high-throughput studies and eventual error handling. With the slice operator, this feature could tell if one or more ionic steps did not reach SCF convergence.
Support raw data formats such as CSV
Correct mpirun settings can significantly speed up VASP calculations, there are some common concerns many users have:
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?
Different ALGO settings produce different output to the OSZICAR. Check how to represent it in py4vasp.
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)
Unit tests should be run on Github
Old issue from Gitlab
Old issue from Gitlab
The dataframe index at the moment is a mixture of kpoint and band. Instead one could separate this into a band and k-point column.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.