25#ifndef __UNIT_CELL_HPP__
26#define __UNIT_CELL_HPP__
36using json = nlohmann::json;
39class Crystal_symmetry;
58 std::vector<std::shared_ptr<Atom>>
atoms_;
115 std::unique_ptr<Crystal_symmetry> symmetry_;
122 std::pair<int, std::vector<int>> num_hubbard_wf_;
127 int next_atom_type_id(std::string label__);
154 add_atom(label, position, {0, 0, 0});
166 inline auto const& paw_atoms()
const
189 void print_info(std::ostream& out__,
int verbosity__)
const;
191 void print_geometry_info(std::ostream& out__,
int verbosity__)
const;
193 void print_nearest_neighbours(std::ostream& out__)
const;
207 json
serialize(
bool cart_pos__ =
false)
const;
220 bool is_point_in_mt(
r3::vector<double> vc,
int& ja,
int& jr,
double& dr,
double tp[2])
const;
222 void generate_radial_functions(std::ostream& out__);
224 void generate_radial_integrals();
250 std::vector<double>
find_mt_radii(
int auto_rmt__,
bool inflate__);
258 return num_hubbard_wf_;
262 template <
typename T>
290 assert(id__ >= 0 && id__ < (
int)
atom_types_.size());
297 assert(id__ >= 0 && id__ < (
int)
atom_types_.size());
302 inline auto const&
atom_type(std::string
const label__)
const
306 s <<
"atom type " << label__ <<
" is not found";
340 return static_cast<int>(
atoms_.size());
346 assert(id__ >= 0 && id__ < (
int)
atoms_.size());
353 assert(id__ >= 0 && id__ < (
int)
atoms_.size());
380 result += nat *
atom_type(iat).num_valence_electrons();
391 result += nat *
atom_type(iat).num_core_electrons();
401 result = std::max(result,
atom_type(iat).num_mt_points());
413 result += nat *
atom_type(iat).mt_aw_basis_size();
424 result += nat *
atom_type(iat).mt_lo_basis_size();
434 result = std::max(result,
atom_type(iat).mt_basis_size());
444 result = std::max(result,
atom_type(iat).mt_radial_basis_size());
452 double result{1e100};
454 result = std::min(result,
atom_type(iat).mt_radius());
464 result = std::max(result,
atom_type(iat).mt_radius());
499 void set_equivalent_atoms(
int const* equivalent_atoms__)
505 inline auto const& spl_num_atoms()
const
510 inline auto const& spl_num_atom_symmetry_classes()
const
515 inline double volume_mt()
const
520 inline double volume_it()
const
535 inline int lmax_apw()
const
544 inline int num_nearest_neighbours(
int ia)
const
549 inline auto const& nearest_neighbour(
int i,
int ia)
const
554 inline auto const& symmetry()
const
556 RTE_ASSERT(symmetry_ !=
nullptr);
560 inline auto const& lattice_vectors()
const
565 inline auto const& inverse_lattice_vectors()
const
570 inline auto const& reciprocal_lattice_vectors()
const
581 auto const& parameters()
const
586 auto const& comm()
const
591 inline auto const& atom_coord(
int iat__)
const
Contains declaration and partial implementation of sirius::Atom class.
namespace for Niels Lohmann
Data and methods specific to the symmetry class of the atom.
Defines the properties of atom type.
int zn() const
Return ionic charge (as positive integer).
int num_atoms() const
Return number of atoms of a given type.
bool augment() const
Return true if this atom type has an augementation charge.
Data and methods specific to the actual atom in the unit cell.
Set of basic parameters of a simulation.
Representation of a unit cell.
splindex_block< atom_index_t > spl_num_atoms_
Split index of atoms.
int mt_aw_basis_size() const
Total number of the augmented wave basis functions over all atoms.
double omega() const
Unit cell volume.
splindex_block< paw_atom_index_t > spl_num_paw_atoms_
Split index of PAW atoms.
auto const & num_hubbard_wf() const
Return number of Hubbard wave-functions.
std::vector< int > paw_atom_index_
Global index of atom by index of PAW atom.
r3::matrix< double > reciprocal_lattice_vectors_
Reciprocal lattice vectors in column order.
int max_num_mt_points() const
Maximum number of muffin-tin points among all atom types.
Atom const & atom(int id__) const
Return const atom instance by id.
int mt_lo_basis_size() const
Total number of local orbital basis functions over all atoms.
void print_info(std::ostream &out__, int verbosity__) const
Print basic info.
auto get_fractional_coordinates(r3::vector< double > a__) const
Get fractional coordinates of the vector by its Cartesian coordinates.
auto max_num_atoms() const
Maximum number of atoms across all atom types.
int num_paw_atoms() const
Return number of atoms with PAW pseudopotential.
std::vector< int > equivalent_atoms_
List of equivalent atoms, provided externally.
int num_atom_symmetry_classes() const
Number of atom symmetry classes.
double min_mt_radius() const
Minimum muffin-tin radius.
auto lattice_vector(int idx__) const
Return a single lattice vector.
std::map< std::string, int > atom_type_id_map_
Mapping between atom type label and an ordered internal id in the range [0, ).
bool augment() const
Return 'True' if at least one atom in the unit cell has an augmentation charge.
int lmax() const
Maximum orbital quantum number of radial functions between all atom types.
std::string chemical_formula()
Get a simple simple chemical formula bases on the total unit cell.
auto const & spl_num_paw_atoms() const
Get split index of PAW atoms.
int num_atom_types() const
Number of atom types.
void initialize()
Initialize the unit cell data.
void init_paw()
Add PAW atoms.
Atom_symmetry_class & atom_symmetry_class(int id__)
Return symmetry class instance by class id.
json serialize(bool cart_pos__=false) const
Write structure to JSON file.
std::vector< std::vector< nearest_neighbour_descriptor > > nearest_neighbours_
List of nearest neighbours for each atom.
std::pair< int, std::vector< int > > num_ps_atomic_wf() const
Get the total number of pseudo atomic wave-functions.
double min_bond_length() const
Find the minimum bond length.
int max_mt_basis_size() const
Maximum number of basis functions among all atom types.
std::vector< std::shared_ptr< Atom_symmetry_class > > atom_symmetry_classes_
List of atom classes.
int max_mt_aw_basis_size() const
Maximum number of AW basis functions among all atom types.
splindex_block< atom_symmetry_class_index_t > spl_num_atom_symmetry_classes_
Split index of atom symmetry classes.
Atom_type & atom_type(int id__)
Return atom type instance by id.
int max_mt_radial_basis_size() const
Maximum number of radial functions among all atom types.
int atom_id_by_position(r3::vector< double > position__)
Get atom ID (global index) by it's position in fractional coordinates.
auto const & atom_type(std::string const label__) const
Return const atom type instance by label.
std::vector< sddk::mdarray< double, 2 > > atom_coord_
Atomic coordinates in GPU-friendly ordering packed in arrays for each atom type.
void set_lattice_vectors(r3::matrix< double > lattice_vectors__)
Set matrix of lattice vectors.
r3::matrix< double > inverse_lattice_vectors_
Inverse matrix of Bravais lattice vectors.
auto & atom_type(std::string const label__)
Return atom type instance by label.
void write_cif()
Write structure to CIF file.
void add_atom(const std::string label, r3::vector< double > position)
Add new atom without vector field to the list of atom types.
int num_atoms() const
Number of atoms in the unit cell.
double num_core_electrons() const
Number of core electrons.
std::vector< double > find_mt_radii(int auto_rmt__, bool inflate__)
Automatically determine new muffin-tin radii as a half distance between neighbor atoms.
Simulation_parameters const & parameters_
Basic parameters of the simulation.
double num_valence_electrons() const
Number of valence electrons.
std::vector< std::shared_ptr< Atom > > atoms_
List of atoms.
double volume_mt_
Total volume of the muffin-tin spheres.
double max_mt_radius() const
Maximum muffin-tin radius.
Atom_type & add_atom_type(const std::string label__, const std::string file_name__="")
Add new atom type to the list of atom types and read necessary data from the .json file.
void get_symmetry()
Get crystal symmetries and equivalent atoms.
double omega_
Volume of the unit cell. Volume of Brillouin zone is then .
auto get_cartesian_coordinates(r3::vector< T > a__) const
Get Cartesian coordinates of the vector by its fractional coordinates.
r3::matrix< double > lattice_vectors_
Bravais lattice vectors in column order.
Atom & atom(int id__)
Return atom instance by id.
void add_atom(const std::string label, r3::vector< double > position, r3::vector< double > vector_field)
Add new atom to the list of atom types.
void update()
Update the parameters that depend on atomic positions or lattice vectors.
void find_nearest_neighbours(double cluster_radius)
Find the cluster of nearest neighbours around each atom.
Atom_type const & atom_type(int id__) const
Return const atom type instance by id.
double volume_it_
Volume of the interstitial region.
double num_electrons() const
Total number of electrons (core + valence).
int total_nuclear_charge() const
Total nuclear charge.
Atom_symmetry_class const & atom_symmetry_class(int id__) const
Return const symmetry class instance by class id.
auto paw_atom_index(paw_atom_index_t::global ipaw__) const
Return global index of atom by the index in the list of PAW atoms.
std::vector< std::shared_ptr< Atom_type > > atom_types_
List of atom types.
bool check_mt_overlap(int &ia__, int &ja__)
Check if MT spheres overlap.
int max_mt_lo_basis_size() const
Maximum local orbital basis size among all atoms.
Unit cell representation.
MPI communicator wrapper.
Interface to nlohmann::json library and helper functions.
Contains declaration and implementation of sddk::MPI_grid class.
void copy(T *target__, T const *source__, size_t n__)
Copy memory inside a device.
Namespace of the SIRIUS library.
Contains definition and implementation of sirius::Simulation_parameters class.