|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Free functions for extracting atom/orbital info from Atom array. More...
Classes | |
| struct | OrthogonalCell |
| struct | SlabCell |
| struct | AtomData |
| Cartesian atom information in type-major order, matching ABACUS atom indices. More... | |
Functions | |
| void | bcast_atoms_tau (Atom *atoms, const int ntype) |
| broadcast the tau array of the atoms | |
| void | bcast_atoms_pseudo (Atom *atoms, const int ntype) |
| broadcast the pseduo of the atoms | |
| void | bcast_Lattice (Lattice &lat) |
| broadcast the lattice | |
| void | bcast_magnetism (Magnetism &magnet, const int ntype, const int nspin) |
| broadcast the magnetism | |
| void | bcast_unitcell (UnitCell &ucell, const int nspin) |
| broadcast the unitcell | |
| int | cal_nlocal (const Atom *atoms, const int ntype, const int nspin) |
| Calculate the total number of local numerical atomic orbitals. | |
| void | cal_nelec (const Atom *atoms, const int &ntype, double &nelec, const double nelec_delta) |
| calculate the total number of electrons in system | |
| void | cal_nbands (const int &nelec, const int &nlocal, const std::vector< double > &nelec_spin, int &nbands, const std::string &esolver_type, const bool lspinorb, const int nspin, const std::string &basis_type, const std::string &smearing_method) |
| Calculate the number of bands. | |
| void | cal_ux (UnitCell &ucell, const int nspin) |
| Calculate ux for the unit cell. | |
| bool | judge_parallel (double a[3], ModuleBase::Vector3< double > b) |
| Judge if two vectors are parallel. | |
| void | cal_nwfc (std::ofstream &log, UnitCell &ucell, Atom *atoms, const int nspin, const int nlocal, const int npol, const std::string &basis_type, const std::string &esolver_type, const std::string &init_wfc, const int nbands) |
| Calculate the total number of local basis. | |
| void | cal_meshx (int &meshx, const Atom *atoms, const int ntype) |
| Calculate meshx. | |
| void | cal_natomwfc (std::ofstream &log, int &natomwfc, const int ntype, const Atom *atoms, const int nspin) |
| Calculate natomwfc. | |
| bool | make_orthogonal_cell (const ModuleBase::Matrix3 &lattice, const double lattice_scale, const double relative_tolerance, OrthogonalCell &cell) |
| ModuleBase::Vector3< double > | relative_position (const ModuleBase::Vector3< double > &position, const OrthogonalCell &cell) |
| ModuleBase::Vector3< double > | weighted_center (const std::vector< ModuleBase::Vector3< double > > &positions, const std::vector< double > &weights, const OrthogonalCell &cell) |
| bool | make_slab_cell (const ModuleBase::Matrix3 &lattice, const double lattice_scale, const int open_axis, const double relative_tolerance, SlabCell &cell) |
| double | relative_coordinate (const ModuleBase::Vector3< double > &position, const SlabCell &cell) |
| Normal displacement in [-L/2, L/2); requires a validated cell and position. | |
| double | weighted_center (const std::vector< ModuleBase::Vector3< double > > &positions, const std::vector< double > &weights, const SlabCell &cell) |
| int | pseudo_atom_z (const Atom &atom) |
| std::vector< AtomData > | get_atom_data (const Atom *atoms, const int ntype, const double lattice_scale) |
| std::vector< std::string > | get_atomLabels (const Atom *atoms, const int ntype) |
| Get atom labels for each atom type. | |
| std::vector< int > | get_atomCounts (const Atom *atoms, const int ntype) |
| Get atom counts (number of atoms) for each atom type. | |
| std::vector< std::vector< int > > | get_lnchiCounts (const Atom *atoms, const int ntype) |
| Get lnchi counts (number of chi functions per L) for each atom type. | |
| std::vector< ModuleBase::Vector3< double > > | get_target_mag (const Atom *atoms, const int ntype, const int nat) |
| Get target magnetic moment for each atom (used by deltaspin). | |
| std::vector< ModuleBase::Vector3< double > > | get_lambda (const Atom *atoms, const int ntype, const int nat) |
| Get Lagrange multiplier for each atom (used by deltaspin). | |
| std::vector< ModuleBase::Vector3< int > > | get_constrain (const Atom *atoms, const int ntype, const int nat) |
| Get constrain flag for each atom (used by deltaspin). | |
| bool | if_atoms_can_move (const Atom *atoms, const int ntype) |
| Judge if any atom can move (any mbl component is non-zero). | |
| bool | if_cell_can_change (const std::vector< int > &lat_axis_free) |
| Judge if any lattice vector can change. | |
| void | check_atomic_stru (UnitCell &ucell, const double &factor) |
| Check atomic structure. | |
| void | print_tau (Atom *atoms, const std::string &Coordinate, const int ntype, const double lat0, std::ofstream &ofs) |
| Print atom positions (tau). | |
| void | print_stru_file (const UnitCell &ucell, const Atom *atoms, const ModuleBase::Matrix3 &latvec, const std::string &fn, const std::string &header, const int &nspin, const bool &vel, const bool &magmom, const bool &orb, const bool &dpks_desc, const int &iproc, const ModuleBase::matrix &force, const bool &has_force, const bool append) |
| Print STRU file according to given settings. | |
| void | print_cell (const UnitCell &ucell, std::ofstream &ofs) |
| Print basic unitcell information to output stream. | |
| StruMeta | make_stru_meta (const UnitCell &ucell) |
| bool | read_atom_species (std::ifstream &ifa, std::ofstream &ofs_running, UnitCell &ucell, const std::string &basis_type, const std::string &orbital_dir, const std::string &init_wfc, const double onsite_radius, const bool deepks_setorb, const bool rpa) |
| Read atom species information. | |
| bool | read_lattice_constant (std::ifstream &ifa, std::ofstream &ofs_running, Lattice &lat) |
| Read lattice constant. | |
| bool | validate_coordinate_system (const std::string &Coordinate, std::ofstream &ofs_warning) |
| Validate coordinate system type. | |
| void | allocate_atom_properties (Atom &atom, int na) |
| Allocate and initialize atom property vectors. | |
| void | set_atom_movement_flags (Atom &atom, int ia, const ModuleBase::Vector3< int > &mv, const bool fixed_atoms) |
| Set atom movement constraints based on fixed_atoms parameter. | |
| bool | is_magnetization_all_zero (const UnitCell &ucell) |
| Check whether every atom carries a zero collinear magnetic moment. | |
| void | autoset_magnetization (UnitCell &ucell, int nspin, std::ofstream &ofs_running) |
| Set default magnetization if not explicitly specified. | |
| void | warn_zero_magnetization_nspin4 (const UnitCell &ucell, std::ofstream &ofs_running) |
| Warn when a nspin=4 run starts from an all-zero magnetization vector. | |
| void | warn_xy_magnetization_ignored (const std::string &label, int n_discarded, int na, std::ofstream &ofs_running) |
| Report, once per atom type, that x/y magnetization was discarded. | |
| bool | finalize_atom_positions (UnitCell &ucell, std::ofstream &ofs_running, std::ofstream &ofs_warning, const std::string &calculation, const std::string &esolver_type) |
| Perform final validation and output. | |
| ModuleBase::Vector3< double > | calculate_lattice_center (const ModuleBase::Matrix3 &latvec, const std::string ¢er_mode) |
| Calculate lattice center for different centering modes. | |
| void | transform_atom_coordinates (Atom &atom, int ia, const std::string &Coordinate, const ModuleBase::Vector3< double > &v, const ModuleBase::Matrix3 &latvec, double lat0, ModuleBase::Vector3< double > &latcenter) |
| Convert between different coordinate systems. | |
| bool | process_magnetization (Atom &atom, int it, int ia, int nspin, bool input_vec_mag, bool input_angle_mag, std::ofstream &ofs_running, const bool noncolin) |
| Convert between magnetization representations and output. | |
| bool | parse_atom_properties (std::ifstream &ifpos, Atom &atom, int ia, ModuleBase::Vector3< int > &mv, bool &input_vec_mag, bool &input_angle_mag, bool &set_element_mag_zero) |
| Parse optional atom properties (mag, angle1, angle2, lambda, sc, m, v). | |
| bool | read_atom_type_header (int it, UnitCell &ucell, std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning, bool &set_element_mag_zero, const std::string &basis_type, const std::string &orbital_dir, const std::string &init_wfc, const double onsite_radius) |
| Read atom type metadata (label, magnetization, orbital info, atom count). | |
| bool | read_orb_file (int it, std::string &orb_file, std::ofstream &ofs_running, Atom *atom) |
| read number of numerical orbitals for each angular momentum | |
| AtomsInfoResult | read_pseudo (std::ofstream &ofs, UnitCell &ucell, const std::string &pseudo_dir, const std::string &global_out_dir, const bool out_element_info, const std::string &dft_functional, const bool lspinorb, const double pseudo_rcut, const double soc_lambda, const int nspin, const int npol, const std::string &basis_type, const std::string &esolver_type, const std::string &init_wfc, const int nbands, const bool two_fermi, const double nelec_delta, const std::string &smearing_method, const std::string &ks_solver, const int bndpar, const double nelec, const double nupdown) |
| Read pseudopotential files and calculate atom information. | |
| void | read_cell_pseudopots (const std::string &fn, std::ofstream &log, UnitCell &ucell, const std::string &global_out_dir, const std::string &dft_functional, const bool lspinorb, const double pseudo_rcut, const double soc_lambda) |
| Read pseudopotential from files for each type of atom. | |
| void | print_unitcell_pseudo (const std::string &fn, UnitCell &ucell) |
| Print unit cell pseudopotential information. | |
| void | compare_atom_labels (const std::string &label1, const std::string &label2) |
| Check consistency between two atom labels from STRU and pseudo or orb file. | |
| bool | check_tau (const Atom *atoms, const int &ntype, const double &lat0) |
| Check atom positions (tau). | |
| void | check_dtau (Atom *atoms, const int &ntype, const double &lat0, ModuleBase::Matrix3 &latvec) |
| Check atom displacements (dtau). | |
| bool | read_atom_positions (UnitCell &ucell, std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning, const int nspin, const std::string &basis_type, const std::string &orbital_dir, const std::string &init_wfc, const double onsite_radius, const bool fixed_atoms, const bool noncolin, const std::string &calculation, const std::string &esolver_type, const int symmetry) |
| Read atomic positions. | |
| bool | read_atom_positions (UnitCell &ucell, std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning) |
| void | remake_cell (Lattice &lat) |
| Adjust lattice vectors for constrained vc-relaxation. | |
| void | setup_cell_after_vc (UnitCell &ucell, std::ofstream &log, const int nspin) |
| Setup cell after vc-relaxation. | |
| void | update_pos_tau (const Lattice &lat, const double *pos, const int ntype, const int nat, Atom *atoms) |
| Update the position and tau of the atoms. | |
| void | update_pos_taud (const Lattice &lat, const double *posd_in, const int ntype, const int nat, Atom *atoms) |
| Update the position and taud of the atoms. | |
| void | update_pos_taud (const Lattice &lat, const ModuleBase::Vector3< double > *posd_in, const int ntype, const int nat, Atom *atoms) |
| Update the position and taud of the atoms (Vector3 version). | |
| void | update_vel (const ModuleBase::Vector3< double > *vel_in, const int ntype, const int nat, Atom *atoms) |
| Update the velocity of the atoms. | |
| void | periodic_boundary_adjustment (Atom *atoms, const ModuleBase::Matrix3 &latvec, const int ntype) |
| Check the boundary of the cell. | |
| void | reset_remake_cell_mock () |
| bool | was_remake_cell_called () |
Variables | |
| bool | allow_cell_change = false |
Free functions for extracting atom/orbital info from Atom array.
The running-log convergence reporting is centralized in IonCellOptimizer::relax_step. These tests lock the unified format shared by every relax method (sd/cg_trad/bfgs/bfgs_trad/lbfgs) and by cell-relax: Largest force is ... eV/Angstrom while threshold is ... eV/Angstrom Largest stress is ... kbar while threshold is ... kbar Relaxation is converged! Relaxation is not converged yet! The markers are what the ASE interface greps for (issue #6546).
| void unitcell::allocate_atom_properties | ( | Atom & | atom, |
| int | na ) |
Allocate and initialize atom property vectors.
| atom | The atom object to allocate properties for |
| na | Number of atoms |
| mass | Atomic mass |
| void unitcell::autoset_magnetization | ( | UnitCell & | ucell, |
| int | nspin, | ||
| std::ofstream & | ofs_running ) |
Set default magnetization if not explicitly specified.
| ucell | Unit cell object |
| nspin | Number of spin components |
| ofs_running | Output stream for running information |
| void unitcell::bcast_atoms_pseudo | ( | Atom * | atoms, |
| const int | ntype ) |
broadcast the pseduo of the atoms
| atoms | the atoms to be broadcasted [in/out] |
| ntype | the number of types of the atoms [in] |
| void unitcell::bcast_atoms_tau | ( | Atom * | atoms, |
| const int | ntype ) |
broadcast the tau array of the atoms
| atoms | the atoms to be broadcasted [in/out] |
| ntype | the number of types of the atoms [in] |
| void unitcell::bcast_Lattice | ( | Lattice & | lat | ) |
broadcast the lattice
| lat | the lattice to be broadcasted [in/out] |
| void unitcell::bcast_magnetism | ( | Magnetism & | magnet, |
| const int | ntype, | ||
| const int | nspin ) |
broadcast the magnetism
| magnet | the magnetism to be broadcasted [in/out] |
| nytpe | the number of types of the atoms [in] |
| void unitcell::bcast_unitcell | ( | UnitCell & | ucell, |
| const int | nspin ) |
broadcast the unitcell
| ucell | the unitcell to be broadcasted [in/out] |
| nspin | the number of spin components |
| void unitcell::cal_meshx | ( | int & | meshx, |
| const Atom * | atoms, | ||
| const int | ntype ) |
Calculate meshx.
Demand: atoms[].msh
| meshx | output mesh size [out] |
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| void unitcell::cal_natomwfc | ( | std::ofstream & | log, |
| int & | natomwfc, | ||
| const int | ntype, | ||
| const Atom * | atoms, | ||
| const int | nspin ) |
Calculate natomwfc.
Demand: atoms[].nchi, atoms[].lchi, atoms[].oc, atoms[].na
| log | output file stream [in] |
| natomwfc | output number of atomic wavefunctions [out] |
| ntype | number of atom types [in] |
| atoms | atom pointer [in] |
| nspin | number of spin components [in] |
| void unitcell::cal_nbands | ( | const int & | nelec, |
| const int & | nlocal, | ||
| const std::vector< double > & | nelec_spin, | ||
| int & | nbands, | ||
| const std::string & | esolver_type, | ||
| const bool | lspinorb, | ||
| const int | nspin, | ||
| const std::string & | basis_type, | ||
| const std::string & | smearing_method ) |
Calculate the number of bands.
IMPORTANT: The nbands parameter must be the user-specified value from INPUT file. If nbands is 0, this function will auto-calculate a default value based on nelec. If nbands is non-zero (user-specified), this function will validate and use it.
BUG FIX NOTE: Previously, cal_atoms_info() did not pass the user-specified nbands, causing result.nbands to always be 0 and triggering auto-calculation regardless of user input. This led to incorrect energy calculations (deviation ~139 eV).
| nelec | [in] total number of electrons |
| nlocal | [in] total number of local basis |
| nelec_spin | [in] number of electrons for each spin |
| nbands | [in/out] number of bands - must be user-specified value on input, will be updated if auto-calculation is triggered (nbands==0) |
| esolver_type | [in] solver type |
| lspinorb | [in] spin-orbit coupling flag |
| nspin | [in] number of spin components |
| basis_type | [in] basis type |
| smearing_method | [in] smearing method |
| void unitcell::cal_nelec | ( | const Atom * | atoms, |
| const int & | ntype, | ||
| double & | nelec, | ||
| const double | nelec_delta ) |
calculate the total number of electrons in system
| atoms | [in] atom pointer |
| ntype | [in] number of atom types |
| nelec | [out] total number of electrons |
| int unitcell::cal_nlocal | ( | const Atom * | atoms, |
| const int | ntype, | ||
| const int | nspin ) |
Calculate the total number of local numerical atomic orbitals.
nlocal = sum over all atom types of (atoms[it].nw * atoms[it].na). For nspin == 4 (non-collinear) each basis function carries 2 polarizations, so nlocal is doubled.
Shared by cal_atoms_info() (which stores the result in PARAM.globalv.nlocal) and GintInfo::init_trace_lo_(), so those two can no longer drift apart. cal_wfc() still repeats the loop inline because it also needs the per-type prefix sums for Atom::stapos_wf, and asserts its own total against the value cal_atoms_info() produced.
| atoms | [in] atom pointer |
| ntype | [in] number of atom types |
| nspin | [in] number of spin components |
| void unitcell::cal_nwfc | ( | std::ofstream & | log, |
| UnitCell & | ucell, | ||
| Atom * | atoms, | ||
| const int | nspin, | ||
| const int | nlocal, | ||
| const int | npol, | ||
| const std::string & | basis_type, | ||
| const std::string & | esolver_type, | ||
| const std::string & | init_wfc, | ||
| const int | nbands ) |
Calculate the total number of local basis.
Target: nwfc, lmax, atoms[].stapos_wf, PARAM.inp.nbands
| log | output file stream [in] |
| ucell | unit cell [in/out] |
| atoms | atom pointer [in/out] |
| nspin | number of spin components [in] |
| nlocal | total number of local basis [in] |
| npol | number of polarizations [in] |
| basis_type | basis type [in] |
| esolver_type | solver type [in] |
| init_wfc | initial wavefunction type [in] |
| nbands | number of bands [in] |
| void unitcell::cal_ux | ( | UnitCell & | ucell, |
| const int | nspin ) |
Calculate ux for the unit cell.
| ucell | unit cell [in/out] |
| nspin | number of spin components [in] |
| ModuleBase::Vector3< double > unitcell::calculate_lattice_center | ( | const ModuleBase::Matrix3 & | latvec, |
| const std::string & | center_mode ) |
| void unitcell::check_atomic_stru | ( | UnitCell & | ucell, |
| const double & | factor ) |
Check atomic structure.
| ucell | unit cell [in/out] |
| factor | scaling factor [in] |
| void unitcell::check_dtau | ( | Atom * | atoms, |
| const int & | ntype, | ||
| const double & | lat0, | ||
| ModuleBase::Matrix3 & | latvec ) |
Check atom displacements (dtau).
| atoms | atom pointer [in/out] |
| ntype | number of atom types [in] |
| lat0 | lattice constant [in] |
| latvec | lattice vectors [in] |
| bool unitcell::check_tau | ( | const Atom * | atoms, |
| const int & | ntype, | ||
| const double & | lat0 ) |
Check atom positions (tau).
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| lat0 | lattice constant [in] |
| void unitcell::compare_atom_labels | ( | const std::string & | label1, |
| const std::string & | label2 ) |
Check consistency between two atom labels from STRU and pseudo or orb file.
| label1 | atom label from STRU [in] |
| label2 | atom label from pseudo or orbital file [in] |
| bool unitcell::finalize_atom_positions | ( | UnitCell & | ucell, |
| std::ofstream & | ofs_running, | ||
| std::ofstream & | ofs_warning, | ||
| const std::string & | calculation, | ||
| const std::string & | esolver_type ) |
Perform final validation and output.
| ucell | Unit cell object |
| ofs_running | Output stream for running information |
| ofs_warning | Output stream for warnings |
| std::vector< AtomData > unitcell::get_atom_data | ( | const Atom * | atoms, |
| int | ntype, | ||
| double | lattice_scale ) |
Extract positions, masses and pseudopotential valence charges. Requires initialized Atom storage and a positive lattice scale in Bohr.
| std::vector< int > unitcell::get_atomCounts | ( | const Atom * | atoms, |
| const int | ntype ) |
Get atom counts (number of atoms) for each atom type.
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| std::vector< std::string > unitcell::get_atomLabels | ( | const Atom * | atoms, |
| const int | ntype ) |
Get atom labels for each atom type.
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| std::vector< ModuleBase::Vector3< int > > unitcell::get_constrain | ( | const Atom * | atoms, |
| const int | ntype, | ||
| const int | nat ) |
Get constrain flag for each atom (used by deltaspin).
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| nat | total number of atoms [in] |
| std::vector< ModuleBase::Vector3< double > > unitcell::get_lambda | ( | const Atom * | atoms, |
| const int | ntype, | ||
| const int | nat ) |
Get Lagrange multiplier for each atom (used by deltaspin).
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| nat | total number of atoms [in] |
| std::vector< std::vector< int > > unitcell::get_lnchiCounts | ( | const Atom * | atoms, |
| const int | ntype ) |
Get lnchi counts (number of chi functions per L) for each atom type.
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| std::vector< ModuleBase::Vector3< double > > unitcell::get_target_mag | ( | const Atom * | atoms, |
| const int | ntype, | ||
| const int | nat ) |
Get target magnetic moment for each atom (used by deltaspin).
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| nat | total number of atoms [in] |
| bool unitcell::if_atoms_can_move | ( | const Atom * | atoms, |
| const int | ntype ) |
Judge if any atom can move (any mbl component is non-zero).
| atoms | atom pointer [in] |
| ntype | number of atom types [in] |
| bool unitcell::if_cell_can_change | ( | const std::vector< int > & | lat_axis_free | ) |
Judge if any lattice vector can change.
| lat_axis_free | lattice-axis freedom flags (size 3) [in] |
| bool unitcell::is_magnetization_all_zero | ( | const UnitCell & | ucell | ) |
Check whether every atom carries a zero collinear magnetic moment.
| ucell | Unit cell object |
| bool unitcell::judge_parallel | ( | double | a[3], |
| ModuleBase::Vector3< double > | b ) |
Judge if two vectors are parallel.
| a | first vector [in] |
| b | second vector [in] |
| bool unitcell::make_orthogonal_cell | ( | const ModuleBase::Matrix3 & | lattice, |
| double | lattice_scale, | ||
| double | relative_tolerance, | ||
| OrthogonalCell & | cell ) |
Accept rectangular cells, including rotated cells. Return false if the lattice vectors are not mutually perpendicular within relative_tolerance.
| bool unitcell::make_slab_cell | ( | const ModuleBase::Matrix3 & | lattice, |
| double | lattice_scale, | ||
| int | open_axis, | ||
| double | relative_tolerance, | ||
| SlabCell & | cell ) |
Return false if the open lattice vector is not perpendicular to the periodic plane within relative_tolerance.
| bool unitcell::parse_atom_properties | ( | std::ifstream & | ifpos, |
| Atom & | atom, | ||
| int | ia, | ||
| ModuleBase::Vector3< int > & | mv, | ||
| bool & | input_vec_mag, | ||
| bool & | input_angle_mag, | ||
| bool & | set_element_mag_zero ) |
Parse optional atom properties (mag, angle1, angle2, lambda, sc, m, v).
| ifpos | Input file stream |
| atom | The atom object |
| ia | Atom index |
| mv | Movement vector (output parameter) |
| input_vec_mag | Whether vector magnetization was input (output parameter) |
| input_angle_mag | Whether angle magnetization was input (output parameter) |
| set_element_mag_zero | Whether to reset element magnetization (output parameter) |
| void unitcell::periodic_boundary_adjustment | ( | Atom * | atoms, |
| const ModuleBase::Matrix3 & | latvec, | ||
| const int | ntype ) |
Check the boundary of the cell.
For each atom, the taud in three directions should be in the range of [-1,1).
| atoms | the atoms to be adjusted [in/out] |
| latvec | the lattice of the atoms [in] |
| ntype | the number of types of the atoms [in] |
| void unitcell::print_cell | ( | const UnitCell & | ucell, |
| std::ofstream & | ofs ) |
Print basic unitcell information to output stream.
| ucell | reference of unitcell [in] |
| ofs | output file stream [in] |
| void unitcell::print_stru_file | ( | const UnitCell & | ucell, |
| const Atom * | atoms, | ||
| const ModuleBase::Matrix3 & | latvec, | ||
| const std::string & | fn, | ||
| const std::string & | header, | ||
| const int & | nspin, | ||
| const bool & | vel, | ||
| const bool & | magmom, | ||
| const bool & | orb, | ||
| const bool & | dpks_desc, | ||
| const int & | iproc, | ||
| const ModuleBase::matrix & | force, | ||
| const bool & | has_force, | ||
| const bool | append ) |
Print STRU file according to given settings.
| ucell | reference of unitcell [in] |
| atoms | Atom list [in] |
| latvec | lattice parameter vector [in] |
| fn | STRU file name [in] |
| header | comment lines written at the top of the file [in] |
| nspin | number of spin channels [in] |
| vel | true for printing velocities [in] |
| magmom | true for printing Mulliken population analysis produced magmom [in] |
| orb | true for printing NUMERICAL_ORBITAL section [in] |
| dpks_desc | true for printing NUMERICAL_DESCRIPTOR section [in] |
| iproc | GlobalV::MY_RANK [in] |
| force | atomic forces in Ry/Bohr, used only when has_force is true [in] |
| has_force | true to emit per-atom f fields; force matrix must match nat [in] |
| append | true to append the structure block to an existing file (out_app_flag == 1 multi-step runs); false truncates [in] |
| void unitcell::print_tau | ( | Atom * | atoms, |
| const std::string & | Coordinate, | ||
| const int | ntype, | ||
| const double | lat0, | ||
| std::ofstream & | ofs ) |
Print atom positions (tau).
| atoms | atom pointer [in] |
| Coordinate | coordinate system type [in] |
| ntype | number of atom types [in] |
| lat0 | lattice constant [in] |
| ofs | output file stream [in] |
| void unitcell::print_unitcell_pseudo | ( | const std::string & | fn, |
| UnitCell & | ucell ) |
Print unit cell pseudopotential information.
| fn | filename [in] |
| ucell | unit cell [in] |
| bool unitcell::process_magnetization | ( | Atom & | atom, |
| int | it, | ||
| int | ia, | ||
| int | nspin, | ||
| bool | input_vec_mag, | ||
| bool | input_angle_mag, | ||
| std::ofstream & | ofs_running, | ||
| const bool | noncolin ) |
Convert between magnetization representations and output.
| atom | The atom object |
| it | Atom type index |
| ia | Atom index |
| nspin | Number of spin components |
| input_vec_mag | Whether vector magnetization was input |
| input_angle_mag | Whether angle magnetization was input |
| ofs_running | Output stream for running information |
| int unitcell::pseudo_atom_z | ( | const Atom & | atom | ) |
Atomic number of the pseudopotential element of one atom type; 0 if the element symbol is not recognized.
| bool unitcell::read_atom_positions | ( | UnitCell & | ucell, |
| std::ifstream & | ifpos, | ||
| std::ofstream & | ofs_running, | ||
| std::ofstream & | ofs_warning ) |
| bool unitcell::read_atom_positions | ( | UnitCell & | ucell, |
| std::ifstream & | ifpos, | ||
| std::ofstream & | ofs_running, | ||
| std::ofstream & | ofs_warning, | ||
| const int | nspin, | ||
| const std::string & | basis_type, | ||
| const std::string & | orbital_dir, | ||
| const std::string & | init_wfc, | ||
| const double | onsite_radius, | ||
| const bool | fixed_atoms, | ||
| const bool | noncolin, | ||
| const std::string & | calculation, | ||
| const std::string & | esolver_type, | ||
| const int | symmetry ) |
Read atomic positions.
| ucell | unit cell [in/out] |
| ifpos | input file stream [in] |
| ofs_running | output file stream [in] |
| ofs_warning | warning output file stream [in] |
| nspin | number of spin components [in] |
| basis_type | basis type [in] |
| orbital_dir | orbital directory [in] |
| init_wfc | initial wavefunction type [in] |
| onsite_radius | onsite radius [in] |
| fixed_atoms | whether atoms are fixed [in] |
| noncolin | non-collinear flag [in] |
| calculation | calculation type [in] |
| esolver_type | solver type [in] |
| bool unitcell::read_atom_species | ( | std::ifstream & | ifa, |
| std::ofstream & | ofs_running, | ||
| UnitCell & | ucell, | ||
| const std::string & | basis_type, | ||
| const std::string & | orbital_dir, | ||
| const std::string & | init_wfc, | ||
| const double | onsite_radius, | ||
| const bool | deepks_setorb, | ||
| const bool | rpa ) |
Read atom species information.
| ifa | input file stream [in] |
| ofs_running | output file stream [in] |
| ucell | unit cell [in/out] |
| basis_type | basis type [in] |
| orbital_dir | orbital directory [in] |
| init_wfc | initial wavefunction type [in] |
| onsite_radius | onsite radius [in] |
| deepks_setorb | whether to set orb for deepks [in] |
| rpa | RPA flag [in] |
| bool unitcell::read_atom_type_header | ( | int | it, |
| UnitCell & | ucell, | ||
| std::ifstream & | ifpos, | ||
| std::ofstream & | ofs_running, | ||
| std::ofstream & | ofs_warning, | ||
| bool & | set_element_mag_zero, | ||
| const std::string & | basis_type, | ||
| const std::string & | orbital_dir, | ||
| const std::string & | init_wfc, | ||
| const double | onsite_radius ) |
Read atom type metadata (label, magnetization, orbital info, atom count).
| it | Atom type index |
| ucell | Unit cell object |
| ifpos | Input file stream |
| ofs_running | Output stream for running information |
| ofs_warning | Output stream for warnings |
| set_element_mag_zero | Whether to reset element magnetization (output parameter) |
liuyu update 2023-05-11 In order to employ the DP model as esolver, all atom types must be specified in the STRU in the order consistent with that of the DP model, even if the number of ucell.atoms is zero!
| void unitcell::read_cell_pseudopots | ( | const std::string & | fn, |
| std::ofstream & | log, | ||
| UnitCell & | ucell, | ||
| const std::string & | global_out_dir, | ||
| const std::string & | dft_functional, | ||
| const bool | lspinorb, | ||
| const double | pseudo_rcut, | ||
| const double | soc_lambda ) |
Read pseudopotential from files for each type of atom.
| fn | filename [in] |
| log | output file stream [in] |
| ucell | unit cell [in/out] |
| global_out_dir | global output directory [in] |
| dft_functional | DFT functional [in] |
| lspinorb | spin-orbit coupling flag [in] |
| pseudo_rcut | pseudo cut-off radius [in] |
| soc_lambda | SOC lambda parameter [in] |
| bool unitcell::read_lattice_constant | ( | std::ifstream & | ifa, |
| std::ofstream & | ofs_running, | ||
| Lattice & | lat ) |
Read lattice constant.
| ifa | input file stream [in] |
| ofs_running | output file stream [in] |
| lat | lattice object [in/out] |
| bool unitcell::read_orb_file | ( | int | it, |
| std::string & | orb_file, | ||
| std::ofstream & | ofs_running, | ||
| Atom * | atom ) |
| AtomsInfoResult unitcell::read_pseudo | ( | std::ofstream & | ofs, |
| UnitCell & | ucell, | ||
| const std::string & | pseudo_dir, | ||
| const std::string & | global_out_dir, | ||
| const bool | out_element_info, | ||
| const std::string & | dft_functional, | ||
| const bool | lspinorb, | ||
| const double | pseudo_rcut, | ||
| const double | soc_lambda, | ||
| const int | nspin, | ||
| const int | npol, | ||
| const std::string & | basis_type, | ||
| const std::string & | esolver_type, | ||
| const std::string & | init_wfc, | ||
| const int | nbands, | ||
| const bool | two_fermi, | ||
| const double | nelec_delta, | ||
| const std::string & | smearing_method, | ||
| const std::string & | ks_solver, | ||
| const int | bndpar, | ||
| const double | nelec, | ||
| const double | nupdown ) |
Read pseudopotential files and calculate atom information.
| ofs | output file stream [in] |
| ucell | unit cell [in/out] |
| pseudo_dir | pseudopotential directory [in] |
| global_out_dir | global output directory [in] |
| out_element_info | whether to output element information [in] |
| dft_functional | DFT functional [in] |
| lspinorb | spin-orbit coupling flag [in] |
| pseudo_rcut | pseudo cut-off radius [in] |
| soc_lambda | SOC lambda parameter [in] |
| nspin | number of spin components [in] |
| npol | number of polarizations [in] |
| basis_type | basis type [in] |
| esolver_type | solver type [in] |
| init_wfc | initial wavefunction type [in] |
| nbands | number of bands [in] |
| two_fermi | two Fermi levels flag [in] |
| nelec_delta | electron number delta [in] |
| smearing_method | smearing method [in] |
| ks_solver | KS solver type [in] |
| bndpar | band parallel parameter [in] |
| nelec | number of electrons [in] |
| nupdown | spin polarization [in] |
| double unitcell::relative_coordinate | ( | const ModuleBase::Vector3< double > & | position, |
| const SlabCell & | cell ) |
Normal displacement in [-L/2, L/2); requires a validated cell and position.
| ModuleBase::Vector3< double > unitcell::relative_position | ( | const ModuleBase::Vector3< double > & | position, |
| const OrthogonalCell & | cell ) |
Minimum-image displacement from origin, with projections in [-L/2, L/2). Requires a cell constructed above and a finite Cartesian position.
| void unitcell::remake_cell | ( | Lattice & | lat | ) |
Adjust lattice vectors for constrained vc-relaxation.
For constrained vc-relaxation where type of lattice is fixed, adjust the lattice vectors.
| lat | lattice object [in/out] |
| void unitcell::reset_remake_cell_mock | ( | ) |
| void unitcell::set_atom_movement_flags | ( | Atom & | atom, |
| int | ia, | ||
| const ModuleBase::Vector3< int > & | mv, | ||
| const bool | fixed_atoms ) |
Set atom movement constraints based on fixed_atoms parameter.
| atom | The atom object |
| ia | Atom index |
| mv | Movement vector (1=movable, 0=fixed) |
| void unitcell::setup_cell_after_vc | ( | UnitCell & | ucell, |
| std::ofstream & | log, | ||
| const int | nspin ) |
Setup cell after vc-relaxation.
| ucell | unit cell [in/out] |
| log | output file stream [in] |
| nspin | number of spin components [in] |
| void unitcell::transform_atom_coordinates | ( | Atom & | atom, |
| int | ia, | ||
| const std::string & | Coordinate, | ||
| const ModuleBase::Vector3< double > & | v, | ||
| const ModuleBase::Matrix3 & | latvec, | ||
| double | lat0, | ||
| ModuleBase::Vector3< double > & | latcenter ) |
Convert between different coordinate systems.
| atom | The atom object |
| ia | Atom index |
| Coordinate | Coordinate system type |
| v | Input position vector |
| latvec | Lattice vectors |
| lat0 | Lattice constant |
| latcenter | Lattice center (output parameter) |
| void unitcell::update_pos_tau | ( | const Lattice & | lat, |
| const double * | pos, | ||
| const int | ntype, | ||
| const int | nat, | ||
| Atom * | atoms ) |
Update the position and tau of the atoms.
| lat | the lattice of the atoms [in] |
| pos | the position of the atoms [in] |
| ntype | the number of types of the atoms [in] |
| nat | the number of atoms [in] |
| atoms | the atoms to be updated [out] |
| void unitcell::update_pos_taud | ( | const Lattice & | lat, |
| const double * | posd_in, | ||
| const int | ntype, | ||
| const int | nat, | ||
| Atom * | atoms ) |
Update the position and taud of the atoms.
| lat | the lattice of the atoms [in] |
| posd_in | the position of the atoms in direct coordinate system [in] |
| ntype | the number of types of the atoms [in] |
| nat | the number of atoms [in] |
| atoms | the atoms to be updated [out] |
| void unitcell::update_pos_taud | ( | const Lattice & | lat, |
| const ModuleBase::Vector3< double > * | posd_in, | ||
| const int | ntype, | ||
| const int | nat, | ||
| Atom * | atoms ) |
Update the position and taud of the atoms (Vector3 version).
| lat | the lattice of the atoms [in] |
| posd_in | the position of the atoms in direct coordinate system [in] |
| ntype | the number of types of the atoms [in] |
| nat | the number of atoms [in] |
| atoms | the atoms to be updated [out] |
| void unitcell::update_vel | ( | const ModuleBase::Vector3< double > * | vel_in, |
| const int | ntype, | ||
| const int | nat, | ||
| Atom * | atoms ) |
Update the velocity of the atoms.
| vel_in | the velocity of the atoms [in] |
| ntype | the number of types of the atoms [in] |
| nat | the number of atoms [in] |
| atoms | the atoms to be updated [out] |
| bool unitcell::validate_coordinate_system | ( | const std::string & | Coordinate, |
| std::ofstream & | ofs_warning ) |
Validate coordinate system type.
| Coordinate | The coordinate system string to validate |
| ofs_warning | Output stream for warnings |
| void unitcell::warn_xy_magnetization_ignored | ( | const std::string & | label, |
| int | n_discarded, | ||
| int | na, | ||
| std::ofstream & | ofs_running ) |
Report, once per atom type, that x/y magnetization was discarded.
| label | Element label of the atom type |
| n_discarded | Number of atoms of this type whose x/y moment was dropped |
| na | Number of atoms of this type |
| ofs_running | Output stream for running information |
| void unitcell::warn_zero_magnetization_nspin4 | ( | const UnitCell & | ucell, |
| std::ofstream & | ofs_running ) |
Warn when a nspin=4 run starts from an all-zero magnetization vector.
The check uses m_loc_, the vector actually consumed by cal_ux(), and not mag: the collinear projection applied when noncolin=0 can leave mag non-zero while m_loc_ is already zero, so keying the check on mag would miss exactly the silent zero-moment start this warning reports.
| ucell | Unit cell object |
| ofs_running | Output stream for running information |
| bool unitcell::was_remake_cell_called | ( | ) |
| ModuleBase::Vector3< double > unitcell::weighted_center | ( | const std::vector< ModuleBase::Vector3< double > > & | positions, |
| const std::vector< double > & | weights, | ||
| const OrthogonalCell & | cell ) |
Unwrap positions about the first position, take their positive-weight center, then wrap the center about cell.origin. Intended for localized systems whose extent about the first position is less than half a cell in each direction. Requires a cell constructed by make_orthogonal_cell, at least one position and positive weights.
| double unitcell::weighted_center | ( | const std::vector< ModuleBase::Vector3< double > > & | positions, |
| const std::vector< double > & | weights, | ||
| const SlabCell & | cell ) |
Mass/weight center along the normal, unwrapped about the first position. Requires a localized slab of extent less than half the normal period.
| bool unitcell::allow_cell_change = false |