Skip to content

Commit

Permalink
Renamed forces.hpp to forces_stress.hpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierandrade committed Sep 30, 2024
1 parent f64c51f commit 410ab84
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ground_state/calculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <operations/preconditioner.hpp>
#include <operations/integral.hpp>
#include <observables/density.hpp>
#include <observables/forces.hpp>
#include <observables/forces_stress.hpp>
#include <parallel/gather.hpp>
#include <mixers/linear.hpp>
#include <mixers/broyden.hpp>
Expand Down
21 changes: 10 additions & 11 deletions src/observables/forces.hpp → src/observables/forces_stress.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* -*- indent-tabs-mode: t -*- */

#ifndef INQ__OBSERVABLES__FORCES
#define INQ__OBSERVABLES__FORCES
#ifndef INQ__OBSERVABLES__FORCES_STRESS
#define INQ__OBSERVABLES__FORCES_STRESS

// Copyright (C) 2019-2023 Lawrence Livermore National Security, LLC., Xavier Andrade, Alfredo A. Correa
// Copyright (C) 2019-2024 Lawrence Livermore National Security, LLC., Xavier Andrade, Alfredo A. Correa
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -39,16 +39,17 @@ struct forces_stress {

template <typename HamiltonianType>
forces_stress(systems::ions const & ions, systems::electrons const & electrons, HamiltonianType const & ham):
forces(ions.size()),
stress({3, 3}, 0.0)
{
forces = calculate_forces(ions, electrons, ham);
calculate(ions, electrons, ham);
}

private:

template <typename HamiltonianType>
gpu::array<vector3<double>, 1> calculate_forces(const systems::ions & ions, systems::electrons const & electrons, HamiltonianType const & ham){
void calculate(const systems::ions & ions, systems::electrons const & electrons, HamiltonianType const & ham){

CALI_CXX_MARK_FUNCTION;

basis::field<basis::real_space, vector3<double, covariant>> gdensity(electrons.density_basis());
Expand Down Expand Up @@ -100,14 +101,12 @@ struct forces_stress {
}
}

gpu::array<vector3<double>, 1> forces(ions.size());

for(int iatom = 0; iatom < ions.size(); iatom++){
forces[iatom] = ionic_forces[iatom] + forces_local[iatom] + forces_non_local[iatom];
}

// MISSING: the non-linear core correction term

return forces;
}

};
Expand All @@ -116,8 +115,8 @@ struct forces_stress {
}
#endif

#ifdef INQ_OBSERVABLES_FORCES_UNIT_TEST
#undef INQ_OBSERVABLES_FORCES_UNIT_TEST
#ifdef INQ_OBSERVABLES_FORCES_STRESS_UNIT_TEST
#undef INQ_OBSERVABLES_FORCES_STRESS_UNIT_TEST

#include <catch2/catch_all.hpp>
#include <basis/real_space.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/real_time/propagate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <hamiltonian/self_consistency.hpp>
#include <operations/overlap_diagonal.hpp>
#include <observables/dipole.hpp>
#include <observables/forces.hpp>
#include <observables/forces_stress.hpp>
#include <options/real_time.hpp>
#include <perturbations/none.hpp>
#include <ionic/propagator.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/real_time/viewables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <operations/overlap_diagonal.hpp>
#include <observables/current.hpp>
#include <observables/dipole.hpp>
#include <observables/forces.hpp>
#include <observables/forces_stress.hpp>
#include <perturbations/none.hpp>
#include <systems/electrons.hpp>
#include <real_time/crank_nicolson.hpp>
Expand Down

0 comments on commit 410ab84

Please sign in to comment.