Skip to content

Commit

Permalink
Cleanup the codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ttadano committed Nov 28, 2017
1 parent e59d62c commit 2274bc3
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 79 deletions.
1 change: 0 additions & 1 deletion alm/alamode.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ namespace ALM_NS
std::string mode;
};
}

5 changes: 3 additions & 2 deletions alm/combination.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ALM_NS


public:
CombinationWithRepetition() {};
CombinationWithRepetition()
{
};

template <class InputIter>
CombinationWithRepetition(InputIter begin,
Expand Down Expand Up @@ -75,4 +77,3 @@ namespace ALM_NS
}
};
}

1 change: 0 additions & 1 deletion alm/constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ namespace ALM_NS
void rref(std::vector<std::vector<double>> &, const double tolerance = eps12);

void generate_symmetry_constraint_in_cartesian(std::vector<ConstraintClass> *);

};

extern "C"
Expand Down
1 change: 0 additions & 1 deletion alm/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ namespace ALM_NS
void exit(const char *, const char *, const char *);
};
}

11 changes: 5 additions & 6 deletions alm/interaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ namespace ALM_NS
{
public:
std::vector<int> atom;
std::vector<std::vector<int> > cell;
std::vector<std::vector<int>> cell;
double distmax;

MinimumDistanceCluster();

MinimumDistanceCluster(const std::vector<int> atom_in,
const std::vector<std::vector<int> > cell_in,
const std::vector<std::vector<int>> cell_in,
const double dist_in)
{
for (int i = 0; i < atom_in.size(); ++i) {
Expand All @@ -196,7 +196,7 @@ namespace ALM_NS
}

MinimumDistanceCluster(const std::vector<int> atom_in,
const std::vector<std::vector<int> > cell_in)
const std::vector<std::vector<int>> cell_in)
{
for (int i = 0; i < atom_in.size(); ++i) {
atom.push_back(atom_in[i]);
Expand Down Expand Up @@ -279,11 +279,10 @@ namespace ALM_NS
std::vector<DistInfo> **,
int *, std::set<MinimumDistanceCluster> **);

void cell_combination(std::vector<std::vector<int> >,
void cell_combination(std::vector<std::vector<int>>,
int, std::vector<int>,
std::vector<std::vector<int> > &);
std::vector<std::vector<int>> &);

void generate_pairs(std::set<IntList> *, std::set<MinimumDistanceCluster> **);
};
}

1 change: 0 additions & 1 deletion alm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,3 @@ namespace ALM_NS
}
};
}

9 changes: 6 additions & 3 deletions alm/pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ namespace ALM_NS
displace(ptr->displace),
writes(ptr->writes),
error(ptr->error),
timer(ptr->timer) {}
timer(ptr->timer)
{
}

virtual ~Pointers() {}
virtual ~Pointers()
{
}

protected:
ALM *alm;
Expand All @@ -52,4 +56,3 @@ namespace ALM_NS
Timer *&timer;
};
}

1 change: 0 additions & 1 deletion alm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,3 @@ namespace ALM_NS
void setup_atomic_class(int *);
};
}

1 change: 0 additions & 1 deletion alm/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ namespace ALM_NS
#endif
};
}

82 changes: 41 additions & 41 deletions alm/writes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void Writes::write_misc_xml()
std::sort(fcs->fc_table[0].begin(), fcs->fc_table[0].end());

