Loading...
Searching...
No Matches
q3::VolumetricField Struct Reference

#include <field.hpp>

Public Member Functions

int atomic_number (int atom_index) const
 Atomic number of one atom, from its element symbol.
 
std::vector< int > atoms_per_species () const
 How many atoms each species has, in species order, for formats that group atoms so.
 
Vector3D cartesian_position_bohr (int atom_index) const
 Cartesian position of one atom, in bohr.
 
Real cell_volume_bohr3 () const
 
Real integral () const
 
int number_of_atoms () const
 
int number_of_grid_points () const
 
Real value (int index_1, int index_2, int index_3) const
 The sample at grid point (i1, i2, i3), third index fastest.
 

Public Attributes

std::vector< Vector3D > atom_positions_crystal
 Fractional (crystal) coordinates, parallel to atom_species_indices.
 
std::vector< int > atom_species_indices
 Species of each atom, an index into species_symbols.
 
std::string description
 Free text for a format's comment line, e.g. "charge density".
 
std::array< int, 3 > grid_dimensions = {0, 0, 0}
 Grid point counts along a1, a2, a3.
 
bool is_a_density = false
 
Matrix3x3 lattice_vectors_bohr {}
 Rows are a1, a2, a3, Cartesian, in bohr.
 
std::vector< std::string > species_symbols
 Element symbols, one per species.
 
std::vector< Real > species_valence_charges
 Valence charge of each species, parallel to species_symbols.
 
std::string unit
 The unit values is in, e.g. "e/bohr^3".
 
std::vector< Real > values
 The samples themselves, number_of_grid_points() of them.
 

Detailed Description

Definition at line 40 of file field.hpp.

Member Function Documentation

◆ atomic_number()

int q3::VolumetricField::atomic_number ( int  atom_index) const
inline

Atomic number of one atom, from its element symbol.

Definition at line 123 of file field.hpp.

References atom_species_indices, q3::PeriodicTable::atomic_number_by_element_symbol(), and species_symbols.

Referenced by q3::CubeVolumetricFieldWriter::write(), and q3::XsfVolumetricFieldWriter::write().

◆ atoms_per_species()

std::vector< int > q3::VolumetricField::atoms_per_species ( ) const
inline

How many atoms each species has, in species order, for formats that group atoms so.

Definition at line 129 of file field.hpp.

References atom_species_indices, and species_symbols.

◆ cartesian_position_bohr()

Vector3D q3::VolumetricField::cartesian_position_bohr ( int  atom_index) const
inline

Cartesian position of one atom, in bohr.

Definition at line 111 of file field.hpp.

References atom_positions_crystal, lattice_vectors_bohr, q3::Vector3D::x, q3::Vector3D::y, and q3::Vector3D::z.

Referenced by q3::CubeVolumetricFieldWriter::write(), and q3::XsfVolumetricFieldWriter::write().

◆ cell_volume_bohr3()

Real q3::VolumetricField::cell_volume_bohr3 ( ) const
inline

Definition at line 82 of file field.hpp.

References q3::Matrix3x3::determinant(), and lattice_vectors_bohr.

Referenced by integral(), and q3::VolumetricCommand::run().

◆ integral()

Real q3::VolumetricField::integral ( ) const
inline

The field integrated over the cell by the midpoint rule the grid is a sample of: Omega / N * sum(values).

For a charge density this is the electron count, which is the one number that says whether a written file is right — a transposed grid or a missed unit changes it, and a viewer's isosurface does not.

Definition at line 103 of file field.hpp.

References cell_volume_bohr3(), number_of_grid_points(), and values.

Referenced by q3::VolumetricCommand::run().

◆ number_of_atoms()

int q3::VolumetricField::number_of_atoms ( ) const
inline

◆ number_of_grid_points()

int q3::VolumetricField::number_of_grid_points ( ) const
inline

Definition at line 74 of file field.hpp.

References grid_dimensions.

Referenced by integral(), and q3::CubeVolumetricFieldReader::read().

◆ value()

Real q3::VolumetricField::value ( int  index_1,
int  index_2,
int  index_3 
) const
inline

The sample at grid point (i1, i2, i3), third index fastest.

Definition at line 87 of file field.hpp.

References grid_dimensions, and values.

Referenced by q3::CubeVolumetricFieldWriter::write(), and q3::XsfVolumetricFieldWriter::write().

Member Data Documentation

◆ atom_positions_crystal

std::vector<Vector3D> q3::VolumetricField::atom_positions_crystal

Fractional (crystal) coordinates, parallel to atom_species_indices.

Definition at line 53 of file field.hpp.

Referenced by cartesian_position_bohr(), and q3::CubeVolumetricFieldReader::read().

◆ atom_species_indices

std::vector<int> q3::VolumetricField::atom_species_indices

Species of each atom, an index into species_symbols.

Definition at line 51 of file field.hpp.

Referenced by atomic_number(), atoms_per_species(), number_of_atoms(), q3::CubeVolumetricFieldReader::read(), and q3::CubeVolumetricFieldWriter::write().

◆ description

std::string q3::VolumetricField::description

Free text for a format's comment line, e.g. "charge density".

Definition at line 58 of file field.hpp.

Referenced by q3::CubeVolumetricFieldReader::read(), q3::VolumetricCommand::run(), q3::CubeVolumetricFieldWriter::write(), and q3::XsfVolumetricFieldWriter::write().

◆ grid_dimensions

std::array<int, 3> q3::VolumetricField::grid_dimensions = {0, 0, 0}

◆ is_a_density

bool q3::VolumetricField::is_a_density = false

Whether integral() is a particle count — true for the charge density and for a band's probability density, false for a potential.

Formats disagree about what they hold, and the disagreement is silent: one format stores the density multiplied by the cell volume, so that summing it and dividing by the point count gives electrons, while a potential in the same file shape is stored unscaled. A writer that cannot honour the distinction refuses the field rather than applying the wrong one.

Definition at line 72 of file field.hpp.

Referenced by q3::VolumetricCommand::run().

◆ lattice_vectors_bohr

Matrix3x3 q3::VolumetricField::lattice_vectors_bohr {}

◆ species_symbols

std::vector<std::string> q3::VolumetricField::species_symbols

Element symbols, one per species.

Definition at line 47 of file field.hpp.

Referenced by atomic_number(), and atoms_per_species().

◆ species_valence_charges

std::vector<Real> q3::VolumetricField::species_valence_charges

Valence charge of each species, parallel to species_symbols.

Definition at line 49 of file field.hpp.

Referenced by q3::CubeVolumetricFieldWriter::write().

◆ unit

std::string q3::VolumetricField::unit

The unit values is in, e.g. "e/bohr^3".

Definition at line 60 of file field.hpp.

Referenced by q3::VolumetricCommand::run(), q3::CubeVolumetricFieldWriter::write(), and q3::XsfVolumetricFieldWriter::write().

◆ values

std::vector<Real> q3::VolumetricField::values

The samples themselves, number_of_grid_points() of them.

Definition at line 56 of file field.hpp.

Referenced by integral(), q3::CubeVolumetricFieldReader::read(), and value().


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