37inline std::unique_ptr<KohnShamSCFIterator>
42 throw std::runtime_error(
"Unsupported basis_type/representation_type combination: " +
63inline std::unique_ptr<PlanewaveKohnShamSCFIterator>
67 std::vector<AtomSpecies> patched_species = input.
species;
116 int chosen_number_of_pools = 1;
117 for (
int candidate = 1; candidate <= number_of_processes; candidate++) {
118 if (number_of_processes % candidate == 0 && candidate <= number_of_kpoints) {
119 chosen_number_of_pools = candidate;
123 log::info(
"MPI topology (automatic): {} rank(s) -> {} k-point pool(s) x {} "
124 "rank(s) per pool, from {} irreducible k-point(s)",
126 chosen_number_of_pools,
127 number_of_processes / chosen_number_of_pools,
130 .reconfigure_topology(chosen_number_of_pools);
139 throw std::invalid_argument(
140 "q3_mpi was started on " + std::to_string(number_of_processes) +
141 " ranks, but this input has only " + std::to_string(number_of_kpoints) +
142 " irreducible k-point(s), so " + std::to_string(execution_policy.
band_size()) +
143 " ranks would share each pool. Q3 parallelizes over k-points; ranks sharing a "
144 "pool distribute the FFT instead, which has no measured speedup and disables "
145 "gamma-only, stress, checkpointing and export. Use a rank count that divides "
146 "into single-rank pools (here: " +
147 std::to_string(number_of_kpoints) +
148 "), give the remaining cores to OMP_NUM_THREADS, or ask for the shared-pool "
149 "layout explicitly with --pools.");
154 if (number_of_pools > number_of_kpoints) {
155 log::warn(
"Requested k-point pools ({}) exceeds available IBZ k-points ({}). "
156 "Clamping to {} pools to match QE behaviour.",
166 .reconfigure_topology(number_of_kpoints);
217 std::unique_ptr<PlanewavePseudopotentialKohnShamSCFIterator> iterator;
220 std::make_unique<PawPlanewavePseudopotentialKohnShamSCFIterator>(std::move(scf_config));
221 }
else if (needs_augmentation) {
222 iterator = std::make_unique<UltrasoftPlanewavePseudopotentialKohnShamSCFIterator>(
223 std::move(scf_config));
226 std::make_unique<PlanewavePseudopotentialKohnShamSCFIterator>(std::move(scf_config));
230 iterator->set_owned_crystal(std::move(crystal));
231 iterator->set_owned_kpoint_grid(std::move(local_kpoint_grid));
232 iterator->set_owned_pseudopotential_set(std::move(pseudopotential_set));
int number_of_kpoints() const
bool has_pseudopotential_type(PseudopotentialType target_type) const
bool has_augmentation_charges() const
static std::string find_spacegroup(const Crystal &crystal, Real symmetry_precision=math::tolerances::default_symmetry_precision)
virtual int number_of_processes() const =0
virtual bool number_of_pools_was_requested() const
virtual KPointsGrid local_kpoint_grid(const KPointsGrid &global_kpoint_grid) const =0
virtual int number_of_pools() const =0
void warn(spdlog::format_string_t< Args... > fmt, Args &&... args)
void info(spdlog::format_string_t< Args... > fmt, Args &&... args)
PseudopotentialSet load_pseudopotentials(std::vector< AtomSpecies > &species, const std::string &pseudopotential_directory)
Crystal build_crystal_from_input(const InputData &input, const std::vector< AtomSpecies > &species)
@ projector_augmented_wave
std::unique_ptr< PlanewavePseudopotentialKohnShamSCFIterator > create_planewave_pseudopotential_iterator(KohnShamSCFIteratorConfig config)
KPointsGrid build_global_kpoint_grid_from_input(const InputData &input, const Crystal &crystal)
std::unique_ptr< KohnShamSCFIterator > create_kohn_sham_iterator_from_config(KohnShamSCFIteratorConfig config)
std::unique_ptr< PlanewaveKohnShamSCFIterator > create_kohn_sham_iterator(const InputData &input, const execution::PlanewaveExecutionPolicy &execution_policy)
std::vector< Real > starting_magnetization
std::string hubbard_projector_type
std::vector< std::pair< std::string, Vector3D > > band_path
std::vector< Real > atomic_starting_magnetization
int davidson_basis_expansion_factor
Real wavefunction_energy_cutoff
std::vector< HubbardSpecification > hubbard
std::string mixing_preconditioning
std::string exchange_correlation_functional
std::string nonlocal_stress_derivative_method
int band_path_points_per_segment
std::vector< HubbardStartingEigenvalue > hubbard_starting_eigenvalues
First-iteration occupation-eigenvalue overrides; empty = no seeding.
std::string diagonalization_method
bool use_exact_wavefunction_grid
Real charge_density_energy_cutoff
std::string dispersion_correction
const execution::ExecutionPolicy * execution_policy
int methfessel_paxton_order
std::string representation_type
bool use_deterministic_fft_planning
int hubbard_fixed_occupation_iterations
Iterations for which the seeded occupation matrix is held; 0 = first iteration only.
Crystal * crystal_structure
int number_of_spin_components
Real convergence_threshold