for (std::vector<FcProperty>::iterator it = fcs->fc_table[0].begin();
it != fcs->fc_table[0].end(); ++it) {
it != fcs->fc_table[0].end(); ++it) {
FcProperty fctmp = *it;
ip = fctmp.mother;

Expand Down Expand Up @@ -530,7 +530,7 @@ void Writes::write_misc_xml()
std::sort(fcs->fc_table[order].begin(), fcs->fc_table[order].end());

for (std::vector<FcProperty>::iterator it = fcs->fc_table[order].begin();
it != fcs->fc_table[order].end(); ++it) {
it != fcs->fc_table[order].end(); ++it) {
FcProperty fctmp = *it;
ip = fctmp.mother + ishift;

Expand Down Expand Up @@ -652,45 +652,45 @@ void Writes::write_hessian()

std::cout << " Complete Hessian matrix : " << files->file_hes << std::endl;

/*
std::string file_fc2 = files->job_title + ".fc2";
std::ofstream ofs_fc2;
ofs_fc2.open(file_fc2.c_str(), std::ios::out);
ofs_fc2 << " # iat, icrd, jat, icrd, icell, relvec, fc2" << std::endl;
double vec[3];
for (std::vector<FcProperty>::iterator it = fcs->fc_table[0].begin();
it != fcs->fc_table[0].end(); ++it) {
FcProperty fctmp = *it;
ip = fctmp.mother;
for (i = 0; i < 2; ++i) pair_tmp[i] = fctmp.elems[i] / 3;
for (itran = 0; itran < symmetry->ntran; ++itran) {
for (i = 0; i < 2; ++i) {
pair_tran[i] = symmetry->map_sym[pair_tmp[i]][symmetry->symnum_tran[itran]];
}
for (std::vector<DistInfo>::iterator
it2 = interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].begin();
it2 != interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].end(); ++it2) {
int multiplicity = interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].size();
for (i = 0; i < 3; ++i) {
vec[i] = interaction->x_image[(*it2).cell][pair_tran[1]][i]
- interaction->x_image[0][pair_tran[0]][i];
}
ofs_fc2 << std::setw(5) << pair_tran[0] + 1 << std::setw(5) << fctmp.elems[0] % 3 + 1;
ofs_fc2 << std::setw(5) << pair_tran[1] + 1 << std::setw(5) << fctmp.elems[1] % 3 + 1;
ofs_fc2 << std::setw(5) << (*it2).cell + 1;
ofs_fc2 << std::setw(15) << vec[0];
ofs_fc2 << std::setw(15) << vec[1];
ofs_fc2 << std::setw(15) << vec[2];
ofs_fc2 << std::setw(15)
<< fitting->params[ip] * fctmp.sign / static_cast<double>(multiplicity);
ofs_fc2 << std::endl;
}
}
}
ofs_fc2.close();
*/
/*
std::string file_fc2 = files->job_title + ".fc2";
std::ofstream ofs_fc2;
ofs_fc2.open(file_fc2.c_str(), std::ios::out);
ofs_fc2 << " # iat, icrd, jat, icrd, icell, relvec, fc2" << std::endl;
double vec[3];
for (std::vector<FcProperty>::iterator it = fcs->fc_table[0].begin();
it != fcs->fc_table[0].end(); ++it) {
FcProperty fctmp = *it;
ip = fctmp.mother;
for (i = 0; i < 2; ++i) pair_tmp[i] = fctmp.elems[i] / 3;
for (itran = 0; itran < symmetry->ntran; ++itran) {
for (i = 0; i < 2; ++i) {
pair_tran[i] = symmetry->map_sym[pair_tmp[i]][symmetry->symnum_tran[itran]];
}
for (std::vector<DistInfo>::iterator
it2 = interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].begin();
it2 != interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].end(); ++it2) {
int multiplicity = interaction->mindist_pairs[pair_tran[0]][pair_tran[1]].size();
for (i = 0; i < 3; ++i) {
vec[i] = interaction->x_image[(*it2).cell][pair_tran[1]][i]
- interaction->x_image[0][pair_tran[0]][i];
}
ofs_fc2 << std::setw(5) << pair_tran[0] + 1 << std::setw(5) << fctmp.elems[0] % 3 + 1;
ofs_fc2 << std::setw(5) << pair_tran[1] + 1 << std::setw(5) << fctmp.elems[1] % 3 + 1;
ofs_fc2 << std::setw(5) << (*it2).cell + 1;
ofs_fc2 << std::setw(15) << vec[0];
ofs_fc2 << std::setw(15) << vec[1];
ofs_fc2 << std::setw(15) << vec[2];
ofs_fc2 << std::setw(15)
<< fitting->params[ip] * fctmp.sign / static_cast<double>(multiplicity);
ofs_fc2 << std::endl;
}
}
}
ofs_fc2.close();
*/
}

std::string Writes::double2string(const double d, const int nprec)
Expand Down
12 changes: 9 additions & 3 deletions alm/writes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ namespace ALM_NS
int kind;
int atom, tran;

AtomProperty() {};
AtomProperty()
{
};

AtomProperty(const AtomProperty &other)
: x(other.x), y(other.y), z(other.z),
kind(other.kind), atom(other.atom), tran(other.tran) {};
kind(other.kind), atom(other.atom), tran(other.tran)
{
};

AtomProperty(const double *pos,
const int kind_in,
Expand All @@ -52,7 +56,9 @@ namespace ALM_NS
int nat, natmin, ntran;
int nspecies;

SystemInfo() {};
SystemInfo()
{
};
};

class Writes: protected Pointers
Expand Down
9 changes: 6 additions & 3 deletions anphon/pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ namespace PHON_NS
isotope(ptr->isotope),
scph(ptr->scph),
ewald(ptr->ewald),
timer(ptr->timer) {}
timer(ptr->timer)
{
}

virtual ~Pointers() {}
virtual ~Pointers()
{
}

protected:
PHON *phon;
Expand Down Expand Up @@ -70,4 +74,3 @@ namespace PHON_NS
Timer *&timer;
};
}

6 changes: 3 additions & 3 deletions anphon/relaxation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ void Relaxation::calc_frequency_resolved_final_state(const unsigned int N,
n1 = f1 + f2 + 1.0;
n2 = f1 - f2;
}

