From 38b403f329d6c6138261fba6d632639d1571886d Mon Sep 17 00:00:00 2001 From: toxa81 Date: Tue, 15 May 2018 11:06:49 +0200 Subject: [PATCH 1/9] change the page name --- src/dft_ground_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dft_ground_state.h b/src/dft_ground_state.h index 875121d71..4fd3fb3d3 100644 --- a/src/dft_ground_state.h +++ b/src/dft_ground_state.h @@ -940,7 +940,7 @@ inline void DFT_ground_state::print_magnetic_moment() #endif // __DFT_GROUND_STATE_H__ -/** \page DFT Spin-polarized DFT +/** \page dft Spin-polarized DFT * \section section1 Preliminary notes * * \note Here and below sybol \f$ {\boldsymbol \sigma} \f$ is reserved for the vector of Pauli matrices. Spin components From 8a0692d0e796c2a6c540f678384ca38c8657d902 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Tue, 15 May 2018 15:39:44 +0200 Subject: [PATCH 2/9] fixe for spglib include --- src/Unit_cell/unit_cell_symmetry.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Unit_cell/unit_cell_symmetry.h b/src/Unit_cell/unit_cell_symmetry.h index 70b0322c9..5f0949008 100644 --- a/src/Unit_cell/unit_cell_symmetry.h +++ b/src/Unit_cell/unit_cell_symmetry.h @@ -26,7 +26,11 @@ #define __UNIT_CELL_SYMMETRY_H__ extern "C" { +#ifdef __SPGLIB_STD_INCLUDE_PATH +#include +#else #include +#endif } #include "geometry3d.hpp" From 1c7d8f00e15198e40075720d59d84c9dd47a203b Mon Sep 17 00:00:00 2001 From: toxa81 Date: Tue, 15 May 2018 16:48:02 +0200 Subject: [PATCH 3/9] fix for new Communicator class --- apps/atoms/atom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/atoms/atom.cpp b/apps/atoms/atom.cpp index b455ce94f..a83aaafef 100644 --- a/apps/atoms/atom.cpp +++ b/apps/atoms/atom.cpp @@ -68,7 +68,7 @@ class Free_atom: public sirius::Atom_type vrho[i] = 0; } - sirius::Mixer* mixer = new sirius::Broyden1(0, np, 12, 0.8, mpi_comm_self()); + sirius::Mixer* mixer = new sirius::Broyden1(0, np, 12, 0.8, Communicator::self()); for (int i = 0; i < np; i++) { mixer->input_local(i, vrho[i]); } @@ -633,7 +633,7 @@ void generate_atom_file(Free_atom& a, sirius::Atom_symmetry_class atom_class(0, a); atom_class.set_spherical_potential(veff); atom_class.generate_radial_functions(relativity_t::none); - runtime::pstdout pout(mpi_comm_self()); + runtime::pstdout pout(Communicator::self()); atom_class.write_enu(pout); pout.flush(); From 219b6de225b364865e89021c93cfc389d98b90a5 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Tue, 15 May 2018 16:48:36 +0200 Subject: [PATCH 4/9] update spglib --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 78519f620..92220f6f6 100644 --- a/configure.py +++ b/configure.py @@ -6,7 +6,7 @@ packages = { "spg" : { - "url" : "https://github.com/atztogo/spglib/archive/v1.9.9.tar.gz", + "url" : "https://github.com/atztogo/spglib/archive/v1.10.3.tar.gz", "options" : [] }, "fftw" : { From 40837e491755a97276ec80fab84b41e912ef1ec5 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Wed, 16 May 2018 08:39:30 +0200 Subject: [PATCH 5/9] cleanup --- src/SDDK/timer.hpp | 14 +++++++------- src/sbessel.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SDDK/timer.hpp b/src/SDDK/timer.hpp index dc8d00171..798a7bced 100644 --- a/src/SDDK/timer.hpp +++ b/src/SDDK/timer.hpp @@ -61,14 +61,14 @@ class timer { return timer_values()[label__]; } - + /// Mapping between parent timer and child timers. /** This map is needed to build a call tree of timers with the information about "self" time and time spent in calling other timers. */ static std::map>& timer_values_ex() { /* the following map is stored: - + parent_timer_label1 |--- child_timer_label1, time1a |--- child timer_label2, time2 |--- child_timer_label3, time3 @@ -83,7 +83,7 @@ class timer } public: - + /// Constructor. timer(std::string label__) : label_(label__) @@ -94,7 +94,7 @@ class timer stack().push_back(label_); active_ = true; } - + /// Destructor. ~timer() { @@ -105,7 +105,7 @@ class timer stop(); } } - + /// Stop the timer and update the statistics. double stop() { @@ -116,7 +116,7 @@ class timer /* remove this timer name from the list; now last element contains the name of the parent timer */ stack().pop_back(); - + /* measure the time difference */ auto t2 = std::chrono::high_resolution_clock::now(); auto tdiff = std::chrono::duration_cast>(t2 - starting_time_); @@ -315,4 +315,4 @@ class timer /* this is needed only to call timer::global_timer() at the beginning */ static timer* global_timer_init__ = &timer::global_timer(); -#endif // __SDDK_INTERNAL_HPP__ +#endif diff --git a/src/sbessel.h b/src/sbessel.h index ad93b9319..9d9430996 100644 --- a/src/sbessel.h +++ b/src/sbessel.h @@ -22,8 +22,8 @@ * \brief Contains implementation of sirius::Spherical_Bessel_functions and sirius::sbessel_approx classes. */ -#ifndef __SBESSEL_PW_H__ -#define __SBESSEL_PW_H__ +#ifndef __SBESSEL_H__ +#define __SBESSEL_H__ #include #include "eigenproblem.h" From f1b3c61be87eef0da853f304154a0aaf1742b652 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Wed, 16 May 2018 15:52:12 +0200 Subject: [PATCH 6/9] fix for magma header --- configure.py | 1 - src/SDDK/GPU/magma.hpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 92220f6f6..788dcf60a 100644 --- a/configure.py +++ b/configure.py @@ -190,7 +190,6 @@ def main(): # add magma include paths if 'MAGMA_ROOT' in platform: makeinc.write("CXX_OPT := $(CXX_OPT) -I%s/include\n"%platform['MAGMA_ROOT']); - makeinc.write("CXX_OPT := $(CXX_OPT) -I%s/control\n"%platform['MAGMA_ROOT']); # add elpa include path if 'ELPA_ROOT' in platform: makeinc.write("CXX_OPT := $(CXX_OPT) -I%s/elpa\n"%platform['ELPA_ROOT']); diff --git a/src/SDDK/GPU/magma.hpp b/src/SDDK/GPU/magma.hpp index 0e6d013c0..0dc7e8774 100644 --- a/src/SDDK/GPU/magma.hpp +++ b/src/SDDK/GPU/magma.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include <../control/magma_threadsetting.h> #include namespace magma { From e48b50c7600976b7e8d36cf4ac6b68b9e7bc9f80 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Thu, 17 May 2018 09:05:51 +0200 Subject: [PATCH 7/9] fix in logig of deducing the default eigen-solver --- src/simulation_context_base.h | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/simulation_context_base.h b/src/simulation_context_base.h index e370a948a..61123f835 100644 --- a/src/simulation_context_base.h +++ b/src/simulation_context_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2017 Anton Kozhevnikov, Thomas Schulthess +// Copyright (c) 2013-2018 Anton Kozhevnikov, Thomas Schulthess // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that @@ -787,42 +787,43 @@ inline void Simulation_context_base::initialize() } std::string evsn[] = {std_evp_solver_name(), gen_evp_solver_name()}; - +#if defined(__MAGMA) + bool is_magma{true}; +#else + bool is_magma{false}; +#endif +#if defined(__SCALAPACK) + bool is_scalapack{true}; +#else + bool is_scalapack{false}; +#endif +#if defined(__ELPA) + bool is_elpa{true}; +#else + bool is_elpa{false}; +#endif + /* deduce the default eigen-value solver */ - if (comm_band().size() == 1 || npc == 1 || npr == 1) { - if (evsn[0] == "") { - #if defined(__GPU) && defined(__MAGMA) - evsn[0] = "magma"; - #else - evsn[0] = "lapack"; - #endif - } - if (evsn[1] == "") { - #if defined(__GPU) && defined(__MAGMA) - evsn[1] = "magma"; - #else - evsn[1] = "lapack"; - #endif - } - } else { - if (evsn[0] == "") { - #ifdef __SCALAPACK - evsn[0] = "scalapack"; - #endif - #ifdef __ELPA - evsn[0] = "elpa1"; - #endif - } - if (evsn[1] == "") { - #ifdef __SCALAPACK - evsn[1] = "scalapack"; - #endif - #ifdef __ELPA - evsn[1] = "elpa1"; - #endif + for (int i: {0, 1}) { + if (evsn[i] == "") { + /* conditions for sequential diagonalization */ + if (comm_band().size() == 1 || npc == 1 || npr == 1 || !is_scalapack) { + if (is_magma) { + evsn[i] = "magma"; + } else { + evsn[i] = "lapack"; + } + } else { + if (is_scalapack) { + evsn[i] = "scalapack"; + } + if (is_elpa) { + evsn[i] = "elpa1"; + } + } } } - + ev_solver_t* evst[] = {&std_evp_solver_type_, &gen_evp_solver_type_}; std::map str_to_ev_solver_t = { From 151912e6e52c6289dc3682ba6ecad17d4dc4d0e0 Mon Sep 17 00:00:00 2001 From: toxa81 Date: Thu, 17 May 2018 10:59:21 +0200 Subject: [PATCH 8/9] cleanup --- src/SDDK/wave_functions.hpp | 2 +- src/SDDK/wf_inner.hpp | 2 +- src/SDDK/wf_trans.hpp | 80 ++++--------------------------------- 3 files changed, 9 insertions(+), 75 deletions(-) diff --git a/src/SDDK/wave_functions.hpp b/src/SDDK/wave_functions.hpp index 954e7b56c..e4508fe54 100644 --- a/src/SDDK/wave_functions.hpp +++ b/src/SDDK/wave_functions.hpp @@ -19,7 +19,7 @@ /** \file wave_functions.hpp * - * \brief Contains declaration and implementation of wave_functions class. + * \brief Contains declaration and implementation of Wave_functions class. */ #ifndef __WAVE_FUNCTIONS_HPP__ diff --git a/src/SDDK/wf_inner.hpp b/src/SDDK/wf_inner.hpp index 1fbf3f31b..f1188f18f 100644 --- a/src/SDDK/wf_inner.hpp +++ b/src/SDDK/wf_inner.hpp @@ -57,7 +57,7 @@ inline void inner(device_t pu__, int irow0__, int jcol0__) { - PROFILE("sddk::wave_functions::inner"); + PROFILE("sddk::Wave_functions::inner"); static_assert(std::is_same::value || std::is_same::value, "wrong type"); diff --git a/src/SDDK/wf_trans.hpp b/src/SDDK/wf_trans.hpp index 8f422cbdf..f400a90c6 100644 --- a/src/SDDK/wf_trans.hpp +++ b/src/SDDK/wf_trans.hpp @@ -1,5 +1,9 @@ /// Linear transformation of the wave-functions. -/** The transformation matrix is expected in the CPU memory. */ +/** The transformation matrix is expected in the CPU memory. The following operation is performed: + * \f[ + * \psi^{out}_{j} = \alpha \sum_{i} \psi^{in}_{i} Z_{ij} + \beta \psi^{out}_{j} + * \f] + */ template inline void transform(device_t pu__, int ispn__, @@ -15,7 +19,7 @@ inline void transform(device_t pu__, int j0__, int n__) { - PROFILE("sddk::wave_functions::transform"); + PROFILE("sddk::Wave_functions::transform"); static_assert(std::is_same::value || std::is_same::value, "wrong type"); @@ -140,7 +144,7 @@ inline void transform(device_t pu__, } }; - sddk::timer t1("sddk::wave_functions::transform|init"); + sddk::timer t1("sddk::Wave_functions::transform|init"); /* initial values for the resulting wave-functions */ for (int iv = 0; iv < nwf; iv++) { if (beta__ == 0) { @@ -370,7 +374,6 @@ inline void transform(device_t pu__, int j0__, int n__) { - transform(pu__, ispn__, alpha__, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, beta__, {&wf_out__}, j0__, n__); } @@ -387,75 +390,6 @@ inline void transform(device_t pu__, int j0__, int n__) { - transform(pu__, ispn__, 1.0, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, 0.0, {&wf_out__}, j0__, n__); } -//== /// Linear transformation of wave-functions. -//== /** The following operation is performed: -//== * \f[ -//== * \psi^{out}_{j} = \alpha \sum_{i} \psi^{in}_{i} Z_{ij} + \beta \psi^{out}_{j} -//== * \f] -//== */ -//== template -//== inline void transform(device_t pu__, -//== double alpha__, -//== wave_functions& wf_in__, -//== int i0__, -//== int m__, -//== dmatrix& mtrx__, -//== int irow0__, -//== int jcol0__, -//== double beta__, -//== wave_functions& wf_out__, -//== int j0__, -//== int n__) -//== { -//== transform(pu__, alpha__, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, beta__, {&wf_out__}, j0__, n__); -//== } -//== -//== template -//== inline void transform(device_t pu__, -//== wave_functions& wf_in__, -//== int i0__, -//== int m__, -//== dmatrix& mtrx__, -//== int irow0__, -//== int jcol0__, -//== wave_functions& wf_out__, -//== int j0__, -//== int n__) -//== { -//== transform(pu__, 1.0, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, 0.0, {&wf_out__}, j0__, n__); -//== } -//== -//== template -//== inline void transform(device_t pu__, -//== double alpha__, -//== std::vector wf_in__, -//== int i0__, -//== int m__, -//== dmatrix& mtrx__, -//== int irow0__, -//== int jcol0__, -//== double beta__, -//== std::vector wf_out__, -//== int j0__, -//== int n__) -//== { -//== assert(wf_in__.size() == wf_out__.size()); -//== for (size_t i = 0; i < wf_in__.size(); i++) { -//== assert(wf_in__[i]->num_components() == wf_in__[0]->num_components()); -//== assert(wf_in__[i]->num_components() == wf_out__[i]->num_components()); -//== } -//== int num_sc = wf_in__[0]->num_components(); -//== for (int is = 0; is < num_sc; is++) { -//== std::vector wf_in; -//== std::vector wf_out; -//== for (size_t i = 0; i < wf_in__.size(); i++) { -//== wf_in.push_back(&wf_in__[i]->component(is)); -//== wf_out.push_back(&wf_out__[i]->component(is)); -//== } -//== transform(pu__, alpha__, wf_in, i0__, m__, mtrx__, irow0__, jcol0__, beta__, wf_out, j0__, n__); -//== } -//== } From 46a264b6272b7efc6d990bf9ec8990ae1f75214a Mon Sep 17 00:00:00 2001 From: toxa81 Date: Fri, 18 May 2018 09:20:08 +0200 Subject: [PATCH 9/9] cleanup --- src/Potential/poisson.hpp | 2 +- src/Unit_cell/free_atom.hpp | 9 +++++++-- src/config.h | 5 +---- src/matching_coefficients.h | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Potential/poisson.hpp b/src/Potential/poisson.hpp index b3c4b9b74..db086248b 100644 --- a/src/Potential/poisson.hpp +++ b/src/Potential/poisson.hpp @@ -221,7 +221,7 @@ inline void Potential::poisson(Periodic_function const& rho) /* add contribution from the pseudo-charge */ poisson_add_pseudo_pw(qmt, qit, const_cast(&rho.f_pw_local(0))); - if (check_pseudo_charge) { + if (ctx_.control().verification_ >= 2) { poisson_sum_G(ctx_.lmmax_rho(), &rho.f_pw_local(0), sbessel_mom_, qit); double d = 0.0; diff --git a/src/Unit_cell/free_atom.hpp b/src/Unit_cell/free_atom.hpp index e31333268..2135b34c2 100644 --- a/src/Unit_cell/free_atom.hpp +++ b/src/Unit_cell/free_atom.hpp @@ -38,7 +38,7 @@ class Free_atom : public Atom_type /// Radial wave-functions. mdarray free_atom_wave_functions_; /// Atomic potential. - Spline free_atom_potential_; + Spline free_atom_potential_; // TODO: rename. this is potential of electronic density /// NIST total energy for LDA calculation. double NIST_LDA_Etot_{0}; /// NIST total energy for scalar-relativistic LDA calculation. @@ -211,7 +211,7 @@ class Free_atom : public Atom_type } for (int i = 0; i < np; i++) { - f(i) = (veff[i] - vnuc[i]) * rho(i); + f(i) = vrho[i] * rho(i); } /* kinetic energy */ energy_kin = eval_sum - fourpi * (f.interpolate().integrate(2) - zn() * rho.integrate(1)); @@ -329,6 +329,11 @@ class Free_atom : public Atom_type { return free_atom_potential_.at_point(x); } + + inline Spline& free_atom_potential() + { + return free_atom_potential_; + } }; } // namespace sirius diff --git a/src/config.h b/src/config.h index 7b4b9cbd4..75fe18d60 100644 --- a/src/config.h +++ b/src/config.h @@ -73,10 +73,7 @@ const bool test_spinor_wf = false; const bool hdf5_trace_errors = false; -/// True if pseudocharge moments in LAPW Poisson solver have to be checked and compared with true multipole moments. -const bool check_pseudo_charge = false; - -/// Tru if LAPW Hamiltonian is diagonalized with second-variational approach. +/// True if LAPW Hamiltonian is diagonalized with second-variational approach. const bool use_second_variation = true; /// True if wave-functions are permanently kept on a GPU and not allocated/deallocated. diff --git a/src/matching_coefficients.h b/src/matching_coefficients.h index 088ca0d38..a93ed65bc 100644 --- a/src/matching_coefficients.h +++ b/src/matching_coefficients.h @@ -88,7 +88,7 @@ class Matching_coefficients /* invert matrix of radial derivatives */ switch (N) { case 1: { - if (unit_cell_.parameters().control().verification_ > 0) { + if (unit_cell_.parameters().control().verification_ >= 1) { if (std::abs(A(0, 0)) < 1.0 / std::sqrt(unit_cell_.omega())) { std::stringstream s; s << "Ill defined plane wave matching problem for atom type " << iat << ", l = " << l << std::endl @@ -103,7 +103,7 @@ class Matching_coefficients case 2: { double det = A(0, 0) * A(1, 1) - A(0, 1) * A(1, 0); - if (unit_cell_.parameters().control().verification_ > 0) { + if (unit_cell_.parameters().control().verification_ >= 1) { if (std::abs(det) < 1.0 / std::sqrt(unit_cell_.omega())) { std::stringstream s; s << "Ill defined plane wave matching problem for atom type " << iat << ", l = " << l << std::endl