Skip to content

Commit

Permalink
write Madelung potential to Atom Data Output
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenbach committed Apr 17, 2024
1 parent 973840c commit f95da1b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Communication/LSMSCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ void communicateSingleAtomData(LSMSCommunication &comm, int from, int to,
MPI_Pack(atom.xvalws, 2, MPI_DOUBLE, buf, s, &pos, comm.comm);
MPI_Pack(&atom.localEnergy, 1, MPI_DOUBLE, buf, s, &pos, comm.comm);
MPI_Pack(&atom.localMadelungEnergy, 1, MPI_DOUBLE, buf, s, &pos, comm.comm);
MPI_Pack(&atom.localMadelungPotential, 1, MPI_DOUBLE, buf, s, &pos, comm.comm);
MPI_Pack(&atom.alloy_class, 1, MPI_INT, buf, s, &pos, comm.comm);
MPI_Pack(&atom.omegaMT, 1, MPI_DOUBLE, buf, s, &pos, comm.comm);
MPI_Pack(&atom.omegaWS, 1, MPI_DOUBLE, buf, s, &pos, comm.comm);
Expand Down Expand Up @@ -706,8 +707,8 @@ void communicateSingleAtomData(LSMSCommunication &comm, int from, int to,
MPI_Unpack(buf, s, &pos, atom.evecOut, 3, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, atom.xvalws, 2, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.localEnergy, 1, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.localMadelungEnergy, 1, MPI_DOUBLE,
comm.comm);
MPI_Unpack(buf, s, &pos, &atom.localMadelungEnergy, 1, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.localMadelungPotential, 1, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.alloy_class, 1, MPI_INT, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.omegaMT, 1, MPI_DOUBLE, comm.comm);
MPI_Unpack(buf, s, &pos, &atom.omegaWS, 1, MPI_DOUBLE, comm.comm);
Expand Down
6 changes: 3 additions & 3 deletions src/Main/writeInfoEvec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ static void writeSingleLocalAtomData(FILE *f, int z, int i, Real posX,
fprintf(f,
"%3d %8d %21.15lf %21.15lf %21.15lf %12.6lf %12.6lf %21.15lf "
"%21.15lf %21.15lf %21.15lf %21.15lf %21.15lf %8.4lf %.15lf "
"%.15lf %21.15lf %21.15lf %21.15lf %10.6lf %10.6lf %.15lf\n",
"%.15lf %21.15lf %21.15lf %21.15lf %10.6lf %10.6lf %.15lf %.15lf\n",
z, i, posX, posY, posZ, atom.qtotws, atom.mtotws, atom.evec[0],
atom.evec[1], atom.evec[2], atom.b_con[0], atom.b_con[1],
atom.b_con[2], atom.vSpinShift, atom.omegaWS,
atom.localEnergy + atom.localMadelungEnergy, atom.mtotmt, atom.mvalmt,
atom.mvalws, atom.r_mesh[atom.jmt], atom.r_mesh[atom.jws],
atom.localMadelungEnergy);
atom.localMadelungEnergy, atom.localMadelungPotential);
}

static void readSingleEvec(FILE *f, int &z, int &i, Real &posX, Real &posY,
Expand Down Expand Up @@ -170,7 +170,7 @@ int writeLocalAtomData(LSMSCommunication &comm, LSMSSystemParameters &lsms,
fprintf(outf,
"# Z global_id x y z qtotws mtotws evec_x evec_y evec_z e_mix "
"B_x B_y B_z vSpinShift localVolume localEnergy mtotmt mvalmt "
"mvalws localElectrostaticEnergy\n");
"mvalws localElectrostaticEnergy Vmad\n");

fprintf(outf, "%.15lf %.15lf %.15lf %.15lf\n", lsms.totalEnergy, eband,
lsms.chempot, lsms.u0);
Expand Down
1 change: 1 addition & 0 deletions src/Potential/calculateChargesPotential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ void calculatePotential(LSMSCommunication &comm, LSMSSystemParameters &lsms, Loc
u0Sum += u0 * local.n_per_type[i];
u0MTSum += u0MT * local.n_per_type[i];
local.atom[i].localMadelungEnergy = u0;
local.atom[i].localMadelungPotential = vmt1[1];
}

/*
Expand Down
3 changes: 2 additions & 1 deletion src/Potential/newPotential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void lsms::ASAPotential::calculatePotential(LSMSCommunication &comm,
}

local.atom[i].localMadelungEnergy = u0;
local.atom[i].localMadelungPotential = vmt1;
u0Sum += u0;

/**
Expand Down Expand Up @@ -259,4 +260,4 @@ void lsms::ASAPotential::calculatePotential(LSMSCommunication &comm,
}

lsms.vmt = vpot_ave;
}
}
2 changes: 2 additions & 0 deletions src/SingleSite/AtomData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ class AtomData {
Real localEnergy{};
Real localMadelungEnergy{};

Real localMadelungPotential{};

// Alloy Class
int alloy_class{};

Expand Down

0 comments on commit f95da1b

Please sign in to comment.