Skip to content

Commit

Permalink
Merge branch 'rename_ions_to_ionic' into 'master'
Browse files Browse the repository at this point in the history
Rename the ions:: namespace to ionic::

See merge request npneq/inq!1097
  • Loading branch information
xavierandrade committed Jul 1, 2024
2 parents 12948f4 + a0e2ccb commit cf1b587
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 86 deletions.
4 changes: 2 additions & 2 deletions src/basis/spherical_grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <gpu/atomic.hpp>
#include <gpu/run.hpp>
#include <gpu/reduce.hpp>
#include <ions/periodic_replicas.hpp>
#include <ionic/periodic_replicas.hpp>
#include <basis/containing_cube.hpp>
#include <basis/real_space.hpp>
#include <cassert>
Expand Down Expand Up @@ -59,7 +59,7 @@ namespace basis {
void initialize(const basis & parent_grid, const vector3<double> & center_point, const double radius){
CALI_CXX_MARK_SCOPE("spherical_grid::initialize");

ions::periodic_replicas const rep(parent_grid.cell(), center_point, parent_grid.diagonal_length());
ionic::periodic_replicas const rep(parent_grid.cell(), center_point, parent_grid.diagonal_length());

vector3<int> local_sizes = parent_grid.local_sizes();

Expand Down
4 changes: 2 additions & 2 deletions src/bomd/propagate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#include <ground_state/calculate.hpp>
#include <ions/propagator.hpp>
#include <ionic/propagator.hpp>
#include <options/real_time.hpp>
#include <real_time/viewables.hpp>
#include <systems/electrons.hpp>
Expand All @@ -21,7 +21,7 @@
namespace inq {
namespace bomd {

template <typename ProcessFunction, typename IonSubPropagator = ions::propagator::molecular_dynamics>
template <typename ProcessFunction, typename IonSubPropagator = ionic::propagator::molecular_dynamics>
void propagate(systems::ions & ions, systems::electrons & electrons, ProcessFunction func, const options::theory & inter, const options::real_time & opts, IonSubPropagator const& ion_propagator = {}){
CALI_CXX_MARK_FUNCTION;

Expand Down
3 changes: 1 addition & 2 deletions src/ground_state/calculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <mixers/broyden.hpp>
#include <eigensolvers/steepest_descent.hpp>
#include <math/complex.hpp>
#include <ions/interaction.hpp>
#include <observables/dipole.hpp>
#include <observables/magnetization.hpp>
#include <options/ground_state.hpp>
Expand Down Expand Up @@ -136,7 +135,7 @@ class calculator {
sc_.update_ionic_fields(electrons.states_comm(), ions_, electrons.atomic_pot());
sc_.update_hamiltonian(ham_, res.energy, electrons.spin_density());

res.energy.ion(inq::ions::interaction_energy(ions_.cell(), ions_, electrons.atomic_pot()));
res.energy.ion(ionic::interaction_energy(ions_.cell(), ions_, electrons.atomic_pot()));

double old_exe = ham_.exchange().update(electrons);
double exe_diff = fabs(old_exe);
Expand Down
2 changes: 1 addition & 1 deletion src/hamiltonian/exchange_operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace hamiltonian {

public:

exchange_operator(systems::cell const & cell, ions::brillouin const & bzone, double const exchange_coefficient, bool const use_ace):
exchange_operator(systems::cell const & cell, ionic::brillouin const & bzone, double const exchange_coefficient, bool const use_ace):
exchange_coefficient_(exchange_coefficient),
use_ace_(use_ace),
sing_(cell, bzone){
Expand Down
2 changes: 1 addition & 1 deletion src/hamiltonian/forces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ gpu::array<vector3<double>, 1> calculate_forces(const systems::ions & ions, syst
electrons.full_comm().all_reduce_n(raw_pointer_cast(forces_non_local.data_elements()), forces_non_local.size(), std::plus<>{});
}

auto ionic_forces = inq::ions::interaction_forces(ions.cell(), ions, electrons.atomic_pot());
auto ionic_forces = ionic::interaction_forces(ions.cell(), ions, electrons.atomic_pot());

gpu::array<vector3<double>, 1> forces_local(ions.size(), {0.0, 0.0, 0.0});

Expand Down
4 changes: 2 additions & 2 deletions src/hamiltonian/ks_hamiltonian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ks_hamiltonian {

////////////////////////////////////////////////////////////////////////////////////////////

ks_hamiltonian(const basis::real_space & basis, ions::brillouin const & bzone, states::ks_states const & states, atomic_potential const & pot, systems::ions const & ions,
ks_hamiltonian(const basis::real_space & basis, ionic::brillouin const & bzone, states::ks_states const & states, atomic_potential const & pot, systems::ions const & ions,
const double exchange_coefficient, bool use_ace = false):
exchange_(basis.cell(), bzone, exchange_coefficient, use_ace),
scalar_potential_(basis, states.num_density_components()),
Expand Down Expand Up @@ -269,7 +269,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG){

states::orbital_set<basis::real_space, complex> phi(rs, st.num_states(), 1, vector3<double, covariant>{0.0, 0.0, 0.0}, 0, cart_comm);

auto bzone = ions::brillouin(ions, input::kpoints::gamma());
auto bzone = ionic::brillouin(ions, input::kpoints::gamma());

hamiltonian::ks_hamiltonian<double> ham(rs, bzone, st, pot, ions, 0.0);

Expand Down
1 change: 0 additions & 1 deletion src/hamiltonian/projector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <gpu/array.hpp>
#include <math/vector3.hpp>
#include <ions/periodic_replicas.hpp>
#include <basis/double_grid.hpp>
#include <basis/real_space.hpp>
#include <basis/spherical_grid.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/hamiltonian/projector_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <gpu/array.hpp>
#include <math/vector3.hpp>
#include <ions/periodic_replicas.hpp>
#include <basis/real_space.hpp>
#include <basis/spherical_grid.hpp>
#include <hamiltonian/atomic_potential.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/hamiltonian/projector_fourier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <gpu/array.hpp>
#include <math/vector3.hpp>
#include <ions/periodic_replicas.hpp>
#include <basis/real_space.hpp>
#include <basis/spherical_grid.hpp>
#include <operations/transform.hpp>
Expand Down
6 changes: 3 additions & 3 deletions src/hamiltonian/singularity_correction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#include <ions/brillouin.hpp>
#include <ionic/brillouin.hpp>

namespace inq {
namespace hamiltonian {
Expand Down Expand Up @@ -44,7 +44,7 @@ class singularity_correction {
return 4*M_PI*M_PI/val;
}

singularity_correction(systems::cell const & cell, ions::brillouin const & bzone):
singularity_correction(systems::cell const & cell, ionic::brillouin const & bzone):
fk_(bzone.size()),
nkpoints_(bzone.size()),
cell_volume_(cell.volume())
Expand Down Expand Up @@ -127,7 +127,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG){
auto ions = systems::ions(systems::cell::lattice({aa, 0.0_b, 0.0_b}, {0.0_b, aa, 0.0_b}, {0.0_b, 0.0_b, aa}));
auto const & cell = ions.cell();

auto bzone = ions::brillouin(ions, input::kpoints::grid({2, 2, 2}));
auto bzone = ionic::brillouin(ions, input::kpoints::grid({2, 2, 2}));

CHECK(hamiltonian::singularity_correction::auxiliary(cell, 2.0*M_PI*vector3<double, covariant>{0.0, -0.5, 0.0}) == 25.9081_a);
CHECK(hamiltonian::singularity_correction::auxiliary(cell, 2.0*M_PI*vector3<double, covariant>{8.3333333333333332E-003, 7.4999999999999997E-002, 0.26666666666666666}) == 42.650855183181122_a);
Expand Down
16 changes: 8 additions & 8 deletions src/interface/kpoints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#include <input/environment.hpp>
#include <ions/brillouin.hpp>
#include <ionic/brillouin.hpp>

namespace inq {
namespace interface {
Expand Down Expand Up @@ -102,7 +102,7 @@ These are the options available:
}

static void status() {
auto bz = ions::brillouin::load(".inq/default_brillouin");
auto bz = ionic::brillouin::load(".inq/default_brillouin");
if(input::environment::global().comm().root()) std::cout << bz;
}

Expand All @@ -111,30 +111,30 @@ These are the options available:
}

static void gamma() {
auto bz = ions::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());
auto bz = ionic::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}

static void grid(int nx, int ny, int nz) {
auto bz = ions::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::grid({nx, ny, nz}));
auto bz = ionic::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::grid({nx, ny, nz}));
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}

static void shifted_grid(int nx, int ny, int nz) {
auto bz = ions::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::grid({nx, ny, nz}, true));
auto bz = ionic::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::grid({nx, ny, nz}, true));
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}

static void insert(double const & kx, double const & ky, double const & kz, double const & weight) {
auto bz = ions::brillouin{};
try { bz = ions::brillouin::load(".inq/default_brillouin"); }
auto bz = ionic::brillouin{};
try { bz = ionic::brillouin::load(".inq/default_brillouin"); }
catch(...){ }
bz.insert({kx, ky, kz}, weight);
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}

static void clear() {
auto bz = ions::brillouin{};
auto bz = ionic::brillouin{};
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}

Expand Down
8 changes: 4 additions & 4 deletions src/interface/run.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ These are the options available:
static void ground_state() {
auto ions = systems::ions::load(".inq/default_ions");

auto bz = ions::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());
auto bz = ionic::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());

try { bz = ions::brillouin::load(".inq/default_brillouin"); }
try { bz = ionic::brillouin::load(".inq/default_brillouin"); }
catch(...) {
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}
Expand All @@ -88,9 +88,9 @@ These are the options available:
static void real_time() {
auto ions = systems::ions::load(".inq/default_ions");

auto bz = ions::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());
auto bz = ionic::brillouin(systems::ions::load(".inq/default_ions"), input::kpoints::gamma());

try { bz = ions::brillouin::load(".inq/default_brillouin"); }
try { bz = ionic::brillouin::load(".inq/default_brillouin"); }
catch(...) {
bz.save(input::environment::global().comm(), ".inq/default_brillouin");
}
Expand Down
18 changes: 9 additions & 9 deletions src/ions/brillouin.hpp → src/ionic/brillouin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <systems/ions.hpp>

namespace inq {
namespace ions {
namespace ionic {

class brillouin {

Expand Down Expand Up @@ -169,8 +169,8 @@ class brillouin {
}
#endif

#ifdef INQ_IONS_BRILLOUIN_UNIT_TEST
#undef INQ_IONS_BRILLOUIN_UNIT_TEST
#ifdef INQ_IONIC_BRILLOUIN_UNIT_TEST
#undef INQ_IONIC_BRILLOUIN_UNIT_TEST

#include <catch2/catch_all.hpp>

Expand All @@ -192,7 +192,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
ions.insert_fractional("C", {0.0 , 0.0 , 0.0 });
ions.insert_fractional("C", {0.25, 0.25, 0.25});

auto bz1 = ions::brillouin(ions, input::kpoints::gamma());
auto bz1 = ionic::brillouin(ions, input::kpoints::gamma());

CHECK(bz1.size() == 1);
CHECK(bz1.kpoint(0)[0] == 0.0_a);
Expand All @@ -212,7 +212,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
bz1.clear();
CHECK(bz1.size() == 0);

auto bz2 = ions::brillouin(ions, input::kpoints::grid({1, 2, 3}));
auto bz2 = ionic::brillouin(ions, input::kpoints::grid({1, 2, 3}));

CHECK(bz2.size() == 6);

Expand Down Expand Up @@ -240,7 +240,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
CHECK(bz2.kpoint(5)[1]/(2*M_PI) == -0.5_a);
CHECK(bz2.kpoint(5)[2]/(2*M_PI) == -0.3333333333_a);

auto bz3 = ions::brillouin(ions, input::kpoints::grid({2, 2, 2}, true));
auto bz3 = ionic::brillouin(ions, input::kpoints::grid({2, 2, 2}, true));

CHECK(bz3.size() == 8);

Expand Down Expand Up @@ -277,7 +277,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
CHECK(bz3.kpoint(7)[2]/(2*M_PI) == -0.25_a);

bz3.save(comm, "save_brillouin_3");
auto read_bz3 = ions::brillouin::load("save_brillouin_3");
auto read_bz3 = ionic::brillouin::load("save_brillouin_3");

CHECK(read_bz3.size() == 8);

Expand Down Expand Up @@ -319,7 +319,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
kpts.insert({0.1, 0.2, 0.3}, 2.0);
kpts.insert({1.0, -0.01, 0.0}, 0.0);

auto bz4 = ions::brillouin(ions, kpts);
auto bz4 = ionic::brillouin(ions, kpts);

CHECK(bz4.size() == 3);

Expand All @@ -340,7 +340,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {
CHECK(bz4.kpoint_weight(2) == 0.0_a);

bz4.save(comm, "save_brillouin_4");
auto read_bz4 = ions::brillouin::load("save_brillouin_4");
auto read_bz4 = ionic::brillouin::load("save_brillouin_4");

CHECK(read_bz4.size() == 3);

Expand Down
Loading

0 comments on commit cf1b587

Please sign in to comment.