Skip to content

Commit

Permalink
feat: plotting ncl densities (#120)
Browse files Browse the repository at this point in the history
* add kinetic energy density
* return density in different format for kinetic energy density

* plot ncl magnetization
* make plotting work for more densities
* fix plots for non standard-cell ystems
* allow multiple isosurfaces in single plot

* add to_numpy function

* add selections for source to all classes
* improve documentation for selections
* selection for quantity and components with synonyms for easy access
* improve documentation of Density.selections() to see available options

* implement aliases for density
* format sources that are aliases different in YAML output

---------

Co-authored-by: Marie-Therese Huebsch <marie-therese.huebsch@vasp.at>
Co-authored-by: Martin Schlipf <martin.schlipf@gmail.com>
  • Loading branch information
3 people authored Dec 22, 2023
1 parent 8971ada commit 372275e
Show file tree
Hide file tree
Showing 19 changed files with 623 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
# File open for editing in vi
*.swp
# autogenerated by dephell
Expand Down
24 changes: 23 additions & 1 deletion src/py4vasp/_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def path(self):
def _raw_data(self):
return self._data_context.data

@property
def _selection(self):
return self._data_context.selection

@data_access
def print(self):
"Print a string representation of this instance."
Expand All @@ -131,6 +135,23 @@ def read(self, *args, **kwargs):
"Convenient wrapper around to_dict. Check that function for examples and optional arguments."
return self.to_dict(*args, **kwargs)

@data_access
def selections(self):
"""Returns possible alternatives for this particular quantity VASP can produce.
The returned dictionary contains a single item with the name of the quantity
mapping to all possible selections. Each of these selection may be passed to
other functions of this quantity to select which output of VASP is used.
Returns
-------
dict
The key indicates this quantity and the values possible choices for arguments
to other functions of this quantity.
"""
sources = list(raw.selections(self._data_context.quantity))
return {self._data_context.quantity: sources}

def _repr_pretty_(self, p, cycle):
p.text(str(self))

Expand Down Expand Up @@ -308,4 +329,5 @@ def __exit__(self, *_):
self._stack.close()

def set_selection(self, selection):
self.selection = selection
if self._counter == 0:
self.selection = selection
Loading

0 comments on commit 372275e

Please sign in to comment.