Skip to content

Commit

Permalink
Minor refarctoring and bug fix in scph.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ttadano committed Sep 25, 2018
1 parent 4a94e41 commit 74ab849
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions anphon/fcs_phonon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ void Fcs_phonon::load_fc2_xml()

fc2_ext.push_back(fcext_tmp);
}
pt.clear();
}

void Fcs_phonon::load_fcs_xml()
Expand Down
26 changes: 15 additions & 11 deletions anphon/scph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ void Scph::exec_scph()
}
}


if (kpoint->kpoint_mode == 2) {
if (thermodynamics->calc_FE_bubble) {
compute_free_energy_bubble_SCPH(delta_dymat_scph);
Expand Down Expand Up @@ -1301,20 +1300,32 @@ void Scph::setup_kmesh()
{
unsigned int ik;
unsigned int i;
unsigned int ns = dynamical->neval;
int ik_minus, loc;
double xtmp[3];
double norm;

// Set up k points for SCPH equation
// Setup k points for SCPH equation
MPI_Bcast(&kmesh_scph[0], 3, MPI_UNSIGNED, 0, MPI_COMM_WORLD);
MPI_Bcast(&kmesh_interpolate[0], 3, MPI_UNSIGNED, 0, MPI_COMM_WORLD);

// Set up k points for Fourier interpolation
nk_scph = kmesh_scph[0] * kmesh_scph[1] * kmesh_scph[2];
nk_interpolate = kmesh_interpolate[0] * kmesh_interpolate[1] * kmesh_interpolate[2];

memory->allocate(xk_scph, nk_scph, 3);
memory->allocate(xk_interpolate, nk_interpolate, 3);
memory->allocate(kvec_na_scph, nk_scph, 3);

kpoint->gen_kmesh(true, kmesh_scph, xk_scph, kp_irred_scph);
kpoint->gen_kmesh(true,
kmesh_scph,
xk_scph,
kp_irred_scph);

kpoint->gen_kmesh(true,
kmesh_interpolate,
xk_interpolate,
kp_irred_interpolate);


for (ik = 0; ik < nk_scph; ++ik) {
for (i = 0; i < 3; ++i) {
Expand Down Expand Up @@ -1347,12 +1358,6 @@ void Scph::setup_kmesh()
knum_minus_scph[ik_minus] = ik;
}

// Set up k points for Fourier interpolation

nk_interpolate = kmesh_interpolate[0] * kmesh_interpolate[1] * kmesh_interpolate[2];
memory->allocate(xk_interpolate, nk_interpolate, 3);
kpoint->gen_kmesh(true, kmesh_interpolate,
xk_interpolate, kp_irred_interpolate);

if (mympi->my_rank == 0) {
std::cout << " Setting up the SCPH calculations ..." << std::endl << std::endl;
Expand Down Expand Up @@ -1659,7 +1664,6 @@ void Scph::setup_eigvecs()
{
int ik;
unsigned int is;
unsigned int nk = kpoint->nk;
unsigned int ns = dynamical->neval;

if (mympi->my_rank == 0) {
Expand Down
2 changes: 1 addition & 1 deletion anphon/symmetry_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void Symmetry::setup_symmetry_operation(int N,
>> rot_tmp[2][0] >> rot_tmp[2][1] >> rot_tmp[2][2]
>> tran_tmp[0] >> tran_tmp[1] >> tran_tmp[2];

SymmList.push_back(SymmetryOperation(rot_tmp, tran_tmp));
SymmList.emplace_back(rot_tmp, tran_tmp);
}
ifs_sym.close();
}
Expand Down
2 changes: 1 addition & 1 deletion anphon/thermodynamics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ double Thermodynamics::compute_FE_bubble_SCPH(const double temp,
}
}

MPI_Allreduce(&FE_local, &FE_return, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Reduce(&FE_local, &FE_return, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);

FE_return *= factor;

Expand Down

0 comments on commit 74ab849

Please sign in to comment.