Skip to content

Commit

Permalink
add time ticker and fix nspin transport
Browse files Browse the repository at this point in the history
  • Loading branch information
A-006 committed May 26, 2024
1 parent 8929180 commit 7056269
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 41 deletions.
77 changes: 37 additions & 40 deletions source/module_hamilt_lcao/module_gint/gint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,48 +133,45 @@ void Gint::cal_gint(Gint_inout* inout)
int nat = ucell.nat;
const int isforce = inout->isforce;
const int isstress =inout->isstress;
// for (int is = 0; is < GlobalV::NSPIN; ++is)
// {
if (isforce || isstress){
std::vector<double> force(nat * 3, 0.0);
std::vector<double> stress(6, 0.0);
GintKernel::gint_fvl_gamma_gpu(this->DMRGint[inout->ispin],
ucell.omega
/ this->ncxyz,
inout->vl,
force,
stress,
this->nplane,
dr,
rcut,
isforce,
isstress,
*this->gridt,
ucell);

if (inout->isforce)
ModuleBase::TITLE("Gint_interface","cal_force_gpu");
ModuleBase::timer::tick("Gint_interface","cal_force_gpu");
if (isforce || isstress){
std::vector<double> force(nat * 3, 0.0);
std::vector<double> stress(6, 0.0);
GintKernel::gint_fvl_gamma_gpu(this->DMRGint[inout->ispin],
ucell.omega
/ this->ncxyz,
inout->vl,
force,
stress,
this->nplane,
dr,
rcut,
isforce,
isstress,
*this->gridt,
ucell);
if (inout->isforce)
{
for (int iat = 0; iat < nat; iat++)
{
for (int iat = 0; iat < nat; iat++)
{
inout->fvl_dphi[0](iat, 0) += force[iat * 3];
inout->fvl_dphi[0](iat, 1) += force[iat * 3 + 1];
inout->fvl_dphi[0](iat, 2) += force[iat * 3 + 2];
}
}
if (inout->isstress){
inout->svl_dphi[0](0, 0) += stress[0];
inout->svl_dphi[0](0, 1) += stress[1];
inout->svl_dphi[0](0, 2) += stress[2];
inout->svl_dphi[0](1, 1) += stress[3];
inout->svl_dphi[0](1, 2) += stress[4];
inout->svl_dphi[0](2, 2) += stress[5];

inout->fvl_dphi[0](iat, 0) = force[iat * 3];
inout->fvl_dphi[0](iat, 1) = force[iat * 3 + 1];
inout->fvl_dphi[0](iat, 2) = force[iat * 3 + 2];
}
force.clear();
stress.clear();
}

// }
}
if (inout->isstress){
inout->svl_dphi[0](0, 0) = stress[0];
inout->svl_dphi[0](0, 1) = stress[1];
inout->svl_dphi[0](0, 2) = stress[2];
inout->svl_dphi[0](1, 1) = stress[3];
inout->svl_dphi[0](1, 2) = stress[4];
inout->svl_dphi[0](2, 2) = stress[5];
}
force.clear();
stress.clear();
}
ModuleBase::timer::tick("Gint_interface","cal_force_gpu");
}
}
else
Expand Down
1 change: 0 additions & 1 deletion source/module_hamilt_lcao/module_gint/gint_force_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "kernels/cuda/gint_force.cuh"
#include "module_base/ylm.h"
#include "module_hamilt_lcao/module_gint/gint_tools.h"

namespace GintKernel
{

Expand Down

0 comments on commit 7056269

Please sign in to comment.