Skip to content

Commit

Permalink
fixed a mistake in OEFEOverlapInverse in the last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Avirup Sircar committed Sep 6, 2024
1 parent 82b4907 commit 15188ee
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,9 @@ int main(int argc, char** argv)
const utils::ScalarSpatialFunctionReal *externalPotentialFunction = new
utils::PointChargePotentialFunction(atomCoordinatesVec, atomChargesVec);

// // add device synchronize for gpu
// utils::mpi::MPIBarrier(comm);
// start = std::chrono::high_resolution_clock::now();
// add device synchronize for gpu
utils::mpi::MPIBarrier(comm);
start = std::chrono::high_resolution_clock::now();

// Create OperatorContext for Basisoverlap

Expand All @@ -949,13 +949,13 @@ int main(int argc, char** argv)
numWantedEigenvalues * ksdft::KSDFTDefaults::CELL_BATCH_SIZE,
true);

// // add device synchronize for gpu
// utils::mpi::MPIBarrier(comm);
// stop = std::chrono::high_resolution_clock::now();
// add device synchronize for gpu
utils::mpi::MPIBarrier(comm);
stop = std::chrono::high_resolution_clock::now();

// duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);

// rootCout << "Time for creation of MContext is(in secs) : " << duration.count()/1e6 << std::endl;
rootCout << "Time for creation of MContext is(in secs) : " << duration.count()/1e6 << std::endl;

// add device synchronize for gpu
utils::mpi::MPIBarrier(comm);
Expand Down
4 changes: 2 additions & 2 deletions src/basis/EnrichmentClassicalInterfaceSpherical.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ namespace dftefe

rootCout
<< "Completed creating Orthogonalized EnrichmentClassicalInterfaceSpherical for "
<< d_enrichmentIdsPartition->nTotalEnrichmentIds() << fieldName
<< d_enrichmentIdsPartition->nTotalEnrichmentIds() << " " << fieldName
<< " enrichments." << std::endl;
}

Expand Down Expand Up @@ -504,7 +504,7 @@ namespace dftefe

rootCout
<< "Completed creating Pristine EnrichmentClassicalInterfaceSpherical for "
<< d_enrichmentIdsPartition->nTotalEnrichmentIds() << fieldName
<< d_enrichmentIdsPartition->nTotalEnrichmentIds() << " " << fieldName
<< " enrichments." << std::endl;
}

Expand Down
54 changes: 38 additions & 16 deletions src/basis/OrthoEFEOverlapInverseOpContextGLL.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ namespace dftefe
numEnrichmentIdsInCell,
(ValueTypeOperator)0);

std::vector<ValueTypeOperator> enrichmentValuesVec(
numEnrichmentIdsInCell *
nQuadPointInCellEnrichmentBlockEnrichment,
0);

if (numEnrichmentIdsInCell > 0)
{
cfeBasisManager->getCellDofsLocalIds(cellIndex,
Expand Down Expand Up @@ -467,6 +472,21 @@ namespace dftefe
classicalComponentInQuadValuesEE.data(),
numEnrichmentIdsInCell,
*eci->getLinAlgOpContext());

for (size_type i = 0; i < numEnrichmentIdsInCell; i++)
{
for (unsigned int qPoint = 0;
qPoint < nQuadPointInCellEnrichmentBlockEnrichment;
qPoint++)
{
*(enrichmentValuesVec.data() +
nQuadPointInCellEnrichmentBlockEnrichment * i +
qPoint) =
efeBDH->getEnrichmentValue(cellIndex,
i,
quadRealPointsVec[qPoint]);
}
}
}


Expand Down Expand Up @@ -522,14 +542,14 @@ namespace dftefe
qPoint++)
{
NpiNpj +=
efeBDH->getEnrichmentValue(
cellIndex,
iNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
efeBDH->getEnrichmentValue(
cellIndex,
jNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(iNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
*(enrichmentValuesVec.data() +
(jNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
cellJxWValuesEnrichmentBlockEnrichment[qPoint];
}
// Ni_pristine* interpolated ci's in
Expand All @@ -542,10 +562,10 @@ namespace dftefe
classicalComponentInQuadValuesEE
[numEnrichmentIdsInCell * qPoint +
(iNode - dofsPerCellCFE)] *
efeBDH->getEnrichmentValue(
cellIndex,
jNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(jNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
cellJxWValuesEnrichmentBlockEnrichment[qPoint];
}
// Ni_pristine* interpolated ci's in
Expand All @@ -555,10 +575,10 @@ namespace dftefe
qPoint++)
{
NpicjNcj +=
efeBDH->getEnrichmentValue(
cellIndex,
iNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(iNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
classicalComponentInQuadValuesEE
[numEnrichmentIdsInCell * qPoint +
(jNode - dofsPerCellCFE)] *
Expand Down Expand Up @@ -851,12 +871,14 @@ namespace dftefe
}
rootCout << "]" << std::endl;
}
**/

linearAlgebra::blasLapack::inverse<ValueTypeOperator, memorySpace>(
d_nglobalEnrichmentIds,
basisOverlapEnrichmentBlockSTL.data(),
*(d_diagonalInv.getLinAlgOpContext()));

/**
rootCout << "Enrichment Block Inverse Matrix: " << std::endl;
for (size_type i = 0; i < d_nglobalEnrichmentIds; i++)
{
Expand Down
32 changes: 16 additions & 16 deletions src/basis/OrthoEFEOverlapOperatorContext.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,14 +713,14 @@ namespace dftefe
qPoint++)
{
NpiNpj +=
eefeBDH->getEnrichmentValue(
cellIndex,
iNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
eefeBDH->getEnrichmentValue(
cellIndex,
jNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(iNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
*(enrichmentValuesVec.data() +
(jNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
cellJxWValuesEnrichmentBlockEnrichment[qPoint];
}
// Ni_pristine* interpolated ci's in
Expand All @@ -733,10 +733,10 @@ namespace dftefe
classicalComponentInQuadValuesEE
[numEnrichmentIdsInCell * qPoint +
(iNode - dofsPerCellCFE)] *
eefeBDH->getEnrichmentValue(
cellIndex,
jNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(jNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
cellJxWValuesEnrichmentBlockEnrichment[qPoint];
}
// Ni_pristine* interpolated ci's in
Expand All @@ -746,10 +746,10 @@ namespace dftefe
qPoint++)
{
NpicjNcj +=
eefeBDH->getEnrichmentValue(
cellIndex,
iNode - dofsPerCellCFE,
quadRealPointsVec[qPoint]) *
*(enrichmentValuesVec.data() +
(iNode - dofsPerCellCFE) *
nQuadPointInCellEnrichmentBlockEnrichment +
qPoint) *
classicalComponentInQuadValuesEE
[numEnrichmentIdsInCell * qPoint +
(jNode - dofsPerCellCFE)] *
Expand Down

0 comments on commit 15188ee

Please sign in to comment.