if (integration->ismear == 0) {
prod_tmp[0] = n1
* (delta_lorentz(omega0 - omega_inner[0] - omega_inner[1], epsilon)
Expand Down Expand Up @@ -2542,7 +2542,7 @@ void Relaxation::print_momentum_resolved_final_state(const unsigned int NT,
n1 = f1 + f2 + 1.0;
n2 = f1 - f2;
}


if (selection_type == 0) {
gamma_k[k][iT] += V3norm * n1;
Expand Down Expand Up @@ -3120,7 +3120,7 @@ void Relaxation::calc_self3omega_tetrahedron(const double Temp,
n1 = f1 + f2 + 1.0;
n2 = f1 - f2;
}

//#pragma omp critical
ret_private[nomega * ithread + iomega]
+= v3_arr[ik][ib] * (n1 * weight_tetra[0][ik] - 2.0 * n2 * weight_tetra[1][ik]);
Expand Down
2 changes: 1 addition & 1 deletion anphon/scph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void Scph::exec_scph()
write_scph_bands(eval_anharm);
} else if (kpoint->kpoint_mode == 2) {
write_scph_dos(eval_anharm);
// write_scph_thermodynamics(eval_anharm);
// write_scph_thermodynamics(eval_anharm);
if (writes->print_msd) {
write_scph_msd(eval_anharm, evec_anharm);
}
Expand Down
2 changes: 1 addition & 1 deletion anphon/selfenergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void Selfenergy::selfenergy_tadpole(const unsigned int N,
} else {
n2 = thermodynamics->fB(omega2, T_tmp);
ret_mpi[i] += v3_tmp2 * (2.0 * n2 + 1.0);
}
}
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions anphon/thermodynamics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ double Thermodynamics::free_energy(const double T)
x = omega / (T * T_to_Ryd);
ret += std::log(x);
}

return T * T_to_Ryd * ret / static_cast<double>(nk);

} else {
Expand All @@ -297,7 +297,6 @@ double Thermodynamics::free_energy(const double T)

return T * T_to_Ryd * ret / static_cast<double>(nk);
}

}

double Thermodynamics::disp2_avg(const double T,
Expand Down Expand Up @@ -325,7 +324,7 @@ double Thermodynamics::disp2_avg(const double T,
if (omega < eps8) continue;

ret += real(dynamical->evec_phonon[ik][is][ns1]
* std::conj(dynamical->evec_phonon[ik][is][ns2]))
* std::conj(dynamical->evec_phonon[ik][is][ns2]))
* T * T_to_Ryd / (omega * omega);
}
} else {
Expand All @@ -340,7 +339,7 @@ double Thermodynamics::disp2_avg(const double T,
if (omega < eps8) continue;

ret += real(dynamical->evec_phonon[ik][is][ns1]
* std::conj(dynamical->evec_phonon[ik][is][ns2]))
* std::conj(dynamical->evec_phonon[ik][is][ns2]))
* (fB(omega, T) + 0.5) / omega;
}
}
Expand Down
8 changes: 4 additions & 4 deletions anphon/write_phonons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void Writes::setup_result_io()
}
if (static_cast<bool>(is_classical) != thermodynamics->classical) {
error->warn("setup_result_io",
"CLASSICAL val is not consistent");
"CLASSICAL val is not consistent");
}

found_tag = false;
Expand Down Expand Up @@ -610,8 +610,8 @@ void Writes::write_phonon_bands()
for (i = 0; i < nk; ++i) {
ofs_bands << std::setw(8) << std::fixed << kaxis[i];
for (j = 0; j < nbands; ++j) {
ofs_bands << std::setw(15) << std::scientific
<< in_kayser(eval[i][dynamical->index_bconnect[i][j]]);
ofs_bands << std::setw(15) << std::scientific
<< in_kayser(eval[i][dynamical->index_bconnect[i][j]]);
}
ofs_bands << std::endl;
}
Expand All @@ -629,7 +629,7 @@ void Writes::write_phonon_bands()
ofs_connect.open(file_connect.c_str(), std::ios::out);
if (!ofs_connect)
error->exit("write_phonon_bands",
"cannot open file_connect");
"cannot open file_connect");

ofs_connect << "# " << str_kpath << std::endl;
ofs_connect << "#" << str_kval << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions tools/analyze_phonons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void calc_kappa_cumulative(double max_length, double delta_length, int itemp)
} else {
c_tmp = Cv(omega[ik][is], temp[itemp]);
}

vel_tmp = pow(vel[ik][is][0][0], 2)
+ pow(vel[ik][is][0][1], 2)
+ pow(vel[ik][is][0][2], 2);
Expand Down Expand Up @@ -782,7 +782,7 @@ void calc_kappa_boundary2(double max_length, double delta_length, int itemp, int
c_tmp = k_Boltzmann;
} else {
c_tmp = Cv(omega[ik][is], temp[itemp]);
}
}

for (i = 0; i < nsame; ++i) {

Expand Down

0 comments on commit 2274bc3

Please sign in to comment.