horton_part.adapters.gpaw module
Convert a legacy GPAW restart into a HORTON-Part periodic density archive.
This module is adapted from denspart.adapters.gpaw on DensPart’s lisa
branch at commit ce0d986. GPAW is imported lazily so that it remains an
optional interoperability dependency.
- class GridPart(data, *densnames)
Bases:
objectHelper class for collecting density grid data.
- __init__(data, *densnames)
- assemble_density_arrays(uniform_data, atoms)
Combine uniform and augmentation grids into HORTON-Part arrays.
- Parameters:
uniform_data – Dictionary with detailed data from the uniform grid of a GPAW calculation.
atoms – List of dictionaries with atomic-grid data.
- Returns:
Dictionary containing the data needed for periodic partitioning.
- Return type:
density
- compute_augmentation_spheres(uniform_data, setups, atoms, atnums, atcoords)
Compute the density density corrections within the muffin tin spheres on grids.
Parametes
- uniform_data, setups, atoms
Data generated by get_uniform_grid_data and get_atomic_grid_data.
- atnums
Atomic numbers
- atcoords
Atomic (nuclear) coordinates.
All results are stored in the atoms argument.
- compute_uniform_points(uniform_data)
Compute the trivial positions and weights of the uniform grid points.
- dump_spline(data, key, y, setup, ell)
Convert a spline from a GPAW atom setup.
- Parameters:
data – Dictionary in which the spline is stored.
key – Used for making dictionary keys.
y – Function values at the spline grid points.
setup – The GPAW setup to which this spline belongs.
ell – Angular momentum.
- eval_correction(atom_data, setup_data)
Compute the pseudo to all-electron corrections for one muffin-tin sphere.
- Parameters:
atom_data – Dictionary with the density matrices.
setup_data – Atomic (basis) functions stored on radial grids.
- Returns:
The atomic grid for integrations in the muffin tin sphere.
- Return type:
grid
Notes
Conventions used in variable names, following GPAW conventions: - with t = pseudo - without t = all-electron - c = core - v = valence
- get_atomic_grid_data(calc)
Load atomic setups and atomic wavefunctions from GPAW calculation.
- Parameters:
calc – GPAW calculator instance.
- Returns:
setups – A dictionary with atomic setups used. Keys are atomic numbers and values are dictionaries with relevant data for later evaluation of the density corrections within the augmentation spheres.
atoms – A list with atomic wavefunction data. Contains dm and optional spindm.
- get_horton2_order(ells)
Return a permutation of the basis functions to obtain HORTON 2 conventions.
- Parameters:
ells – Array with angular momenta of the basis functions.
- Returns:
Reordering of the basis functions.
- Return type:
permutation
- get_uniform_grid_data(calc, cellvecs, atnums, bohr)
Take the (pseudo) density on the the uniform grid. This is the easy part.
- Parameters:
calc – GPAW calculator instance.
cellvecs – 3 x 3 array whose rows are cell vectors.
atnums – Array with atomic numbers.
bohr – The ASE conversion factor from bohr to angstrom.
- Returns:
Dictionary with several items extracted from the GPAW calculator.
- Return type:
uniform_data
- main(args=None)
Command-line interface.
- parse_args(args)
Parse command-line arguments.
- prepare_input(atoms, calc)
Prepare HORTON-Part input from a GPAW run.
- Parameters:
atoms – A list of ASE atoms from a GPAW calculation.
calc – The GPAW calculator instance
- Returns:
A dictionary with all input data for a partitioning.
- Return type:
input_data