Skip to content

Commit

Permalink
Modified poisson solve such distribute call inside vmult is not neces…
Browse files Browse the repository at this point in the history
…sary. Tested on hcpMg non orthogonal unit cell- got 13 decimal places match in energy and force as before, and same number of scf itertions. With this optimization alongwith a minor optimization which phani will do in a separate PR, there is no requirement of using the forked dealii anymore.
  • Loading branch information
dsambit committed Mar 23, 2018
1 parent a6d07ed commit f540d6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -e
set -o pipefail
#script to setup and build DFT-FE
#Provide paths for external libraries and optimization flag (0 for Debug, 1 for Release)
dealiiPetscRealDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscReal_noavx_64bit_thread_opt2"
dealiiPetscComplexDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscComplex_noavx_64bit_thread_opt2"
dealiiPetscRealDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscReal_noavx_64bit_thread_master"
dealiiPetscComplexDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscComplex_noavx_64bit_thread_master"
alglibDir="/nfs/mcfs_comp/home/rudraa/software/alglib/cpp/src"
libxcDir="/home/vikramg/DFT-FE-softwares/softwareCentos/libxcNew/install_intel18"
spglibDir="/home/vikramg/DFT-FE-softwares/softwareCentos/spglib"
Expand Down
12 changes: 9 additions & 3 deletions src/poisson/poisson.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void poissonClass<FEOrder>::AX (const dealii::MatrixFree<3,double> &data,
for (unsigned int cell=cell_range.first; cell<cell_range.second; ++cell)
{
fe_eval.reinit(cell);
fe_eval.read_dof_values_plain(src);
fe_eval.read_dof_values(src);
fe_eval.evaluate(false,true,false);
for (unsigned int q=0; q<fe_eval.n_q_points; ++q)
{
Expand All @@ -290,8 +290,10 @@ void poissonClass<FEOrder>::vmult(vectorType &dst, vectorType &src) const
{

dst=0.0;
//src.update_ghost_values();

/*
dftPtr->d_constraintsVector[d_constraintMatrixId]->distribute(src);
for(types::global_dof_index i = 0; i < src.size(); ++i)
{
if(src.in_local_range(i))
Expand All @@ -302,14 +304,16 @@ void poissonClass<FEOrder>::vmult(vectorType &dst, vectorType &src) const
}
}
}
*/
dftPtr->matrix_free_data.cell_loop (&poissonClass<FEOrder>::AX, this, dst, src);

//This is necessary specifically for periodic boundary conditions
//for solving total electrostatic potential with pinned nodes
//Only master node is pinned and remaining slave nodes are still
//constrained to master node and setting other slave nodes
//to zero is necessary after every "Ax" and hence call this function.
dftPtr->d_constraintsVector[d_constraintMatrixId]->set_zero(dst);
// (Only necessary for dealiiOpt)
//dftPtr->d_constraintsVector[d_constraintMatrixId]->set_zero(dst);

}

Expand Down Expand Up @@ -353,6 +357,7 @@ void poissonClass<FEOrder>::solve(vectorType& phi, int constraintMatrixId, std::
//solver.solve(*this, phi, rhs, IdentityMatrix(rhs.size()));

//assumed phi distributed prior
/*
for(types::global_dof_index i = 0; i < phi.size(); ++i)
{
if(phi.in_local_range(i))
Expand All @@ -361,6 +366,7 @@ void poissonClass<FEOrder>::solve(vectorType& phi, int constraintMatrixId, std::
phi(i)=0;
}
}
*/
phi.update_ghost_values();
solver.solve(*this, phi, rhs, preconditioner);
//phi.update_ghost_values();
Expand Down

0 comments on commit f540d6c

Please sign in to comment.