From 6ab0b2c249317e43a5efa87ac1759943e67fa77f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 21:58:47 -0400 Subject: [PATCH] use std::vector<>.data() to access underlying pointer --- src/MC/fix_sgcmc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MC/fix_sgcmc.cpp b/src/MC/fix_sgcmc.cpp index 77ead0479f..a2115bd5f6 100644 --- a/src/MC/fix_sgcmc.cpp +++ b/src/MC/fix_sgcmc.cpp @@ -274,7 +274,7 @@ void FixSemiGrandCanonicalMC::init() // MPI sum to get global concentrations. speciesCounts.resize(atom->ntypes+1); - MPI_Allreduce(&localSpeciesCounts.front(), &speciesCounts.front(), localSpeciesCounts.size(), + MPI_Allreduce(localSpeciesCounts.data(), speciesCounts.data(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); } @@ -411,7 +411,7 @@ void FixSemiGrandCanonicalMC::doMC() // semi-grandcanonical method. // MPI sum of total change in number of particles. - MPI_Allreduce(&deltaN.front(), &deltaNGlobal.front(), deltaN.size(), MPI_INT, MPI_SUM, world); + MPI_Allreduce(deltaN.data(), deltaNGlobal.data(), deltaN.size(), MPI_INT, MPI_SUM, world); // Perform outer MC acceptance test. // This is done in sync by all processors. @@ -476,7 +476,7 @@ void FixSemiGrandCanonicalMC::doMC() if (mask[i] & groupbit) localSpeciesCounts[*type]++; } - MPI_Allreduce(&localSpeciesCounts.front(), &speciesCounts.front(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); + MPI_Allreduce(localSpeciesCounts.data(), speciesCounts.data(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); } }