Skip to content

Commit

Permalink
Merge pull request #215 from electronic-structure/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
electronic-structure authored May 18, 2018
2 parents 94931d5 + 311d5c2 commit 535c252
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 133 deletions.
4 changes: 2 additions & 2 deletions apps/atoms/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Free_atom: public sirius::Atom_type
vrho[i] = 0;
}

sirius::Mixer<double>* mixer = new sirius::Broyden1<double>(0, np, 12, 0.8, mpi_comm_self());
sirius::Mixer<double>* mixer = new sirius::Broyden1<double>(0, np, 12, 0.8, Communicator::self());
for (int i = 0; i < np; i++) {
mixer->input_local(i, vrho[i]);
}
Expand Down Expand Up @@ -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();

Expand Down
3 changes: 1 addition & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion src/Potential/poisson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ inline void Potential::poisson(Periodic_function<double> const& rho)
/* add contribution from the pseudo-charge */
poisson_add_pseudo_pw(qmt, qit, const_cast<double_complex*>(&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;
Expand Down
2 changes: 1 addition & 1 deletion src/SDDK/GPU/magma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <magma.h>
#include <magma_z.h>
#include <magma_d.h>
#include <magma_threadsetting.h>
#include <../control/magma_threadsetting.h>
#include <cstring>

namespace magma {
Expand Down
14 changes: 7 additions & 7 deletions src/SDDK/timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, std::map<std::string, double>>& timer_values_ex()
{
/* the following map is stored:
parent_timer_label1 |--- child_timer_label1, time1a
|--- child timer_label2, time2
|--- child_timer_label3, time3
Expand All @@ -83,7 +83,7 @@ class timer
}

public:

/// Constructor.
timer(std::string label__)
: label_(label__)
Expand All @@ -94,7 +94,7 @@ class timer
stack().push_back(label_);
active_ = true;
}

/// Destructor.
~timer()
{
Expand All @@ -105,7 +105,7 @@ class timer
stop();
}
}

/// Stop the timer and update the statistics.
double stop()
{
Expand All @@ -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<std::chrono::duration<double>>(t2 - starting_time_);
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/SDDK/wave_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
2 changes: 1 addition & 1 deletion src/SDDK/wf_inner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, double>::value || std::is_same<T, double_complex>::value, "wrong type");

Expand Down
80 changes: 7 additions & 73 deletions src/SDDK/wf_trans.hpp
Original file line number Diff line number Diff line change
@@ -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 <typename T>
inline void transform(device_t pu__,
int ispn__,
Expand All @@ -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<T, double>::value || std::is_same<T, double_complex>::value, "wrong type");

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -370,7 +374,6 @@ inline void transform(device_t pu__,
int j0__,
int n__)
{

transform<T>(pu__, ispn__, alpha__, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, beta__, {&wf_out__}, j0__, n__);
}

Expand All @@ -387,75 +390,6 @@ inline void transform(device_t pu__,
int j0__,
int n__)
{

transform<T>(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 <typename T>
//== inline void transform(device_t pu__,
//== double alpha__,
//== wave_functions& wf_in__,
//== int i0__,
//== int m__,
//== dmatrix<T>& mtrx__,
//== int irow0__,
//== int jcol0__,
//== double beta__,
//== wave_functions& wf_out__,
//== int j0__,
//== int n__)
//== {
//== transform<T>(pu__, alpha__, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, beta__, {&wf_out__}, j0__, n__);
//== }
//==
//== template <typename T>
//== inline void transform(device_t pu__,
//== wave_functions& wf_in__,
//== int i0__,
//== int m__,
//== dmatrix<T>& mtrx__,
//== int irow0__,
//== int jcol0__,
//== wave_functions& wf_out__,
//== int j0__,
//== int n__)
//== {
//== transform<T>(pu__, 1.0, {&wf_in__}, i0__, m__, mtrx__, irow0__, jcol0__, 0.0, {&wf_out__}, j0__, n__);
//== }
//==
//== template <typename T>
//== inline void transform(device_t pu__,
//== double alpha__,
//== std::vector<Wave_functions*> wf_in__,
//== int i0__,
//== int m__,
//== dmatrix<T>& mtrx__,
//== int irow0__,
//== int jcol0__,
//== double beta__,
//== std::vector<Wave_functions*> 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<wave_functions*> wf_in;
//== std::vector<wave_functions*> 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__);
//== }
//== }
9 changes: 7 additions & 2 deletions src/Unit_cell/free_atom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Free_atom : public Atom_type
/// Radial wave-functions.
mdarray<double, 2> free_atom_wave_functions_;
/// Atomic potential.
Spline<double> free_atom_potential_;
Spline<double> 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.
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -329,6 +329,11 @@ class Free_atom : public Atom_type
{
return free_atom_potential_.at_point(x);
}

inline Spline<double>& free_atom_potential()
{
return free_atom_potential_;
}
};
} // namespace sirius

Expand Down
4 changes: 4 additions & 0 deletions src/Unit_cell/unit_cell_symmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
#define __UNIT_CELL_SYMMETRY_H__

extern "C" {
#ifdef __SPGLIB_STD_INCLUDE_PATH
#include <spglib/spglib.h>
#else
#include <spglib.h>
#endif
}

#include "geometry3d.hpp"
Expand Down
5 changes: 1 addition & 4 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/dft_ground_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/matching_coefficients.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sbessel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gsl/gsl_sf_bessel.h>
#include "eigenproblem.h"
Expand Down
Loading

0 comments on commit 535c252

Please sign in to comment.