Density and hamiltonian objects¶
- class gpaw.density.Density(gd, finegd, nspins, collinear, charge, redistributor, background_charge=None)[source]¶
Density object.
- =============== =====================================================
- ``gd`` Grid descriptor for coarse grids.
- ``finegd`` Grid descriptor for fine grids.
- ``interpolate`` Function for interpolating the electron density.
- ``mixer`` ``DensityMixer`` object.
- =============== =====================================================
- Soft and smooth pseudo functions on uniform 3D grids:
nt_sG
Electron density on the coarse grid.
nt_sg
Electron density on the fine grid.
nt_g
Electron density on the fine grid.
rhot_g
Charge density on the fine grid.
nct_G
Core electron-density on the coarse grid.
Create the Density object.
- calculate_pseudo_density(wfs)[source]¶
Calculate nt_sG from scratch.
nt_sG will be equal to nct_G plus the contribution from wfs.add_to_density().
- get_all_electron_density(atoms=None, gridrefinement=2, spos_ac=None, skip_core=False)[source]¶
Return real all-electron density array.
- Usage: Either get_all_electron_density(atoms) or
get_all_electron_density(spos_ac=spos_ac)
- skip_core=True theoretically returns the
all-electron valence density (use with care; will not in general integrate to valence)
- get_correction(a, spin)[source]¶
Integrated atomic density correction.
Get the integrated correction to the pseuso density relative to the all-electron density.
- get_spin_contamination(atoms, majority_spin=0)[source]¶
Calculate the spin contamination.
Spin contamination is defined as the integral over the spin density difference, where it is negative (i.e. the minority spin density is larger than the majority spin density.
- initialize_from_atomic_densities(basis_functions)[source]¶
Initialize D_asp, nt_sG and Q_aL from atomic densities.
nt_sG is initialized from atomic orbitals, and will be constructed with the specified magnetic moments and obeying Hund’s rules if
hund
is true.
- class gpaw.hamiltonian.Hamiltonian(gd, finegd, nspins, collinear, setups, timer, xc, world, redistributor, vext=None)[source]¶
- apply(a_xG, b_xG, wfs, kpt, calculate_P_ani=True)[source]¶
Apply the Hamiltonian operator to a set of vectors.
Parameters:
- a_nG: ndarray
Set of vectors to which the overlap operator is applied.
- b_nG: ndarray, output
Resulting S times a_nG vectors.
- wfs: WaveFunctions
Wave-function object defined in wavefunctions.py
- kpt: KPoint object
k-point object defined in kpoint.py.
- calculate_P_ani: bool
When True, the integrals of projector times vectors P_ni = <p_i | a_nG> are calculated. When False, existing P_ani are used
- calculate_kinetic_energy_directly(density, wfs)[source]¶
Calculate kinetic energy as 1/2 (nable psi)^2 it gives better estimate of kinetic energy during the SCF. Important for direct min.
‘calculate_kinetic_energy’ method gives a correct value of kinetic energy only at self-consistent solution.
- Parameters:
density –
wfs –
- Returns:
total kinetic energy
- calculate_kinetic_energy_using_kin_en_matrix(density, wfs)[source]¶
E_k = sum_{M’M} rho_MM’ T_M’M better agreement between gradients of energy and the total energy during the direct minimisation. This is important when the line search is used. Also avoids using the eigenvalues which are not calculated during the direct minimisation.
‘calculate_kinetic_energy’ method gives a correct value of kinetic energy only at self-consistent solution.
- Parameters:
density –
wfs –
- Returns:
total kinetic energy
- get_energy(e_entropy, wfs, kin_en_using_band=True)[source]¶
Sum up all eigenvalues weighted with occupation numbers