Loading...
Searching...
No Matches
q3::NonlocalPseudopotentialStressTensorCalculator Class Reference

#include <nonlocal.hpp>

Public Member Functions

 NonlocalPseudopotentialStressTensorCalculator (const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis, const KPointsGrid &kpoint_grid, const NormConservingPlanewaveKohnShamSCFState &scf_state, StressTensorContributions &result, const std::string &derivative_method="analytical")
 
void compute ()
 

Detailed Description

Definition at line 37 of file nonlocal.hpp.

Constructor & Destructor Documentation

◆ NonlocalPseudopotentialStressTensorCalculator()

q3::NonlocalPseudopotentialStressTensorCalculator::NonlocalPseudopotentialStressTensorCalculator ( const Crystal &  crystal_structure,
const PlanewaveBasis &  planewave_basis,
const KPointsGrid &  kpoint_grid,
const NormConservingPlanewaveKohnShamSCFState &  scf_state,
StressTensorContributions &  result,
const std::string &  derivative_method = "analytical" 
)
inline

Definition at line 39 of file nonlocal.hpp.

Member Function Documentation

◆ compute()

void q3::NonlocalPseudopotentialStressTensorCalculator::compute ( )
inline

kpoint_state_index runs over number_of_kpoints * number_of_spin_components "quantum states" (spin-major: spin_index * number_of_kpoints + kpoint_index, matching PlanewaveKohnShamQuantumSystem's storage convention) — looping kpoint_index alone silently drops the second spin channel for LSDA (nspin=2). kpoint_grid_[kpoint_index] itself is NOT spin-doubled: same physical k-point and already spin-halved weight for both channels.

number_of_plane_waves/g_vector_indices_at_kpoint are PlanewaveBasis-derived (the G-vector set for a k-point does not depend on spin) — physical kpoint_index. occupation/wavefunction_coefficient/eigenvalue are QuantumSystem-derived (per spin channel) — spin-doubled kpoint_state_index.

The k+G geometry and its spherical harmonics do not depend on the atom, so they are computed once per k-point. Only the structure factor does, and it is formed per atom as that atom is reached. This used to be a 56-byte record per projector per plane wave – on the 54-atom silicon cell over a gigabyte of the same numbers.

The D matrix couples projectors of the same atom only, so every term below is a sum over atoms of an atom's own projectors. The cell is therefore worked through in blocks of consecutive atoms, each holding its projectors and their six strain derivatives for as long as it takes to contract them with the occupied bands. The whole cell at once is what took the 54-atom silicon cell from 2.3 GiB through the SCF to over 4 GiB here.

A block carries an eighth as many projectors as there are occupied bands, so its seven arrays stay below the occupied wavefunctions, but never fewer than 64: every contraction copies the wavefunctions into the BLAS's own buffers, and with a handful of projectors per call that copy, not the product, is the cost. Measured with Accelerate on this cell, 18 rows per call took five times as long per projector as the whole cell in one call, and 378 rows were within 10% of it.

Definition at line 53 of file nonlocal.hpp.

References q3::PlanewaveKohnShamSCFState::eigenvalue(), q3::PlanewaveKohnShamSCFState::g_vector_indices_at_kpoint(), q3::NormConservingPlanewaveKohnShamQuantumSystem::has_ultrasoft(), q3::PlanewaveBasis::is_gamma_only(), q3::StressTensorContributions::nonlocal, q3::Crystal::number_of_atoms(), q3::PlanewaveKohnShamSCFState::number_of_bands(), q3::KPointsGrid::number_of_kpoints(), q3::PlanewaveKohnShamSCFState::number_of_plane_waves(), q3::PlanewaveKohnShamSCFState::number_of_spin_components(), q3::PlanewaveKohnShamSCFState::occupation(), q3::math::tolerances::occupation_threshold, q3::NormConservingPlanewaveKohnShamQuantumSystem::pseudopotential_basis(), q3::NormConservingPlanewaveKohnShamSCFState::quantum_system(), q3::Crystal::reciprocal_lattice_vectors(), q3::Crystal::species_type_index(), and q3::PlanewaveKohnShamSCFState::wavefunction_coefficient().

Referenced by q3::NormConservingPlanewaveStressTensorCalculator::compute().


The documentation for this class was generated from the following file: