Skip to content

Commit

Permalink
...EJB
Browse files Browse the repository at this point in the history
  • Loading branch information
ebylaska committed Nov 21, 2024
1 parent d3d14a0 commit f9f65ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Nwpw/nwpwlib/utilities/nwpw_scf_mixing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ class nwpw_scf_mixing : public nwpw_kerker {
for (auto i=0; i<nsize; ++i)
tf[i] = ff[i]/(1.0 + alpha*std::pow(rr[i],twothirds));

// Apply Kerker filter to smooth residual ff
//for (auto ms=0; ms<ispin; ++ms)
// kerker_G(tf + ms*n2ft3d);

std::memcpy(vnew,rr,nsize*sizeof(double)); //
DAXPY_PWDFT(nsize,beta,tf,one,vnew,one); // vnew(n) = rho(n-1) + beta*tf
std::memcpy(rr,vnew,nsize*sizeof(double)); //vm=vnew
Expand Down
17 changes: 10 additions & 7 deletions Nwpw/pspw/minimizer/cgsd_energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ double cgsd_energy(Control2 &control, Molecule &mymolecule, bool doprint, std::o
//std::cout << "total energy0=" << total_energy0 << std::endl;
//std::cout << "total sum0=" << sum0 << std::endl;

int ks_it_in = control.ks_maxit_orb();
int ks_it_out = control.ks_maxit_orbs();
double scf_error;

nwpw_scf_mixing scfmix(mygrid,kerker_g0,
Expand All @@ -365,10 +367,13 @@ double cgsd_energy(Control2 &control, Molecule &mymolecule, bool doprint, std::o
cgsd_steepest_update(mymolecule,oprint,nolagrange,it_in,dte,coutput);

// rotate orbitals
mymolecule.gen_hml();
mymolecule.diagonalize();
mymolecule.rotate1to2();
mymolecule.swap_psi1_psi2();
if (extra_rotate)
{
mymolecule.gen_hml();
mymolecule.diagonalize();
mymolecule.rotate1to2();
mymolecule.swap_psi1_psi2();
}

//define fractional occupation here

Expand All @@ -377,9 +382,7 @@ double cgsd_energy(Control2 &control, Molecule &mymolecule, bool doprint, std::o
bfgscount = 0;
stalled = false;
}
int ks_it_in = control.ks_maxit_orb();
int ks_it_out = control.ks_maxit_orbs();
deltae_old = deltae;
deltae_old = deltae;

int nsize = mygrid->ispin*mygrid->n2ft3d;
std::memcpy(mymolecule.rho2,mymolecule.rho1,nsize*sizeof(double));
Expand Down

0 comments on commit f9f65ef

Please sign in to comment.