Skip to content

Commit

Permalink
seekpath_structure_analysis: expand parameter input into keywords
Browse files Browse the repository at this point in the history
The original design required a single `Dict` node that contained all the
parameters that were to be passed to Seekpath. However, since arbitrary
keyword arguments are now supported in process functions it is better to
expect individual data nodes. Since all parameters for the Seekpath
function will expect simple data types, such as a string, int, float or
bool, we unpack the nodes in the kwargs into their underlying base
values and pass it on.
  • Loading branch information
sphuber committed Mar 6, 2020
1 parent 50e0638 commit ec24908
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@
"""Calcfunction to primitivize a structure and return high symmetry k-point path through its Brillouin zone."""
from __future__ import absolute_import
from aiida.engine import calcfunction
from aiida.orm import Data


@calcfunction
def seekpath_structure_analysis(structure, parameters):
"""Primitivize the structure with SeeKpath and return high symmetry k-point path through its Brillouin zone.
def seekpath_structure_analysis(structure, **kwargs):
"""Primitivize the structure with SeeKpath and generate the high symmetry k-point path through its Brillouin zone.
This calcfunction will take a structure and pass it through SeeKpath to get the normalized primitive cell and the
path of high symmetry k-points through its Brillouin zone. Note that the returned primitive cell may differ from the
original structure in which case the k-points are only congruent with the primitive cell.
The keyword arguments can be used to specify various Seekpath parameters, such as:
with_time_reversal: True
reference_distance: 0.025
recipe: 'hpkot'
threshold: 1e-07
symprec: 1e-05
angle_tolerance: -1.0
Note that exact parameters that are available and their defaults will depend on your Seekpath version.
"""
from aiida.tools import get_explicit_kpoints_path
return get_explicit_kpoints_path(structure, **parameters.get_dict())

# All keyword arugments should be `Data` node instances of base type and so should have the `.value` attribute
unwrapped_kwargs = {key: node.value for key, node in kwargs.items() if isinstance(node, Data)}

return get_explicit_kpoints_path(structure, **unwrapped_kwargs)

0 comments on commit ec24908

Please sign in to comment.