Skip to content

Commit a6f23fa

Browse files
committed
change the cal_vcav.cpp
1 parent e23a944 commit a6f23fa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

source/module_hamilt_general/module_surchem/cal_vcav.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
#include "module_hamilt_general/module_xc/xc_functional.h"
33
#include "surchem.h"
44

5-
void lapl_rho(const std::complex<double>* rhog, double* lapn, const ModulePW::PW_Basis* rho_basis)
5+
void lapl_rho(const double& tpiba2,
6+
const std::complex<double>* rhog,
7+
double* lapn,
8+
const ModulePW::PW_Basis* rho_basis)
69
{
710
std::complex<double> *gdrtmpg = new std::complex<double>[rho_basis->npw];
811
ModuleBase::GlobalFunc::ZEROS(lapn, rho_basis->nrxx);
@@ -21,7 +24,7 @@ void lapl_rho(const std::complex<double>* rhog, double* lapn, const ModulePW::PW
2124
rho_basis->recip2real(aux, aux);
2225
// remember to multily 2pi/a0, which belongs to G vectors.
2326
for (int ir = 0; ir < rho_basis->nrxx; ir++)
24-
lapn[ir] -= aux[ir].real() * GlobalC::ucell.tpiba2;
27+
lapn[ir] -= aux[ir].real() * tpiba2;
2528
}
2629

2730
delete[] gdrtmpg;
@@ -67,7 +70,7 @@ void surchem::createcavity(const UnitCell& ucell,
6770
ModuleBase::GlobalFunc::ZEROS(lapn, rho_basis->nrxx);
6871

6972
// nabla n
70-
XC_Functional::grad_rho(PS_TOTN, nablan, rho_basis, GlobalC::ucell.tpiba);
73+
XC_Functional::grad_rho(PS_TOTN, nablan, rho_basis, ucell.tpiba);
7174

7275
// |\nabla n |^2 = nablan_2
7376
for (int ir = 0; ir < rho_basis->nrxx; ir++)
@@ -76,7 +79,7 @@ void surchem::createcavity(const UnitCell& ucell,
7679
}
7780

7881
// Laplacian of n
79-
lapl_rho(PS_TOTN, lapn, rho_basis);
82+
lapl_rho(ucell.tpiba2,PS_TOTN, lapn, rho_basis);
8083

8184
//-------------------------------------------------------------
8285
// add -Lap(n)/|\nabla n| to vwork and copy \sqrt(|\nabla n|^2)
@@ -126,7 +129,7 @@ void surchem::createcavity(const UnitCell& ucell,
126129

127130
// \nabla(1 / |\nabla n|), ggn in real space
128131
ModuleBase::Vector3<double> *ggn = new ModuleBase::Vector3<double>[rho_basis->nrxx];
129-
XC_Functional::grad_rho(inv_gn, ggn, rho_basis, GlobalC::ucell.tpiba);
132+
XC_Functional::grad_rho(inv_gn, ggn, rho_basis, ucell.tpiba);
130133

131134
//-------------------------------------------------------------
132135
// add -(\nabla n . \nabla(1/ |\nabla n|)) to Vcav in real space

0 commit comments

Comments
 (0)