25#include <boost/math/distributions/normal.hpp>
26#include <boost/math/special_functions/spherical_harmonic.hpp>
27#include <boost/random/normal_distribution.hpp>
37 std::vector<dftfe::uInt> &globalMasterNodeIdList,
39 const MPI_Comm &mpi_communicator)
41 int numberMasterNodesOnLocalProc = masterNodeIdList.size();
43 int *masterNodeIdListSizes =
new int[numMeshPartitions];
45 MPI_Allgather(&numberMasterNodesOnLocalProc,
48 &numberMasterNodesOnLocalProc),
49 masterNodeIdListSizes,
55 std::accumulate(&(masterNodeIdListSizes[0]),
56 &(masterNodeIdListSizes[numMeshPartitions]),
59 globalMasterNodeIdList.resize(newMasterNodeIdListSize);
61 int *mpiOffsets =
new int[numMeshPartitions];
65 for (
dftfe::Int i = 1; i < numMeshPartitions; ++i)
66 mpiOffsets[i] = masterNodeIdListSizes[i - 1] + mpiOffsets[i - 1];
68 MPI_Allgatherv(&(masterNodeIdList[0]),
69 numberMasterNodesOnLocalProc,
71 &(globalMasterNodeIdList[0]),
72 &(masterNodeIdListSizes[0]),
75 globalMasterNodeIdList.data()),
79 delete[] masterNodeIdListSizes;
89 const MPI_Comm &mpi_communicator)
92 std::map<dftfe::Int, dftfe::Int>::iterator iter;
94 std::vector<dftfe::Int> localSpreadVec;
96 iter = localMap.begin();
97 while (iter != localMap.end())
99 localSpreadVec.push_back(iter->first);
100 localSpreadVec.push_back(iter->second);
104 int localSpreadVecSize = localSpreadVec.size();
106 int *spreadVecSizes =
new int[numMeshPartitions];
108 MPI_Allgather(&localSpreadVecSize,
117 std::accumulate(&(spreadVecSizes[0]),
118 &(spreadVecSizes[numMeshPartitions]),
121 std::vector<dftfe::Int> globalSpreadVec(globalSpreadVecSize);
123 int *mpiOffsets =
new int[numMeshPartitions];
127 for (
dftfe::Int i = 1; i < numMeshPartitions; ++i)
128 mpiOffsets[i] = spreadVecSizes[i - 1] + mpiOffsets[i - 1];
130 MPI_Allgatherv(&(localSpreadVec[0]),
133 &(globalSpreadVec[0]),
134 &(spreadVecSizes[0]),
139 for (
dftfe::Int i = 0; i < globalSpreadVecSize; i = i + 2)
140 localMap[globalSpreadVec[i]] = globalSpreadVec[i + 1];
143 delete[] spreadVecSizes;
152 const alglib::spline1dinterpolant *spline)
154 splineVal = alglib::spline1dcalc(*spline, radialCoordinate);
163 double &sphericalHarmonicVal)
166 sphericalHarmonicVal =
167 std::sqrt(2.0) * boost::math::spherical_harmonic_i(l, -m, theta, phi);
170 sphericalHarmonicVal =
171 boost::math::spherical_harmonic_r(l, m, theta, phi);
174 sphericalHarmonicVal =
175 std::sqrt(2.0) * boost::math::spherical_harmonic_r(l, m, theta, phi);
186 double tolerance = 1
e-12;
187 r = std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
189 if (std::fabs(r - 0.0) <= tolerance)
196 theta = std::acos(x[2] / r);
205 if (fabs(theta - 0.0) >= tolerance && fabs(theta - M_PI) >= tolerance)
206 phi = std::atan2(x[1], x[0]);
MPI_Datatype mpi_type_id(const int *)
Definition dftfeDataTypes.h:49
wrapper to convert pseudopotential file from upf to dftfe format and returns the nonlinear core corre...
Definition pseudoPotentialToDftfeConverter.cc:36
void getRadialFunctionVal(const double radialCoordinate, double &splineVal, const alglib::spline1dinterpolant *spline)
Definition pseudoUtils.h:150
void exchangeNumberingMap(std::map< dftfe::Int, dftfe::Int > &localMap, dftfe::uInt numMeshPartitions, const MPI_Comm &mpi_communicator)
Definition pseudoUtils.h:87
void convertCartesianToSpherical(double *x, double &r, double &theta, double &phi)
Definition pseudoUtils.h:181
void getSphericalHarmonicVal(const double theta, const double phi, const dftfe::Int l, const dftfe::Int m, double &sphericalHarmonicVal)
Definition pseudoUtils.h:159
void exchangeLocalList(const std::vector< dftfe::uInt > &masterNodeIdList, std::vector< dftfe::uInt > &globalMasterNodeIdList, dftfe::uInt numMeshPartitions, const MPI_Comm &mpi_communicator)
Definition pseudoUtils.h:36
Definition pseudoPotentialToDftfeConverter.cc:34
@ e
Definition ExcSSDFunctionalBaseClass.h:59
std::uint32_t uInt
Definition TypeConfig.h:10
std::int32_t Int
Definition TypeConfig.h:11