Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Electrostatic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Electrostatic::~Electrostatic()
if (grhoc_ != nullptr) delete grhoc_;
}

void Electrostatic::setupInitialVh(const POTDTYPE* const vh_init)
void Electrostatic::setupInitialVh(const std::vector<POTDTYPE>& vh_init)
{
poisson_solver_->set_vh(vh_init);

Expand Down Expand Up @@ -153,7 +153,7 @@ void Electrostatic::setupPB(

// initialize vh with last trial solution
pb::GridFunc<POTDTYPE> gf_vh(*pbGrid_, bc_[0], bc_[1], bc_[2]);
gf_vh.assign(pot.vh_rho());
gf_vh.assign((pot.vh_rho()).data());
poisson_solver_->set_vh(gf_vh);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Electrostatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Electrostatic
template <class T>
void computeVh(const pb::GridFunc<POTDTYPE>& vhinit, const Ions& ions,
Rho<T>& rho, Potentials& pot);
void setupInitialVh(const POTDTYPE* const);
void setupInitialVh(const std::vector<POTDTYPE>&);
void setupInitialVh(const pb::GridFunc<POTDTYPE>&);
template <class T>
void computeVhRho(Rho<T>& rho);
Expand Down
3 changes: 2 additions & 1 deletion src/Forces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ void Forces<T>::get_loc_proj(RHODTYPE* rho,
const int numpt = mymesh->numpt();

Potentials& pot = hamiltonian_->potential();
const std::vector<POTDTYPE>& vh_rho(pot.vh_rho());
for (int idx = 0; idx < numpt; idx++)
{
const double vhrho = pot.vh_rho(idx);
const double vhrho = vh_rho[idx];
for (short dir = 0; dir < 3; dir++)
{
double* lproj = &(loc_proj[dir * NPTS]);
Expand Down
18 changes: 1 addition & 17 deletions src/MGmol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ int MGmol<OrbitalsType>::initial()
mmpi.barrier();
if (ct.verbose > 0) current_orbitals_->printChromaticNumber(os_);

pot.initBackground(*ions_);

// Random initialization of the wavefunctions
if (ct.restart_info <= 2)
{
Expand Down Expand Up @@ -834,23 +832,9 @@ void MGmol<OrbitalsType>::initNuc(Ions& ions)

Potentials& pot = hamiltonian_->potential();

// initialize poentials based on ionic positions and their species
pot.initialize(ions);

// Check compensating charges
double comp_rho = getCharge(pot.rho_comp());

if (onpe0 && ct.verbose > 1)
{
os_ << std::setprecision(8) << std::fixed
<< " Charge of rhoc: " << comp_rho << std::endl;
}

#if 1
pot.rescaleRhoComp();
#endif

pot.addBackgroundToRhoComp();

electrostat_->setupRhoc(pot.rho_comp());

if (onpe0 && ct.verbose > 3) os_ << " initNuc done" << std::endl;
Expand Down
5 changes: 4 additions & 1 deletion src/Poisson.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ class Poisson : public PoissonInterface

virtual void set_rhod(pb::GridFunc<RHODTYPE>* /*rhod*/){};
void set_vh(const pb::GridFunc<POTDTYPE>& vh) { (*vh_) = vh; };
void set_vh(const POTDTYPE* const vh) { vh_->assign(vh, 'd'); };
void set_vh(const std::vector<POTDTYPE>& vh)
{
vh_->assign(vh.data(), 'd');
};
void resetVh() { vh_->resetData(); }
void set_vepsilon(const POTDTYPE* const vepsilon)
{
Expand Down
Loading