diff -Nru phonopy-2.12.0/c/derivative_dynmat.c phonopy-2.13.1/c/derivative_dynmat.c --- phonopy-2.12.0/c/derivative_dynmat.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/derivative_dynmat.c 2022-02-13 03:47:08.000000000 +0000 @@ -32,344 +32,303 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ +#include "derivative_dynmat.h" + #include #include -#include "derivative_dynmat.h" #define PI 3.14159265358979323846 -static void get_derivative_nac(double *ddnac, - double *dnac, - const long num_patom, - const double *lattice, - const double *mass, - const double *q, - const double *born, - const double *dielectric, - const double *q_direction, - const double factor); -static double get_A(const long atom_i, - const long cart_i, - const double q[3], +static void get_derivative_nac(double *ddnac, double *dnac, + const long num_patom, const double *lattice, + const double *mass, const double *q, + const double *born, const double *dielectric, + const double *q_direction, const double factor); +static double get_A(const long atom_i, const long cart_i, const double q[3], const double *born); -static double get_C(const double q[3], - const double *dielectric); -static double get_dA(const long atom_i, - const long cart_i, - const long cart_j, +static double get_C(const double q[3], const double *dielectric); +static double get_dA(const long atom_i, const long cart_i, const long cart_j, const double *born); -static double get_dC(const long cart_i, - const long cart_j, - const long cart_k, - const double q[3], - const double *dielectric); - -void ddm_get_derivative_dynmat_at_q(double *derivative_dynmat, - const long num_patom, - const long num_satom, - const double *fc, - const double *q, - const double *lattice, /* column vector */ - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double nac_factor, - const double *born, - const double *dielectric, - const double *q_direction) -{ - long i, j, k, l, m, n, adrs, adrsT, is_nac, m_pair, i_pair, svecs_adrs; - double coef[3], real_coef[3], imag_coef[3]; - double c, s, phase, mass_sqrt, fc_elem, factor, real_phase, imag_phase; - double ddm_real[3][3][3], ddm_imag[3][3][3]; - double *ddnac, *dnac; - - if (born) { - is_nac = 1; - if (q_direction) { - if (fabs(q_direction[0]) < 1e-5 && - fabs(q_direction[1]) < 1e-5 && - fabs(q_direction[2]) < 1e-5) { - is_nac = 0; - } +static double get_dC(const long cart_i, const long cart_j, const long cart_k, + const double q[3], const double *dielectric); + +void ddm_get_derivative_dynmat_at_q( + double *derivative_dynmat, const long num_patom, const long num_satom, + const double *fc, const double *q, + const double *lattice, /* column vector */ + const double (*svecs)[3], const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double nac_factor, + const double *born, const double *dielectric, const double *q_direction) { + long i, j, k, l, m, n, adrs, adrsT, is_nac, m_pair, i_pair, svecs_adrs; + double coef[3], real_coef[3], imag_coef[3]; + double c, s, phase, mass_sqrt, fc_elem, factor, real_phase, imag_phase; + double ddm_real[3][3][3], ddm_imag[3][3][3]; + double *ddnac, *dnac; + + if (born) { + is_nac = 1; + if (q_direction) { + if (fabs(q_direction[0]) < 1e-5 && fabs(q_direction[1]) < 1e-5 && + fabs(q_direction[2]) < 1e-5) { + is_nac = 0; + } + } else { + if (fabs(q[0]) < 1e-5 && fabs(q[1]) < 1e-5 && fabs(q[2]) < 1e-5) { + is_nac = 0; + } + } } else { - if (fabs(q[0]) < 1e-5 && - fabs(q[1]) < 1e-5 && - fabs(q[2]) < 1e-5) { is_nac = 0; - } } - } else { - is_nac = 0; - } - - if (is_nac) { - ddnac = (double*) malloc(sizeof(double) * num_patom * num_patom * 27); - dnac = (double*) malloc(sizeof(double) * num_patom * num_patom * 9); - factor = nac_factor * num_patom / num_satom; - get_derivative_nac(ddnac, - dnac, - num_patom, - lattice, - mass, - q, - born, - dielectric, - q_direction, - factor); - } - - for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_patom; j++) { - mass_sqrt = sqrt(mass[i] * mass[j]); - - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - ddm_real[m][k][l] = 0; - ddm_imag[m][k][l] = 0; - } - } - } - for (k = 0; k < num_satom; k++) { /* Lattice points of right index of fc */ - if (s2p_map[k] != p2s_map[j]) { - continue; - } + if (is_nac) { + ddnac = (double *)malloc(sizeof(double) * num_patom * num_patom * 27); + dnac = (double *)malloc(sizeof(double) * num_patom * num_patom * 9); + factor = nac_factor * num_patom / num_satom; + get_derivative_nac(ddnac, dnac, num_patom, lattice, mass, q, born, + dielectric, q_direction, factor); + } - real_phase = 0; - imag_phase = 0; - for (l = 0; l < 3; l++) { - real_coef[l] = 0; - imag_coef[l] = 0; - } - i_pair = k * num_patom + i; - m_pair = multi[i_pair][0]; - svecs_adrs = multi[i_pair][1]; - for (l = 0; l < m_pair; l++) { - phase = 0; - for (m = 0; m < 3; m++) { - phase += q[m] * svecs[svecs_adrs + l][m]; - } - s = sin(phase * 2 * PI); - c = cos(phase * 2 * PI); - - real_phase += c; - imag_phase += s; - - for (m = 0; m < 3; m++) { - coef[m] = 0; - for (n = 0; n < 3; n++) { - coef[m] += 2 * PI * lattice[m * 3 + n] * svecs[svecs_adrs + l][n]; + for (i = 0; i < num_patom; i++) { + for (j = 0; j < num_patom; j++) { + mass_sqrt = sqrt(mass[i] * mass[j]); + + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + for (m = 0; m < 3; m++) { + ddm_real[m][k][l] = 0; + ddm_imag[m][k][l] = 0; + } + } } - } - for (m =0; m < 3; m++) { - real_coef[m] -= coef[m] * s; - imag_coef[m] += coef[m] * c; - } - } - - real_phase /= m_pair; - imag_phase /= m_pair; - - for (l = 0; l < 3; l++) { - real_coef[l] /= m_pair; - imag_coef[l] /= m_pair; - } - - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - fc_elem = fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m] - / mass_sqrt; - if (is_nac) { - fc_elem += dnac[i * 9 * num_patom + j * 9 + l * 3 + m]; + for (k = 0; k < num_satom; + k++) { /* Lattice points of right index of fc */ + if (s2p_map[k] != p2s_map[j]) { + continue; + } + + real_phase = 0; + imag_phase = 0; + for (l = 0; l < 3; l++) { + real_coef[l] = 0; + imag_coef[l] = 0; + } + i_pair = k * num_patom + i; + m_pair = multi[i_pair][0]; + svecs_adrs = multi[i_pair][1]; + for (l = 0; l < m_pair; l++) { + phase = 0; + for (m = 0; m < 3; m++) { + phase += q[m] * svecs[svecs_adrs + l][m]; + } + s = sin(phase * 2 * PI); + c = cos(phase * 2 * PI); + + real_phase += c; + imag_phase += s; + + for (m = 0; m < 3; m++) { + coef[m] = 0; + for (n = 0; n < 3; n++) { + coef[m] += 2 * PI * lattice[m * 3 + n] * + svecs[svecs_adrs + l][n]; + } + } + + for (m = 0; m < 3; m++) { + real_coef[m] -= coef[m] * s; + imag_coef[m] += coef[m] * c; + } + } + + real_phase /= m_pair; + imag_phase /= m_pair; + + for (l = 0; l < 3; l++) { + real_coef[l] /= m_pair; + imag_coef[l] /= m_pair; + } + + for (l = 0; l < 3; l++) { + for (m = 0; m < 3; m++) { + fc_elem = + fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m] / + mass_sqrt; + if (is_nac) { + fc_elem += + dnac[i * 9 * num_patom + j * 9 + l * 3 + m]; + } + for (n = 0; n < 3; n++) { + ddm_real[n][l][m] += fc_elem * real_coef[n]; + ddm_imag[n][l][m] += fc_elem * imag_coef[n]; + if (is_nac) { + ddm_real[n][l][m] += + ddnac[n * num_patom * num_patom * 9 + + i * 9 * num_patom + j * 9 + l * 3 + + m] * + real_phase; + ddm_imag[n][l][m] += + ddnac[n * num_patom * num_patom * 9 + + i * 9 * num_patom + j * 9 + l * 3 + + m] * + imag_phase; + } + } + } + } } - for (n = 0; n < 3; n++) { - ddm_real[n][l][m] += fc_elem * real_coef[n]; - ddm_imag[n][l][m] += fc_elem * imag_coef[n]; - if (is_nac) { - ddm_real[n][l][m] += - ddnac[n * num_patom * num_patom * 9 + - i * 9 * num_patom + j * 9 + l * 3 + m] * real_phase; - ddm_imag[n][l][m] += - ddnac[n * num_patom * num_patom * 9 + - i * 9 * num_patom + j * 9 + l * 3 + m] * imag_phase; - } + + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + for (m = 0; m < 3; m++) { + adrs = (k * num_patom * num_patom * 18 + + (i * 3 + l) * num_patom * 6 + j * 6 + m * 2); + derivative_dynmat[adrs] += ddm_real[k][l][m]; + derivative_dynmat[adrs + 1] += ddm_imag[k][l][m]; + } + } } - } } - } + } - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - adrs = (k * num_patom * num_patom * 18 + - (i * 3 + l) * num_patom * 6 + j * 6 + m * 2); - derivative_dynmat[adrs] += ddm_real[k][l][m]; - derivative_dynmat[adrs + 1] += ddm_imag[k][l][m]; - } + /* Symmetrize to be a Hermitian matrix */ + for (i = 0; i < 3; i++) { + for (j = i; j < num_patom * 3; j++) { + for (k = 0; k < num_patom * 3; k++) { + adrs = + i * num_patom * num_patom * 18 + j * num_patom * 6 + k * 2; + adrsT = + i * num_patom * num_patom * 18 + k * num_patom * 6 + j * 2; + derivative_dynmat[adrs] += derivative_dynmat[adrsT]; + derivative_dynmat[adrs] /= 2; + derivative_dynmat[adrs + 1] -= derivative_dynmat[adrsT + 1]; + derivative_dynmat[adrs + 1] /= 2; + derivative_dynmat[adrsT] = derivative_dynmat[adrs]; + derivative_dynmat[adrsT + 1] = -derivative_dynmat[adrs + 1]; + } } - } } - } - /* Symmetrize to be a Hermitian matrix */ - for (i = 0; i < 3; i++) { - for (j = i; j < num_patom * 3; j++) { - for (k = 0; k < num_patom * 3; k++) { - adrs = i * num_patom * num_patom * 18 + j * num_patom * 6 + k * 2; - adrsT = i * num_patom * num_patom * 18 + k * num_patom * 6 + j * 2; - derivative_dynmat[adrs] += derivative_dynmat[adrsT]; - derivative_dynmat[adrs] /= 2; - derivative_dynmat[adrs + 1] -= derivative_dynmat[adrsT+ 1]; - derivative_dynmat[adrs + 1] /= 2; - derivative_dynmat[adrsT] = derivative_dynmat[adrs]; - derivative_dynmat[adrsT + 1] = -derivative_dynmat[adrs + 1]; - } - } - } - - - if (is_nac) { - free(ddnac); - ddnac = NULL; - free(dnac); - dnac = NULL; - } + if (is_nac) { + free(ddnac); + ddnac = NULL; + free(dnac); + dnac = NULL; + } } /* D_nac = a * AB/C */ /* dD_nac = a * D_nac * (A'/A + B'/B - C'/C) */ -static void get_derivative_nac(double *ddnac, - double *dnac, - const long num_patom, - const double *lattice, - const double *mass, - const double *q, - const double *born, - const double *dielectric, - const double *q_direction, - const double factor) -{ - long i, j, k, l, m; - double a, b, c, da, db, dc, volume, mass_sqrt; - double q_cart[3], rec_lat[9]; - - volume = - lattice[0] * (lattice[4] * lattice[8] - lattice[5] * lattice[7]) + - lattice[1] * (lattice[5] * lattice[6] - lattice[3] * lattice[8]) + - lattice[2] * (lattice[3] * lattice[7] - lattice[4] * lattice[6]); - - rec_lat[0] = (lattice[4] * lattice[8] - lattice[5] * lattice[7]) / volume; - rec_lat[1] = (lattice[5] * lattice[6] - lattice[3] * lattice[8]) / volume; - rec_lat[2] = (lattice[3] * lattice[7] - lattice[4] * lattice[6]) / volume; - rec_lat[3] = (lattice[7] * lattice[2] - lattice[8] * lattice[1]) / volume; - rec_lat[4] = (lattice[8] * lattice[0] - lattice[6] * lattice[2]) / volume; - rec_lat[5] = (lattice[6] * lattice[1] - lattice[7] * lattice[0]) / volume; - rec_lat[6] = (lattice[1] * lattice[5] - lattice[2] * lattice[4]) / volume; - rec_lat[7] = (lattice[2] * lattice[3] - lattice[0] * lattice[5]) / volume; - rec_lat[8] = (lattice[0] * lattice[4] - lattice[1] * lattice[3]) / volume; - - for (i = 0; i < 3; i++) { - q_cart[i] = 0; - for (j = 0; j < 3; j++) { - if (q_direction) { - q_cart[i] += rec_lat[i * 3 + j] * q_direction[j]; - } else { - q_cart[i] += rec_lat[i * 3 + j] * q[j]; - } - } - } - - c = get_C(q_cart, dielectric); - - for (i = 0; i < num_patom; i++) { /* atom_i */ - for (j = 0; j < num_patom; j++) { /* atom_j */ - mass_sqrt = sqrt(mass[i] * mass[j]); - for (k = 0; k < 3; k++) { /* derivative direction */ - for (l = 0; l < 3; l++) { /* alpha */ - a = get_A(i, l, q_cart, born); - da = get_dA(i, l, k, born); - for (m = 0; m < 3; m++) { /* beta */ - b = get_A(j, m, q_cart, born); - db = get_dA(j, m, k, born); - dc = get_dC(l, m, k, q_cart, dielectric); - ddnac[k * num_patom * num_patom * 9 + - i * 9 * num_patom + j * 9 + l * 3 + m] = - (da * b + db * a - a * b * dc / c) / (c * mass_sqrt) * factor; - if (k == 0) { - dnac[i * 9 * num_patom + j * 9 + l * 3 + m] = - a * b / (c * mass_sqrt) * factor; +static void get_derivative_nac(double *ddnac, double *dnac, + const long num_patom, const double *lattice, + const double *mass, const double *q, + const double *born, const double *dielectric, + const double *q_direction, const double factor) { + long i, j, k, l, m; + double a, b, c, da, db, dc, volume, mass_sqrt; + double q_cart[3], rec_lat[9]; + + volume = lattice[0] * (lattice[4] * lattice[8] - lattice[5] * lattice[7]) + + lattice[1] * (lattice[5] * lattice[6] - lattice[3] * lattice[8]) + + lattice[2] * (lattice[3] * lattice[7] - lattice[4] * lattice[6]); + + rec_lat[0] = (lattice[4] * lattice[8] - lattice[5] * lattice[7]) / volume; + rec_lat[1] = (lattice[5] * lattice[6] - lattice[3] * lattice[8]) / volume; + rec_lat[2] = (lattice[3] * lattice[7] - lattice[4] * lattice[6]) / volume; + rec_lat[3] = (lattice[7] * lattice[2] - lattice[8] * lattice[1]) / volume; + rec_lat[4] = (lattice[8] * lattice[0] - lattice[6] * lattice[2]) / volume; + rec_lat[5] = (lattice[6] * lattice[1] - lattice[7] * lattice[0]) / volume; + rec_lat[6] = (lattice[1] * lattice[5] - lattice[2] * lattice[4]) / volume; + rec_lat[7] = (lattice[2] * lattice[3] - lattice[0] * lattice[5]) / volume; + rec_lat[8] = (lattice[0] * lattice[4] - lattice[1] * lattice[3]) / volume; + + for (i = 0; i < 3; i++) { + q_cart[i] = 0; + for (j = 0; j < 3; j++) { + if (q_direction) { + q_cart[i] += rec_lat[i * 3 + j] * q_direction[j]; + } else { + q_cart[i] += rec_lat[i * 3 + j] * q[j]; + } + } + } + + c = get_C(q_cart, dielectric); + + for (i = 0; i < num_patom; i++) { /* atom_i */ + for (j = 0; j < num_patom; j++) { /* atom_j */ + mass_sqrt = sqrt(mass[i] * mass[j]); + for (k = 0; k < 3; k++) { /* derivative direction */ + for (l = 0; l < 3; l++) { /* alpha */ + a = get_A(i, l, q_cart, born); + da = get_dA(i, l, k, born); + for (m = 0; m < 3; m++) { /* beta */ + b = get_A(j, m, q_cart, born); + db = get_dA(j, m, k, born); + dc = get_dC(l, m, k, q_cart, dielectric); + ddnac[k * num_patom * num_patom * 9 + + i * 9 * num_patom + j * 9 + l * 3 + m] = + (da * b + db * a - a * b * dc / c) / + (c * mass_sqrt) * factor; + if (k == 0) { + dnac[i * 9 * num_patom + j * 9 + l * 3 + m] = + a * b / (c * mass_sqrt) * factor; + } + } + } } - } } - } } - } } -static double get_A(const long atom_i, - const long cart_i, - const double q[3], - const double *born) -{ - long i; - double sum; - - sum = 0; - for (i = 0; i < 3; i++) { - sum += q[i] * born[atom_i * 9 + i * 3 + cart_i]; - } +static double get_A(const long atom_i, const long cart_i, const double q[3], + const double *born) { + long i; + double sum; + + sum = 0; + for (i = 0; i < 3; i++) { + sum += q[i] * born[atom_i * 9 + i * 3 + cart_i]; + } - return sum; + return sum; } -static double get_C(const double q[3], - const double *dielectric) -{ - long i, j; - double sum; - - sum = 0; - for (i = 0; i < 3; i++) { - for (j = 0; j < 3; j++) { - sum += q[i] * dielectric[i * 3 + j] * q[j]; +static double get_C(const double q[3], const double *dielectric) { + long i, j; + double sum; + + sum = 0; + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + sum += q[i] * dielectric[i * 3 + j] * q[j]; + } } - } - return sum; + return sum; } -static double get_dA(const long atom_i, - const long cart_i, - const long cart_j, - const double *born) -{ - return born[atom_i * 9 + cart_j * 3 + cart_i]; +static double get_dA(const long atom_i, const long cart_i, const long cart_j, + const double *born) { + return born[atom_i * 9 + cart_j * 3 + cart_i]; } -static double get_dC(const long cart_i, - const long cart_j, - const long cart_k, - const double q[3], - const double *dielectric) -{ - if (cart_k == 0) { - return (2 * q[0] * dielectric[0] + - q[1] * (dielectric[1] + dielectric[3]) + - q[2] * (dielectric[2] + dielectric[6])); - } - if (cart_k == 1) { - return (2 * q[1] * dielectric[4] + - q[2] * (dielectric[5] + dielectric[7]) + - q[0] * (dielectric[1] + dielectric[3])); - } - if (cart_k == 2) { - return (2 * q[2] * dielectric[8] + - q[0] * (dielectric[2] + dielectric[6]) + - q[1] * (dielectric[5] + dielectric[7])); - } - return 0; +static double get_dC(const long cart_i, const long cart_j, const long cart_k, + const double q[3], const double *dielectric) { + if (cart_k == 0) { + return (2 * q[0] * dielectric[0] + + q[1] * (dielectric[1] + dielectric[3]) + + q[2] * (dielectric[2] + dielectric[6])); + } + if (cart_k == 1) { + return (2 * q[1] * dielectric[4] + + q[2] * (dielectric[5] + dielectric[7]) + + q[0] * (dielectric[1] + dielectric[3])); + } + if (cart_k == 2) { + return (2 * q[2] * dielectric[8] + + q[0] * (dielectric[2] + dielectric[6]) + + q[1] * (dielectric[5] + dielectric[7])); + } + return 0; } diff -Nru phonopy-2.12.0/c/derivative_dynmat.h phonopy-2.13.1/c/derivative_dynmat.h --- phonopy-2.12.0/c/derivative_dynmat.h 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/derivative_dynmat.h 2022-02-13 03:47:08.000000000 +0000 @@ -35,20 +35,12 @@ #ifndef __derivative_dynmat_H__ #define __derivative_dynmat_H__ -void ddm_get_derivative_dynmat_at_q(double *derivative_dynmat, - const long num_patom, - const long num_satom, - const double *fc, - const double *q, - const double *lattice, /* column vector */ - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double nac_factor, - const double *born, - const double *dielectric, - const double *q_direction); +void ddm_get_derivative_dynmat_at_q( + double *derivative_dynmat, const long num_patom, const long num_satom, + const double *fc, const double *q, + const double *lattice, /* column vector */ + const double (*svecs)[3], const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double nac_factor, + const double *born, const double *dielectric, const double *q_direction); #endif diff -Nru phonopy-2.12.0/c/dynmat.c phonopy-2.13.1/c/dynmat.c --- phonopy-2.12.0/c/dynmat.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/dynmat.c 2022-02-13 03:47:08.000000000 +0000 @@ -32,304 +32,238 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ +#include "dynmat.h" + #include #include -#include "dynmat.h" #define PI 3.14159265358979323846 -static void get_dynmat_ij(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double (*charge_sum)[3][3], - const long i, +static void get_dynmat_ij(double *dynamical_matrix, const long num_patom, + const long num_satom, const double *fc, + const double q[3], const double (*svecs)[3], + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, + const double (*charge_sum)[3][3], const long i, const long j); -static void get_dm(double dm_real[3][3], - double dm_imag[3][3], - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], - const double (*svecs)[3], - const long (*multi)[2], - const long *p2s_map, - const double (*charge_sum)[3][3], - const long i, - const long j, +static void get_dm(double dm_real[3][3], double dm_imag[3][3], + const long num_patom, const long num_satom, const double *fc, + const double q[3], const double (*svecs)[3], + const long (*multi)[2], const long *p2s_map, + const double (*charge_sum)[3][3], const long i, const long j, const long k); static double get_dielectric_part(const double q_cart[3], const double dielectric[3][3]); static void get_KK(double *dd_part, /* [natom, 3, natom, 3, (real,imag)] */ const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, + const long num_G, const long num_patom, + const double q_cart[3], const double *q_direction_cart, const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */ - const double lambda, - const double tolerance); + const double lambda, const double tolerance); static void make_Hermitian(double *mat, const long num_band); -static void multiply_borns(double *dd, - const double *dd_in, - const long num_patom, - const double (*born)[3][3]); +static void multiply_borns(double *dd, const double *dd_in, + const long num_patom, const double (*born)[3][3]); long dym_get_dynamical_matrix_at_q(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], + const long num_patom, const long num_satom, + const double *fc, const double q[3], const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double (*charge_sum)[3][3], - const long with_openmp) -{ - long i, j, ij; + const long with_openmp) { + long i, j, ij; - if (with_openmp) { + if (with_openmp) { #ifdef PHPYOPENMP #pragma omp parallel for #endif - for (ij = 0; ij < num_patom * num_patom ; ij++) { - get_dynmat_ij(dynamical_matrix, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - mass, - s2p_map, - p2s_map, - charge_sum, - ij / num_patom, /* i */ - ij % num_patom); /* j */ + for (ij = 0; ij < num_patom * num_patom; ij++) { + get_dynmat_ij(dynamical_matrix, num_patom, num_satom, fc, q, svecs, + multi, mass, s2p_map, p2s_map, charge_sum, + ij / num_patom, /* i */ + ij % num_patom); /* j */ + } + } else { + for (i = 0; i < num_patom; i++) { + for (j = 0; j < num_patom; j++) { + get_dynmat_ij(dynamical_matrix, num_patom, num_satom, fc, q, + svecs, multi, mass, s2p_map, p2s_map, charge_sum, + i, j); + } + } + } + + make_Hermitian(dynamical_matrix, num_patom * 3); + + return 0; +} + +void dym_get_recip_dipole_dipole( + double *dd, /* [natom, 3, natom, 3, (real,imag)] */ + const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double q_cart[3], + const double *q_direction_cart, /* must be pointer */ + const double (*born)[3][3], const double dielectric[3][3], + const double (*pos)[3], /* [num_patom, 3] */ + const double factor, /* 4pi/V*unit-conv */ + const double lambda, const double tolerance) { + long i, k, l, adrs, adrs_sum; + double *dd_tmp; + + dd_tmp = NULL; + dd_tmp = (double *)malloc(sizeof(double) * num_patom * num_patom * 18); + + for (i = 0; i < num_patom * num_patom * 18; i++) { + dd[i] = 0; + dd_tmp[i] = 0; + } + + get_KK(dd_tmp, G_list, num_G, num_patom, q_cart, q_direction_cart, + dielectric, pos, lambda, tolerance); + + multiply_borns(dd, dd_tmp, num_patom, born); + + for (i = 0; i < num_patom; i++) { + for (k = 0; k < 3; k++) { /* alpha */ + for (l = 0; l < 3; l++) { /* beta */ + adrs = i * num_patom * 9 + k * num_patom * 3 + i * 3 + l; + adrs_sum = i * 9 + k * 3 + l; + dd[adrs * 2] -= dd_q0[adrs_sum * 2]; + dd[adrs * 2 + 1] -= dd_q0[adrs_sum * 2 + 1]; + } + } + } + + for (i = 0; i < num_patom * num_patom * 18; i++) { + dd[i] *= factor; + } + + /* This may not be necessary. */ + /* make_Hermitian(dd, num_patom * 3); */ + + free(dd_tmp); + dd_tmp = NULL; +} + +void dym_get_recip_dipole_dipole_q0( + double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double (*born)[3][3], + const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */ + const double lambda, const double tolerance) { + long i, j, k, l, adrs_tmp, adrs, adrsT; + double zero_vec[3]; + double *dd_tmp1, *dd_tmp2; + + dd_tmp1 = NULL; + dd_tmp1 = (double *)malloc(sizeof(double) * num_patom * num_patom * 18); + dd_tmp2 = NULL; + dd_tmp2 = (double *)malloc(sizeof(double) * num_patom * num_patom * 18); + + for (i = 0; i < num_patom * num_patom * 18; i++) { + dd_tmp1[i] = 0; + dd_tmp2[i] = 0; + } + + zero_vec[0] = 0; + zero_vec[1] = 0; + zero_vec[2] = 0; + + get_KK(dd_tmp1, G_list, num_G, num_patom, zero_vec, NULL, dielectric, pos, + lambda, tolerance); + + multiply_borns(dd_tmp2, dd_tmp1, num_patom, born); + + for (i = 0; i < num_patom * 18; i++) { + dd_q0[i] = 0; + } + + for (i = 0; i < num_patom; i++) { + for (k = 0; k < 3; k++) { /* alpha */ + for (l = 0; l < 3; l++) { /* beta */ + adrs = i * 9 + k * 3 + l; + for (j = 0; j < num_patom; j++) { + adrs_tmp = + i * num_patom * 9 + k * num_patom * 3 + j * 3 + l; + dd_q0[adrs * 2] += dd_tmp2[adrs_tmp * 2]; + dd_q0[adrs * 2 + 1] += dd_tmp2[adrs_tmp * 2 + 1]; + } + } + } + } + + /* Summation over another atomic index */ + /* for (j = 0; j < num_patom; j++) { */ + /* for (k = 0; k < 3; k++) { /\* alpha *\/ */ + /* for (l = 0; l < 3; l++) { /\* beta *\/ */ + /* adrs = j * 9 + k * 3 + l; */ + /* for (i = 0; i < num_patom; i++) { */ + /* adrs_tmp = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l ; */ + /* dd_q0[adrs * 2] += dd_tmp2[adrs_tmp * 2]; */ + /* dd_q0[adrs * 2 + 1] += dd_tmp2[adrs_tmp * 2 + 1]; */ + /* } */ + /* } */ + /* } */ + /* } */ + + for (i = 0; i < num_patom; i++) { + for (k = 0; k < 3; k++) { /* alpha */ + for (l = 0; l < 3; l++) { /* beta */ + adrs = i * 9 + k * 3 + l; + adrsT = i * 9 + l * 3 + k; + dd_q0[adrs * 2] += dd_q0[adrsT * 2]; + dd_q0[adrs * 2] /= 2; + dd_q0[adrsT * 2] = dd_q0[adrs * 2]; + dd_q0[adrs * 2 + 1] -= dd_q0[adrsT * 2 + 1]; + dd_q0[adrs * 2 + 1] /= 2; + dd_q0[adrsT * 2 + 1] = -dd_q0[adrs * 2 + 1]; + } + } + } + + free(dd_tmp1); + dd_tmp1 = NULL; + free(dd_tmp2); + dd_tmp2 = NULL; +} + +void dym_get_charge_sum( + double (*charge_sum)[3][3], const long num_patom, + const double factor, /* 4pi/V*unit-conv and denominator */ + const double q_cart[3], const double (*born)[3][3]) { + long i, j, k, a, b; + double(*q_born)[3]; + + q_born = (double(*)[3])malloc(sizeof(double[3]) * num_patom); + for (i = 0; i < num_patom; i++) { + for (j = 0; j < 3; j++) { + q_born[i][j] = 0; + } + } + + for (i = 0; i < num_patom; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 3; k++) { + q_born[i][j] += q_cart[k] * born[i][k][j]; + } + } } - } else { + for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_patom; j++) { - get_dynmat_ij(dynamical_matrix, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - mass, - s2p_map, - p2s_map, - charge_sum, - i, - j); - } - } - } - - make_Hermitian(dynamical_matrix, num_patom * 3); - - return 0; -} - -void dym_get_recip_dipole_dipole(double *dd, /* [natom, 3, natom, 3, (real,imag)] */ - const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, /* must be pointer */ - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double factor, /* 4pi/V*unit-conv */ - const double lambda, - const double tolerance) -{ - long i, k, l, adrs, adrs_sum; - double *dd_tmp; - - dd_tmp = NULL; - dd_tmp = (double*) malloc(sizeof(double) * num_patom * num_patom * 18); - - for (i = 0; i < num_patom * num_patom * 18; i++) { - dd[i] = 0; - dd_tmp[i] = 0; - } - - get_KK(dd_tmp, - G_list, - num_G, - num_patom, - q_cart, - q_direction_cart, - dielectric, - pos, - lambda, - tolerance); - - multiply_borns(dd, dd_tmp, num_patom, born); - - for (i = 0; i < num_patom; i++) { - for (k = 0; k < 3; k++) { /* alpha */ - for (l = 0; l < 3; l++) { /* beta */ - adrs = i * num_patom * 9 + k * num_patom * 3 + i * 3 + l; - adrs_sum = i * 9 + k * 3 + l; - dd[adrs * 2] -= dd_q0[adrs_sum * 2]; - dd[adrs * 2 + 1] -= dd_q0[adrs_sum * 2 + 1]; - } - } - } - - for (i = 0; i < num_patom * num_patom * 18; i++) { - dd[i] *= factor; - } - - /* This may not be necessary. */ - /* make_Hermitian(dd, num_patom * 3); */ - - free(dd_tmp); - dd_tmp = NULL; -} - -void dym_get_recip_dipole_dipole_q0(double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double lambda, - const double tolerance) -{ - long i, j, k, l, adrs_tmp, adrs, adrsT; - double zero_vec[3]; - double *dd_tmp1, *dd_tmp2; - - dd_tmp1 = NULL; - dd_tmp1 = (double*) malloc(sizeof(double) * num_patom * num_patom * 18); - dd_tmp2 = NULL; - dd_tmp2 = (double*) malloc(sizeof(double) * num_patom * num_patom * 18); - - for (i = 0; i < num_patom * num_patom * 18; i++) { - dd_tmp1[i] = 0; - dd_tmp2[i] = 0; - } - - zero_vec[0] = 0; - zero_vec[1] = 0; - zero_vec[2] = 0; - - get_KK(dd_tmp1, - G_list, - num_G, - num_patom, - zero_vec, - NULL, - dielectric, - pos, - lambda, - tolerance); - - multiply_borns(dd_tmp2, dd_tmp1, num_patom, born); - - for (i = 0; i < num_patom * 18; i++) { - dd_q0[i] = 0; - } - - for (i = 0; i < num_patom; i++) { - for (k = 0; k < 3; k++) { /* alpha */ - for (l = 0; l < 3; l++) { /* beta */ - adrs = i * 9 + k * 3 + l; for (j = 0; j < num_patom; j++) { - adrs_tmp = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l ; - dd_q0[adrs * 2] += dd_tmp2[adrs_tmp * 2]; - dd_q0[adrs * 2 + 1] += dd_tmp2[adrs_tmp * 2 + 1]; - } - } - } - } - - /* Summation over another atomic index */ - /* for (j = 0; j < num_patom; j++) { */ - /* for (k = 0; k < 3; k++) { /\* alpha *\/ */ - /* for (l = 0; l < 3; l++) { /\* beta *\/ */ - /* adrs = j * 9 + k * 3 + l; */ - /* for (i = 0; i < num_patom; i++) { */ - /* adrs_tmp = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l ; */ - /* dd_q0[adrs * 2] += dd_tmp2[adrs_tmp * 2]; */ - /* dd_q0[adrs * 2 + 1] += dd_tmp2[adrs_tmp * 2 + 1]; */ - /* } */ - /* } */ - /* } */ - /* } */ - - for (i = 0; i < num_patom; i++) { - for (k = 0; k < 3; k++) { /* alpha */ - for (l = 0; l < 3; l++) { /* beta */ - adrs = i * 9 + k * 3 + l; - adrsT = i * 9 + l * 3 + k; - dd_q0[adrs * 2] += dd_q0[adrsT * 2]; - dd_q0[adrs * 2] /= 2; - dd_q0[adrsT * 2] = dd_q0[adrs * 2]; - dd_q0[adrs * 2 + 1] -= dd_q0[adrsT * 2 + 1]; - dd_q0[adrs * 2 + 1] /= 2; - dd_q0[adrsT * 2 + 1] = -dd_q0[adrs * 2 + 1]; - } - } - } - - free(dd_tmp1); - dd_tmp1 = NULL; - free(dd_tmp2); - dd_tmp2 = NULL; -} - -void dym_get_charge_sum(double (*charge_sum)[3][3], - const long num_patom, - const double factor, /* 4pi/V*unit-conv and denominator */ - const double q_cart[3], - const double (*born)[3][3]) -{ - long i, j, k, a, b; - double (*q_born)[3]; - - q_born = (double (*)[3]) malloc(sizeof(double[3]) * num_patom); - for (i = 0; i < num_patom; i++) { - for (j = 0; j < 3; j++) { - q_born[i][j] = 0; - } - } - - for (i = 0; i < num_patom; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 3; k++) { - q_born[i][j] += q_cart[k] * born[i][k][j]; - } - } - } - - for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_patom; j++) { - for (a = 0; a < 3; a++) { - for (b = 0; b < 3; b++) { - charge_sum[i * num_patom + j][a][b] = - q_born[i][a] * q_born[j][b] * factor; + for (a = 0; a < 3; a++) { + for (b = 0; b < 3; b++) { + charge_sum[i * num_patom + j][a][b] = + q_born[i][a] * q_born[j][b] * factor; + } + } } - } } - } - free(q_born); - q_born = NULL; + free(q_born); + q_born = NULL; } /* fc[num_patom, num_satom, 3, 3] */ @@ -337,302 +271,267 @@ /* comm_points[num_satom / num_patom, 3] */ /* shortest_vectors[:, 3] */ /* multiplicities[num_satom, num_patom, 2] */ -void dym_transform_dynmat_to_fc(double *fc, - const double *dm, +void dym_transform_dynmat_to_fc(double *fc, const double *dm, const double (*comm_points)[3], const double (*svecs)[3], - const long (*multi)[2], - const double *masses, - const long *s2pp_map, - const long *fc_index_map, - const long num_patom, - const long num_satom) -{ - long i, j, k, l, m, N, adrs, m_pair, i_pair, svecs_adrs; - double coef, phase, cos_phase, sin_phase; - - N = num_satom / num_patom; - for (i = 0; i < num_patom * num_satom * 9; i++) { - fc[i] = 0; - } - - for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_satom; j++) { - i_pair = j * num_patom + i; - m_pair = multi[i_pair][0]; - svecs_adrs = multi[i_pair][1]; - coef = sqrt(masses[i] * masses[s2pp_map[j]]) / N; - for (k = 0; k < N; k++) { - cos_phase = 0; - sin_phase = 0; - for (l = 0; l < m_pair; l++) { - phase = 0; - for (m = 0; m < 3; m++) { - phase -= comm_points[k][m] * svecs[svecs_adrs + l][m]; - } - cos_phase += cos(phase * 2 * PI); - sin_phase += sin(phase * 2 * PI); + const long (*multi)[2], const double *masses, + const long *s2pp_map, const long *fc_index_map, + const long num_patom, const long num_satom) { + long i, j, k, l, m, N, adrs, m_pair, i_pair, svecs_adrs; + double coef, phase, cos_phase, sin_phase; + + N = num_satom / num_patom; + for (i = 0; i < num_patom * num_satom * 9; i++) { + fc[i] = 0; + } + + for (i = 0; i < num_patom; i++) { + for (j = 0; j < num_satom; j++) { + i_pair = j * num_patom + i; + m_pair = multi[i_pair][0]; + svecs_adrs = multi[i_pair][1]; + coef = sqrt(masses[i] * masses[s2pp_map[j]]) / N; + for (k = 0; k < N; k++) { + cos_phase = 0; + sin_phase = 0; + for (l = 0; l < m_pair; l++) { + phase = 0; + for (m = 0; m < 3; m++) { + phase -= comm_points[k][m] * svecs[svecs_adrs + l][m]; + } + cos_phase += cos(phase * 2 * PI); + sin_phase += sin(phase * 2 * PI); + } + cos_phase /= m_pair; + sin_phase /= m_pair; + for (l = 0; l < 3; l++) { + for (m = 0; m < 3; m++) { + adrs = k * num_patom * num_patom * 18 + + i * num_patom * 18 + l * num_patom * 6 + + s2pp_map[j] * 6 + m * 2; + fc[fc_index_map[i] * num_satom * 9 + j * 9 + l * 3 + + m] += + (dm[adrs] * cos_phase - dm[adrs + 1] * sin_phase) * + coef; + } + } + } } - cos_phase /= m_pair; - sin_phase /= m_pair; - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - adrs = k * num_patom * num_patom * 18 + i * num_patom * 18 + - l * num_patom * 6 + s2pp_map[j] * 6 + m * 2; - fc[fc_index_map[i] * num_satom * 9 + j * 9 + l * 3 + m] += - (dm[adrs] * cos_phase - dm[adrs + 1] * sin_phase) * coef; - } - } - } - } - } + } } +static void get_dynmat_ij(double *dynamical_matrix, const long num_patom, + const long num_satom, const double *fc, + const double q[3], const double (*svecs)[3], + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, + const double (*charge_sum)[3][3], const long i, + const long j) { + long k, l, adrs; + double mass_sqrt; + double dm_real[3][3], dm_imag[3][3]; + + mass_sqrt = sqrt(mass[i] * mass[j]); -static void get_dynmat_ij(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double (*charge_sum)[3][3], - const long i, - const long j) -{ - long k, l, adrs; - double mass_sqrt; - double dm_real[3][3], dm_imag[3][3]; + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + dm_real[k][l] = 0; + dm_imag[k][l] = 0; + } + } - mass_sqrt = sqrt(mass[i] * mass[j]); + for (k = 0; k < num_satom; k++) { /* Lattice points of right index of fc */ + if (s2p_map[k] != p2s_map[j]) { + continue; + } + get_dm(dm_real, dm_imag, num_patom, num_satom, fc, q, svecs, multi, + p2s_map, charge_sum, i, j, k); + } - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - dm_real[k][l] = 0; - dm_imag[k][l] = 0; + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + adrs = (i * 3 + k) * num_patom * 3 + j * 3 + l; + dynamical_matrix[adrs * 2] = dm_real[k][l] / mass_sqrt; + dynamical_matrix[adrs * 2 + 1] = dm_imag[k][l] / mass_sqrt; + } } - } +} - for (k = 0; k < num_satom; k++) { /* Lattice points of right index of fc */ - if (s2p_map[k] != p2s_map[j]) { - continue; - } - get_dm(dm_real, - dm_imag, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - p2s_map, - charge_sum, - i, - j, - k); - } +static void get_dm(double dm_real[3][3], double dm_imag[3][3], + const long num_patom, const long num_satom, const double *fc, + const double q[3], const double (*svecs)[3], + const long (*multi)[2], const long *p2s_map, + const double (*charge_sum)[3][3], const long i, const long j, + const long k) { + long l, m, i_pair, m_pair, adrs; + double phase, cos_phase, sin_phase, fc_elem; + + cos_phase = 0; + sin_phase = 0; + + i_pair = k * num_patom + i; + m_pair = multi[i_pair][0]; + adrs = multi[i_pair][1]; + + for (l = 0; l < m_pair; l++) { + phase = 0; + for (m = 0; m < 3; m++) { + phase += q[m] * svecs[adrs + l][m]; + } + cos_phase += cos(phase * 2 * PI) / m_pair; + sin_phase += sin(phase * 2 * PI) / m_pair; + } - for (k = 0; k < 3; k++) { for (l = 0; l < 3; l++) { - adrs = (i * 3 + k) * num_patom * 3 + j * 3 + l; - dynamical_matrix[adrs * 2] = dm_real[k][l] / mass_sqrt; - dynamical_matrix[adrs * 2 + 1] = dm_imag[k][l] / mass_sqrt; - } - } -} - -static void get_dm(double dm_real[3][3], - double dm_imag[3][3], - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], - const double (*svecs)[3], - const long (*multi)[2], - const long *p2s_map, - const double (*charge_sum)[3][3], - const long i, - const long j, - const long k) -{ - long l, m, i_pair, m_pair, adrs; - double phase, cos_phase, sin_phase, fc_elem; - - cos_phase = 0; - sin_phase = 0; - - i_pair = k * num_patom + i; - m_pair = multi[i_pair][0]; - adrs = multi[i_pair][1]; - - for (l = 0; l < m_pair; l++) { - phase = 0; - for (m = 0; m < 3; m++) { - phase += q[m] * svecs[adrs + l][m]; - } - cos_phase += cos(phase * 2 * PI) / m_pair; - sin_phase += sin(phase * 2 * PI) / m_pair; - } - - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - if (charge_sum) { - fc_elem = (fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m] + - charge_sum[i * num_patom + j][l][m]); - } else { - fc_elem = fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m]; - } - dm_real[l][m] += fc_elem * cos_phase; - dm_imag[l][m] += fc_elem * sin_phase; + for (m = 0; m < 3; m++) { + if (charge_sum) { + fc_elem = (fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m] + + charge_sum[i * num_patom + j][l][m]); + } else { + fc_elem = fc[p2s_map[i] * num_satom * 9 + k * 9 + l * 3 + m]; + } + dm_real[l][m] += fc_elem * cos_phase; + dm_imag[l][m] += fc_elem * sin_phase; + } } - } } static double get_dielectric_part(const double q_cart[3], - const double dielectric[3][3]) -{ - long i, j; - double x[3]; - double sum; - - for (i = 0; i < 3; i++) { - x[i] = 0; - for (j = 0; j < 3; j++) { - x[i] += dielectric[i][j] * q_cart[j]; - } - } - - sum = 0; - for (i = 0; i < 3; i++) { - sum += q_cart[i] * x[i]; - } + const double dielectric[3][3]) { + long i, j; + double x[3]; + double sum; - return sum; + for (i = 0; i < 3; i++) { + x[i] = 0; + for (j = 0; j < 3; j++) { + x[i] += dielectric[i][j] * q_cart[j]; + } + } + + sum = 0; + for (i = 0; i < 3; i++) { + sum += q_cart[i] * x[i]; + } + + return sum; } static void get_KK(double *dd_part, /* [natom, 3, natom, 3, (real,imag)] */ const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, + const long num_G, const long num_patom, + const double q_cart[3], const double *q_direction_cart, const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */ - const double lambda, - const double tolerance) -{ - long i, j, k, l, g, adrs; - double q_K[3]; - double norm, cos_phase, sin_phase, phase, dielectric_part, exp_damp, L2; - double KK[3][3]; - - L2 = 4 * lambda * lambda; - - /* sum over K = G + q and over G (i.e. q=0) */ - /* q_direction has values for summation over K at Gamma point. */ - /* q_direction is NULL for summation over G */ - for (g = 0; g < num_G; g++) { - norm = 0; - for (i = 0; i < 3; i++) { - q_K[i] = G_list[g][i] + q_cart[i]; - norm += q_K[i] * q_K[i]; - } - - if (sqrt(norm) < tolerance) { - if (!q_direction_cart) { - continue; - } else { - dielectric_part = get_dielectric_part(q_direction_cart, dielectric); + const double lambda, const double tolerance) { + long i, j, k, l, g, adrs; + double q_K[3]; + double norm, cos_phase, sin_phase, phase, dielectric_part, exp_damp, L2; + double KK[3][3]; + + L2 = 4 * lambda * lambda; + + /* sum over K = G + q and over G (i.e. q=0) */ + /* q_direction has values for summation over K at Gamma point. */ + /* q_direction is NULL for summation over G */ + for (g = 0; g < num_G; g++) { + norm = 0; for (i = 0; i < 3; i++) { - for (j = 0; j < 3; j++) { - KK[i][j] = - q_direction_cart[i] * q_direction_cart[j] / dielectric_part; - } + q_K[i] = G_list[g][i] + q_cart[i]; + norm += q_K[i] * q_K[i]; } - } - } else { - dielectric_part = get_dielectric_part(q_K, dielectric); - exp_damp = exp(-dielectric_part / L2); - for (i = 0; i < 3; i++) { - for (j = 0; j < 3; j++) { - KK[i][j] = q_K[i] * q_K[j] / dielectric_part * exp_damp; + + if (sqrt(norm) < tolerance) { + if (!q_direction_cart) { + continue; + } else { + dielectric_part = + get_dielectric_part(q_direction_cart, dielectric); + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + KK[i][j] = q_direction_cart[i] * q_direction_cart[j] / + dielectric_part; + } + } + } + } else { + dielectric_part = get_dielectric_part(q_K, dielectric); + exp_damp = exp(-dielectric_part / L2); + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + KK[i][j] = q_K[i] * q_K[j] / dielectric_part * exp_damp; + } + } + } + + for (i = 0; i < num_patom; i++) { + for (j = 0; j < num_patom; j++) { + phase = 0; + for (k = 0; k < 3; k++) { + /* For D-type dynamical matrix */ + /* phase += (pos[i][k] - pos[j][k]) * q_K[k]; */ + /* For C-type dynamical matrix */ + phase += (pos[i][k] - pos[j][k]) * G_list[g][k]; + } + phase *= 2 * PI; + cos_phase = cos(phase); + sin_phase = sin(phase); + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + adrs = + i * num_patom * 9 + k * num_patom * 3 + j * 3 + l; + dd_part[adrs * 2] += KK[k][l] * cos_phase; + dd_part[adrs * 2 + 1] += KK[k][l] * sin_phase; + } + } + } + } + } +} + +static void make_Hermitian(double *mat, const long num_band) { + long i, j, adrs, adrsT; + + for (i = 0; i < num_band; i++) { + for (j = i; j < num_band; j++) { + adrs = i * num_band + j * 1; + adrs *= 2; + adrsT = j * num_band + i * 1; + adrsT *= 2; + /* real part */ + mat[adrs] += mat[adrsT]; + mat[adrs] /= 2; + /* imaginary part */ + mat[adrs + 1] -= mat[adrsT + 1]; + mat[adrs + 1] /= 2; + /* store */ + mat[adrsT] = mat[adrs]; + mat[adrsT + 1] = -mat[adrs + 1]; } - } } +} + +static void multiply_borns(double *dd, const double *dd_in, + const long num_patom, const double (*born)[3][3]) { + long i, j, k, l, m, n, adrs, adrs_in; + double zz; for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_patom; j++) { - phase = 0; - for (k = 0; k < 3; k++) { - /* For D-type dynamical matrix */ - /* phase += (pos[i][k] - pos[j][k]) * q_K[k]; */ - /* For C-type dynamical matrix */ - phase += (pos[i][k] - pos[j][k]) * G_list[g][k]; - } - phase *= 2 * PI; - cos_phase = cos(phase); - sin_phase = sin(phase); - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - adrs = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l; - dd_part[adrs * 2] += KK[k][l] * cos_phase; - dd_part[adrs * 2 + 1] += KK[k][l] * sin_phase; - } - } - } - } - } -} - -static void make_Hermitian(double *mat, const long num_band) -{ - long i, j, adrs, adrsT; - - for (i = 0; i < num_band; i++) { - for (j = i; j < num_band; j++) { - adrs = i * num_band + j * 1; - adrs *= 2; - adrsT = j * num_band + i * 1; - adrsT *= 2; - /* real part */ - mat[adrs] += mat[adrsT]; - mat[adrs] /= 2; - /* imaginary part */ - mat[adrs + 1] -= mat[adrsT+ 1]; - mat[adrs + 1] /= 2; - /* store */ - mat[adrsT] = mat[adrs]; - mat[adrsT + 1] = -mat[adrs + 1]; - } - } -} - -static void multiply_borns(double *dd, - const double *dd_in, - const long num_patom, - const double (*born)[3][3]) -{ - long i, j, k, l, m, n, adrs, adrs_in; - double zz; - - for (i = 0; i < num_patom; i++) { - for (j = 0; j < num_patom; j++) { - for (k = 0; k < 3; k++) { /* alpha */ - for (l = 0; l < 3; l++) { /* beta */ - adrs = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l; - for (m = 0; m < 3; m++) { /* alpha' */ - for (n = 0; n < 3; n++) { /* beta' */ - adrs_in = i * num_patom * 9 + m * num_patom * 3 + j * 3 + n ; - zz = born[i][m][k] * born[j][n][l]; - dd[adrs * 2] += dd_in[adrs_in * 2] * zz; - dd[adrs * 2 + 1] += dd_in[adrs_in * 2 + 1] * zz; + for (j = 0; j < num_patom; j++) { + for (k = 0; k < 3; k++) { /* alpha */ + for (l = 0; l < 3; l++) { /* beta */ + adrs = i * num_patom * 9 + k * num_patom * 3 + j * 3 + l; + for (m = 0; m < 3; m++) { /* alpha' */ + for (n = 0; n < 3; n++) { /* beta' */ + adrs_in = i * num_patom * 9 + m * num_patom * 3 + + j * 3 + n; + zz = born[i][m][k] * born[j][n][l]; + dd[adrs * 2] += dd_in[adrs_in * 2] * zz; + dd[adrs * 2 + 1] += dd_in[adrs_in * 2 + 1] * zz; + } + } + } } - } } - } } - } } diff -Nru phonopy-2.12.0/c/dynmat.h phonopy-2.13.1/c/dynmat.h --- phonopy-2.12.0/c/dynmat.h 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/dynmat.h 2022-02-13 03:47:08.000000000 +0000 @@ -36,58 +36,42 @@ #define __dynmat_H__ long dym_get_dynamical_matrix_at_q(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], + const long num_patom, const long num_satom, + const double *fc, const double q[3], const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double (*charge_sum)[3][3], const long with_openmp); -void dym_get_recip_dipole_dipole(double *dd, /* [natom, 3, natom, 3, (real,imag)] */ - const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, /* must be pointer */ - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double factor, /* 4pi/V*unit-conv */ - const double lambda, - const double tolerance); -void dym_get_recip_dipole_dipole_q0(double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [natom, 3] */ - const double lambda, - const double tolerance); -void dym_get_charge_sum(double (*charge_sum)[3][3], - const long num_patom, - const double factor, - const double q_cart[3], +void dym_get_recip_dipole_dipole( + double *dd, /* [natom, 3, natom, 3, (real,imag)] */ + const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double q_cart[3], + const double *q_direction_cart, /* must be pointer */ + const double (*born)[3][3], const double dielectric[3][3], + const double (*pos)[3], /* [num_patom, 3] */ + const double factor, /* 4pi/V*unit-conv */ + const double lambda, const double tolerance); +void dym_get_recip_dipole_dipole_q0( + double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double (*born)[3][3], + const double dielectric[3][3], const double (*pos)[3], /* [natom, 3] */ + const double lambda, const double tolerance); +void dym_get_charge_sum(double (*charge_sum)[3][3], const long num_patom, + const double factor, const double q_cart[3], const double (*born)[3][3]); /* fc[num_patom, num_satom, 3, 3] */ /* dm[num_comm_points, num_patom * 3, num_patom *3] */ /* comm_points[num_satom / num_patom, 3] */ /* shortest_vectors[:, 3] */ /* multiplicities[num_satom, num_patom, 2] */ -void dym_transform_dynmat_to_fc(double *fc, - const double *dm, +void dym_transform_dynmat_to_fc(double *fc, const double *dm, const double (*comm_points)[3], const double (*svecs)[3], - const long (*multi)[2], - const double *masses, - const long *s2pp_map, - const long *fc_index_map, - const long num_patom, - const long num_satom); + const long (*multi)[2], const double *masses, + const long *s2pp_map, const long *fc_index_map, + const long num_patom, const long num_satom); #endif diff -Nru phonopy-2.12.0/c/_phonopy.c phonopy-2.13.1/c/_phonopy.c --- phonopy-2.12.0/c/_phonopy.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/_phonopy.c 2022-02-13 03:47:08.000000000 +0000 @@ -33,46 +33,45 @@ /* POSSIBILITY OF SUCH DAMAGE. */ #include -#include -#include -#include #include +#include #include +#include +#include + #include "phonopy.h" /* PHPYCONST is defined in dynmat.h */ /* Build dynamical matrix */ -static PyObject * py_transform_dynmat_to_fc(PyObject *self, PyObject *args); -static PyObject * py_perm_trans_symmetrize_fc(PyObject *self, PyObject *args); -static PyObject * -py_perm_trans_symmetrize_compact_fc(PyObject *self, PyObject *args); -static PyObject * py_transpose_compact_fc(PyObject *self, PyObject *args); -static PyObject * py_get_dynamical_matrix(PyObject *self, PyObject *args); -static PyObject * py_get_nac_dynamical_matrix(PyObject *self, PyObject *args); -static PyObject * py_get_recip_dipole_dipole(PyObject *self, PyObject *args); -static PyObject * py_get_recip_dipole_dipole_q0(PyObject *self, PyObject *args); -static PyObject * py_get_derivative_dynmat(PyObject *self, PyObject *args); -static PyObject * py_get_thermal_properties(PyObject *self, PyObject *args); -static PyObject * py_distribute_fc2(PyObject *self, PyObject *args); -static PyObject * py_compute_permutation(PyObject *self, PyObject *args); -static PyObject * -py_gsv_set_smallest_vectors_sparse(PyObject *self, PyObject *args); -static PyObject * -py_gsv_set_smallest_vectors_dense(PyObject *self, PyObject *args); -static PyObject * -py_thm_relative_grid_address(PyObject *self, PyObject *args); -static PyObject * -py_thm_all_relative_grid_address(PyObject *self, PyObject *args); -static PyObject * -py_thm_integration_weight(PyObject *self, PyObject *args); -static PyObject * -py_thm_integration_weight_at_omegas(PyObject *self, PyObject *args); -static PyObject * py_get_tetrahedra_frequenies(PyObject *self, PyObject *args); -static PyObject * py_tetrahedron_method_dos(PyObject *self, PyObject *args); +static PyObject* py_transform_dynmat_to_fc(PyObject* self, PyObject* args); +static PyObject* py_perm_trans_symmetrize_fc(PyObject* self, PyObject* args); +static PyObject* py_perm_trans_symmetrize_compact_fc(PyObject* self, + PyObject* args); +static PyObject* py_transpose_compact_fc(PyObject* self, PyObject* args); +static PyObject* py_get_dynamical_matrix(PyObject* self, PyObject* args); +static PyObject* py_get_nac_dynamical_matrix(PyObject* self, PyObject* args); +static PyObject* py_get_recip_dipole_dipole(PyObject* self, PyObject* args); +static PyObject* py_get_recip_dipole_dipole_q0(PyObject* self, PyObject* args); +static PyObject* py_get_derivative_dynmat(PyObject* self, PyObject* args); +static PyObject* py_get_thermal_properties(PyObject* self, PyObject* args); +static PyObject* py_distribute_fc2(PyObject* self, PyObject* args); +static PyObject* py_compute_permutation(PyObject* self, PyObject* args); +static PyObject* py_gsv_set_smallest_vectors_sparse(PyObject* self, + PyObject* args); +static PyObject* py_gsv_set_smallest_vectors_dense(PyObject* self, + PyObject* args); +static PyObject* py_thm_relative_grid_address(PyObject* self, PyObject* args); +static PyObject* py_thm_all_relative_grid_address(PyObject* self, + PyObject* args); +static PyObject* py_thm_integration_weight(PyObject* self, PyObject* args); +static PyObject* py_thm_integration_weight_at_omegas(PyObject* self, + PyObject* args); +static PyObject* py_get_tetrahedra_frequenies(PyObject* self, PyObject* args); +static PyObject* py_tetrahedron_method_dos(PyObject* self, PyObject* args); struct module_state { - PyObject *error; + PyObject* error; }; #if PY_MAJOR_VERSION >= 3 @@ -82,1143 +81,911 @@ static struct module_state _state; #endif -static PyObject * -error_out(PyObject *m) { - struct module_state *st = GETSTATE(m); - PyErr_SetString(st->error, "something bad happened"); - return NULL; +static PyObject* error_out(PyObject* m) { + struct module_state* st = GETSTATE(m); + PyErr_SetString(st->error, "something bad happened"); + return NULL; } static PyMethodDef _phonopy_methods[] = { - {"error_out", (PyCFunction)error_out, METH_NOARGS, NULL}, - {"transform_dynmat_to_fc", py_transform_dynmat_to_fc, METH_VARARGS, - "Transform a set of dynmat to force constants"}, - {"perm_trans_symmetrize_fc", py_perm_trans_symmetrize_fc, METH_VARARGS, - "Enforce permutation and translational symmetry of force constants"}, - {"perm_trans_symmetrize_compact_fc", py_perm_trans_symmetrize_compact_fc, - METH_VARARGS, - "Enforce permutation and translational symmetry of compact force constants"}, - {"transpose_compact_fc", py_transpose_compact_fc, - METH_VARARGS, - "Transpose compact force constants"}, - {"dynamical_matrix", py_get_dynamical_matrix, METH_VARARGS, - "Dynamical matrix"}, - {"nac_dynamical_matrix", py_get_nac_dynamical_matrix, METH_VARARGS, - "NAC dynamical matrix"}, - {"recip_dipole_dipole", py_get_recip_dipole_dipole, METH_VARARGS, - "Reciprocal part of dipole-dipole interaction"}, - {"recip_dipole_dipole_q0", py_get_recip_dipole_dipole_q0, METH_VARARGS, - "q=0 terms of reciprocal part of dipole-dipole interaction"}, - {"derivative_dynmat", py_get_derivative_dynmat, METH_VARARGS, - "Q derivative of dynamical matrix"}, - {"thermal_properties", py_get_thermal_properties, METH_VARARGS, - "Thermal properties"}, - {"distribute_fc2", py_distribute_fc2, METH_VARARGS, - "Distribute force constants for all atoms in atom_list using precomputed symmetry mappings."}, - {"compute_permutation", py_compute_permutation, METH_VARARGS, - "Compute indices of original points in a set of rotated points."}, - {"gsv_set_smallest_vectors_sparse", py_gsv_set_smallest_vectors_sparse, - METH_VARARGS, "Set shortest vectors in sparse array."}, - {"gsv_set_smallest_vectors_dense", py_gsv_set_smallest_vectors_dense, - METH_VARARGS, "Set shortest vectors in dense array."}, - {"tetrahedra_relative_grid_address", py_thm_relative_grid_address, - METH_VARARGS, "Relative grid addresses of vertices of 24 tetrahedra"}, - {"all_tetrahedra_relative_grid_address", - py_thm_all_relative_grid_address, METH_VARARGS, - "4 (all) sets of relative grid addresses of vertices of 24 tetrahedra"}, - {"tetrahedra_integration_weight", py_thm_integration_weight, - METH_VARARGS, "Integration weight for tetrahedron method"}, - {"tetrahedra_integration_weight_at_omegas", - py_thm_integration_weight_at_omegas, - METH_VARARGS, "Integration weight for tetrahedron method at omegas"}, - {"tetrahedra_frequencies", py_get_tetrahedra_frequenies, - METH_VARARGS, "Run tetrahedron method"}, - {"tetrahedron_method_dos", py_tetrahedron_method_dos, - METH_VARARGS, "Run tetrahedron method"}, - {NULL, NULL, 0, NULL} -}; + {"error_out", (PyCFunction)error_out, METH_NOARGS, NULL}, + {"transform_dynmat_to_fc", py_transform_dynmat_to_fc, METH_VARARGS, + "Transform a set of dynmat to force constants"}, + {"perm_trans_symmetrize_fc", py_perm_trans_symmetrize_fc, METH_VARARGS, + "Enforce permutation and translational symmetry of force constants"}, + {"perm_trans_symmetrize_compact_fc", py_perm_trans_symmetrize_compact_fc, + METH_VARARGS, + "Enforce permutation and translational symmetry of compact force " + "constants"}, + {"transpose_compact_fc", py_transpose_compact_fc, METH_VARARGS, + "Transpose compact force constants"}, + {"dynamical_matrix", py_get_dynamical_matrix, METH_VARARGS, + "Dynamical matrix"}, + {"nac_dynamical_matrix", py_get_nac_dynamical_matrix, METH_VARARGS, + "NAC dynamical matrix"}, + {"recip_dipole_dipole", py_get_recip_dipole_dipole, METH_VARARGS, + "Reciprocal part of dipole-dipole interaction"}, + {"recip_dipole_dipole_q0", py_get_recip_dipole_dipole_q0, METH_VARARGS, + "q=0 terms of reciprocal part of dipole-dipole interaction"}, + {"derivative_dynmat", py_get_derivative_dynmat, METH_VARARGS, + "Q derivative of dynamical matrix"}, + {"thermal_properties", py_get_thermal_properties, METH_VARARGS, + "Thermal properties"}, + {"distribute_fc2", py_distribute_fc2, METH_VARARGS, + "Distribute force constants for all atoms in atom_list using precomputed " + "symmetry mappings."}, + {"compute_permutation", py_compute_permutation, METH_VARARGS, + "Compute indices of original points in a set of rotated points."}, + {"gsv_set_smallest_vectors_sparse", py_gsv_set_smallest_vectors_sparse, + METH_VARARGS, "Set shortest vectors in sparse array."}, + {"gsv_set_smallest_vectors_dense", py_gsv_set_smallest_vectors_dense, + METH_VARARGS, "Set shortest vectors in dense array."}, + {"tetrahedra_relative_grid_address", py_thm_relative_grid_address, + METH_VARARGS, "Relative grid addresses of vertices of 24 tetrahedra"}, + {"all_tetrahedra_relative_grid_address", py_thm_all_relative_grid_address, + METH_VARARGS, + "4 (all) sets of relative grid addresses of vertices of 24 tetrahedra"}, + {"tetrahedra_integration_weight", py_thm_integration_weight, METH_VARARGS, + "Integration weight for tetrahedron method"}, + {"tetrahedra_integration_weight_at_omegas", + py_thm_integration_weight_at_omegas, METH_VARARGS, + "Integration weight for tetrahedron method at omegas"}, + {"tetrahedra_frequencies", py_get_tetrahedra_frequenies, METH_VARARGS, + "Run tetrahedron method"}, + {"tetrahedron_method_dos", py_tetrahedron_method_dos, METH_VARARGS, + "Run tetrahedron method"}, + {NULL, NULL, 0, NULL}}; #if PY_MAJOR_VERSION >= 3 -static int _phonopy_traverse(PyObject *m, visitproc visit, void *arg) { - Py_VISIT(GETSTATE(m)->error); - return 0; +static int _phonopy_traverse(PyObject* m, visitproc visit, void* arg) { + Py_VISIT(GETSTATE(m)->error); + return 0; } -static int _phonopy_clear(PyObject *m) { - Py_CLEAR(GETSTATE(m)->error); - return 0; +static int _phonopy_clear(PyObject* m) { + Py_CLEAR(GETSTATE(m)->error); + return 0; } static struct PyModuleDef moduledef = { - PyModuleDef_HEAD_INIT, - "_phonopy", - NULL, - sizeof(struct module_state), - _phonopy_methods, - NULL, - _phonopy_traverse, - _phonopy_clear, - NULL -}; + PyModuleDef_HEAD_INIT, "_phonopy", NULL, + sizeof(struct module_state), _phonopy_methods, NULL, + _phonopy_traverse, _phonopy_clear, NULL}; #define INITERROR return NULL -PyObject * -PyInit__phonopy(void) - +PyObject* PyInit__phonopy(void) #else #define INITERROR return - void - init_phonopy(void) +void init_phonopy(void) #endif { #if PY_MAJOR_VERSION >= 3 - PyObject *module = PyModule_Create(&moduledef); + PyObject* module = PyModule_Create(&moduledef); #else - PyObject *module = Py_InitModule("_phonopy", _phonopy_methods); + PyObject* module = Py_InitModule("_phonopy", _phonopy_methods); #endif - struct module_state *st; - if (module == NULL) - INITERROR; - st = GETSTATE(module); - - st->error = PyErr_NewException("_phonopy.Error", NULL, NULL); - if (st->error == NULL) { - Py_DECREF(module); - INITERROR; - } + struct module_state* st; + if (module == NULL) INITERROR; + st = GETSTATE(module); + + st->error = PyErr_NewException("_phonopy.Error", NULL, NULL); + if (st->error == NULL) { + Py_DECREF(module); + INITERROR; + } #if PY_MAJOR_VERSION >= 3 - return module; + return module; #endif } -static PyObject * py_transform_dynmat_to_fc(PyObject *self, PyObject *args) -{ - PyArrayObject* py_force_constants; - PyArrayObject* py_dynamical_matrices; - PyArrayObject* py_commensurate_points; - PyArrayObject* py_svecs; - PyArrayObject* py_multi; - PyArrayObject* py_masses; - PyArrayObject* py_s2pp_map; - PyArrayObject* py_fc_index_map; - - double* fc; - double* dm; - double (*comm_points)[3]; - double (*svecs)[3]; - double* masses; - long (*multi)[2]; - long* s2pp_map; - long* fc_index_map; - long num_patom; - long num_satom; - - if (!PyArg_ParseTuple(args, "OOOOOOOO", - &py_force_constants, - &py_dynamical_matrices, - &py_commensurate_points, - &py_svecs, - &py_multi, - &py_masses, - &py_s2pp_map, - &py_fc_index_map)) { - return NULL; - } - - fc = (double*)PyArray_DATA(py_force_constants); - dm = (double*)PyArray_DATA(py_dynamical_matrices); - comm_points = (double(*)[3])PyArray_DATA(py_commensurate_points); - svecs = (double(*)[3])PyArray_DATA(py_svecs); - masses = (double*)PyArray_DATA(py_masses); - multi = (long(*)[2])PyArray_DATA(py_multi); - s2pp_map = (long*)PyArray_DATA(py_s2pp_map); - fc_index_map = (long*)PyArray_DATA(py_fc_index_map); - num_patom = PyArray_DIMS(py_multi)[1]; - num_satom = PyArray_DIMS(py_multi)[0]; - - phpy_transform_dynmat_to_fc(fc, - dm, - comm_points, - svecs, - multi, - masses, - s2pp_map, - fc_index_map, - num_patom, - num_satom); - - Py_RETURN_NONE; -} - -static PyObject * py_compute_permutation(PyObject *self, PyObject *args) -{ - PyArrayObject* permutation; - PyArrayObject* lattice; - PyArrayObject* positions; - PyArrayObject* permuted_positions; - double symprec; - - int* rot_atoms; - double (*lat)[3]; - double (*pos)[3]; - double (*rot_pos)[3]; - int num_pos; - - int is_found; - - if (!PyArg_ParseTuple(args, "OOOOd", - &permutation, - &lattice, - &positions, - &permuted_positions, - &symprec)) { - return NULL; - } +static PyObject* py_transform_dynmat_to_fc(PyObject* self, PyObject* args) { + PyArrayObject* py_force_constants; + PyArrayObject* py_dynamical_matrices; + PyArrayObject* py_commensurate_points; + PyArrayObject* py_svecs; + PyArrayObject* py_multi; + PyArrayObject* py_masses; + PyArrayObject* py_s2pp_map; + PyArrayObject* py_fc_index_map; + + double* fc; + double* dm; + double(*comm_points)[3]; + double(*svecs)[3]; + double* masses; + long(*multi)[2]; + long* s2pp_map; + long* fc_index_map; + long num_patom; + long num_satom; + + if (!PyArg_ParseTuple(args, "OOOOOOOO", &py_force_constants, + &py_dynamical_matrices, &py_commensurate_points, + &py_svecs, &py_multi, &py_masses, &py_s2pp_map, + &py_fc_index_map)) { + return NULL; + } + + fc = (double*)PyArray_DATA(py_force_constants); + dm = (double*)PyArray_DATA(py_dynamical_matrices); + comm_points = (double(*)[3])PyArray_DATA(py_commensurate_points); + svecs = (double(*)[3])PyArray_DATA(py_svecs); + masses = (double*)PyArray_DATA(py_masses); + multi = (long(*)[2])PyArray_DATA(py_multi); + s2pp_map = (long*)PyArray_DATA(py_s2pp_map); + fc_index_map = (long*)PyArray_DATA(py_fc_index_map); + num_patom = PyArray_DIMS(py_multi)[1]; + num_satom = PyArray_DIMS(py_multi)[0]; + + phpy_transform_dynmat_to_fc(fc, dm, comm_points, svecs, multi, masses, + s2pp_map, fc_index_map, num_patom, num_satom); + + Py_RETURN_NONE; +} + +static PyObject* py_compute_permutation(PyObject* self, PyObject* args) { + PyArrayObject* permutation; + PyArrayObject* lattice; + PyArrayObject* positions; + PyArrayObject* permuted_positions; + double symprec; + + int* rot_atoms; + double(*lat)[3]; + double(*pos)[3]; + double(*rot_pos)[3]; + int num_pos; + + int is_found; + + if (!PyArg_ParseTuple(args, "OOOOd", &permutation, &lattice, &positions, + &permuted_positions, &symprec)) { + return NULL; + } + + rot_atoms = (int*)PyArray_DATA(permutation); + lat = (double(*)[3])PyArray_DATA(lattice); + pos = (double(*)[3])PyArray_DATA(positions); + rot_pos = (double(*)[3])PyArray_DATA(permuted_positions); + num_pos = PyArray_DIMS(positions)[0]; + + is_found = phpy_compute_permutation(rot_atoms, lat, pos, rot_pos, num_pos, + symprec); + + if (is_found) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +} + +static PyObject* py_gsv_set_smallest_vectors_sparse(PyObject* self, + PyObject* args) { + PyArrayObject* py_smallest_vectors; + PyArrayObject* py_multiplicity; + PyArrayObject* py_pos_to; + PyArrayObject* py_pos_from; + PyArrayObject* py_lattice_points; + PyArrayObject* py_reduced_basis; + PyArrayObject* py_trans_mat; + double symprec; + + double(*smallest_vectors)[27][3]; + int* multiplicity; + double(*pos_to)[3]; + double(*pos_from)[3]; + int(*lattice_points)[3]; + double(*reduced_basis)[3]; + int(*trans_mat)[3]; + int num_pos_to, num_pos_from, num_lattice_points; + + if (!PyArg_ParseTuple(args, "OOOOOOOd", &py_smallest_vectors, + &py_multiplicity, &py_pos_to, &py_pos_from, + &py_lattice_points, &py_reduced_basis, &py_trans_mat, + &symprec)) { + return NULL; + } + + smallest_vectors = (double(*)[27][3])PyArray_DATA(py_smallest_vectors); + multiplicity = (int*)PyArray_DATA(py_multiplicity); + pos_to = (double(*)[3])PyArray_DATA(py_pos_to); + pos_from = (double(*)[3])PyArray_DATA(py_pos_from); + num_pos_to = PyArray_DIMS(py_pos_to)[0]; + num_pos_from = PyArray_DIMS(py_pos_from)[0]; + lattice_points = (int(*)[3])PyArray_DATA(py_lattice_points); + num_lattice_points = PyArray_DIMS(py_lattice_points)[0]; + reduced_basis = (double(*)[3])PyArray_DATA(py_reduced_basis); + trans_mat = (int(*)[3])PyArray_DATA(py_trans_mat); + + phpy_set_smallest_vectors_sparse(smallest_vectors, multiplicity, pos_to, + num_pos_to, pos_from, num_pos_from, + lattice_points, num_lattice_points, + reduced_basis, trans_mat, symprec); + + Py_RETURN_NONE; +} + +static PyObject* py_gsv_set_smallest_vectors_dense(PyObject* self, + PyObject* args) { + PyArrayObject* py_smallest_vectors; + PyArrayObject* py_multiplicity; + PyArrayObject* py_pos_to; + PyArrayObject* py_pos_from; + PyArrayObject* py_lattice_points; + PyArrayObject* py_reduced_basis; + PyArrayObject* py_trans_mat; + long initialize; + double symprec; + + double(*smallest_vectors)[3]; + long(*multiplicity)[2]; + double(*pos_to)[3]; + double(*pos_from)[3]; + long(*lattice_points)[3]; + double(*reduced_basis)[3]; + long(*trans_mat)[3]; + long num_pos_to, num_pos_from, num_lattice_points; + + if (!PyArg_ParseTuple(args, "OOOOOOOld", &py_smallest_vectors, + &py_multiplicity, &py_pos_to, &py_pos_from, + &py_lattice_points, &py_reduced_basis, &py_trans_mat, + &initialize, &symprec)) { + return NULL; + } + + smallest_vectors = (double(*)[3])PyArray_DATA(py_smallest_vectors); + multiplicity = (long(*)[2])PyArray_DATA(py_multiplicity); + pos_to = (double(*)[3])PyArray_DATA(py_pos_to); + pos_from = (double(*)[3])PyArray_DATA(py_pos_from); + num_pos_to = PyArray_DIMS(py_pos_to)[0]; + num_pos_from = PyArray_DIMS(py_pos_from)[0]; + lattice_points = (long(*)[3])PyArray_DATA(py_lattice_points); + num_lattice_points = PyArray_DIMS(py_lattice_points)[0]; + reduced_basis = (double(*)[3])PyArray_DATA(py_reduced_basis); + trans_mat = (long(*)[3])PyArray_DATA(py_trans_mat); + + phpy_set_smallest_vectors_dense( + smallest_vectors, multiplicity, pos_to, num_pos_to, pos_from, + num_pos_from, lattice_points, num_lattice_points, reduced_basis, + trans_mat, initialize, symprec); + + Py_RETURN_NONE; +} + +static PyObject* py_perm_trans_symmetrize_fc(PyObject* self, PyObject* args) { + PyArrayObject* py_fc; + double* fc; + int level; + + int n_satom; + + if (!PyArg_ParseTuple(args, "Oi", &py_fc, &level)) { + return NULL; + } + + fc = (double*)PyArray_DATA(py_fc); + n_satom = PyArray_DIMS(py_fc)[0]; + + phpy_perm_trans_symmetrize_fc(fc, n_satom, level); + + Py_RETURN_NONE; +} + +static PyObject* py_perm_trans_symmetrize_compact_fc(PyObject* self, + PyObject* args) { + PyArrayObject* py_fc; + PyArrayObject* py_permutations; + PyArrayObject* py_s2pp_map; + PyArrayObject* py_p2s_map; + PyArrayObject* py_nsym_list; + int level; + double* fc; + int* perms; + int* s2pp; + int* p2s; + int* nsym_list; + + int n_patom, n_satom; + + if (!PyArg_ParseTuple(args, "OOOOOi", &py_fc, &py_permutations, + &py_s2pp_map, &py_p2s_map, &py_nsym_list, &level)) { + return NULL; + } + + fc = (double*)PyArray_DATA(py_fc); + perms = (int*)PyArray_DATA(py_permutations); + s2pp = (int*)PyArray_DATA(py_s2pp_map); + p2s = (int*)PyArray_DATA(py_p2s_map); + nsym_list = (int*)PyArray_DATA(py_nsym_list); + n_patom = PyArray_DIMS(py_fc)[0]; + n_satom = PyArray_DIMS(py_fc)[1]; + + phpy_perm_trans_symmetrize_compact_fc(fc, p2s, s2pp, nsym_list, perms, + n_satom, n_patom, level); + + Py_RETURN_NONE; +} + +static PyObject* py_transpose_compact_fc(PyObject* self, PyObject* args) { + PyArrayObject* py_fc; + PyArrayObject* py_permutations; + PyArrayObject* py_s2pp_map; + PyArrayObject* py_p2s_map; + PyArrayObject* py_nsym_list; + double* fc; + int* s2pp; + int* p2s; + int* nsym_list; + int* perms; + int n_patom, n_satom; + + if (!PyArg_ParseTuple(args, "OOOOO", &py_fc, &py_permutations, &py_s2pp_map, + &py_p2s_map, &py_nsym_list)) { + return NULL; + } + + fc = (double*)PyArray_DATA(py_fc); + perms = (int*)PyArray_DATA(py_permutations); + s2pp = (int*)PyArray_DATA(py_s2pp_map); + p2s = (int*)PyArray_DATA(py_p2s_map); + nsym_list = (int*)PyArray_DATA(py_nsym_list); + n_patom = PyArray_DIMS(py_fc)[0]; + n_satom = PyArray_DIMS(py_fc)[1]; + + phpy_set_index_permutation_symmetry_compact_fc(fc, p2s, s2pp, nsym_list, + perms, n_satom, n_patom, 1); + + Py_RETURN_NONE; +} + +static PyObject* py_get_dynamical_matrix(PyObject* self, PyObject* args) { + PyArrayObject* py_dynamical_matrix; + PyArrayObject* py_force_constants; + PyArrayObject* py_svecs; + PyArrayObject* py_q; + PyArrayObject* py_multi; + PyArrayObject* py_masses; + PyArrayObject* py_s2p_map; + PyArrayObject* py_p2s_map; + + double* dm; + double* fc; + double* q; + double(*svecs)[3]; + double* m; + long(*multi)[2]; + long* s2p_map; + long* p2s_map; + long num_patom; + long num_satom; + + if (!PyArg_ParseTuple(args, "OOOOOOOO", &py_dynamical_matrix, + &py_force_constants, &py_q, &py_svecs, &py_multi, + &py_masses, &py_s2p_map, &py_p2s_map)) { + return NULL; + } + + dm = (double*)PyArray_DATA(py_dynamical_matrix); + fc = (double*)PyArray_DATA(py_force_constants); + q = (double*)PyArray_DATA(py_q); + svecs = (double(*)[3])PyArray_DATA(py_svecs); + m = (double*)PyArray_DATA(py_masses); + multi = (long(*)[2])PyArray_DATA(py_multi); + s2p_map = (long*)PyArray_DATA(py_s2p_map); + p2s_map = (long*)PyArray_DATA(py_p2s_map); + num_patom = PyArray_DIMS(py_p2s_map)[0]; + num_satom = PyArray_DIMS(py_s2p_map)[0]; + + phpy_get_dynamical_matrix_at_q(dm, num_patom, num_satom, fc, q, svecs, + multi, m, s2p_map, p2s_map, NULL, 1); + + Py_RETURN_NONE; +} + +static PyObject* py_get_nac_dynamical_matrix(PyObject* self, PyObject* args) { + PyArrayObject* py_dynamical_matrix; + PyArrayObject* py_force_constants; + PyArrayObject* py_svecs; + PyArrayObject* py_q_cart; + PyArrayObject* py_q; + PyArrayObject* py_multi; + PyArrayObject* py_masses; + PyArrayObject* py_s2p_map; + PyArrayObject* py_p2s_map; + PyArrayObject* py_born; + double factor; + + double* dm; + double* fc; + double* q_cart; + double* q; + double(*svecs)[3]; + double* m; + double(*born)[3][3]; + long(*multi)[2]; + long* s2p_map; + long* p2s_map; + long num_patom; + long num_satom; + + long n; + double(*charge_sum)[3][3]; + + if (!PyArg_ParseTuple(args, "OOOOOOOOOOd", &py_dynamical_matrix, + &py_force_constants, &py_q, &py_svecs, &py_multi, + &py_masses, &py_s2p_map, &py_p2s_map, &py_q_cart, + &py_born, &factor)) + return NULL; + + dm = (double*)PyArray_DATA(py_dynamical_matrix); + fc = (double*)PyArray_DATA(py_force_constants); + q_cart = (double*)PyArray_DATA(py_q_cart); + q = (double*)PyArray_DATA(py_q); + svecs = (double(*)[3])PyArray_DATA(py_svecs); + m = (double*)PyArray_DATA(py_masses); + born = (double(*)[3][3])PyArray_DATA(py_born); + multi = (long(*)[2])PyArray_DATA(py_multi); + s2p_map = (long*)PyArray_DATA(py_s2p_map); + p2s_map = (long*)PyArray_DATA(py_p2s_map); + num_patom = PyArray_DIMS(py_p2s_map)[0]; + num_satom = PyArray_DIMS(py_s2p_map)[0]; + + charge_sum = + (double(*)[3][3])malloc(sizeof(double[3][3]) * num_patom * num_patom); + n = num_satom / num_patom; + + phpy_get_charge_sum(charge_sum, num_patom, factor / n, q_cart, born); + phpy_get_dynamical_matrix_at_q(dm, num_patom, num_satom, fc, q, svecs, + multi, m, s2p_map, p2s_map, charge_sum, 1); + + free(charge_sum); + + Py_RETURN_NONE; +} + +static PyObject* py_get_recip_dipole_dipole(PyObject* self, PyObject* args) { + PyArrayObject* py_dd; + PyArrayObject* py_dd_q0; + PyArrayObject* py_G_list; + PyArrayObject* py_q_cart; + PyArrayObject* py_q_direction; + PyArrayObject* py_born; + PyArrayObject* py_dielectric; + PyArrayObject* py_positions; + double factor; + double lambda; + double tolerance; + + double* dd; + double* dd_q0; + double(*G_list)[3]; + double* q_vector; + double* q_direction; + double(*born)[3][3]; + double(*dielectric)[3]; + double(*pos)[3]; + long num_patom, num_G; + + if (!PyArg_ParseTuple(args, "OOOOOOOOddd", &py_dd, &py_dd_q0, &py_G_list, + &py_q_cart, &py_q_direction, &py_born, &py_dielectric, + &py_positions, &factor, &lambda, &tolerance)) + return NULL; + + dd = (double*)PyArray_DATA(py_dd); + dd_q0 = (double*)PyArray_DATA(py_dd_q0); + G_list = (double(*)[3])PyArray_DATA(py_G_list); + if ((PyObject*)py_q_direction == Py_None) { + q_direction = NULL; + } else { + q_direction = (double*)PyArray_DATA(py_q_direction); + } + q_vector = (double*)PyArray_DATA(py_q_cart); + born = (double(*)[3][3])PyArray_DATA(py_born); + dielectric = (double(*)[3])PyArray_DATA(py_dielectric); + pos = (double(*)[3])PyArray_DATA(py_positions); + num_G = PyArray_DIMS(py_G_list)[0]; + num_patom = PyArray_DIMS(py_positions)[0]; + + phpy_get_recip_dipole_dipole(dd, /* [natom, 3, natom, 3, (real, imag)] */ + dd_q0, /* [natom, 3, 3, (real, imag)] */ + G_list, /* [num_kvec, 3] */ + num_G, num_patom, q_vector, q_direction, born, + dielectric, pos, /* [natom, 3] */ + factor, /* 4pi/V*unit-conv */ + lambda, /* 4 * Lambda^2 */ + tolerance); + + Py_RETURN_NONE; +} + +static PyObject* py_get_recip_dipole_dipole_q0(PyObject* self, PyObject* args) { + PyArrayObject* py_dd_q0; + PyArrayObject* py_G_list; + PyArrayObject* py_born; + PyArrayObject* py_dielectric; + PyArrayObject* py_positions; + double lambda; + double tolerance; + + double* dd_q0; + double(*G_list)[3]; + double(*born)[3][3]; + double(*dielectric)[3]; + double(*pos)[3]; + long num_patom, num_G; + + if (!PyArg_ParseTuple(args, "OOOOOdd", &py_dd_q0, &py_G_list, &py_born, + &py_dielectric, &py_positions, &lambda, &tolerance)) + return NULL; + + dd_q0 = (double*)PyArray_DATA(py_dd_q0); + G_list = (double(*)[3])PyArray_DATA(py_G_list); + born = (double(*)[3][3])PyArray_DATA(py_born); + dielectric = (double(*)[3])PyArray_DATA(py_dielectric); + pos = (double(*)[3])PyArray_DATA(py_positions); + num_G = PyArray_DIMS(py_G_list)[0]; + num_patom = PyArray_DIMS(py_positions)[0]; + + phpy_get_recip_dipole_dipole_q0(dd_q0, /* [natom, 3, 3, (real, imag)] */ + G_list, /* [num_kvec, 3] */ + num_G, num_patom, born, dielectric, + pos, /* [natom, 3] */ + lambda, /* 4 * Lambda^2 */ + tolerance); + + Py_RETURN_NONE; +} + +static PyObject* py_get_derivative_dynmat(PyObject* self, PyObject* args) { + PyArrayObject* py_derivative_dynmat; + PyArrayObject* py_force_constants; + PyArrayObject* py_svecs; + PyArrayObject* py_lattice; + PyArrayObject* py_q_vector; + PyArrayObject* py_multi; + PyArrayObject* py_masses; + PyArrayObject* py_s2p_map; + PyArrayObject* py_p2s_map; + PyArrayObject* py_born; + PyArrayObject* py_dielectric; + PyArrayObject* py_q_direction; + double nac_factor; + + double* ddm; + double* fc; + double* q_vector; + double* lat; + double(*svecs)[3]; + double* masses; + long(*multi)[2]; + long* s2p_map; + long* p2s_map; + long num_patom; + long num_satom; + + double* born; + double* epsilon; + double* q_dir; + + if (!PyArg_ParseTuple( + args, "OOOOOOOOOdOOO", &py_derivative_dynmat, &py_force_constants, + &py_q_vector, &py_lattice, /* column vectors */ + &py_svecs, &py_multi, &py_masses, &py_s2p_map, &py_p2s_map, + &nac_factor, &py_born, &py_dielectric, &py_q_direction)) { + return NULL; + } + + ddm = (double*)PyArray_DATA(py_derivative_dynmat); + fc = (double*)PyArray_DATA(py_force_constants); + q_vector = (double*)PyArray_DATA(py_q_vector); + lat = (double*)PyArray_DATA(py_lattice); + svecs = (double(*)[3])PyArray_DATA(py_svecs); + masses = (double*)PyArray_DATA(py_masses); + multi = (long(*)[2])PyArray_DATA(py_multi); + s2p_map = (long*)PyArray_DATA(py_s2p_map); + p2s_map = (long*)PyArray_DATA(py_p2s_map); + num_patom = PyArray_DIMS(py_p2s_map)[0]; + num_satom = PyArray_DIMS(py_s2p_map)[0]; + + if ((PyObject*)py_born == Py_None) { + born = NULL; + } else { + born = (double*)PyArray_DATA(py_born); + } + if ((PyObject*)py_dielectric == Py_None) { + epsilon = NULL; + } else { + epsilon = (double*)PyArray_DATA(py_dielectric); + } + if ((PyObject*)py_q_direction == Py_None) { + q_dir = NULL; + } else { + q_dir = (double*)PyArray_DATA(py_q_direction); + } + + phpy_get_derivative_dynmat_at_q(ddm, num_patom, num_satom, fc, q_vector, + lat, svecs, multi, masses, s2p_map, p2s_map, + nac_factor, born, epsilon, q_dir); - rot_atoms = (int*)PyArray_DATA(permutation); - lat = (double(*)[3])PyArray_DATA(lattice); - pos = (double(*)[3])PyArray_DATA(positions); - rot_pos = (double(*)[3])PyArray_DATA(permuted_positions); - num_pos = PyArray_DIMS(positions)[0]; - - is_found = phpy_compute_permutation(rot_atoms, - lat, - pos, - rot_pos, - num_pos, - symprec); - - if (is_found) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } -} - -static PyObject * -py_gsv_set_smallest_vectors_sparse(PyObject *self, PyObject *args) -{ - PyArrayObject* py_smallest_vectors; - PyArrayObject* py_multiplicity; - PyArrayObject* py_pos_to; - PyArrayObject* py_pos_from; - PyArrayObject* py_lattice_points; - PyArrayObject* py_reduced_basis; - PyArrayObject* py_trans_mat; - double symprec; - - double (*smallest_vectors)[27][3]; - int * multiplicity; - double (*pos_to)[3]; - double (*pos_from)[3]; - int (*lattice_points)[3]; - double (*reduced_basis)[3]; - int (*trans_mat)[3]; - int num_pos_to, num_pos_from, num_lattice_points; - - if (!PyArg_ParseTuple(args, "OOOOOOOd", - &py_smallest_vectors, - &py_multiplicity, - &py_pos_to, - &py_pos_from, - &py_lattice_points, - &py_reduced_basis, - &py_trans_mat, - &symprec)) { - return NULL; - } - - smallest_vectors = (double(*)[27][3])PyArray_DATA(py_smallest_vectors); - multiplicity = (int*)PyArray_DATA(py_multiplicity); - pos_to = (double(*)[3])PyArray_DATA(py_pos_to); - pos_from = (double(*)[3])PyArray_DATA(py_pos_from); - num_pos_to = PyArray_DIMS(py_pos_to)[0]; - num_pos_from = PyArray_DIMS(py_pos_from)[0]; - lattice_points = (int(*)[3])PyArray_DATA(py_lattice_points); - num_lattice_points = PyArray_DIMS(py_lattice_points)[0]; - reduced_basis = (double(*)[3])PyArray_DATA(py_reduced_basis); - trans_mat = (int(*)[3])PyArray_DATA(py_trans_mat); - - phpy_set_smallest_vectors_sparse(smallest_vectors, - multiplicity, - pos_to, - num_pos_to, - pos_from, - num_pos_from, - lattice_points, - num_lattice_points, - reduced_basis, - trans_mat, - symprec); - - Py_RETURN_NONE; -} - -static PyObject * -py_gsv_set_smallest_vectors_dense(PyObject *self, PyObject *args) -{ - PyArrayObject* py_smallest_vectors; - PyArrayObject* py_multiplicity; - PyArrayObject* py_pos_to; - PyArrayObject* py_pos_from; - PyArrayObject* py_lattice_points; - PyArrayObject* py_reduced_basis; - PyArrayObject* py_trans_mat; - long initialize; - double symprec; - - double (*smallest_vectors)[3]; - long (*multiplicity)[2]; - double (*pos_to)[3]; - double (*pos_from)[3]; - long (*lattice_points)[3]; - double (*reduced_basis)[3]; - long (*trans_mat)[3]; - long num_pos_to, num_pos_from, num_lattice_points; - - if (!PyArg_ParseTuple(args, "OOOOOOOld", - &py_smallest_vectors, - &py_multiplicity, - &py_pos_to, - &py_pos_from, - &py_lattice_points, - &py_reduced_basis, - &py_trans_mat, - &initialize, - &symprec)) { - return NULL; - } - - smallest_vectors = (double(*)[3])PyArray_DATA(py_smallest_vectors); - multiplicity = (long(*)[2])PyArray_DATA(py_multiplicity); - pos_to = (double(*)[3])PyArray_DATA(py_pos_to); - pos_from = (double(*)[3])PyArray_DATA(py_pos_from); - num_pos_to = PyArray_DIMS(py_pos_to)[0]; - num_pos_from = PyArray_DIMS(py_pos_from)[0]; - lattice_points = (long(*)[3])PyArray_DATA(py_lattice_points); - num_lattice_points = PyArray_DIMS(py_lattice_points)[0]; - reduced_basis = (double(*)[3])PyArray_DATA(py_reduced_basis); - trans_mat = (long(*)[3])PyArray_DATA(py_trans_mat); - - phpy_set_smallest_vectors_dense(smallest_vectors, - multiplicity, - pos_to, - num_pos_to, - pos_from, - num_pos_from, - lattice_points, - num_lattice_points, - reduced_basis, - trans_mat, - initialize, - symprec); - - Py_RETURN_NONE; -} - -static PyObject * py_perm_trans_symmetrize_fc(PyObject *self, PyObject *args) -{ - PyArrayObject* py_fc; - double *fc; - int level; - - int n_satom; - - if (!PyArg_ParseTuple(args, "Oi", &py_fc, &level)) { - return NULL; - } - - fc = (double*)PyArray_DATA(py_fc); - n_satom = PyArray_DIMS(py_fc)[0]; - - phpy_perm_trans_symmetrize_fc(fc, n_satom, level); - - Py_RETURN_NONE; -} - -static PyObject * -py_perm_trans_symmetrize_compact_fc(PyObject *self, PyObject *args) -{ - PyArrayObject* py_fc; - PyArrayObject* py_permutations; - PyArrayObject* py_s2pp_map; - PyArrayObject* py_p2s_map; - PyArrayObject* py_nsym_list; - int level; - double *fc; - int *perms; - int *s2pp; - int *p2s; - int *nsym_list; - - int n_patom, n_satom; - - if (!PyArg_ParseTuple(args, "OOOOOi", - &py_fc, - &py_permutations, - &py_s2pp_map, - &py_p2s_map, - &py_nsym_list, - &level)) { - return NULL; - } - - fc = (double*)PyArray_DATA(py_fc); - perms = (int*)PyArray_DATA(py_permutations); - s2pp = (int*)PyArray_DATA(py_s2pp_map); - p2s = (int*)PyArray_DATA(py_p2s_map); - nsym_list = (int*)PyArray_DATA(py_nsym_list); - n_patom = PyArray_DIMS(py_fc)[0]; - n_satom = PyArray_DIMS(py_fc)[1]; - - phpy_perm_trans_symmetrize_compact_fc( - fc, p2s, s2pp, nsym_list, perms, n_satom, n_patom, level); - - Py_RETURN_NONE; -} - -static PyObject * py_transpose_compact_fc(PyObject *self, PyObject *args) -{ - PyArrayObject* py_fc; - PyArrayObject* py_permutations; - PyArrayObject* py_s2pp_map; - PyArrayObject* py_p2s_map; - PyArrayObject* py_nsym_list; - double *fc; - int *s2pp; - int *p2s; - int *nsym_list; - int *perms; - int n_patom, n_satom; - - if (!PyArg_ParseTuple(args, "OOOOO", - &py_fc, - &py_permutations, - &py_s2pp_map, - &py_p2s_map, - &py_nsym_list)) { - return NULL; - } - - fc = (double*)PyArray_DATA(py_fc); - perms = (int*)PyArray_DATA(py_permutations); - s2pp = (int*)PyArray_DATA(py_s2pp_map); - p2s = (int*)PyArray_DATA(py_p2s_map); - nsym_list = (int*)PyArray_DATA(py_nsym_list); - n_patom = PyArray_DIMS(py_fc)[0]; - n_satom = PyArray_DIMS(py_fc)[1]; - - phpy_set_index_permutation_symmetry_compact_fc(fc, - p2s, - s2pp, - nsym_list, - perms, - n_satom, - n_patom, - 1); - - Py_RETURN_NONE; -} - -static PyObject * py_get_dynamical_matrix(PyObject *self, PyObject *args) -{ - PyArrayObject* py_dynamical_matrix; - PyArrayObject* py_force_constants; - PyArrayObject* py_svecs; - PyArrayObject* py_q; - PyArrayObject* py_multi; - PyArrayObject* py_masses; - PyArrayObject* py_s2p_map; - PyArrayObject* py_p2s_map; - - double* dm; - double* fc; - double* q; - double (*svecs)[3]; - double* m; - long (*multi)[2]; - long* s2p_map; - long* p2s_map; - long num_patom; - long num_satom; - - if (!PyArg_ParseTuple(args, "OOOOOOOO", - &py_dynamical_matrix, - &py_force_constants, - &py_q, - &py_svecs, - &py_multi, - &py_masses, - &py_s2p_map, - &py_p2s_map)) { - return NULL; - } - - dm = (double*)PyArray_DATA(py_dynamical_matrix); - fc = (double*)PyArray_DATA(py_force_constants); - q = (double*)PyArray_DATA(py_q); - svecs = (double(*)[3])PyArray_DATA(py_svecs); - m = (double*)PyArray_DATA(py_masses); - multi = (long(*)[2])PyArray_DATA(py_multi); - s2p_map = (long*)PyArray_DATA(py_s2p_map); - p2s_map = (long*)PyArray_DATA(py_p2s_map); - num_patom = PyArray_DIMS(py_p2s_map)[0]; - num_satom = PyArray_DIMS(py_s2p_map)[0]; - - phpy_get_dynamical_matrix_at_q(dm, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - m, - s2p_map, - p2s_map, - NULL, - 1); - - Py_RETURN_NONE; -} - - -static PyObject * py_get_nac_dynamical_matrix(PyObject *self, PyObject *args) -{ - PyArrayObject* py_dynamical_matrix; - PyArrayObject* py_force_constants; - PyArrayObject* py_svecs; - PyArrayObject* py_q_cart; - PyArrayObject* py_q; - PyArrayObject* py_multi; - PyArrayObject* py_masses; - PyArrayObject* py_s2p_map; - PyArrayObject* py_p2s_map; - PyArrayObject* py_born; - double factor; - - double* dm; - double* fc; - double* q_cart; - double* q; - double (*svecs)[3]; - double* m; - double (*born)[3][3]; - long (*multi)[2]; - long* s2p_map; - long* p2s_map; - long num_patom; - long num_satom; - - long n; - double (*charge_sum)[3][3]; - - if (!PyArg_ParseTuple(args, "OOOOOOOOOOd", - &py_dynamical_matrix, - &py_force_constants, - &py_q, - &py_svecs, - &py_multi, - &py_masses, - &py_s2p_map, - &py_p2s_map, - &py_q_cart, - &py_born, - &factor)) - return NULL; - - dm = (double*)PyArray_DATA(py_dynamical_matrix); - fc = (double*)PyArray_DATA(py_force_constants); - q_cart = (double*)PyArray_DATA(py_q_cart); - q = (double*)PyArray_DATA(py_q); - svecs = (double(*)[3])PyArray_DATA(py_svecs); - m = (double*)PyArray_DATA(py_masses); - born = (double(*)[3][3])PyArray_DATA(py_born); - multi = (long(*)[2])PyArray_DATA(py_multi); - s2p_map = (long*)PyArray_DATA(py_s2p_map); - p2s_map = (long*)PyArray_DATA(py_p2s_map); - num_patom = PyArray_DIMS(py_p2s_map)[0]; - num_satom = PyArray_DIMS(py_s2p_map)[0]; - - charge_sum = (double(*)[3][3]) - malloc(sizeof(double[3][3]) * num_patom * num_patom); - n = num_satom / num_patom; - - phpy_get_charge_sum(charge_sum, num_patom, factor / n, q_cart, born); - phpy_get_dynamical_matrix_at_q(dm, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - m, - s2p_map, - p2s_map, - charge_sum, - 1); - - free(charge_sum); - - Py_RETURN_NONE; -} - -static PyObject * py_get_recip_dipole_dipole(PyObject *self, PyObject *args) -{ - PyArrayObject* py_dd; - PyArrayObject* py_dd_q0; - PyArrayObject* py_G_list; - PyArrayObject* py_q_cart; - PyArrayObject* py_q_direction; - PyArrayObject* py_born; - PyArrayObject* py_dielectric; - PyArrayObject* py_positions; - double factor; - double lambda; - double tolerance; - - double* dd; - double* dd_q0; - double (*G_list)[3]; - double* q_vector; - double* q_direction; - double (*born)[3][3]; - double (*dielectric)[3]; - double (*pos)[3]; - long num_patom, num_G; - - if (!PyArg_ParseTuple(args, "OOOOOOOOddd", - &py_dd, - &py_dd_q0, - &py_G_list, - &py_q_cart, - &py_q_direction, - &py_born, - &py_dielectric, - &py_positions, - &factor, - &lambda, - &tolerance)) - return NULL; - - - dd = (double*)PyArray_DATA(py_dd); - dd_q0 = (double*)PyArray_DATA(py_dd_q0); - G_list = (double(*)[3])PyArray_DATA(py_G_list); - if ((PyObject*)py_q_direction == Py_None) { - q_direction = NULL; - } else { - q_direction = (double*)PyArray_DATA(py_q_direction); - } - q_vector = (double*)PyArray_DATA(py_q_cart); - born = (double(*)[3][3])PyArray_DATA(py_born); - dielectric = (double(*)[3])PyArray_DATA(py_dielectric); - pos = (double(*)[3])PyArray_DATA(py_positions); - num_G = PyArray_DIMS(py_G_list)[0]; - num_patom = PyArray_DIMS(py_positions)[0]; - - phpy_get_recip_dipole_dipole(dd, /* [natom, 3, natom, 3, (real, imag)] */ - dd_q0, /* [natom, 3, 3, (real, imag)] */ - G_list, /* [num_kvec, 3] */ - num_G, - num_patom, - q_vector, - q_direction, - born, - dielectric, - pos, /* [natom, 3] */ - factor, /* 4pi/V*unit-conv */ - lambda, /* 4 * Lambda^2 */ - tolerance); - - Py_RETURN_NONE; -} - -static PyObject * py_get_recip_dipole_dipole_q0(PyObject *self, PyObject *args) -{ - PyArrayObject* py_dd_q0; - PyArrayObject* py_G_list; - PyArrayObject* py_born; - PyArrayObject* py_dielectric; - PyArrayObject* py_positions; - double lambda; - double tolerance; - - double* dd_q0; - double (*G_list)[3]; - double (*born)[3][3]; - double (*dielectric)[3]; - double (*pos)[3]; - long num_patom, num_G; - - if (!PyArg_ParseTuple(args, "OOOOOdd", - &py_dd_q0, - &py_G_list, - &py_born, - &py_dielectric, - &py_positions, - &lambda, - &tolerance)) - return NULL; - - - dd_q0 = (double*)PyArray_DATA(py_dd_q0); - G_list = (double(*)[3])PyArray_DATA(py_G_list); - born = (double(*)[3][3])PyArray_DATA(py_born); - dielectric = (double(*)[3])PyArray_DATA(py_dielectric); - pos = (double(*)[3])PyArray_DATA(py_positions); - num_G = PyArray_DIMS(py_G_list)[0]; - num_patom = PyArray_DIMS(py_positions)[0]; - - phpy_get_recip_dipole_dipole_q0(dd_q0, /* [natom, 3, 3, (real, imag)] */ - G_list, /* [num_kvec, 3] */ - num_G, - num_patom, - born, - dielectric, - pos, /* [natom, 3] */ - lambda, /* 4 * Lambda^2 */ - tolerance); - - Py_RETURN_NONE; -} - -static PyObject * py_get_derivative_dynmat(PyObject *self, PyObject *args) -{ - PyArrayObject* py_derivative_dynmat; - PyArrayObject* py_force_constants; - PyArrayObject* py_svecs; - PyArrayObject* py_lattice; - PyArrayObject* py_q_vector; - PyArrayObject* py_multi; - PyArrayObject* py_masses; - PyArrayObject* py_s2p_map; - PyArrayObject* py_p2s_map; - PyArrayObject* py_born; - PyArrayObject* py_dielectric; - PyArrayObject* py_q_direction; - double nac_factor; - - double* ddm; - double* fc; - double* q_vector; - double* lat; - double (*svecs)[3]; - double* masses; - long (*multi)[2]; - long* s2p_map; - long* p2s_map; - long num_patom; - long num_satom; - - double *born; - double *epsilon; - double *q_dir; - - if (!PyArg_ParseTuple(args, "OOOOOOOOOdOOO", - &py_derivative_dynmat, - &py_force_constants, - &py_q_vector, - &py_lattice, /* column vectors */ - &py_svecs, - &py_multi, - &py_masses, - &py_s2p_map, - &py_p2s_map, - &nac_factor, - &py_born, - &py_dielectric, - &py_q_direction)) { - return NULL; - } - - ddm = (double*)PyArray_DATA(py_derivative_dynmat); - fc = (double*)PyArray_DATA(py_force_constants); - q_vector = (double*)PyArray_DATA(py_q_vector); - lat = (double*)PyArray_DATA(py_lattice); - svecs = (double(*)[3])PyArray_DATA(py_svecs); - masses = (double*)PyArray_DATA(py_masses); - multi = (long(*)[2])PyArray_DATA(py_multi); - s2p_map = (long*)PyArray_DATA(py_s2p_map); - p2s_map = (long*)PyArray_DATA(py_p2s_map); - num_patom = PyArray_DIMS(py_p2s_map)[0]; - num_satom = PyArray_DIMS(py_s2p_map)[0]; - - if ((PyObject*)py_born == Py_None) { - born = NULL; - } else { - born = (double*)PyArray_DATA(py_born); - } - if ((PyObject*)py_dielectric == Py_None) { - epsilon = NULL; - } else { - epsilon = (double*)PyArray_DATA(py_dielectric); - } - if ((PyObject*)py_q_direction == Py_None) { - q_dir = NULL; - } else { - q_dir = (double*)PyArray_DATA(py_q_direction); - } - - phpy_get_derivative_dynmat_at_q(ddm, - num_patom, - num_satom, - fc, - q_vector, - lat, - svecs, - multi, - masses, - s2p_map, - p2s_map, - nac_factor, - born, - epsilon, - q_dir); - - Py_RETURN_NONE; + Py_RETURN_NONE; } /* Thermal properties */ -static PyObject * py_get_thermal_properties(PyObject *self, PyObject *args) -{ - PyArrayObject* py_thermal_props; - PyArrayObject* py_temperatures; - PyArrayObject* py_frequencies; - PyArrayObject* py_weights; - - double cutoff_frequency; - - double *temperatures; - double* freqs; - double *thermal_props; - long* weights; - long num_qpoints; - long num_bands; - long num_temp; - - if (!PyArg_ParseTuple(args, "OOOOd", - &py_thermal_props, - &py_temperatures, - &py_frequencies, - &py_weights, - &cutoff_frequency)) { - return NULL; - } - - thermal_props = (double*)PyArray_DATA(py_thermal_props); - temperatures = (double*)PyArray_DATA(py_temperatures); - num_temp = (long)PyArray_DIMS(py_temperatures)[0]; - freqs = (double*)PyArray_DATA(py_frequencies); - num_qpoints = (long)PyArray_DIMS(py_frequencies)[0]; - weights = (long*)PyArray_DATA(py_weights); - num_bands = (long)PyArray_DIMS(py_frequencies)[1]; - - phpy_get_thermal_properties(thermal_props, - temperatures, - freqs, - weights, - num_temp, - num_qpoints, - num_bands, - cutoff_frequency); - - Py_RETURN_NONE; -} - -static PyObject * py_distribute_fc2(PyObject *self, PyObject *args) -{ - PyArrayObject* py_force_constants; - PyArrayObject* py_permutations; - PyArrayObject* py_map_atoms; - PyArrayObject* py_map_syms; - PyArrayObject* py_atom_list; - PyArrayObject* py_rotations_cart; - - double (*r_carts)[3][3]; - double (*fc2)[3][3]; - int *permutations; - int *map_atoms; - int *map_syms; - int *atom_list; - npy_intp num_pos, num_rot, len_atom_list; - - if (!PyArg_ParseTuple(args, "OOOOOO", - &py_force_constants, - &py_atom_list, - &py_rotations_cart, - &py_permutations, - &py_map_atoms, - &py_map_syms)) { - return NULL; - } - - fc2 = (double(*)[3][3])PyArray_DATA(py_force_constants); - atom_list = (int*)PyArray_DATA(py_atom_list); - len_atom_list = PyArray_DIMS(py_atom_list)[0]; - permutations = (int*)PyArray_DATA(py_permutations); - map_atoms = (int*)PyArray_DATA(py_map_atoms); - map_syms = (int*)PyArray_DATA(py_map_syms); - r_carts = (double(*)[3][3])PyArray_DATA(py_rotations_cart); - num_rot = PyArray_DIMS(py_permutations)[0]; - num_pos = PyArray_DIMS(py_permutations)[1]; - - if (PyArray_NDIM(py_map_atoms) != 1 || PyArray_DIMS(py_map_atoms)[0] != num_pos) - { - PyErr_SetString(PyExc_ValueError, "wrong shape for map_atoms"); - return NULL; - } - - if (PyArray_NDIM(py_map_syms) != 1 || PyArray_DIMS(py_map_syms)[0] != num_pos) - { - PyErr_SetString(PyExc_ValueError, "wrong shape for map_syms"); - return NULL; - } - - if (PyArray_DIMS(py_rotations_cart)[0] != num_rot) - { - PyErr_SetString(PyExc_ValueError, "permutations and rotations are different length"); - return NULL; - } - - phpy_distribute_fc2(fc2, - atom_list, - len_atom_list, - r_carts, - permutations, - map_atoms, - map_syms, - num_rot, - num_pos); - Py_RETURN_NONE; -} - - -static PyObject * -py_thm_relative_grid_address(PyObject *self, PyObject *args) -{ - PyArrayObject* py_relative_grid_address; - PyArrayObject* py_reciprocal_lattice_py; - - long (*relative_grid_address)[4][3]; - double (*reciprocal_lattice)[3]; - - if (!PyArg_ParseTuple(args, "OO", - &py_relative_grid_address, - &py_reciprocal_lattice_py)) { - return NULL; - } - - relative_grid_address = (long(*)[4][3])PyArray_DATA(py_relative_grid_address); - reciprocal_lattice = (double(*)[3])PyArray_DATA(py_reciprocal_lattice_py); - - phpy_get_relative_grid_address(relative_grid_address, reciprocal_lattice); - - Py_RETURN_NONE; -} - -static PyObject * -py_thm_all_relative_grid_address(PyObject *self, PyObject *args) -{ - PyArrayObject* py_relative_grid_address; - - long (*relative_grid_address)[24][4][3]; - - if (!PyArg_ParseTuple(args, "O", - &py_relative_grid_address)) { - return NULL; - } - - relative_grid_address = - (long(*)[24][4][3])PyArray_DATA(py_relative_grid_address); - - phpy_get_all_relative_grid_address(relative_grid_address); - - Py_RETURN_NONE; -} - -static PyObject * -py_thm_integration_weight(PyObject *self, PyObject *args) -{ - double omega; - PyArrayObject* py_tetrahedra_omegas; - char* function; - - double (*tetrahedra_omegas)[4]; - double iw; - - if (!PyArg_ParseTuple(args, "dOs", - &omega, - &py_tetrahedra_omegas, - &function)) { - return NULL; - } - - tetrahedra_omegas = (double(*)[4])PyArray_DATA(py_tetrahedra_omegas); - - iw = phpy_get_integration_weight(omega, - tetrahedra_omegas, - function[0]); - - return PyFloat_FromDouble(iw); -} - -static PyObject * -py_thm_integration_weight_at_omegas(PyObject *self, PyObject *args) -{ - PyArrayObject* py_integration_weights; - PyArrayObject* py_omegas; - PyArrayObject* py_tetrahedra_omegas; - char* function; - - double *omegas; - double *iw; - long num_omegas; - double (*tetrahedra_omegas)[4]; - - long i; - - if (!PyArg_ParseTuple(args, "OOOs", - &py_integration_weights, - &py_omegas, - &py_tetrahedra_omegas, - &function)) { - return NULL; - } - - omegas = (double*)PyArray_DATA(py_omegas); - iw = (double*)PyArray_DATA(py_integration_weights); - num_omegas = (long)PyArray_DIMS(py_omegas)[0]; - tetrahedra_omegas = (double(*)[4])PyArray_DATA(py_tetrahedra_omegas); +static PyObject* py_get_thermal_properties(PyObject* self, PyObject* args) { + PyArrayObject* py_thermal_props; + PyArrayObject* py_temperatures; + PyArrayObject* py_frequencies; + PyArrayObject* py_weights; + + double cutoff_frequency; + + double* temperatures; + double* freqs; + double* thermal_props; + long* weights; + long num_qpoints; + long num_bands; + long num_temp; + + if (!PyArg_ParseTuple(args, "OOOOd", &py_thermal_props, &py_temperatures, + &py_frequencies, &py_weights, &cutoff_frequency)) { + return NULL; + } + + thermal_props = (double*)PyArray_DATA(py_thermal_props); + temperatures = (double*)PyArray_DATA(py_temperatures); + num_temp = (long)PyArray_DIMS(py_temperatures)[0]; + freqs = (double*)PyArray_DATA(py_frequencies); + num_qpoints = (long)PyArray_DIMS(py_frequencies)[0]; + weights = (long*)PyArray_DATA(py_weights); + num_bands = (long)PyArray_DIMS(py_frequencies)[1]; + + phpy_get_thermal_properties(thermal_props, temperatures, freqs, weights, + num_temp, num_qpoints, num_bands, + cutoff_frequency); + + Py_RETURN_NONE; +} + +static PyObject* py_distribute_fc2(PyObject* self, PyObject* args) { + PyArrayObject* py_force_constants; + PyArrayObject* py_permutations; + PyArrayObject* py_map_atoms; + PyArrayObject* py_map_syms; + PyArrayObject* py_atom_list; + PyArrayObject* py_rotations_cart; + + double(*r_carts)[3][3]; + double(*fc2)[3][3]; + int* permutations; + int* map_atoms; + int* map_syms; + int* atom_list; + npy_intp num_pos, num_rot, len_atom_list; + + if (!PyArg_ParseTuple(args, "OOOOOO", &py_force_constants, &py_atom_list, + &py_rotations_cart, &py_permutations, &py_map_atoms, + &py_map_syms)) { + return NULL; + } + + fc2 = (double(*)[3][3])PyArray_DATA(py_force_constants); + atom_list = (int*)PyArray_DATA(py_atom_list); + len_atom_list = PyArray_DIMS(py_atom_list)[0]; + permutations = (int*)PyArray_DATA(py_permutations); + map_atoms = (int*)PyArray_DATA(py_map_atoms); + map_syms = (int*)PyArray_DATA(py_map_syms); + r_carts = (double(*)[3][3])PyArray_DATA(py_rotations_cart); + num_rot = PyArray_DIMS(py_permutations)[0]; + num_pos = PyArray_DIMS(py_permutations)[1]; + + if (PyArray_NDIM(py_map_atoms) != 1 || + PyArray_DIMS(py_map_atoms)[0] != num_pos) { + PyErr_SetString(PyExc_ValueError, "wrong shape for map_atoms"); + return NULL; + } + + if (PyArray_NDIM(py_map_syms) != 1 || + PyArray_DIMS(py_map_syms)[0] != num_pos) { + PyErr_SetString(PyExc_ValueError, "wrong shape for map_syms"); + return NULL; + } + + if (PyArray_DIMS(py_rotations_cart)[0] != num_rot) { + PyErr_SetString(PyExc_ValueError, + "permutations and rotations are different length"); + return NULL; + } + + phpy_distribute_fc2(fc2, atom_list, len_atom_list, r_carts, permutations, + map_atoms, map_syms, num_rot, num_pos); + Py_RETURN_NONE; +} + +static PyObject* py_thm_relative_grid_address(PyObject* self, PyObject* args) { + PyArrayObject* py_relative_grid_address; + PyArrayObject* py_reciprocal_lattice_py; + + long(*relative_grid_address)[4][3]; + double(*reciprocal_lattice)[3]; + + if (!PyArg_ParseTuple(args, "OO", &py_relative_grid_address, + &py_reciprocal_lattice_py)) { + return NULL; + } + + relative_grid_address = + (long(*)[4][3])PyArray_DATA(py_relative_grid_address); + reciprocal_lattice = (double(*)[3])PyArray_DATA(py_reciprocal_lattice_py); + + phpy_get_relative_grid_address(relative_grid_address, reciprocal_lattice); + + Py_RETURN_NONE; +} + +static PyObject* py_thm_all_relative_grid_address(PyObject* self, + PyObject* args) { + PyArrayObject* py_relative_grid_address; + + long(*relative_grid_address)[24][4][3]; + + if (!PyArg_ParseTuple(args, "O", &py_relative_grid_address)) { + return NULL; + } + + relative_grid_address = + (long(*)[24][4][3])PyArray_DATA(py_relative_grid_address); + + phpy_get_all_relative_grid_address(relative_grid_address); + + Py_RETURN_NONE; +} + +static PyObject* py_thm_integration_weight(PyObject* self, PyObject* args) { + double omega; + PyArrayObject* py_tetrahedra_omegas; + char* function; + + double(*tetrahedra_omegas)[4]; + double iw; + + if (!PyArg_ParseTuple(args, "dOs", &omega, &py_tetrahedra_omegas, + &function)) { + return NULL; + } + + tetrahedra_omegas = (double(*)[4])PyArray_DATA(py_tetrahedra_omegas); + + iw = phpy_get_integration_weight(omega, tetrahedra_omegas, function[0]); + + return PyFloat_FromDouble(iw); +} + +static PyObject* py_thm_integration_weight_at_omegas(PyObject* self, + PyObject* args) { + PyArrayObject* py_integration_weights; + PyArrayObject* py_omegas; + PyArrayObject* py_tetrahedra_omegas; + char* function; + + double* omegas; + double* iw; + long num_omegas; + double(*tetrahedra_omegas)[4]; + + long i; + + if (!PyArg_ParseTuple(args, "OOOs", &py_integration_weights, &py_omegas, + &py_tetrahedra_omegas, &function)) { + return NULL; + } + + omegas = (double*)PyArray_DATA(py_omegas); + iw = (double*)PyArray_DATA(py_integration_weights); + num_omegas = (long)PyArray_DIMS(py_omegas)[0]; + tetrahedra_omegas = (double(*)[4])PyArray_DATA(py_tetrahedra_omegas); #pragma omp parallel for - for (i = 0; i < num_omegas; i++) { - iw[i] = phpy_get_integration_weight(omegas[i], - tetrahedra_omegas, - function[0]); - } - - Py_RETURN_NONE; -} - -static PyObject * py_get_tetrahedra_frequenies(PyObject *self, PyObject *args) -{ - PyArrayObject* py_freq_tetras; - PyArrayObject* py_grid_points; - PyArrayObject* py_mesh; - PyArrayObject* py_grid_address; - PyArrayObject* py_gp_ir_index; - PyArrayObject* py_relative_grid_address; - PyArrayObject* py_frequencies; - - double* freq_tetras; - long* grid_points; - long* mesh; - long (*grid_address)[3]; - long* gp_ir_index; - long (*relative_grid_address)[3]; - double* frequencies; - - long num_gp_in, num_band; - - if (!PyArg_ParseTuple(args, "OOOOOOO", - &py_freq_tetras, - &py_grid_points, - &py_mesh, - &py_grid_address, - &py_gp_ir_index, - &py_relative_grid_address, - &py_frequencies)) { - return NULL; - } - - freq_tetras = (double*)PyArray_DATA(py_freq_tetras); - grid_points = (long*)PyArray_DATA(py_grid_points); - num_gp_in = PyArray_DIMS(py_grid_points)[0]; - mesh = (long*)PyArray_DATA(py_mesh); - grid_address = (long(*)[3])PyArray_DATA(py_grid_address); - gp_ir_index = (long*)PyArray_DATA(py_gp_ir_index); - relative_grid_address = (long(*)[3])PyArray_DATA(py_relative_grid_address); - frequencies = (double*)PyArray_DATA(py_frequencies); - num_band = PyArray_DIMS(py_frequencies)[1]; - - phpy_get_tetrahedra_frequenies(freq_tetras, - mesh, - grid_points, - grid_address, - relative_grid_address, - gp_ir_index, - frequencies, - num_band, - num_gp_in); - - Py_RETURN_NONE; -} - -static PyObject * py_tetrahedron_method_dos(PyObject *self, PyObject *args) -{ - PyArrayObject* py_dos; - PyArrayObject* py_mesh; - PyArrayObject* py_freq_points; - PyArrayObject* py_frequencies; - PyArrayObject* py_coef; - PyArrayObject* py_grid_address; - PyArrayObject* py_grid_mapping_table; - PyArrayObject* py_relative_grid_address; - - double *dos; - long* mesh; - double* freq_points; - double* frequencies; - double* coef; - long (*grid_address)[3]; - long num_gp, num_ir_gp, num_band, num_freq_points, num_coef; - long *grid_mapping_table; - long (*relative_grid_address)[4][3]; - - if (!PyArg_ParseTuple(args, "OOOOOOOO", - &py_dos, - &py_mesh, - &py_freq_points, - &py_frequencies, - &py_coef, - &py_grid_address, - &py_grid_mapping_table, - &py_relative_grid_address)) { - return NULL; - } - - /* dos[num_ir_gp][num_band][num_freq_points][num_coef] */ - dos = (double*)PyArray_DATA(py_dos); - mesh = (long*)PyArray_DATA(py_mesh); - freq_points = (double*)PyArray_DATA(py_freq_points); - num_freq_points = (long)PyArray_DIMS(py_freq_points)[0]; - frequencies = (double*)PyArray_DATA(py_frequencies); - num_ir_gp = (long)PyArray_DIMS(py_frequencies)[0]; - num_band = (long)PyArray_DIMS(py_frequencies)[1]; - coef = (double*)PyArray_DATA(py_coef); - num_coef = (long)PyArray_DIMS(py_coef)[1]; - grid_address = (long(*)[3])PyArray_DATA(py_grid_address); - num_gp = (long)PyArray_DIMS(py_grid_address)[0]; - grid_mapping_table = (long*)PyArray_DATA(py_grid_mapping_table); - relative_grid_address = (long(*)[4][3])PyArray_DATA(py_relative_grid_address); - - phpy_tetrahedron_method_dos(dos, - mesh, - grid_address, - relative_grid_address, - grid_mapping_table, - freq_points, - frequencies, - coef, - num_freq_points, - num_ir_gp, - num_band, - num_coef, - num_gp); + for (i = 0; i < num_omegas; i++) { + iw[i] = phpy_get_integration_weight(omegas[i], tetrahedra_omegas, + function[0]); + } + + Py_RETURN_NONE; +} + +static PyObject* py_get_tetrahedra_frequenies(PyObject* self, PyObject* args) { + PyArrayObject* py_freq_tetras; + PyArrayObject* py_grid_points; + PyArrayObject* py_mesh; + PyArrayObject* py_grid_address; + PyArrayObject* py_gp_ir_index; + PyArrayObject* py_relative_grid_address; + PyArrayObject* py_frequencies; + + double* freq_tetras; + long* grid_points; + long* mesh; + long(*grid_address)[3]; + long* gp_ir_index; + long(*relative_grid_address)[3]; + double* frequencies; + + long num_gp_in, num_band; + + if (!PyArg_ParseTuple(args, "OOOOOOO", &py_freq_tetras, &py_grid_points, + &py_mesh, &py_grid_address, &py_gp_ir_index, + &py_relative_grid_address, &py_frequencies)) { + return NULL; + } + + freq_tetras = (double*)PyArray_DATA(py_freq_tetras); + grid_points = (long*)PyArray_DATA(py_grid_points); + num_gp_in = PyArray_DIMS(py_grid_points)[0]; + mesh = (long*)PyArray_DATA(py_mesh); + grid_address = (long(*)[3])PyArray_DATA(py_grid_address); + gp_ir_index = (long*)PyArray_DATA(py_gp_ir_index); + relative_grid_address = (long(*)[3])PyArray_DATA(py_relative_grid_address); + frequencies = (double*)PyArray_DATA(py_frequencies); + num_band = PyArray_DIMS(py_frequencies)[1]; + + phpy_get_tetrahedra_frequenies(freq_tetras, mesh, grid_points, grid_address, + relative_grid_address, gp_ir_index, + frequencies, num_band, num_gp_in); + + Py_RETURN_NONE; +} + +static PyObject* py_tetrahedron_method_dos(PyObject* self, PyObject* args) { + PyArrayObject* py_dos; + PyArrayObject* py_mesh; + PyArrayObject* py_freq_points; + PyArrayObject* py_frequencies; + PyArrayObject* py_coef; + PyArrayObject* py_grid_address; + PyArrayObject* py_grid_mapping_table; + PyArrayObject* py_relative_grid_address; + + double* dos; + long* mesh; + double* freq_points; + double* frequencies; + double* coef; + long(*grid_address)[3]; + long num_gp, num_ir_gp, num_band, num_freq_points, num_coef; + long* grid_mapping_table; + long(*relative_grid_address)[4][3]; + + if (!PyArg_ParseTuple(args, "OOOOOOOO", &py_dos, &py_mesh, &py_freq_points, + &py_frequencies, &py_coef, &py_grid_address, + &py_grid_mapping_table, &py_relative_grid_address)) { + return NULL; + } + + /* dos[num_ir_gp][num_band][num_freq_points][num_coef] */ + dos = (double*)PyArray_DATA(py_dos); + mesh = (long*)PyArray_DATA(py_mesh); + freq_points = (double*)PyArray_DATA(py_freq_points); + num_freq_points = (long)PyArray_DIMS(py_freq_points)[0]; + frequencies = (double*)PyArray_DATA(py_frequencies); + num_ir_gp = (long)PyArray_DIMS(py_frequencies)[0]; + num_band = (long)PyArray_DIMS(py_frequencies)[1]; + coef = (double*)PyArray_DATA(py_coef); + num_coef = (long)PyArray_DIMS(py_coef)[1]; + grid_address = (long(*)[3])PyArray_DATA(py_grid_address); + num_gp = (long)PyArray_DIMS(py_grid_address)[0]; + grid_mapping_table = (long*)PyArray_DATA(py_grid_mapping_table); + relative_grid_address = + (long(*)[4][3])PyArray_DATA(py_relative_grid_address); + + phpy_tetrahedron_method_dos(dos, mesh, grid_address, relative_grid_address, + grid_mapping_table, freq_points, frequencies, + coef, num_freq_points, num_ir_gp, num_band, + num_coef, num_gp); - Py_RETURN_NONE; + Py_RETURN_NONE; } diff -Nru phonopy-2.12.0/c/phonopy.c phonopy-2.13.1/c/phonopy.c --- phonopy-2.12.0/c/phonopy.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/phonopy.c 2022-02-13 03:47:08.000000000 +0000 @@ -32,984 +32,814 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ +#include "phonopy.h" + +#include #include #include #include -#include -#include "dynmat.h" + #include "derivative_dynmat.h" +#include "dynmat.h" #include "rgrid.h" -#include "phonopy.h" #include "tetrahedron_method.h" #define KB 8.6173382568083159E-05 -static void set_index_permutation_symmetry_fc(double * fc, const int natom); -static void set_translational_symmetry_fc(double * fc, const int natom); -static void set_translational_symmetry_compact_fc(double * fc, - const int p2s[], +static void set_index_permutation_symmetry_fc(double *fc, const int natom); +static void set_translational_symmetry_fc(double *fc, const int natom); +static void set_translational_symmetry_compact_fc(double *fc, const int p2s[], const int n_satom, const int n_patom); static double get_free_energy(const double temperature, const double f); static double get_entropy(const double temperature, const double f); static double get_heat_capacity(const double temperature, const double f); /* static double get_energy(double temperature, double f); */ -static void distribute_fc2(double (*fc2)[3][3], - const int * atom_list, +static void distribute_fc2(double (*fc2)[3][3], const int *atom_list, const int len_atom_list, PHPYCONST double (*r_carts)[3][3], - const int * permutations, - const int * map_atoms, - const int * map_syms, - const int num_rot, + const int *permutations, const int *map_atoms, + const int *map_syms, const int num_rot, const int num_pos); static int nint(const double a); -void phpy_transform_dynmat_to_fc(double *fc, - const double *dm, +void phpy_transform_dynmat_to_fc(double *fc, const double *dm, const double (*comm_points)[3], const double (*svecs)[3], - const long (*multi)[2], - const double *masses, - const long *s2pp_map, - const long *fc_index_map, - const long num_patom, - const long num_satom) -{ - dym_transform_dynmat_to_fc(fc, - dm, - comm_points, - svecs, - multi, - masses, - s2pp_map, - fc_index_map, - num_patom, - num_satom); + const long (*multi)[2], const double *masses, + const long *s2pp_map, const long *fc_index_map, + const long num_patom, const long num_satom) { + dym_transform_dynmat_to_fc(fc, dm, comm_points, svecs, multi, masses, + s2pp_map, fc_index_map, num_patom, num_satom); } - long phpy_get_dynamical_matrix_at_q(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], + const long num_patom, const long num_satom, + const double *fc, const double q[3], const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double (*charge_sum)[3][3], - const long with_openmp) -{ - return dym_get_dynamical_matrix_at_q(dynamical_matrix, - num_patom, - num_satom, - fc, - q, - svecs, - multi, - mass, - s2p_map, - p2s_map, - charge_sum, - 1); -} - - -void phpy_get_charge_sum(double (*charge_sum)[3][3], - const long num_patom, - const double factor, /* 4pi/V*unit-conv and denominator */ - const double q_cart[3], - const double (*born)[3][3]) -{ - dym_get_charge_sum(charge_sum, num_patom, factor, q_cart, born); -} - - -void phpy_get_recip_dipole_dipole(double *dd, /* [natom, 3, natom, 3, (real,imag)] */ - const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, /* must be pointer */ - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double factor, /* 4pi/V*unit-conv */ - const double lambda, - const double tolerance) -{ - dym_get_recip_dipole_dipole(dd, - dd_q0, - G_list, - num_G, - num_patom, - q_cart, - q_direction_cart, - born, - dielectric, - pos, - factor, - lambda, - tolerance); -} - - -void phpy_get_recip_dipole_dipole_q0(double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double lambda, - const double tolerance) -{ - dym_get_recip_dipole_dipole_q0(dd_q0, - G_list, - num_G, - num_patom, - born, - dielectric, - pos, - lambda, - tolerance); -} - - -void phpy_get_derivative_dynmat_at_q(double *derivative_dynmat, - const long num_patom, - const long num_satom, - const double *fc, - const double *q, - const double *lattice, /* column vector */ - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double nac_factor, - const double *born, - const double *dielectric, - const double *q_direction) -{ - ddm_get_derivative_dynmat_at_q(derivative_dynmat, - num_patom, - num_satom, - fc, - q, - lattice, - svecs, - multi, - mass, - s2p_map, - p2s_map, - nac_factor, - born, - dielectric, - q_direction); + const long with_openmp) { + return dym_get_dynamical_matrix_at_q(dynamical_matrix, num_patom, num_satom, + fc, q, svecs, multi, mass, s2p_map, + p2s_map, charge_sum, 1); +} + +void phpy_get_charge_sum( + double (*charge_sum)[3][3], const long num_patom, + const double factor, /* 4pi/V*unit-conv and denominator */ + const double q_cart[3], const double (*born)[3][3]) { + dym_get_charge_sum(charge_sum, num_patom, factor, q_cart, born); +} + +void phpy_get_recip_dipole_dipole( + double *dd, /* [natom, 3, natom, 3, (real,imag)] */ + const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double q_cart[3], + const double *q_direction_cart, /* must be pointer */ + const double (*born)[3][3], const double dielectric[3][3], + const double (*pos)[3], /* [num_patom, 3] */ + const double factor, /* 4pi/V*unit-conv */ + const double lambda, const double tolerance) { + dym_get_recip_dipole_dipole(dd, dd_q0, G_list, num_G, num_patom, q_cart, + q_direction_cart, born, dielectric, pos, factor, + lambda, tolerance); +} + +void phpy_get_recip_dipole_dipole_q0( + double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double (*born)[3][3], + const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */ + const double lambda, const double tolerance) { + dym_get_recip_dipole_dipole_q0(dd_q0, G_list, num_G, num_patom, born, + dielectric, pos, lambda, tolerance); +} + +void phpy_get_derivative_dynmat_at_q( + double *derivative_dynmat, const long num_patom, const long num_satom, + const double *fc, const double *q, + const double *lattice, /* column vector */ + const double (*svecs)[3], const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double nac_factor, + const double *born, const double *dielectric, const double *q_direction) { + ddm_get_derivative_dynmat_at_q( + derivative_dynmat, num_patom, num_satom, fc, q, lattice, svecs, multi, + mass, s2p_map, p2s_map, nac_factor, born, dielectric, q_direction); } - void phpy_get_relative_grid_address(long relative_grid_address[24][4][3], - PHPYCONST double reciprocal_lattice[3][3]) -{ - thm_get_relative_grid_address(relative_grid_address, reciprocal_lattice); + PHPYCONST double reciprocal_lattice[3][3]) { + thm_get_relative_grid_address(relative_grid_address, reciprocal_lattice); } -void phpy_get_all_relative_grid_address(long relative_grid_address[4][24][4][3]) -{ - thm_get_all_relative_grid_address(relative_grid_address); +void phpy_get_all_relative_grid_address( + long relative_grid_address[4][24][4][3]) { + thm_get_all_relative_grid_address(relative_grid_address); } double phpy_get_integration_weight(const double omega, PHPYCONST double tetrahedra_omegas[24][4], - const char function) -{ - return thm_get_integration_weight(omega, tetrahedra_omegas, function); + const char function) { + return thm_get_integration_weight(omega, tetrahedra_omegas, function); } -void phpy_get_tetrahedra_frequenies(double *freq_tetras, - const long mesh[3], - const long* grid_points, +void phpy_get_tetrahedra_frequenies(double *freq_tetras, const long mesh[3], + const long *grid_points, PHPYCONST long (*grid_address)[3], PHPYCONST long (*relative_grid_address)[3], - const long* gp_ir_index, + const long *gp_ir_index, const double *frequencies, - const long num_band, - const long num_gp) -{ - long is_shift[3] = {0, 0, 0}; - long i, j, k, gp; - long g_addr[3]; - long address_double[3]; + const long num_band, const long num_gp) { + long is_shift[3] = {0, 0, 0}; + long i, j, k, gp; + long g_addr[3]; + long address_double[3]; - /* relative_grid_address[4, 24, 3] is viewed as [96, 3]. */ - for (i = 0; i < num_gp; i++) { + /* relative_grid_address[4, 24, 3] is viewed as [96, 3]. */ + for (i = 0; i < num_gp; i++) { #pragma omp parallel for private(k, g_addr, gp, address_double) - for (j = 0; j < num_band * 96; j++) { - for (k = 0; k < 3; k++) { - g_addr[k] = grid_address[grid_points[i]][k] + - relative_grid_address[j % 96][k]; - } - rgd_get_double_grid_address(address_double, - g_addr, - mesh, - is_shift); - gp = rgd_get_double_grid_index(address_double, mesh); - freq_tetras[i * num_band * 96 + j] = frequencies[gp_ir_index[gp] * num_band + j / 96]; + for (j = 0; j < num_band * 96; j++) { + for (k = 0; k < 3; k++) { + g_addr[k] = grid_address[grid_points[i]][k] + + relative_grid_address[j % 96][k]; + } + rgd_get_double_grid_address(address_double, g_addr, mesh, is_shift); + gp = rgd_get_double_grid_index(address_double, mesh); + freq_tetras[i * num_band * 96 + j] = + frequencies[gp_ir_index[gp] * num_band + j / 96]; + } } - } } - -void phpy_tetrahedron_method_dos(double *dos, - const long mesh[3], +void phpy_tetrahedron_method_dos(double *dos, const long mesh[3], PHPYCONST long (*grid_address)[3], PHPYCONST long (*relative_grid_address)[4][3], const long *grid_mapping_table, const double *freq_points, - const double *frequencies, - const double *coef, + const double *frequencies, const double *coef, const long num_freq_points, - const long num_ir_gp, - const long num_band, - const long num_coef, - const long num_gp) -{ - long is_shift[3] = {0, 0, 0}; - long i, j, k, l, m, q, r, count; - long ir_gps[24][4]; - long g_addr[3]; - double tetrahedra[24][4]; - long address_double[3]; - long *gp2ir, *ir_grid_points; - long *weights; - double iw; - - gp2ir = NULL; - ir_grid_points = NULL; - weights = NULL; - - gp2ir = (long*)malloc(sizeof(long) * num_gp); - ir_grid_points = (long*)malloc(sizeof(long) * num_ir_gp); - weights = (long*)malloc(sizeof(long) * num_ir_gp); - - count = 0; - for (i = 0; i < num_gp; i++) { - if (grid_mapping_table[i] == i) { - gp2ir[i] = count; - ir_grid_points[count] = i; - weights[count] = 1; - count++; - } else { - gp2ir[i] = gp2ir[grid_mapping_table[i]]; - weights[gp2ir[i]]++; - } - } - - if (num_ir_gp != count) { - printf("Something is wrong!\n"); - } - -#pragma omp parallel for private(j, k, l, m, q, r, iw, ir_gps, g_addr, tetrahedra, address_double) - for (i = 0; i < num_ir_gp; i++) { - /* set 24 tetrahedra */ - for (l = 0; l < 24; l++) { - for (q = 0; q < 4; q++) { - for (r = 0; r < 3; r++) { - g_addr[r] = grid_address[ir_grid_points[i]][r] + - relative_grid_address[l][q][r]; - } - rgd_get_double_grid_address(address_double, - g_addr, - mesh, - is_shift); - ir_gps[l][q] = gp2ir[rgd_get_double_grid_index(address_double, mesh)]; - } - } - - for (k = 0; k < num_band; k++) { - for (l = 0; l < 24; l++) { - for (q = 0; q < 4; q++) { - tetrahedra[l][q] = frequencies[ir_gps[l][q] * num_band + k]; - } - } - for (j = 0; j < num_freq_points; j++) { - iw = thm_get_integration_weight(freq_points[j], tetrahedra, 'I') * weights[i]; - for (m = 0; m < num_coef; m++) { - dos[i * num_band * num_freq_points * num_coef + - k * num_coef * num_freq_points + j * num_coef + m] += - iw * coef[i * num_coef * num_band + m * num_band + k]; - } - } - } - } - - free(gp2ir); - gp2ir = NULL; - free(ir_grid_points); - ir_grid_points = NULL; - free(weights); - weights = NULL; -} + const long num_ir_gp, const long num_band, + const long num_coef, const long num_gp) { + long is_shift[3] = {0, 0, 0}; + long i, j, k, l, m, q, r, count; + long ir_gps[24][4]; + long g_addr[3]; + double tetrahedra[24][4]; + long address_double[3]; + long *gp2ir, *ir_grid_points; + long *weights; + double iw; + + gp2ir = NULL; + ir_grid_points = NULL; + weights = NULL; + + gp2ir = (long *)malloc(sizeof(long) * num_gp); + ir_grid_points = (long *)malloc(sizeof(long) * num_ir_gp); + weights = (long *)malloc(sizeof(long) * num_ir_gp); + + count = 0; + for (i = 0; i < num_gp; i++) { + if (grid_mapping_table[i] == i) { + gp2ir[i] = count; + ir_grid_points[count] = i; + weights[count] = 1; + count++; + } else { + gp2ir[i] = gp2ir[grid_mapping_table[i]]; + weights[gp2ir[i]]++; + } + } + + if (num_ir_gp != count) { + printf("Something is wrong!\n"); + } + +#pragma omp parallel for private(j, k, l, m, q, r, iw, ir_gps, g_addr, \ + tetrahedra, address_double) + for (i = 0; i < num_ir_gp; i++) { + /* set 24 tetrahedra */ + for (l = 0; l < 24; l++) { + for (q = 0; q < 4; q++) { + for (r = 0; r < 3; r++) { + g_addr[r] = grid_address[ir_grid_points[i]][r] + + relative_grid_address[l][q][r]; + } + rgd_get_double_grid_address(address_double, g_addr, mesh, + is_shift); + ir_gps[l][q] = + gp2ir[rgd_get_double_grid_index(address_double, mesh)]; + } + } + for (k = 0; k < num_band; k++) { + for (l = 0; l < 24; l++) { + for (q = 0; q < 4; q++) { + tetrahedra[l][q] = frequencies[ir_gps[l][q] * num_band + k]; + } + } + for (j = 0; j < num_freq_points; j++) { + iw = thm_get_integration_weight(freq_points[j], tetrahedra, + 'I') * + weights[i]; + for (m = 0; m < num_coef; m++) { + dos[i * num_band * num_freq_points * num_coef + + k * num_coef * num_freq_points + j * num_coef + m] += + iw * coef[i * num_coef * num_band + m * num_band + k]; + } + } + } + } + + free(gp2ir); + gp2ir = NULL; + free(ir_grid_points); + ir_grid_points = NULL; + free(weights); + weights = NULL; +} void phpy_get_thermal_properties(double *thermal_props, const double *temperatures, - const double *freqs, - const long *weights, - const long num_temp, - const long num_qpoints, + const double *freqs, const long *weights, + const long num_temp, const long num_qpoints, const long num_bands, - const double cutoff_frequency) -{ - long i, j, k; - double f; - double *tp; - - tp = (double*)malloc(sizeof(double) * num_qpoints * num_temp * 3); - for (i = 0; i < num_qpoints * num_temp * 3; i++) { - tp[i] = 0; - } + const double cutoff_frequency) { + long i, j, k; + double f; + double *tp; + + tp = (double *)malloc(sizeof(double) * num_qpoints * num_temp * 3); + for (i = 0; i < num_qpoints * num_temp * 3; i++) { + tp[i] = 0; + } #pragma omp parallel for private(j, k, f) - for (i = 0; i < num_qpoints; i++){ - for (j = 0; j < num_temp; j++) { - for (k = 0; k < num_bands; k++){ - f = freqs[i * num_bands + k]; - if (temperatures[j] > 0 && f > cutoff_frequency) { - tp[i * num_temp * 3 + j * 3] += - get_free_energy(temperatures[j], f) * weights[i]; - tp[i * num_temp * 3 + j * 3 + 1] += - get_entropy(temperatures[j], f) * weights[i]; - tp[i * num_temp * 3 + j * 3 + 2] += - get_heat_capacity(temperatures[j], f) * weights[i]; + for (i = 0; i < num_qpoints; i++) { + for (j = 0; j < num_temp; j++) { + for (k = 0; k < num_bands; k++) { + f = freqs[i * num_bands + k]; + if (temperatures[j] > 0 && f > cutoff_frequency) { + tp[i * num_temp * 3 + j * 3] += + get_free_energy(temperatures[j], f) * weights[i]; + tp[i * num_temp * 3 + j * 3 + 1] += + get_entropy(temperatures[j], f) * weights[i]; + tp[i * num_temp * 3 + j * 3 + 2] += + get_heat_capacity(temperatures[j], f) * weights[i]; + } + } } - } } - } - for (i = 0; i < num_qpoints; i++) { - for (j = 0; j < num_temp * 3; j++) { - thermal_props[j] += tp[i * num_temp * 3 + j]; + for (i = 0; i < num_qpoints; i++) { + for (j = 0; j < num_temp * 3; j++) { + thermal_props[j] += tp[i * num_temp * 3 + j]; + } } - } - free(tp); - tp = NULL; + free(tp); + tp = NULL; } - -void phpy_distribute_fc2(double (*fc2)[3][3], - const int * atom_list, +void phpy_distribute_fc2(double (*fc2)[3][3], const int *atom_list, const int len_atom_list, PHPYCONST double (*r_carts)[3][3], - const int * permutations, - const int * map_atoms, - const int * map_syms, - const int num_rot, - const int num_pos) -{ - distribute_fc2(fc2, - atom_list, - len_atom_list, - r_carts, - permutations, - map_atoms, - map_syms, - num_rot, - num_pos); + const int *permutations, const int *map_atoms, + const int *map_syms, const int num_rot, + const int num_pos) { + distribute_fc2(fc2, atom_list, len_atom_list, r_carts, permutations, + map_atoms, map_syms, num_rot, num_pos); } - -int phpy_compute_permutation(int * rot_atom, - PHPYCONST double lat[3][3], +int phpy_compute_permutation(int *rot_atom, PHPYCONST double lat[3][3], PHPYCONST double (*pos)[3], - PHPYCONST double (*rot_pos)[3], - const int num_pos, - const double symprec) -{ - int i,j,k,l; - int search_start; - double distance2, diff_cart; - double diff[3]; - - for (i = 0; i < num_pos; i++) { - rot_atom[i] = -1; - } - - /* optimization: Iterate primarily by pos instead of rot_pos. */ - /* (find where 0 belongs in rot_atom, then where 1 belongs, etc.) */ - /* Then track the first unassigned index. */ - /* */ - /* This works best if the permutation is close to the identity. */ - /* (more specifically, if the max value of 'rot_atom[i] - i' is small) */ - search_start = 0; - for (i = 0; i < num_pos; i++) { - while (rot_atom[search_start] >= 0) { - search_start++; - } - for (j = search_start; j < num_pos; j++) { - if (rot_atom[j] >= 0) { - continue; - } - - for (k = 0; k < 3; k++) { - diff[k] = pos[i][k] - rot_pos[j][k]; - diff[k] -= nint(diff[k]); - } - distance2 = 0; - for (k = 0; k < 3; k++) { - diff_cart = 0; - for (l = 0; l < 3; l++) { - diff_cart += lat[k][l] * diff[l]; - } - distance2 += diff_cart * diff_cart; - } - - if (sqrt(distance2) < symprec) { - rot_atom[j] = i; - break; - } - } - } - - for (i = 0; i < num_pos; i++) { - if (rot_atom[i] < 0) { - return 0; - } - } - return 1; -} - - -void phpy_set_smallest_vectors_sparse(double (*smallest_vectors)[27][3], - int *multiplicity, - PHPYCONST double (*pos_to)[3], - const int num_pos_to, - PHPYCONST double (*pos_from)[3], - const int num_pos_from, - PHPYCONST int (*lattice_points)[3], - const int num_lattice_points, - PHPYCONST double reduced_basis[3][3], - PHPYCONST int trans_mat[3][3], - const double symprec) -{ - int i, j, k, l, count; - double length_tmp, minimum, vec_xyz; - double *length; - double (*vec)[3]; - - length = (double*)malloc(sizeof(double) * num_lattice_points); - vec = (double(*)[3])malloc(sizeof(double[3]) * num_lattice_points); - - for (i = 0; i < num_pos_to; i++) { - for (j = 0; j < num_pos_from; j++) { - for (k = 0; k < num_lattice_points; k++) { - length[k] = 0; - for (l = 0; l < 3; l++) { - vec[k][l] = pos_to[i][l] - pos_from[j][l] + lattice_points[k][l]; - } - for (l = 0; l < 3; l++) { - length_tmp = (reduced_basis[l][0] * vec[k][0] + - reduced_basis[l][1] * vec[k][1] + - reduced_basis[l][2] * vec[k][2]); - length[k] += length_tmp * length_tmp; - } - length[k] = sqrt(length[k]); - } - - minimum = DBL_MAX; - for (k = 0; k < num_lattice_points; k++) { - if (length[k] < minimum) { - minimum = length[k]; - } - } - - count = 0; - for (k = 0; k < num_lattice_points; k++) { - if (length[k] - minimum < symprec) { - for (l = 0; l < 3; l++) { - /* Transform back to supercell coordinates */ - vec_xyz = (trans_mat[l][0] * vec[k][0] + - trans_mat[l][1] * vec[k][1] + - trans_mat[l][2] * vec[k][2]); - smallest_vectors[i * num_pos_from + j][count][l] = vec_xyz; - } - count++; - } - } - if (count > 27) { /* should not be greater than 27 */ - printf("Warning (gsv_set_smallest_vectors_sparse): "); - printf("number of shortest vectors is out of range,\n"); - break; - } else { - multiplicity[i * num_pos_from + j] = count; - } - } - } - - free(length); - length = NULL; - free(vec); - vec = NULL; -} - - -void phpy_set_smallest_vectors_dense(double (*smallest_vectors)[3], - long (*multiplicity)[2], - PHPYCONST double (*pos_to)[3], - const long num_pos_to, - PHPYCONST double (*pos_from)[3], - const long num_pos_from, - PHPYCONST long (*lattice_points)[3], - const long num_lattice_points, - PHPYCONST double reduced_basis[3][3], - PHPYCONST long trans_mat[3][3], - const long initialize, - const double symprec) -{ - long i, j, k, l, count, adrs; - double length_tmp, minimum, vec_xyz; - double *length; - double (*vec)[3]; - - length = (double*)malloc(sizeof(double) * num_lattice_points); - vec = (double(*)[3])malloc(sizeof(double[3]) * num_lattice_points); - - adrs = 0; - - for (i = 0; i < num_pos_to; i++) { - for (j = 0; j < num_pos_from; j++) { - for (k = 0; k < num_lattice_points; k++) { - length[k] = 0; - for (l = 0; l < 3; l++) { - vec[k][l] = pos_to[i][l] - pos_from[j][l] + lattice_points[k][l]; - } - for (l = 0; l < 3; l++) { - length_tmp = (reduced_basis[l][0] * vec[k][0] + - reduced_basis[l][1] * vec[k][1] + - reduced_basis[l][2] * vec[k][2]); - length[k] += length_tmp * length_tmp; - } - length[k] = sqrt(length[k]); - } - - minimum = DBL_MAX; - for (k = 0; k < num_lattice_points; k++) { - if (length[k] < minimum) { - minimum = length[k]; - } - } - - count = 0; - for (k = 0; k < num_lattice_points; k++) { - if (length[k] - minimum < symprec) { - if (!initialize) { - for (l = 0; l < 3; l++) { - /* Transform back to supercell coordinates */ - vec_xyz = (trans_mat[l][0] * vec[k][0] + - trans_mat[l][1] * vec[k][1] + - trans_mat[l][2] * vec[k][2]); - smallest_vectors[adrs + count][l] = vec_xyz; - } - } - count++; - } - } - if (initialize) { - multiplicity[i * num_pos_from + j][0] = count; - multiplicity[i * num_pos_from + j][1] = adrs; - } - adrs += count; - } - } - - free(length); - length = NULL; - free(vec); - vec = NULL; -} - + PHPYCONST double (*rot_pos)[3], const int num_pos, + const double symprec) { + int i, j, k, l; + int search_start; + double distance2, diff_cart; + double diff[3]; + + for (i = 0; i < num_pos; i++) { + rot_atom[i] = -1; + } + + /* optimization: Iterate primarily by pos instead of rot_pos. */ + /* (find where 0 belongs in rot_atom, then where 1 belongs, etc.) */ + /* Then track the first unassigned index. */ + /* */ + /* This works best if the permutation is close to the identity. */ + /* (more specifically, if the max value of 'rot_atom[i] - i' is small) */ + search_start = 0; + for (i = 0; i < num_pos; i++) { + while (rot_atom[search_start] >= 0) { + search_start++; + } + for (j = search_start; j < num_pos; j++) { + if (rot_atom[j] >= 0) { + continue; + } -void phpy_perm_trans_symmetrize_fc(double *fc, - const int n_satom, - const int level) -{ - int i, j, k, l, iter; - double sum; + for (k = 0; k < 3; k++) { + diff[k] = pos[i][k] - rot_pos[j][k]; + diff[k] -= nint(diff[k]); + } + distance2 = 0; + for (k = 0; k < 3; k++) { + diff_cart = 0; + for (l = 0; l < 3; l++) { + diff_cart += lat[k][l] * diff[l]; + } + distance2 += diff_cart * diff_cart; + } - for (iter = 0; iter < level; iter++) { - /* Subtract drift along column */ - for (j = 0; j < n_satom; j++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - sum = 0; - for (i = 0; i < n_satom; i++) { - sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; - } - sum /= n_satom; - for (i = 0; i < n_satom; i++) { - fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; - } - } - } - } - /* Subtract drift along row */ - for (i = 0; i < n_satom; i++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - sum = 0; - for (j = 0; j < n_satom; j++) { - sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; - } - sum /= n_satom; - for (j = 0; j < n_satom; j++) { - fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; - } - } - } - } - set_index_permutation_symmetry_fc(fc, n_satom); - } - set_translational_symmetry_fc(fc, n_satom); -} + if (sqrt(distance2) < symprec) { + rot_atom[j] = i; + break; + } + } + } + for (i = 0; i < num_pos; i++) { + if (rot_atom[i] < 0) { + return 0; + } + } + return 1; +} + +void phpy_set_smallest_vectors_sparse( + double (*smallest_vectors)[27][3], int *multiplicity, + PHPYCONST double (*pos_to)[3], const int num_pos_to, + PHPYCONST double (*pos_from)[3], const int num_pos_from, + PHPYCONST int (*lattice_points)[3], const int num_lattice_points, + PHPYCONST double reduced_basis[3][3], PHPYCONST int trans_mat[3][3], + const double symprec) { + int i, j, k, l, count; + double length_tmp, minimum, vec_xyz; + double *length; + double(*vec)[3]; + + length = (double *)malloc(sizeof(double) * num_lattice_points); + vec = (double(*)[3])malloc(sizeof(double[3]) * num_lattice_points); + + for (i = 0; i < num_pos_to; i++) { + for (j = 0; j < num_pos_from; j++) { + for (k = 0; k < num_lattice_points; k++) { + length[k] = 0; + for (l = 0; l < 3; l++) { + vec[k][l] = + pos_to[i][l] - pos_from[j][l] + lattice_points[k][l]; + } + for (l = 0; l < 3; l++) { + length_tmp = (reduced_basis[l][0] * vec[k][0] + + reduced_basis[l][1] * vec[k][1] + + reduced_basis[l][2] * vec[k][2]); + length[k] += length_tmp * length_tmp; + } + length[k] = sqrt(length[k]); + } -void phpy_perm_trans_symmetrize_compact_fc(double *fc, - const int p2s[], - const int s2pp[], - const int nsym_list[], - const int perms[], - const int n_satom, - const int n_patom, - const int level) -{ - int i, j, k, l, n, iter; - double sum; - - for (iter=0; iter < level; iter++) { - - for (n = 0; n < 2; n++) { - /* transpose only */ - phpy_set_index_permutation_symmetry_compact_fc(fc, - p2s, - s2pp, - nsym_list, - perms, - n_satom, - n_patom, - 1); - for (i = 0; i < n_patom; i++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - sum = 0; - for (j = 0; j < n_satom; j++) { - sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; - } - sum /= n_satom; - for (j = 0; j < n_satom; j++) { - fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; - } - } - } - } - } - - phpy_set_index_permutation_symmetry_compact_fc(fc, - p2s, - s2pp, - nsym_list, - perms, - n_satom, - n_patom, - 0); - } - - set_translational_symmetry_compact_fc(fc, p2s, n_satom, n_patom); + minimum = DBL_MAX; + for (k = 0; k < num_lattice_points; k++) { + if (length[k] < minimum) { + minimum = length[k]; + } + } -} + count = 0; + for (k = 0; k < num_lattice_points; k++) { + if (length[k] - minimum < symprec) { + for (l = 0; l < 3; l++) { + /* Transform back to supercell coordinates */ + vec_xyz = (trans_mat[l][0] * vec[k][0] + + trans_mat[l][1] * vec[k][1] + + trans_mat[l][2] * vec[k][2]); + smallest_vectors[i * num_pos_from + j][count][l] = + vec_xyz; + } + count++; + } + } + if (count > 27) { /* should not be greater than 27 */ + printf("Warning (gsv_set_smallest_vectors_sparse): "); + printf("number of shortest vectors is out of range,\n"); + break; + } else { + multiplicity[i * num_pos_from + j] = count; + } + } + } + free(length); + length = NULL; + free(vec); + vec = NULL; +} + +void phpy_set_smallest_vectors_dense( + double (*smallest_vectors)[3], long (*multiplicity)[2], + PHPYCONST double (*pos_to)[3], const long num_pos_to, + PHPYCONST double (*pos_from)[3], const long num_pos_from, + PHPYCONST long (*lattice_points)[3], const long num_lattice_points, + PHPYCONST double reduced_basis[3][3], PHPYCONST long trans_mat[3][3], + const long initialize, const double symprec) { + long i, j, k, l, count, adrs; + double length_tmp, minimum, vec_xyz; + double *length; + double(*vec)[3]; + + length = (double *)malloc(sizeof(double) * num_lattice_points); + vec = (double(*)[3])malloc(sizeof(double[3]) * num_lattice_points); + + adrs = 0; + + for (i = 0; i < num_pos_to; i++) { + for (j = 0; j < num_pos_from; j++) { + for (k = 0; k < num_lattice_points; k++) { + length[k] = 0; + for (l = 0; l < 3; l++) { + vec[k][l] = + pos_to[i][l] - pos_from[j][l] + lattice_points[k][l]; + } + for (l = 0; l < 3; l++) { + length_tmp = (reduced_basis[l][0] * vec[k][0] + + reduced_basis[l][1] * vec[k][1] + + reduced_basis[l][2] * vec[k][2]); + length[k] += length_tmp * length_tmp; + } + length[k] = sqrt(length[k]); + } -void phpy_set_index_permutation_symmetry_compact_fc(double * fc, - const int p2s[], - const int s2pp[], - const int nsym_list[], - const int perms[], - const int n_satom, - const int n_patom, - const int is_transpose) -{ - int i, j, k, l, m, n, i_p, j_p, i_trans; - double fc_elem; - char *done; - - done = NULL; - done = (char*)malloc(sizeof(char) * n_satom * n_patom); - for (i = 0; i < n_satom * n_patom; i++) { - done[i] = 0; - } + minimum = DBL_MAX; + for (k = 0; k < num_lattice_points; k++) { + if (length[k] < minimum) { + minimum = length[k]; + } + } - for (j = 0; j < n_satom; j++) { - j_p = s2pp[j]; - for (i_p = 0; i_p < n_patom; i_p++) { - i = p2s[i_p]; - if (i == j) { /* diagnoal part */ - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - if (l > k) { - m = i_p * n_satom * 9 + i * 9 + k * 3 + l; - n = i_p * n_satom * 9 + i * 9 + l * 3 + k; - if (is_transpose) { - fc_elem = fc[m]; - fc[m] = fc[n]; - fc[n] = fc_elem; - } else { - fc[m] = (fc[m] + fc[n]) / 2; - fc[n] = fc[m]; - } + count = 0; + for (k = 0; k < num_lattice_points; k++) { + if (length[k] - minimum < symprec) { + if (!initialize) { + for (l = 0; l < 3; l++) { + /* Transform back to supercell coordinates */ + vec_xyz = (trans_mat[l][0] * vec[k][0] + + trans_mat[l][1] * vec[k][1] + + trans_mat[l][2] * vec[k][2]); + smallest_vectors[adrs + count][l] = vec_xyz; + } + } + count++; + } } - } - } - } - if (!done[i_p * n_satom + j]) { - /* (j, i) -- nsym_list[j] --> (j', i') */ - /* nsym_list[j] translates j to j' where j' is in */ - /* primitive cell. The same translation sends i to i' */ - /* where i' is not necessarily to be in primitive cell. */ - /* Thus, i' = perms[nsym_list[j] * n_satom + i] */ - i_trans = perms[nsym_list[j] * n_satom + i]; - done[i_p * n_satom + j] = 1; - done[j_p * n_satom + i_trans] = 1; - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - m = i_p * n_satom * 9 + j * 9 + k * 3 + l; - n = j_p * n_satom * 9 + i_trans * 9 + l * 3 + k; - if (is_transpose) { - fc_elem = fc[m]; - fc[m] = fc[n]; - fc[n] = fc_elem; - } else { - fc[m] = (fc[n] + fc[m]) / 2; - fc[n] = fc[m]; + if (initialize) { + multiplicity[i * num_pos_from + j][0] = count; + multiplicity[i * num_pos_from + j][1] = adrs; } - } + adrs += count; } - } } - } - free(done); - done = NULL; + free(length); + length = NULL; + free(vec); + vec = NULL; } +void phpy_perm_trans_symmetrize_fc(double *fc, const int n_satom, + const int level) { + int i, j, k, l, iter; + double sum; -static void set_index_permutation_symmetry_fc(double * fc, - const int natom) -{ - int i, j, k, l, m, n; - - for (i = 0; i < natom; i++) { - /* non diagonal part */ - for (j = i + 1; j < natom; j++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - m = i * natom * 9 + j * 9 + k * 3 + l; - n = j * natom * 9 + i * 9 + l * 3 + k; - fc[m] += fc[n]; - fc[m] /= 2; - fc[n] = fc[m]; + for (iter = 0; iter < level; iter++) { + /* Subtract drift along column */ + for (j = 0; j < n_satom; j++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + sum = 0; + for (i = 0; i < n_satom; i++) { + sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; + } + sum /= n_satom; + for (i = 0; i < n_satom; i++) { + fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; + } + } + } } - } + /* Subtract drift along row */ + for (i = 0; i < n_satom; i++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + sum = 0; + for (j = 0; j < n_satom; j++) { + sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; + } + sum /= n_satom; + for (j = 0; j < n_satom; j++) { + fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; + } + } + } + } + set_index_permutation_symmetry_fc(fc, n_satom); } + set_translational_symmetry_fc(fc, n_satom); +} - /* diagnoal part */ - for (k = 0; k < 2; k++) { - for (l = k + 1; l < 3; l++) { - m = i * natom * 9 + i * 9 + k * 3 + l; - n = i * natom * 9 + i * 9 + l * 3 + k; - fc[m] += fc[n]; - fc[m] /= 2; - fc[n] = fc[m]; - } +void phpy_perm_trans_symmetrize_compact_fc(double *fc, const int p2s[], + const int s2pp[], + const int nsym_list[], + const int perms[], const int n_satom, + const int n_patom, const int level) { + int i, j, k, l, n, iter; + double sum; + + for (iter = 0; iter < level; iter++) { + for (n = 0; n < 2; n++) { + /* transpose only */ + phpy_set_index_permutation_symmetry_compact_fc( + fc, p2s, s2pp, nsym_list, perms, n_satom, n_patom, 1); + for (i = 0; i < n_patom; i++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + sum = 0; + for (j = 0; j < n_satom; j++) { + sum += fc[i * n_satom * 9 + j * 9 + k * 3 + l]; + } + sum /= n_satom; + for (j = 0; j < n_satom; j++) { + fc[i * n_satom * 9 + j * 9 + k * 3 + l] -= sum; + } + } + } + } + } + + phpy_set_index_permutation_symmetry_compact_fc( + fc, p2s, s2pp, nsym_list, perms, n_satom, n_patom, 0); } - } + + set_translational_symmetry_compact_fc(fc, p2s, n_satom, n_patom); } +void phpy_set_index_permutation_symmetry_compact_fc( + double *fc, const int p2s[], const int s2pp[], const int nsym_list[], + const int perms[], const int n_satom, const int n_patom, + const int is_transpose) { + int i, j, k, l, m, n, i_p, j_p, i_trans; + double fc_elem; + char *done; -static void set_translational_symmetry_fc(double * fc, - const int natom) -{ - int i, j, k, l, m; - double sums[3][3]; + done = NULL; + done = (char *)malloc(sizeof(char) * n_satom * n_patom); + for (i = 0; i < n_satom * n_patom; i++) { + done[i] = 0; + } - for (i = 0; i < natom; i++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - sums[k][l] = 0; - m = i * natom * 9 + k * 3 + l; - for (j = 0; j < natom; j++) { - if (i != j) { - sums[k][l] += fc[m]; - } - m += 9; + for (j = 0; j < n_satom; j++) { + j_p = s2pp[j]; + for (i_p = 0; i_p < n_patom; i_p++) { + i = p2s[i_p]; + if (i == j) { /* diagnoal part */ + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + if (l > k) { + m = i_p * n_satom * 9 + i * 9 + k * 3 + l; + n = i_p * n_satom * 9 + i * 9 + l * 3 + k; + if (is_transpose) { + fc_elem = fc[m]; + fc[m] = fc[n]; + fc[n] = fc_elem; + } else { + fc[m] = (fc[m] + fc[n]) / 2; + fc[n] = fc[m]; + } + } + } + } + } + if (!done[i_p * n_satom + j]) { + /* (j, i) -- nsym_list[j] --> (j', i') */ + /* nsym_list[j] translates j to j' where j' is in */ + /* primitive cell. The same translation sends i to i' */ + /* where i' is not necessarily to be in primitive cell. */ + /* Thus, i' = perms[nsym_list[j] * n_satom + i] */ + i_trans = perms[nsym_list[j] * n_satom + i]; + done[i_p * n_satom + j] = 1; + done[j_p * n_satom + i_trans] = 1; + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + m = i_p * n_satom * 9 + j * 9 + k * 3 + l; + n = j_p * n_satom * 9 + i_trans * 9 + l * 3 + k; + if (is_transpose) { + fc_elem = fc[m]; + fc[m] = fc[n]; + fc[n] = fc_elem; + } else { + fc[m] = (fc[n] + fc[m]) / 2; + fc[n] = fc[m]; + } + } + } + } } - } } - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - fc[i * natom * 9 + i * 9 + k * 3 + l] = -(sums[k][l] + sums[l][k]) / 2; - } - } - } + + free(done); + done = NULL; } +static void set_index_permutation_symmetry_fc(double *fc, const int natom) { + int i, j, k, l, m, n; -static void set_translational_symmetry_compact_fc(double * fc, - const int p2s[], - const int n_satom, - const int n_patom) -{ - int j, k, l, m, i_p; - double sums[3][3]; - - for (i_p = 0; i_p < n_patom; i_p++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - sums[k][l] = 0; - m = i_p * n_satom * 9 + k * 3 + l; - for (j = 0; j < n_satom; j++) { - if (p2s[i_p] != j) { - sums[k][l] += fc[m]; - } - m += 9; + for (i = 0; i < natom; i++) { + /* non diagonal part */ + for (j = i + 1; j < natom; j++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + m = i * natom * 9 + j * 9 + k * 3 + l; + n = j * natom * 9 + i * 9 + l * 3 + k; + fc[m] += fc[n]; + fc[m] /= 2; + fc[n] = fc[m]; + } + } + } + + /* diagnoal part */ + for (k = 0; k < 2; k++) { + for (l = k + 1; l < 3; l++) { + m = i * natom * 9 + i * 9 + k * 3 + l; + n = i * natom * 9 + i * 9 + l * 3 + k; + fc[m] += fc[n]; + fc[m] /= 2; + fc[n] = fc[m]; + } } - } - } - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - fc[i_p * n_satom * 9 + p2s[i_p] * 9 + k * 3 + l] = - -(sums[k][l] + sums[l][k]) / 2; - } } - } } +static void set_translational_symmetry_fc(double *fc, const int natom) { + int i, j, k, l, m; + double sums[3][3]; -static double get_free_energy(const double temperature, const double f) -{ - /* temperature is defined by T (K) */ - /* 'f' must be given in eV. */ - return KB * temperature * log(1 - exp(- f / (KB * temperature))); + for (i = 0; i < natom; i++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + sums[k][l] = 0; + m = i * natom * 9 + k * 3 + l; + for (j = 0; j < natom; j++) { + if (i != j) { + sums[k][l] += fc[m]; + } + m += 9; + } + } + } + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + fc[i * natom * 9 + i * 9 + k * 3 + l] = + -(sums[k][l] + sums[l][k]) / 2; + } + } + } } +static void set_translational_symmetry_compact_fc(double *fc, const int p2s[], + const int n_satom, + const int n_patom) { + int j, k, l, m, i_p; + double sums[3][3]; -static double get_entropy(const double temperature, const double f) -{ - /* temperature is defined by T (K) */ - /* 'f' must be given in eV. */ - double val; - - val = f / (2 * KB * temperature); - return 1 / (2 * temperature) * f * cosh(val) / sinh(val) - KB * log(2 * sinh(val)); + for (i_p = 0; i_p < n_patom; i_p++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + sums[k][l] = 0; + m = i_p * n_satom * 9 + k * 3 + l; + for (j = 0; j < n_satom; j++) { + if (p2s[i_p] != j) { + sums[k][l] += fc[m]; + } + m += 9; + } + } + } + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + fc[i_p * n_satom * 9 + p2s[i_p] * 9 + k * 3 + l] = + -(sums[k][l] + sums[l][k]) / 2; + } + } + } } - -static double get_heat_capacity(const double temperature, const double f) -{ - /* temperature is defined by T (K) */ - /* 'f' must be given in eV. */ - /* If val is close to 1. Then expansion is used. */ - double val, val1, val2; - - val = f / (KB * temperature); - val1 = exp(val); - val2 = (val) / (val1 - 1); - return KB * val1 * val2 * val2; +static double get_free_energy(const double temperature, const double f) { + /* temperature is defined by T (K) */ + /* 'f' must be given in eV. */ + return KB * temperature * log(1 - exp(-f / (KB * temperature))); +} + +static double get_entropy(const double temperature, const double f) { + /* temperature is defined by T (K) */ + /* 'f' must be given in eV. */ + double val; + + val = f / (2 * KB * temperature); + return 1 / (2 * temperature) * f * cosh(val) / sinh(val) - + KB * log(2 * sinh(val)); +} + +static double get_heat_capacity(const double temperature, const double f) { + /* temperature is defined by T (K) */ + /* 'f' must be given in eV. */ + /* If val is close to 1. Then expansion is used. */ + double val, val1, val2; + + val = f / (KB * temperature); + val1 = exp(val); + val2 = (val) / (val1 - 1); + return KB * val1 * val2 * val2; } - static void distribute_fc2(double (*fc2)[3][3], /* shape[n_pos][n_pos] */ - const int * atom_list, - const int len_atom_list, + const int *atom_list, const int len_atom_list, PHPYCONST double (*r_carts)[3][3], /* shape[n_rot] */ - const int * permutations, /* shape[n_rot][n_pos] */ - const int * map_atoms, /* shape [n_pos] */ - const int * map_syms, /* shape [n_pos] */ - const int num_rot, - const int num_pos) -{ - int i, j, k, l, m; - int atom_todo, atom_done, atom_other; - int sym_index; - int *atom_list_reverse; - double (*fc2_done)[3]; - double (*fc2_todo)[3]; - double (*r_cart)[3]; - const int * permutation; - - atom_list_reverse = NULL; - atom_list_reverse = (int*)malloc(sizeof(int) * num_pos); - /* atom_list_reverse[!atom_done] is undefined. */ - for (i = 0; i < len_atom_list; i++) { - atom_done = map_atoms[atom_list[i]]; - if (atom_done == atom_list[i]) { - atom_list_reverse[atom_done] = i; - } - } - - for (i = 0; i < len_atom_list; i++) { - /* look up how this atom maps into the done list. */ - atom_todo = atom_list[i]; - atom_done = map_atoms[atom_todo]; - sym_index = map_syms[atom_todo]; - - /* skip the atoms in the done list, */ - /* which are easily identified because they map to themselves. */ - if (atom_todo == atom_done) { - continue; - } - - /* look up information about the rotation */ - r_cart = r_carts[sym_index]; - permutation = &permutations[sym_index * num_pos]; /* shape[num_pos] */ - - /* distribute terms from atom_done to atom_todo */ - for (atom_other = 0; atom_other < num_pos; atom_other++) { - fc2_done = fc2[atom_list_reverse[atom_done] * num_pos + permutation[atom_other]]; - fc2_todo = fc2[i * num_pos + atom_other]; - for (j = 0; j < 3; j++) { - for (k = 0; k < 3; k++) { - for (l = 0; l < 3; l++) { - for (m = 0; m < 3; m++) { - /* P' = R^-1 P R */ - fc2_todo[j][k] += r_cart[l][j] * r_cart[m][k] * fc2_done[l][m]; + const int *permutations, /* shape[n_rot][n_pos] */ + const int *map_atoms, /* shape [n_pos] */ + const int *map_syms, /* shape [n_pos] */ + const int num_rot, const int num_pos) { + int i, j, k, l, m; + int atom_todo, atom_done, atom_other; + int sym_index; + int *atom_list_reverse; + double(*fc2_done)[3]; + double(*fc2_todo)[3]; + double(*r_cart)[3]; + const int *permutation; + + atom_list_reverse = NULL; + atom_list_reverse = (int *)malloc(sizeof(int) * num_pos); + /* atom_list_reverse[!atom_done] is undefined. */ + for (i = 0; i < len_atom_list; i++) { + atom_done = map_atoms[atom_list[i]]; + if (atom_done == atom_list[i]) { + atom_list_reverse[atom_done] = i; + } + } + + for (i = 0; i < len_atom_list; i++) { + /* look up how this atom maps into the done list. */ + atom_todo = atom_list[i]; + atom_done = map_atoms[atom_todo]; + sym_index = map_syms[atom_todo]; + + /* skip the atoms in the done list, */ + /* which are easily identified because they map to themselves. */ + if (atom_todo == atom_done) { + continue; + } + + /* look up information about the rotation */ + r_cart = r_carts[sym_index]; + permutation = &permutations[sym_index * num_pos]; /* shape[num_pos] */ + + /* distribute terms from atom_done to atom_todo */ + for (atom_other = 0; atom_other < num_pos; atom_other++) { + fc2_done = fc2[atom_list_reverse[atom_done] * num_pos + + permutation[atom_other]]; + fc2_todo = fc2[i * num_pos + atom_other]; + for (j = 0; j < 3; j++) { + for (k = 0; k < 3; k++) { + for (l = 0; l < 3; l++) { + for (m = 0; m < 3; m++) { + /* P' = R^-1 P R */ + fc2_todo[j][k] += + r_cart[l][j] * r_cart[m][k] * fc2_done[l][m]; + } + } + } } - } } - } } - } - free(atom_list_reverse); - atom_list_reverse = NULL; + free(atom_list_reverse); + atom_list_reverse = NULL; } - /* static double get_energy(double temperature, double f){ */ /* /\* temperature is defined by T (K) *\/ */ /* /\* 'f' must be given in eV. *\/ */ /* return f / (exp(f / (KB * temperature)) - 1); */ /* } */ - -static int nint(const double a) -{ - if (a < 0.0) - return (int) (a - 0.5); - else - return (int) (a + 0.5); +static int nint(const double a) { + if (a < 0.0) + return (int)(a - 0.5); + else + return (int)(a + 0.5); } diff -Nru phonopy-2.12.0/c/phonopy.h phonopy-2.13.1/c/phonopy.h --- phonopy-2.12.0/c/phonopy.h 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/phonopy.h 2022-02-13 03:47:08.000000000 +0000 @@ -32,6 +32,8 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ +#include + #ifndef __phonopy_H__ #define __phonopy_H__ @@ -39,70 +41,47 @@ #define PHPYCONST #endif -void phpy_transform_dynmat_to_fc(double *fc, - const double *dm, +void phpy_transform_dynmat_to_fc(double *fc, const double *dm, const double (*comm_points)[3], const double (*svecs)[3], - const long (*multi)[2], - const double *masses, - const long *s2pp_map, - const long *fc_index_map, - const long num_patom, - const long num_satom); + const long (*multi)[2], const double *masses, + const long *s2pp_map, const long *fc_index_map, + const long num_patom, const long num_satom); long phpy_get_dynamical_matrix_at_q(double *dynamical_matrix, - const long num_patom, - const long num_satom, - const double *fc, - const double q[3], + const long num_patom, const long num_satom, + const double *fc, const double q[3], const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, + const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double (*charge_sum)[3][3], const long with_openmp); -void phpy_get_charge_sum(double (*charge_sum)[3][3], - const long num_patom, - const double factor, /* 4pi/V*unit-conv and denominator */ - const double q_cart[3], - const double (*born)[3][3]); -void phpy_get_recip_dipole_dipole(double *dd, /* [natom, 3, natom, 3, (real,imag)] */ - const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double q_cart[3], - const double *q_direction_cart, /* must be pointer */ - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double factor, /* 4pi/V*unit-conv */ - const double lambda, - const double tolerance); -void phpy_get_recip_dipole_dipole_q0(double *dd_q0, /* [natom, 3, 3, (real,imag)] */ - const double (*G_list)[3], /* [num_G, 3] */ - const long num_G, - const long num_patom, - const double (*born)[3][3], - const double dielectric[3][3], - const double (*pos)[3], /* [num_patom, 3] */ - const double lambda, - const double tolerance); -void phpy_get_derivative_dynmat_at_q(double *derivative_dynmat, - const long num_patom, - const long num_satom, - const double *fc, - const double *q, - const double *lattice, /* column vector */ - const double (*svecs)[3], - const long (*multi)[2], - const double *mass, - const long *s2p_map, - const long *p2s_map, - const double nac_factor, - const double *born, - const double *dielectric, - const double *q_direction); +void phpy_get_charge_sum( + double (*charge_sum)[3][3], const long num_patom, + const double factor, /* 4pi/V*unit-conv and denominator */ + const double q_cart[3], const double (*born)[3][3]); +void phpy_get_recip_dipole_dipole( + double *dd, /* [natom, 3, natom, 3, (real,imag)] */ + const double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double q_cart[3], + const double *q_direction_cart, /* must be pointer */ + const double (*born)[3][3], const double dielectric[3][3], + const double (*pos)[3], /* [num_patom, 3] */ + const double factor, /* 4pi/V*unit-conv */ + const double lambda, const double tolerance); +void phpy_get_recip_dipole_dipole_q0( + double *dd_q0, /* [natom, 3, 3, (real,imag)] */ + const double (*G_list)[3], /* [num_G, 3] */ + const long num_G, const long num_patom, const double (*born)[3][3], + const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */ + const double lambda, const double tolerance); +void phpy_get_derivative_dynmat_at_q( + double *derivative_dynmat, const long num_patom, const long num_satom, + const double *fc, const double *q, + const double *lattice, /* column vector */ + const double (*svecs)[3], const long (*multi)[2], const double *mass, + const long *s2p_map, const long *p2s_map, const double nac_factor, + const double *born, const double *dielectric, const double *q_direction); void phpy_get_neighboring_grid_points(size_t neighboring_grid_points[], const size_t grid_point, PHPYCONST int relative_grid_address[][3], @@ -112,97 +91,68 @@ const size_t bz_map[]); void phpy_get_relative_grid_address(long relative_grid_address[24][4][3], PHPYCONST double reciprocal_lattice[3][3]); -void phpy_get_all_relative_grid_address(long relative_grid_address[4][24][4][3]); +void phpy_get_all_relative_grid_address( + long relative_grid_address[4][24][4][3]); double phpy_get_integration_weight(const double omega, PHPYCONST double tetrahedra_omegas[24][4], const char function); -void phpy_get_tetrahedra_frequenies(double *freq_tetras, - const long mesh[3], - const long* grid_points, +void phpy_get_tetrahedra_frequenies(double *freq_tetras, const long mesh[3], + const long *grid_points, PHPYCONST long (*grid_address)[3], PHPYCONST long (*relative_grid_address)[3], - const long* gp_ir_index, + const long *gp_ir_index, const double *frequencies, - const long num_band, - const long num_gp); -void phpy_tetrahedron_method_dos(double *dos, - const long mesh[3], + const long num_band, const long num_gp); +void phpy_tetrahedron_method_dos(double *dos, const long mesh[3], PHPYCONST long (*grid_address)[3], PHPYCONST long (*relative_grid_address)[4][3], const long *grid_mapping_table, const double *freq_points, - const double *frequencies, - const double *coef, + const double *frequencies, const double *coef, const long num_freq_points, - const long num_ir_gp, - const long num_band, - const long num_coef, - const long num_gp); + const long num_ir_gp, const long num_band, + const long num_coef, const long num_gp); void phpy_get_thermal_properties(double *thermal_props, const double *temperatures, - const double *freqs, - const long *weights, - const long num_temp, - const long num_qpoints, + const double *freqs, const long *weights, + const long num_temp, const long num_qpoints, const long num_bands, const double cutoff_frequency); -void phpy_distribute_fc2(double (*fc2)[3][3], - const int * atom_list, +void phpy_distribute_fc2(double (*fc2)[3][3], const int *atom_list, const int len_atom_list, PHPYCONST double (*r_carts)[3][3], - const int * permutations, - const int * map_atoms, - const int * map_syms, - const int num_rot, + const int *permutations, const int *map_atoms, + const int *map_syms, const int num_rot, const int num_pos); -int phpy_compute_permutation(int * rot_atom, - PHPYCONST double lat[3][3], +int phpy_compute_permutation(int *rot_atom, PHPYCONST double lat[3][3], PHPYCONST double (*pos)[3], - PHPYCONST double (*rot_pos)[3], - const int num_pos, + PHPYCONST double (*rot_pos)[3], const int num_pos, const double symprec); -void phpy_set_smallest_vectors_sparse(double (*smallest_vectors)[27][3], - int *multiplicity, - PHPYCONST double (*pos_to)[3], - const int num_pos_to, - PHPYCONST double (*pos_from)[3], - const int num_pos_from, - PHPYCONST int (*lattice_points)[3], - const int num_lattice_points, - PHPYCONST double reduced_basis[3][3], - PHPYCONST int trans_mat[3][3], - const double symprec); -void phpy_set_smallest_vectors_dense(double (*smallest_vectors)[3], - long (*multiplicity)[2], - PHPYCONST double (*pos_to)[3], - const long num_pos_to, - PHPYCONST double (*pos_from)[3], - const long num_pos_from, - PHPYCONST long (*lattice_points)[3], - const long num_lattice_points, - PHPYCONST double reduced_basis[3][3], - PHPYCONST long trans_mat[3][3], - const long initialize, - const double symprec); +void phpy_set_smallest_vectors_sparse( + double (*smallest_vectors)[27][3], int *multiplicity, + PHPYCONST double (*pos_to)[3], const int num_pos_to, + PHPYCONST double (*pos_from)[3], const int num_pos_from, + PHPYCONST int (*lattice_points)[3], const int num_lattice_points, + PHPYCONST double reduced_basis[3][3], PHPYCONST int trans_mat[3][3], + const double symprec); +void phpy_set_smallest_vectors_dense( + double (*smallest_vectors)[3], long (*multiplicity)[2], + PHPYCONST double (*pos_to)[3], const long num_pos_to, + PHPYCONST double (*pos_from)[3], const long num_pos_from, + PHPYCONST long (*lattice_points)[3], const long num_lattice_points, + PHPYCONST double reduced_basis[3][3], PHPYCONST long trans_mat[3][3], + const long initialize, const double symprec); -void phpy_perm_trans_symmetrize_fc(double *fc, - const int nsatom, +void phpy_perm_trans_symmetrize_fc(double *fc, const int nsatom, const int level); -void phpy_perm_trans_symmetrize_compact_fc(double *fc, - const int p2s[], +void phpy_perm_trans_symmetrize_compact_fc(double *fc, const int p2s[], const int s2pp[], const int nsym_list[], - const int perms[], - const int n_satom, - const int n_patom, - const int level); -void phpy_set_index_permutation_symmetry_compact_fc(double * fc, - const int p2s[], - const int s2pp[], - const int nsym_list[], - const int perms[], - const int n_satom, - const int n_patom, - const int is_transpose); + const int perms[], const int n_satom, + const int n_patom, const int level); +void phpy_set_index_permutation_symmetry_compact_fc( + double *fc, const int p2s[], const int s2pp[], const int nsym_list[], + const int perms[], const int n_satom, const int n_patom, + const int is_transpose); #endif diff -Nru phonopy-2.12.0/c/rgrid.c phonopy-2.13.1/c/rgrid.c --- phonopy-2.12.0/c/rgrid.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/rgrid.c 2022-02-13 03:47:08.000000000 +0000 @@ -32,11 +32,12 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include #include "rgrid.h" +#include +#include +#include + static void get_all_grid_addresses(long grid_address[][3], const long mesh[3]); static long get_double_grid_index(const long address_double[3], const long mesh[3]); @@ -46,118 +47,106 @@ static void reduce_double_grid_address(long address[3], const long mesh[3]); static long mat_modulo_l(const long a, const long b); - -void rgd_get_all_grid_addresses(long grid_address[][3], const long mesh[3]) -{ - get_all_grid_addresses(grid_address, mesh); +void rgd_get_all_grid_addresses(long grid_address[][3], const long mesh[3]) { + get_all_grid_addresses(grid_address, mesh); } long rgd_get_double_grid_index(const long address_double[3], - const long mesh[3]) -{ - return get_double_grid_index(address_double, mesh); -} - -void rgd_get_double_grid_address(long address_double[3], - const long address[3], - const long mesh[3], - const long is_shift[3]) -{ - long i; - - for (i = 0; i < 3; i++) { - address_double[i] = address[i] * 2 + (is_shift[i] != 0); - } - reduce_double_grid_address(address_double, mesh); -} - -static void get_all_grid_addresses(long grid_address[][3], const long mesh[3]) -{ - long i, j, k; - long grid_index; - long address[3]; - - for (i = 0; i < mesh[0]; i++) { - address[0] = i; - for (j = 0; j < mesh[1]; j++) { - address[1] = j; - for (k = 0; k < mesh[2]; k++) { - address[2] = k; - grid_index = get_grid_index_single_mesh(address, mesh); - - assert(mesh[0] * mesh[1] * mesh[2] > grid_index); - - grid_address[grid_index][0] = address[0]; - grid_address[grid_index][1] = address[1]; - grid_address[grid_index][2] = address[2]; - reduce_grid_address(grid_address[grid_index], mesh); - } + const long mesh[3]) { + return get_double_grid_index(address_double, mesh); +} + +void rgd_get_double_grid_address(long address_double[3], const long address[3], + const long mesh[3], const long is_shift[3]) { + long i; + + for (i = 0; i < 3; i++) { + address_double[i] = address[i] * 2 + (is_shift[i] != 0); + } + reduce_double_grid_address(address_double, mesh); +} + +static void get_all_grid_addresses(long grid_address[][3], const long mesh[3]) { + long i, j, k; + long grid_index; + long address[3]; + + for (i = 0; i < mesh[0]; i++) { + address[0] = i; + for (j = 0; j < mesh[1]; j++) { + address[1] = j; + for (k = 0; k < mesh[2]; k++) { + address[2] = k; + grid_index = get_grid_index_single_mesh(address, mesh); + + assert(mesh[0] * mesh[1] * mesh[2] > grid_index); + + grid_address[grid_index][0] = address[0]; + grid_address[grid_index][1] = address[1]; + grid_address[grid_index][2] = address[2]; + reduce_grid_address(grid_address[grid_index], mesh); + } + } } - } } static long get_double_grid_index(const long address_double[3], - const long mesh[3]) -{ - long i; - long address[3]; - - for (i = 0; i < 3; i++) { - if (address_double[i] % 2 == 0) { - address[i] = address_double[i] / 2; - } else { - address[i] = (address_double[i] - 1) / 2; + const long mesh[3]) { + long i; + long address[3]; + + for (i = 0; i < 3; i++) { + if (address_double[i] % 2 == 0) { + address[i] = address_double[i] / 2; + } else { + address[i] = (address_double[i] - 1) / 2; + } + address[i] = mat_modulo_l(address[i], mesh[i]); } - address[i] = mat_modulo_l(address[i], mesh[i]); - } - return get_grid_index_single_mesh(address, mesh); + return get_grid_index_single_mesh(address, mesh); } static long get_grid_index_single_mesh(const long address[3], - const long mesh[3]) -{ + const long mesh[3]) { #ifndef GRID_ORDER_XYZ - return (address[2] * mesh[0] * (long)(mesh[1]) - + address[1] * mesh[0] + address[0]); + return (address[2] * mesh[0] * (long)(mesh[1]) + address[1] * mesh[0] + + address[0]); #else - return (address[0] * mesh[1] * (long)(mesh[2]) - + address[1] * mesh[2] + address[2]); + return (address[0] * mesh[1] * (long)(mesh[2]) + address[1] * mesh[2] + + address[2]); #endif } -static void reduce_grid_address(long address[3], const long mesh[3]) -{ - long i; +static void reduce_grid_address(long address[3], const long mesh[3]) { + long i; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { #ifndef GRID_BOUNDARY_AS_NEGATIVE - address[i] -= mesh[i] * (address[i] > mesh[i] / 2); + address[i] -= mesh[i] * (address[i] > mesh[i] / 2); #else - address[i] -= mesh[i] * (address[i] > (mesh[i] - 1) / 2); + address[i] -= mesh[i] * (address[i] > (mesh[i] - 1) / 2); #endif - } + } } -static void reduce_double_grid_address(long address[3], const long mesh[3]) -{ - long i; +static void reduce_double_grid_address(long address[3], const long mesh[3]) { + long i; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { #ifndef GRID_BOUNDARY_AS_NEGATIVE - address[i] -= 2 * mesh[i] * (address[i] > mesh[i]); + address[i] -= 2 * mesh[i] * (address[i] > mesh[i]); #else - address[i] -= 2 * mesh[i] * (address[i] > mesh[i] - 1); + address[i] -= 2 * mesh[i] * (address[i] > mesh[i] - 1); #endif - } + } } -static long mat_modulo_l(const long a, const long b) -{ - long c; - c = a % b; - if (c < 0) { - c += b; - } - return c; +static long mat_modulo_l(const long a, const long b) { + long c; + c = a % b; + if (c < 0) { + c += b; + } + return c; } diff -Nru phonopy-2.12.0/c/rgrid.h phonopy-2.13.1/c/rgrid.h --- phonopy-2.12.0/c/rgrid.h 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/rgrid.h 2022-02-13 03:47:08.000000000 +0000 @@ -73,9 +73,7 @@ void rgd_get_all_grid_addresses(long grid_address[][3], const long mesh[3]); long rgd_get_double_grid_index(const long address_double[3], const long mesh[3]); -void rgd_get_double_grid_address(long address_double[3], - const long address[3], - const long mesh[3], - const long is_shift[3]); +void rgd_get_double_grid_address(long address_double[3], const long address[3], + const long mesh[3], const long is_shift[3]); #endif diff -Nru phonopy-2.12.0/c/tetrahedron_method.c phonopy-2.13.1/c/tetrahedron_method.c --- phonopy-2.12.0/c/tetrahedron_method.c 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/tetrahedron_method.c 2022-02-13 03:47:08.000000000 +0000 @@ -34,12 +34,13 @@ /* tetrahedron_method.c */ /* Copyright (C) 2014 Atsushi Togo */ -#include #include "tetrahedron_method.h" +#include + #ifdef THMWARNING #include -#define warning_print(...) fprintf(stderr,__VA_ARGS__) +#define warning_print(...) fprintf(stderr, __VA_ARGS__) #else #define warning_print(...) #endif @@ -63,942 +64,1258 @@ /* 6: c + b 2, 4, 7 */ /* 7: c + a + b 3, 5, 6 */ - -static long main_diagonals[4][3] = {{ 1, 1, 1}, /* 0-7 */ +static long main_diagonals[4][3] = {{1, 1, 1}, /* 0-7 */ {-1, 1, 1}, /* 1-6 */ - { 1,-1, 1}, /* 2-5 */ - { 1, 1,-1}}; /* 3-4 */ + {1, -1, 1}, /* 2-5 */ + {1, 1, -1}}; /* 3-4 */ static long db_relative_grid_address[4][24][4][3] = { - { - { { 0, 0, 0}, { 1, 0, 0}, { 1, 1, 0}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 0, 1}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 1, 1, 0}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 1, 1}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 0, 0, 1}, { 1, 0, 1}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 0, 0, 1}, { 0, 1, 1}, { 1, 1, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 1, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, 0, 1}, { 0, 1, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 0, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 0, 1}, { 1, 0, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 0, 1}, {-1, -1, 0}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 0, 1}, {-1, -1, 0}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 1, 0}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 1, 1, 0}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 0, -1}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 0, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, -1, -1}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, -1, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, -1, -1}, { 0, -1, -1}, { 0, 0, -1}, }, - { { 0, 0, 0}, {-1, -1, -1}, { 0, -1, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, -1, -1}, {-1, 0, -1}, { 0, 0, -1}, }, - { { 0, 0, 0}, {-1, -1, -1}, {-1, 0, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, -1, -1}, {-1, -1, 0}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, -1, -1}, {-1, -1, 0}, {-1, 0, 0}, }, - }, - { - { { 0, 0, 0}, { 1, 0, 0}, { 0, 1, 0}, { 0, 1, 1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 0, 1}, { 0, 1, 1}, }, - { { 0, 0, 0}, {-1, 1, 0}, {-1, 1, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 0, 1}, {-1, 1, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 1, 0}, {-1, 1, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 1, 1}, { 0, 1, 1}, }, - { { 0, 0, 0}, {-1, 0, 1}, { 0, 0, 1}, {-1, 1, 1}, }, - { { 0, 0, 0}, { 0, 0, 1}, {-1, 1, 1}, { 0, 1, 1}, }, - { { 0, 0, 0}, { 0, 0, 1}, { 0, -1, 0}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 0, 1}, { 1, -1, 0}, }, - { { 0, 0, 0}, {-1, 0, 1}, { 0, -1, 0}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 0, 1}, { 0, 0, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 0, -1}, { 1, 0, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 1, 0}, { 1, 0, -1}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 0, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 1, 0}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 0, -1, -1}, { 1, -1, -1}, { 0, 0, -1}, }, - { { 0, 0, 0}, { 0, -1, -1}, { 1, -1, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 1, -1, -1}, { 0, 0, -1}, { 1, 0, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, -1, -1}, { 1, 0, -1}, }, - { { 0, 0, 0}, { 1, -1, -1}, { 0, -1, 0}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, -1, -1}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 0, -1, -1}, { 0, 0, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, -1, -1}, { 0, -1, 0}, {-1, 0, 0}, }, - }, - { - { { 0, 0, 0}, { 1, 0, 0}, { 0, 1, 0}, { 1, 0, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 0, 1}, { 1, 0, 1}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 0, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 1, 0}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 1, -1, 1}, { 0, -1, 0}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 0, -1, 1}, { 1, -1, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, -1, 1}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, -1, 1}, { 1, 0, 1}, }, - { { 0, 0, 0}, { 0, -1, 1}, { 1, -1, 1}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 1, -1, 1}, { 0, 0, 1}, { 1, 0, 1}, }, - { { 0, 0, 0}, { 0, -1, 1}, { 0, -1, 0}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, -1, 1}, { 0, 0, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 0, -1}, { 0, 1, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 1, 0}, { 0, 1, -1}, }, - { { 0, 0, 0}, {-1, 0, -1}, { 0, 0, -1}, {-1, 1, -1}, }, - { { 0, 0, 0}, {-1, 0, -1}, {-1, 1, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, 0, -1}, {-1, 1, -1}, { 0, 1, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 1, -1}, { 0, 1, -1}, }, - { { 0, 0, 0}, {-1, 1, 0}, {-1, 1, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, 1, 0}, { 0, 1, 0}, {-1, 1, -1}, }, - { { 0, 0, 0}, { 0, 0, -1}, { 0, -1, 0}, { 1, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, 0, -1}, { 1, -1, 0}, }, - { { 0, 0, 0}, {-1, 0, -1}, { 0, 0, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, 0, -1}, { 0, -1, 0}, {-1, 0, 0}, }, - }, - { - { { 0, 0, 0}, { 1, 0, 0}, { 1, 1, 0}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 1, 1, 0}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 0, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, 1, 0}, {-1, 0, 1}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, -1, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 0, -1, 1}, { 0, 0, 1}, }, - { { 0, 0, 0}, {-1, -1, 1}, {-1, -1, 0}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, -1, 1}, {-1, -1, 0}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, -1, 1}, { 0, -1, 1}, { 0, -1, 0}, }, - { { 0, 0, 0}, {-1, -1, 1}, {-1, 0, 1}, {-1, 0, 0}, }, - { { 0, 0, 0}, {-1, -1, 1}, { 0, -1, 1}, { 0, 0, 1}, }, - { { 0, 0, 0}, {-1, -1, 1}, {-1, 0, 1}, { 0, 0, 1}, }, - { { 0, 0, 0}, { 0, 0, -1}, { 1, 0, -1}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 0, 0, -1}, { 0, 1, -1}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 0, -1}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 1, -1}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 1, 0}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 1, 1, 0}, { 1, 1, -1}, }, - { { 0, 0, 0}, { 0, 0, -1}, { 0, 1, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, 1, 0}, { 0, 1, -1}, {-1, 0, 0}, }, - { { 0, 0, 0}, { 0, 0, -1}, { 1, 0, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 1, 0, 0}, { 1, 0, -1}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 0, -1}, {-1, -1, 0}, { 0, -1, 0}, }, - { { 0, 0, 0}, { 0, 0, -1}, {-1, -1, 0}, {-1, 0, 0}, }, - }, + { + { + {0, 0, 0}, + {1, 0, 0}, + {1, 1, 0}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 0, 1}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 1, 1}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {1, 0, 1}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {0, 1, 1}, + {1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 1, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {0, 1, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 0, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {1, 0, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {-1, -1, 0}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {-1, -1, 0}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 1, 0}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 0, -1}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 0, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, -1, -1}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, -1, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {0, -1, -1}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {0, -1, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {-1, 0, -1}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {-1, 0, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {-1, -1, 0}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, -1, -1}, + {-1, -1, 0}, + {-1, 0, 0}, + }, + }, + { + { + {0, 0, 0}, + {1, 0, 0}, + {0, 1, 0}, + {0, 1, 1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 0, 1}, + {0, 1, 1}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {-1, 1, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 0, 1}, + {-1, 1, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 1, 0}, + {-1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 1, 1}, + {0, 1, 1}, + }, + { + {0, 0, 0}, + {-1, 0, 1}, + {0, 0, 1}, + {-1, 1, 1}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {-1, 1, 1}, + {0, 1, 1}, + }, + { + {0, 0, 0}, + {0, 0, 1}, + {0, -1, 0}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 0, 1}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {-1, 0, 1}, + {0, -1, 0}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 0, 1}, + {0, 0, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 0, -1}, + {1, 0, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 1, 0}, + {1, 0, -1}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 0, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 1, 0}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {0, -1, -1}, + {1, -1, -1}, + {0, 0, -1}, + }, + { + {0, 0, 0}, + {0, -1, -1}, + {1, -1, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {1, -1, -1}, + {0, 0, -1}, + {1, 0, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, -1, -1}, + {1, 0, -1}, + }, + { + {0, 0, 0}, + {1, -1, -1}, + {0, -1, 0}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, -1, -1}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {0, -1, -1}, + {0, 0, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, -1, -1}, + {0, -1, 0}, + {-1, 0, 0}, + }, + }, + { + { + {0, 0, 0}, + {1, 0, 0}, + {0, 1, 0}, + {1, 0, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + {1, 0, 1}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 0, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {1, -1, 1}, + {0, -1, 0}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {0, -1, 1}, + {1, -1, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, -1, 1}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, -1, 1}, + {1, 0, 1}, + }, + { + {0, 0, 0}, + {0, -1, 1}, + {1, -1, 1}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {1, -1, 1}, + {0, 0, 1}, + {1, 0, 1}, + }, + { + {0, 0, 0}, + {0, -1, 1}, + {0, -1, 0}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, -1, 1}, + {0, 0, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 0, -1}, + {0, 1, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 1, 0}, + {0, 1, -1}, + }, + { + {0, 0, 0}, + {-1, 0, -1}, + {0, 0, -1}, + {-1, 1, -1}, + }, + { + {0, 0, 0}, + {-1, 0, -1}, + {-1, 1, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {-1, 1, -1}, + {0, 1, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 1, -1}, + {0, 1, -1}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {-1, 1, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, 1, 0}, + {0, 1, 0}, + {-1, 1, -1}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {0, -1, 0}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, 0, -1}, + {1, -1, 0}, + }, + { + {0, 0, 0}, + {-1, 0, -1}, + {0, 0, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, 0, -1}, + {0, -1, 0}, + {-1, 0, 0}, + }, + }, + { + { + {0, 0, 0}, + {1, 0, 0}, + {1, 1, 0}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 0, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {-1, 0, 1}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, -1, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {0, -1, 1}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {-1, -1, 0}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {-1, -1, 0}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {0, -1, 1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {-1, 0, 1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {0, -1, 1}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {-1, -1, 1}, + {-1, 0, 1}, + {0, 0, 1}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {1, 0, -1}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {0, 1, -1}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 0, -1}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 1, -1}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 1, 0}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {1, 1, -1}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {0, 1, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, 1, 0}, + {0, 1, -1}, + {-1, 0, 0}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {1, 0, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {1, 0, 0}, + {1, 0, -1}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {-1, -1, 0}, + {0, -1, 0}, + }, + { + {0, 0, 0}, + {0, 0, -1}, + {-1, -1, 0}, + {-1, 0, 0}, + }, + }, }; -static double -get_integration_weight(const double omega, - THMCONST double tetrahedra_omegas[24][4], - double (*gn)(const long, - const double, - const double[4]), - double (*IJ)(const long, - const long, - const double, - const double[4])); +static double get_integration_weight( + const double omega, THMCONST double tetrahedra_omegas[24][4], + double (*gn)(const long, const double, const double[4]), + double (*IJ)(const long, const long, const double, const double[4])); static long get_main_diagonal(THMCONST double rec_lattice[3][3]); static long sort_omegas(double v[4]); static double norm_squared_d3(const double a[3]); -static void multiply_matrix_vector_di3(double v[3], - THMCONST double a[3][3], +static void multiply_matrix_vector_di3(double v[3], THMCONST double a[3][3], const long b[3]); -static double _f(const long n, - const long m, - const double omega, +static double _f(const long n, const long m, const double omega, const double vertices_omegas[4]); -static double _J(const long i, - const long ci, - const double omega, +static double _J(const long i, const long ci, const double omega, const double vertices_omegas[4]); -static double _I(const long i, - const long ci, - const double omega, +static double _I(const long i, const long ci, const double omega, const double vertices_omegas[4]); -static double _n(const long i, - const double omega, +static double _n(const long i, const double omega, const double vertices_omegas[4]); -static double _g(const long i, - const double omega, +static double _g(const long i, const double omega, const double vertices_omegas[4]); static double _n_0(void); -static double _n_1(const double omega, - const double vertices_omegas[4]); -static double _n_2(const double omega, - const double vertices_omegas[4]); -static double _n_3(const double omega, - const double vertices_omegas[4]); +static double _n_1(const double omega, const double vertices_omegas[4]); +static double _n_2(const double omega, const double vertices_omegas[4]); +static double _n_3(const double omega, const double vertices_omegas[4]); static double _n_4(void); static double _g_0(void); -static double _g_1(const double omega, - const double vertices_omegas[4]); -static double _g_2(const double omega, - const double vertices_omegas[4]); -static double _g_3(const double omega, - const double vertices_omegas[4]); +static double _g_1(const double omega, const double vertices_omegas[4]); +static double _g_2(const double omega, const double vertices_omegas[4]); +static double _g_3(const double omega, const double vertices_omegas[4]); static double _g_4(void); static double _J_0(void); -static double _J_10(const double omega, - const double vertices_omegas[4]); -static double _J_11(const double omega, - const double vertices_omegas[4]); -static double _J_12(const double omega, - const double vertices_omegas[4]); -static double _J_13(const double omega, - const double vertices_omegas[4]); -static double _J_20(const double omega, - const double vertices_omegas[4]); -static double _J_21(const double omega, - const double vertices_omegas[4]); -static double _J_22(const double omega, - const double vertices_omegas[4]); -static double _J_23(const double omega, - const double vertices_omegas[4]); -static double _J_30(const double omega, - const double vertices_omegas[4]); -static double _J_31(const double omega, - const double vertices_omegas[4]); -static double _J_32(const double omega, - const double vertices_omegas[4]); -static double _J_33(const double omega, - const double vertices_omegas[4]); +static double _J_10(const double omega, const double vertices_omegas[4]); +static double _J_11(const double omega, const double vertices_omegas[4]); +static double _J_12(const double omega, const double vertices_omegas[4]); +static double _J_13(const double omega, const double vertices_omegas[4]); +static double _J_20(const double omega, const double vertices_omegas[4]); +static double _J_21(const double omega, const double vertices_omegas[4]); +static double _J_22(const double omega, const double vertices_omegas[4]); +static double _J_23(const double omega, const double vertices_omegas[4]); +static double _J_30(const double omega, const double vertices_omegas[4]); +static double _J_31(const double omega, const double vertices_omegas[4]); +static double _J_32(const double omega, const double vertices_omegas[4]); +static double _J_33(const double omega, const double vertices_omegas[4]); static double _J_4(void); static double _I_0(void); -static double _I_10(const double omega, - const double vertices_omegas[4]); -static double _I_11(const double omega, - const double vertices_omegas[4]); -static double _I_12(const double omega, - const double vertices_omegas[4]); -static double _I_13(const double omega, - const double vertices_omegas[4]); -static double _I_20(const double omega, - const double vertices_omegas[4]); -static double _I_21(const double omega, - const double vertices_omegas[4]); -static double _I_22(const double omega, - const double vertices_omegas[4]); -static double _I_23(const double omega, - const double vertices_omegas[4]); -static double _I_30(const double omega, - const double vertices_omegas[4]); -static double _I_31(const double omega, - const double vertices_omegas[4]); -static double _I_32(const double omega, - const double vertices_omegas[4]); -static double _I_33(const double omega, - const double vertices_omegas[4]); +static double _I_10(const double omega, const double vertices_omegas[4]); +static double _I_11(const double omega, const double vertices_omegas[4]); +static double _I_12(const double omega, const double vertices_omegas[4]); +static double _I_13(const double omega, const double vertices_omegas[4]); +static double _I_20(const double omega, const double vertices_omegas[4]); +static double _I_21(const double omega, const double vertices_omegas[4]); +static double _I_22(const double omega, const double vertices_omegas[4]); +static double _I_23(const double omega, const double vertices_omegas[4]); +static double _I_30(const double omega, const double vertices_omegas[4]); +static double _I_31(const double omega, const double vertices_omegas[4]); +static double _I_32(const double omega, const double vertices_omegas[4]); +static double _I_33(const double omega, const double vertices_omegas[4]); static double _I_4(void); - void thm_get_relative_grid_address(long relative_grid_address[24][4][3], - THMCONST double rec_lattice[3][3]) -{ - long i, j, k, main_diag_index; + THMCONST double rec_lattice[3][3]) { + long i, j, k, main_diag_index; - main_diag_index = get_main_diagonal(rec_lattice); + main_diag_index = get_main_diagonal(rec_lattice); - for (i = 0; i < 24; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 3; k++) { - relative_grid_address[i][j][k] = - db_relative_grid_address[main_diag_index][i][j][k]; - } + for (i = 0; i < 24; i++) { + for (j = 0; j < 4; j++) { + for (k = 0; k < 3; k++) { + relative_grid_address[i][j][k] = + db_relative_grid_address[main_diag_index][i][j][k]; + } + } } - } } -void thm_get_all_relative_grid_address(long relative_grid_address[4][24][4][3]) -{ - long i, j, k, main_diag_index; - - for (main_diag_index = 0; main_diag_index < 4; main_diag_index++) { - for (i = 0; i < 24; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 3; k++) { - relative_grid_address[main_diag_index][i][j][k] = - db_relative_grid_address[main_diag_index][i][j][k]; +void thm_get_all_relative_grid_address( + long relative_grid_address[4][24][4][3]) { + long i, j, k, main_diag_index; + + for (main_diag_index = 0; main_diag_index < 4; main_diag_index++) { + for (i = 0; i < 24; i++) { + for (j = 0; j < 4; j++) { + for (k = 0; k < 3; k++) { + relative_grid_address[main_diag_index][i][j][k] = + db_relative_grid_address[main_diag_index][i][j][k]; + } + } } - } } - } } double thm_get_integration_weight(const double omega, THMCONST double tetrahedra_omegas[24][4], - const char function) -{ - if (function == 'I') { - return get_integration_weight(omega, - tetrahedra_omegas, - _g, _I); - } else { - return get_integration_weight(omega, - tetrahedra_omegas, - _n, _J); - } -} - -static double -get_integration_weight(const double omega, - THMCONST double tetrahedra_omegas[24][4], - double (*gn)(const long, - const double, - const double[4]), - double (*IJ)(const long, - const long, - const double, - const double[4])) -{ - long i, j, ci; - double sum; - double v[4]; - - sum = 0; - for (i = 0; i < 24; i++) { - for (j = 0; j < 4; j++) { - v[j] = tetrahedra_omegas[i][j]; - } - ci = sort_omegas(v); - if (omega < v[0]) { - sum += IJ(0, ci, omega, v) * gn(0, omega, v); + const char function) { + if (function == 'I') { + return get_integration_weight(omega, tetrahedra_omegas, _g, _I); } else { - if (v[0] < omega && omega < v[1]) { - sum += IJ(1, ci, omega, v) * gn(1, omega, v); - } else { - if (v[1] < omega && omega < v[2]) { - sum += IJ(2, ci, omega, v) * gn(2, omega, v); + return get_integration_weight(omega, tetrahedra_omegas, _n, _J); + } +} + +static double get_integration_weight( + const double omega, THMCONST double tetrahedra_omegas[24][4], + double (*gn)(const long, const double, const double[4]), + double (*IJ)(const long, const long, const double, const double[4])) { + long i, j, ci; + double sum; + double v[4]; + + sum = 0; + for (i = 0; i < 24; i++) { + for (j = 0; j < 4; j++) { + v[j] = tetrahedra_omegas[i][j]; + } + ci = sort_omegas(v); + if (omega < v[0]) { + sum += IJ(0, ci, omega, v) * gn(0, omega, v); } else { - if (v[2] < omega && omega < v[3]) { - sum += IJ(3, ci, omega, v) * gn(3, omega, v); - } else { - if (v[3] < omega) { - sum += IJ(4, ci, omega, v) * gn(4, omega, v); + if (v[0] < omega && omega < v[1]) { + sum += IJ(1, ci, omega, v) * gn(1, omega, v); + } else { + if (v[1] < omega && omega < v[2]) { + sum += IJ(2, ci, omega, v) * gn(2, omega, v); + } else { + if (v[2] < omega && omega < v[3]) { + sum += IJ(3, ci, omega, v) * gn(3, omega, v); + } else { + if (v[3] < omega) { + sum += IJ(4, ci, omega, v) * gn(4, omega, v); + } + } + } } - } } - } } - } - return sum / 6; + return sum / 6; +} + +static long sort_omegas(double v[4]) { + long i; + double w[4]; + + i = 0; + + if (v[0] > v[1]) { + w[0] = v[1]; + w[1] = v[0]; + i = 1; + } else { + w[0] = v[0]; + w[1] = v[1]; + } + + if (v[2] > v[3]) { + w[2] = v[3]; + w[3] = v[2]; + } else { + w[2] = v[2]; + w[3] = v[3]; + } + + if (w[0] > w[2]) { + v[0] = w[2]; + v[1] = w[0]; + if (i == 0) { + i = 4; + } + } else { + v[0] = w[0]; + v[1] = w[2]; + } + + if (w[1] > w[3]) { + v[3] = w[1]; + v[2] = w[3]; + if (i == 1) { + i = 3; + } + } else { + v[3] = w[3]; + v[2] = w[1]; + if (i == 1) { + i = 5; + } + } + + if (v[1] > v[2]) { + w[1] = v[1]; + v[1] = v[2]; + v[2] = w[1]; + if (i == 4) { + i = 2; + } + if (i == 5) { + i = 1; + } + } else { + if (i == 4) { + i = 1; + } + if (i == 5) { + i = 2; + } + } + return i; } -static long sort_omegas(double v[4]) -{ - long i; - double w[4]; - - i = 0; - - if (v[0] > v[1]) { - w[0] = v[1]; - w[1] = v[0]; - i = 1; - } else { - w[0] = v[0]; - w[1] = v[1]; - } - - if (v[2] > v[3]) { - w[2] = v[3]; - w[3] = v[2]; - } else { - w[2] = v[2]; - w[3] = v[3]; - } - - if (w[0] > w[2]) { - v[0] = w[2]; - v[1] = w[0]; - if (i == 0) { - i = 4; - } - } else { - v[0] = w[0]; - v[1] = w[2]; - } - - if (w[1] > w[3]) { - v[3] = w[1]; - v[2] = w[3]; - if (i == 1) { - i = 3; - } - } else { - v[3] = w[3]; - v[2] = w[1]; - if (i == 1) { - i = 5; - } - } - - if (v[1] > v[2]) { - w[1] = v[1]; - v[1] = v[2]; - v[2] = w[1]; - if (i == 4) { - i = 2; - } - if (i == 5) { - i = 1; - } - } else { - if (i == 4) { - i = 1; - } - if (i == 5) { - i = 2; - } - } - return i; -} - -static long get_main_diagonal(THMCONST double rec_lattice[3][3]) -{ - long i, shortest; - double length, min_length; - double main_diag[3]; - - shortest = 0; - multiply_matrix_vector_di3(main_diag, rec_lattice, main_diagonals[0]); - min_length = norm_squared_d3(main_diag); - for (i = 1; i < 4; i++) { - multiply_matrix_vector_di3(main_diag, rec_lattice, main_diagonals[i]); - length = norm_squared_d3(main_diag); - if (min_length > length) { - min_length = length; - shortest = i; - } - } - return shortest; -} - -static double norm_squared_d3(const double a[3]) -{ - return a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; -} - -static void multiply_matrix_vector_di3(double v[3], - THMCONST double a[3][3], - const long b[3]) -{ - long i; - double c[3]; - - for (i = 0; i < 3; i++) { - c[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2]; - } - - for (i = 0; i < 3; i++) { - v[i] = c[i]; - } -} - -static double _f(const long n, - const long m, - const double omega, - const double vertices_omegas[4]) -{ - return ((omega - vertices_omegas[m]) / - (vertices_omegas[n] - vertices_omegas[m])); -} - -static double _J(const long i, - const long ci, - const double omega, - const double vertices_omegas[4]) -{ - switch (i) { - case 0: - return _J_0(); - case 1: - switch (ci) { - case 0: - return _J_10(omega, vertices_omegas); - case 1: - return _J_11(omega, vertices_omegas); - case 2: - return _J_12(omega, vertices_omegas); - case 3: - return _J_13(omega, vertices_omegas); - } - case 2: - switch (ci) { - case 0: - return _J_20(omega, vertices_omegas); - case 1: - return _J_21(omega, vertices_omegas); - case 2: - return _J_22(omega, vertices_omegas); - case 3: - return _J_23(omega, vertices_omegas); - } - case 3: - switch (ci) { - case 0: - return _J_30(omega, vertices_omegas); - case 1: - return _J_31(omega, vertices_omegas); - case 2: - return _J_32(omega, vertices_omegas); - case 3: - return _J_33(omega, vertices_omegas); - } - case 4: - return _J_4(); - } - - warning_print("******* Warning *******\n"); - warning_print(" J is something wrong. \n"); - warning_print("******* Warning *******\n"); - warning_print("(line %d, %s).\n", __LINE__, __FILE__); - - return 0; -} - - -static double _I(const long i, - const long ci, - const double omega, - const double vertices_omegas[4]) -{ - switch (i) { - case 0: - return _I_0(); - case 1: - switch (ci) { - case 0: - return _I_10(omega, vertices_omegas); - case 1: - return _I_11(omega, vertices_omegas); - case 2: - return _I_12(omega, vertices_omegas); - case 3: - return _I_13(omega, vertices_omegas); - } - case 2: - switch (ci) { - case 0: - return _I_20(omega, vertices_omegas); - case 1: - return _I_21(omega, vertices_omegas); - case 2: - return _I_22(omega, vertices_omegas); - case 3: - return _I_23(omega, vertices_omegas); - } - case 3: - switch (ci) { - case 0: - return _I_30(omega, vertices_omegas); - case 1: - return _I_31(omega, vertices_omegas); - case 2: - return _I_32(omega, vertices_omegas); - case 3: - return _I_33(omega, vertices_omegas); - } - case 4: - return _I_4(); - } - - warning_print("******* Warning *******\n"); - warning_print(" I is something wrong. \n"); - warning_print("******* Warning *******\n"); - warning_print("(line %d, %s).\n", __LINE__, __FILE__); - - return 0; -} - -static double _n(const long i, - const double omega, - const double vertices_omegas[4]) -{ - switch (i) { - case 0: - return _n_0(); - case 1: - return _n_1(omega, vertices_omegas); - case 2: - return _n_2(omega, vertices_omegas); - case 3: - return _n_3(omega, vertices_omegas); - case 4: - return _n_4(); - } - - warning_print("******* Warning *******\n"); - warning_print(" n is something wrong. \n"); - warning_print("******* Warning *******\n"); - warning_print("(line %d, %s).\n", __LINE__, __FILE__); - - return 0; -} - -static double _g(const long i, - const double omega, - const double vertices_omegas[4]) -{ - switch (i) { - case 0: - return _g_0(); - case 1: - return _g_1(omega, vertices_omegas); - case 2: - return _g_2(omega, vertices_omegas); - case 3: - return _g_3(omega, vertices_omegas); - case 4: - return _g_4(); - } - - warning_print("******* Warning *******\n"); - warning_print(" g is something wrong. \n"); - warning_print("******* Warning *******\n"); - warning_print("(line %d, %s).\n", __LINE__, __FILE__); +static long get_main_diagonal(THMCONST double rec_lattice[3][3]) { + long i, shortest; + double length, min_length; + double main_diag[3]; + + shortest = 0; + multiply_matrix_vector_di3(main_diag, rec_lattice, main_diagonals[0]); + min_length = norm_squared_d3(main_diag); + for (i = 1; i < 4; i++) { + multiply_matrix_vector_di3(main_diag, rec_lattice, main_diagonals[i]); + length = norm_squared_d3(main_diag); + if (min_length > length) { + min_length = length; + shortest = i; + } + } + return shortest; +} - return 0; +static double norm_squared_d3(const double a[3]) { + return a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; } -/* omega < omega1 */ -static double _n_0(void) -{ - return 0.0; +static void multiply_matrix_vector_di3(double v[3], THMCONST double a[3][3], + const long b[3]) { + long i; + double c[3]; + + for (i = 0; i < 3; i++) { + c[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2]; + } + + for (i = 0; i < 3; i++) { + v[i] = c[i]; + } } +static double _f(const long n, const long m, const double omega, + const double vertices_omegas[4]) { + return ((omega - vertices_omegas[m]) / + (vertices_omegas[n] - vertices_omegas[m])); +} + +static double _J(const long i, const long ci, const double omega, + const double vertices_omegas[4]) { + switch (i) { + case 0: + return _J_0(); + case 1: + switch (ci) { + case 0: + return _J_10(omega, vertices_omegas); + case 1: + return _J_11(omega, vertices_omegas); + case 2: + return _J_12(omega, vertices_omegas); + case 3: + return _J_13(omega, vertices_omegas); + } + case 2: + switch (ci) { + case 0: + return _J_20(omega, vertices_omegas); + case 1: + return _J_21(omega, vertices_omegas); + case 2: + return _J_22(omega, vertices_omegas); + case 3: + return _J_23(omega, vertices_omegas); + } + case 3: + switch (ci) { + case 0: + return _J_30(omega, vertices_omegas); + case 1: + return _J_31(omega, vertices_omegas); + case 2: + return _J_32(omega, vertices_omegas); + case 3: + return _J_33(omega, vertices_omegas); + } + case 4: + return _J_4(); + } + + warning_print("******* Warning *******\n"); + warning_print(" J is something wrong. \n"); + warning_print("******* Warning *******\n"); + warning_print("(line %d, %s).\n", __LINE__, __FILE__); + + return 0; +} + +static double _I(const long i, const long ci, const double omega, + const double vertices_omegas[4]) { + switch (i) { + case 0: + return _I_0(); + case 1: + switch (ci) { + case 0: + return _I_10(omega, vertices_omegas); + case 1: + return _I_11(omega, vertices_omegas); + case 2: + return _I_12(omega, vertices_omegas); + case 3: + return _I_13(omega, vertices_omegas); + } + case 2: + switch (ci) { + case 0: + return _I_20(omega, vertices_omegas); + case 1: + return _I_21(omega, vertices_omegas); + case 2: + return _I_22(omega, vertices_omegas); + case 3: + return _I_23(omega, vertices_omegas); + } + case 3: + switch (ci) { + case 0: + return _I_30(omega, vertices_omegas); + case 1: + return _I_31(omega, vertices_omegas); + case 2: + return _I_32(omega, vertices_omegas); + case 3: + return _I_33(omega, vertices_omegas); + } + case 4: + return _I_4(); + } + + warning_print("******* Warning *******\n"); + warning_print(" I is something wrong. \n"); + warning_print("******* Warning *******\n"); + warning_print("(line %d, %s).\n", __LINE__, __FILE__); + + return 0; +} + +static double _n(const long i, const double omega, + const double vertices_omegas[4]) { + switch (i) { + case 0: + return _n_0(); + case 1: + return _n_1(omega, vertices_omegas); + case 2: + return _n_2(omega, vertices_omegas); + case 3: + return _n_3(omega, vertices_omegas); + case 4: + return _n_4(); + } + + warning_print("******* Warning *******\n"); + warning_print(" n is something wrong. \n"); + warning_print("******* Warning *******\n"); + warning_print("(line %d, %s).\n", __LINE__, __FILE__); + + return 0; +} + +static double _g(const long i, const double omega, + const double vertices_omegas[4]) { + switch (i) { + case 0: + return _g_0(); + case 1: + return _g_1(omega, vertices_omegas); + case 2: + return _g_2(omega, vertices_omegas); + case 3: + return _g_3(omega, vertices_omegas); + case 4: + return _g_4(); + } + + warning_print("******* Warning *******\n"); + warning_print(" g is something wrong. \n"); + warning_print("******* Warning *******\n"); + warning_print("(line %d, %s).\n", __LINE__, __FILE__); + + return 0; +} + +/* omega < omega1 */ +static double _n_0(void) { return 0.0; } + /* omega1 < omega < omega2 */ -static double _n_1(const double omega, - const double vertices_omegas[4]) -{ - return (_f(1, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(3, 0, omega, vertices_omegas)); +static double _n_1(const double omega, const double vertices_omegas[4]) { + return (_f(1, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(3, 0, omega, vertices_omegas)); } /* omega2 < omega < omega3 */ -static double _n_2(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas)); +static double _n_2(const double omega, const double vertices_omegas[4]) { + return ( + _f(3, 1, omega, vertices_omegas) * _f(2, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas)); } /* omega2 < omega < omega3 */ -static double _n_3(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 - - _f(0, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas)); +static double _n_3(const double omega, const double vertices_omegas[4]) { + return (1.0 - _f(0, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas)); } /* omega4 < omega */ -static double _n_4(void) -{ - return 1.0; -} +static double _n_4(void) { return 1.0; } /* omega < omega1 */ -static double _g_0(void) -{ - return 0.0; -} +static double _g_0(void) { return 0.0; } /* omega1 < omega < omega2 */ -static double _g_1(const double omega, - const double vertices_omegas[4]) -{ - return (3 * - _f(1, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) / - (vertices_omegas[3] - vertices_omegas[0])); +static double _g_1(const double omega, const double vertices_omegas[4]) { + return (3 * _f(1, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) / + (vertices_omegas[3] - vertices_omegas[0])); } /* omega2 < omega < omega3 */ -static double _g_2(const double omega, - const double vertices_omegas[4]) -{ - return (3 / - (vertices_omegas[3] - vertices_omegas[0]) * - (_f(1, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) + - _f(2, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas))); +static double _g_2(const double omega, const double vertices_omegas[4]) { + return ( + 3 / (vertices_omegas[3] - vertices_omegas[0]) * + (_f(1, 2, omega, vertices_omegas) * _f(2, 0, omega, vertices_omegas) + + _f(2, 1, omega, vertices_omegas) * _f(1, 3, omega, vertices_omegas))); } /* omega3 < omega < omega4 */ -static double _g_3(const double omega, - const double vertices_omegas[4]) -{ - return (3 * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas) / - (vertices_omegas[3] - vertices_omegas[0])); +static double _g_3(const double omega, const double vertices_omegas[4]) { + return (3 * _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas) / + (vertices_omegas[3] - vertices_omegas[0])); } /* omega4 < omega */ -static double _g_4(void) -{ - return 0.0; -} - -static double _J_0(void) -{ - return 0.0; -} - -static double _J_10(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 + - _f(0, 1, omega, vertices_omegas) + - _f(0, 2, omega, vertices_omegas) + - _f(0, 3, omega, vertices_omegas)) / 4; -} - -static double _J_11(const double omega, - const double vertices_omegas[4]) -{ - return _f(1, 0, omega, vertices_omegas) / 4; -} - -static double _J_12(const double omega, - const double vertices_omegas[4]) -{ - return _f(2, 0, omega, vertices_omegas) / 4; -} - -static double _J_13(const double omega, - const double vertices_omegas[4]) -{ - return _f(3, 0, omega, vertices_omegas) / 4; -} - -static double _J_20(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - (1.0 + - _f(0, 3, omega, vertices_omegas)) + - _f(3, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) * - (1.0 + - _f(0, 3, omega, vertices_omegas) + - _f(0, 2, omega, vertices_omegas))) / 4 / _n_2(omega, vertices_omegas); -} - -static double _J_21(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - (1.0 + - _f(1, 3, omega, vertices_omegas) + - _f(1, 2, omega, vertices_omegas)) + - _f(3, 0, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - (_f(1, 3, omega, vertices_omegas) + - _f(1, 2, omega, vertices_omegas)) + - _f(3, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas)) / 4 / _n_2(omega, vertices_omegas); -} - -static double _J_22(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) * - (_f(2, 1, omega, vertices_omegas) + - _f(2, 0, omega, vertices_omegas))) / 4 / _n_2(omega, vertices_omegas); -} - -static double _J_23(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 1, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - _f(3, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) * - (_f(3, 1, omega, vertices_omegas) + - _f(3, 0, omega, vertices_omegas)) + - _f(3, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) * - _f(3, 0, omega, vertices_omegas)) / 4 / _n_2(omega, vertices_omegas); -} - -static double _J_30(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 - - _f(0, 3, omega, vertices_omegas) * - _f(0, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas)) / 4 / _n_3(omega, vertices_omegas); -} - -static double _J_31(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 - - _f(0, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas)) / 4 / _n_3(omega, vertices_omegas); -} - -static double _J_32(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 - - _f(0, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas)) / 4 / _n_3(omega, vertices_omegas); -} - -static double _J_33(const double omega, - const double vertices_omegas[4]) -{ - return (1.0 - - _f(0, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 3, omega, vertices_omegas) * - (1.0 + - _f(3, 0, omega, vertices_omegas) + - _f(3, 1, omega, vertices_omegas) + - _f(3, 2, omega, vertices_omegas))) / 4 / _n_3(omega, vertices_omegas); -} - -static double _J_4(void) -{ - return 0.25; -} - -static double _I_0(void) -{ - return 0.0; -} - -static double _I_10(const double omega, - const double vertices_omegas[4]) -{ - return (_f(0, 1, omega, vertices_omegas) + - _f(0, 2, omega, vertices_omegas) + - _f(0, 3, omega, vertices_omegas)) / 3; -} - -static double _I_11(const double omega, - const double vertices_omegas[4]) -{ - return _f(1, 0, omega, vertices_omegas) / 3; -} - -static double _I_12(const double omega, - const double vertices_omegas[4]) -{ - return _f(2, 0, omega, vertices_omegas) / 3; -} - -static double _I_13(const double omega, - const double vertices_omegas[4]) -{ - return _f(3, 0, omega, vertices_omegas) / 3; -} - -static double _I_20(const double omega, - const double vertices_omegas[4]) -{ - return (_f(0, 3, omega, vertices_omegas) + - _f(0, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) / - (_f(1, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) + - _f(2, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas))) / 3; -} - -static double _I_21(const double omega, - const double vertices_omegas[4]) -{ - return (_f(1, 2, omega, vertices_omegas) + - _f(1, 3, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) / - (_f(1, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) + - _f(2, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas))) / 3; -} - -static double _I_22(const double omega, - const double vertices_omegas[4]) -{ - return (_f(2, 1, omega, vertices_omegas) + - _f(2, 0, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) * - _f(1, 2, omega, vertices_omegas) / - (_f(1, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) + - _f(2, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas))) / 3; -} - -static double _I_23(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 0, omega, vertices_omegas) + - _f(3, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas) * - _f(2, 1, omega, vertices_omegas) / - (_f(1, 2, omega, vertices_omegas) * - _f(2, 0, omega, vertices_omegas) + - _f(2, 1, omega, vertices_omegas) * - _f(1, 3, omega, vertices_omegas))) / 3; -} - -static double _I_30(const double omega, - const double vertices_omegas[4]) -{ - return _f(0, 3, omega, vertices_omegas) / 3; -} - -static double _I_31(const double omega, - const double vertices_omegas[4]) -{ - return _f(1, 3, omega, vertices_omegas) / 3; -} - -static double _I_32(const double omega, - const double vertices_omegas[4]) -{ - return _f(2, 3, omega, vertices_omegas) / 3; -} - -static double _I_33(const double omega, - const double vertices_omegas[4]) -{ - return (_f(3, 0, omega, vertices_omegas) + - _f(3, 1, omega, vertices_omegas) + - _f(3, 2, omega, vertices_omegas)) / 3; -} - -static double _I_4(void) -{ - return 0.0; +static double _g_4(void) { return 0.0; } + +static double _J_0(void) { return 0.0; } + +static double _J_10(const double omega, const double vertices_omegas[4]) { + return (1.0 + _f(0, 1, omega, vertices_omegas) + + _f(0, 2, omega, vertices_omegas) + + _f(0, 3, omega, vertices_omegas)) / + 4; +} + +static double _J_11(const double omega, const double vertices_omegas[4]) { + return _f(1, 0, omega, vertices_omegas) / 4; +} + +static double _J_12(const double omega, const double vertices_omegas[4]) { + return _f(2, 0, omega, vertices_omegas) / 4; +} + +static double _J_13(const double omega, const double vertices_omegas[4]) { + return _f(3, 0, omega, vertices_omegas) / 4; +} + +static double _J_20(const double omega, const double vertices_omegas[4]) { + return (_f(3, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + (1.0 + _f(0, 3, omega, vertices_omegas)) + + _f(3, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) * + (1.0 + _f(0, 3, omega, vertices_omegas) + + _f(0, 2, omega, vertices_omegas))) / + 4 / _n_2(omega, vertices_omegas); +} + +static double _J_21(const double omega, const double vertices_omegas[4]) { + return (_f(3, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + (1.0 + _f(1, 3, omega, vertices_omegas) + + _f(1, 2, omega, vertices_omegas)) + + _f(3, 0, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + (_f(1, 3, omega, vertices_omegas) + + _f(1, 2, omega, vertices_omegas)) + + _f(3, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas)) / + 4 / _n_2(omega, vertices_omegas); +} + +static double _J_22(const double omega, const double vertices_omegas[4]) { + return (_f(3, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) * + (_f(2, 1, omega, vertices_omegas) + + _f(2, 0, omega, vertices_omegas))) / + 4 / _n_2(omega, vertices_omegas); +} + +static double _J_23(const double omega, const double vertices_omegas[4]) { + return (_f(3, 1, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + _f(3, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) * + (_f(3, 1, omega, vertices_omegas) + + _f(3, 0, omega, vertices_omegas)) + + _f(3, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) * + _f(3, 0, omega, vertices_omegas)) / + 4 / _n_2(omega, vertices_omegas); +} + +static double _J_30(const double omega, const double vertices_omegas[4]) { + return (1.0 - _f(0, 3, omega, vertices_omegas) * + _f(0, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas)) / + 4 / _n_3(omega, vertices_omegas); +} + +static double _J_31(const double omega, const double vertices_omegas[4]) { + return (1.0 - _f(0, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas)) / + 4 / _n_3(omega, vertices_omegas); +} + +static double _J_32(const double omega, const double vertices_omegas[4]) { + return (1.0 - _f(0, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas)) / + 4 / _n_3(omega, vertices_omegas); +} + +static double _J_33(const double omega, const double vertices_omegas[4]) { + return (1.0 - _f(0, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 3, omega, vertices_omegas) * + (1.0 + _f(3, 0, omega, vertices_omegas) + + _f(3, 1, omega, vertices_omegas) + + _f(3, 2, omega, vertices_omegas))) / + 4 / _n_3(omega, vertices_omegas); +} + +static double _J_4(void) { return 0.25; } + +static double _I_0(void) { return 0.0; } + +static double _I_10(const double omega, const double vertices_omegas[4]) { + return (_f(0, 1, omega, vertices_omegas) + + _f(0, 2, omega, vertices_omegas) + + _f(0, 3, omega, vertices_omegas)) / + 3; +} + +static double _I_11(const double omega, const double vertices_omegas[4]) { + return _f(1, 0, omega, vertices_omegas) / 3; +} + +static double _I_12(const double omega, const double vertices_omegas[4]) { + return _f(2, 0, omega, vertices_omegas) / 3; +} + +static double _I_13(const double omega, const double vertices_omegas[4]) { + return _f(3, 0, omega, vertices_omegas) / 3; +} + +static double _I_20(const double omega, const double vertices_omegas[4]) { + return (_f(0, 3, omega, vertices_omegas) + + _f(0, 2, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) / + (_f(1, 2, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) + + _f(2, 1, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas))) / + 3; +} + +static double _I_21(const double omega, const double vertices_omegas[4]) { + return (_f(1, 2, omega, vertices_omegas) + + _f(1, 3, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) / + (_f(1, 2, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) + + _f(2, 1, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas))) / + 3; +} + +static double _I_22(const double omega, const double vertices_omegas[4]) { + return (_f(2, 1, omega, vertices_omegas) + + _f(2, 0, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) * + _f(1, 2, omega, vertices_omegas) / + (_f(1, 2, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) + + _f(2, 1, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas))) / + 3; +} + +static double _I_23(const double omega, const double vertices_omegas[4]) { + return (_f(3, 0, omega, vertices_omegas) + + _f(3, 1, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas) * + _f(2, 1, omega, vertices_omegas) / + (_f(1, 2, omega, vertices_omegas) * + _f(2, 0, omega, vertices_omegas) + + _f(2, 1, omega, vertices_omegas) * + _f(1, 3, omega, vertices_omegas))) / + 3; +} + +static double _I_30(const double omega, const double vertices_omegas[4]) { + return _f(0, 3, omega, vertices_omegas) / 3; +} + +static double _I_31(const double omega, const double vertices_omegas[4]) { + return _f(1, 3, omega, vertices_omegas) / 3; +} + +static double _I_32(const double omega, const double vertices_omegas[4]) { + return _f(2, 3, omega, vertices_omegas) / 3; +} + +static double _I_33(const double omega, const double vertices_omegas[4]) { + return (_f(3, 0, omega, vertices_omegas) + + _f(3, 1, omega, vertices_omegas) + + _f(3, 2, omega, vertices_omegas)) / + 3; } + +static double _I_4(void) { return 0.0; } diff -Nru phonopy-2.12.0/c/tetrahedron_method.h phonopy-2.13.1/c/tetrahedron_method.h --- phonopy-2.12.0/c/tetrahedron_method.h 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/c/tetrahedron_method.h 2022-02-13 03:47:08.000000000 +0000 @@ -39,8 +39,6 @@ #define THMCONST #endif -#include - void thm_get_relative_grid_address(long relative_grid_address[24][4][3], THMCONST double rec_lattice[3][3]); void thm_get_all_relative_grid_address(long relative_grid_address[4][24][4][3]); diff -Nru phonopy-2.12.0/debian/changelog phonopy-2.13.1/debian/changelog --- phonopy-2.12.0/debian/changelog 2021-11-24 09:16:43.000000000 +0000 +++ phonopy-2.13.1/debian/changelog 2022-02-17 07:11:06.000000000 +0000 @@ -1,3 +1,11 @@ +phonopy (2.13.1-1) unstable; urgency=medium + + * New upstream version 2.13.1 + * Updating debian/copyright. + * Updating manpages. + + -- Andrius Merkys Thu, 17 Feb 2022 02:11:06 -0500 + phonopy (2.12.0-2) unstable; urgency=medium [ Andrius Merkys ] diff -Nru phonopy-2.12.0/debian/copyright phonopy-2.13.1/debian/copyright --- phonopy-2.12.0/debian/copyright 2021-11-24 09:15:10.000000000 +0000 +++ phonopy-2.13.1/debian/copyright 2022-02-17 06:52:39.000000000 +0000 @@ -4,11 +4,33 @@ Source: https://github.com/phonopy/phonopy Files: * -Copyright: 2014, Atsushi Togo +Copyright: 2010-2022, Atsushi Togo +License: BSD-3-Clause + +Files: phonopy/interface/crystal.py + phonopy/interface/turbomole.py + scripts/phonopy-crystal-born +Copyright: 2016-2019, Antti J. Karttunen +License: BSD-3-Clause + +Files: phonopy/interface/fleur.py +Copyright: 2021, Alexander Neukirchen +License: BSD-3-Clause + +Files: phonopy/interface/siesta.py +Copyright: 2015, Henrique Pereira Coutada Miranda +License: BSD-3-Clause + +Files: phonopy/interface/aims.py +Copyright: 2009-2011, Joerg Meyer +License: BSD-3-Clause + +Files: phonopy/interface/cp2k.py +Copyright: 2017-2019, Tiziano Müller License: BSD-3-Clause Files: debian/* -Copyright: 2021, Andrius Merkys +Copyright: 2021-2022, Andrius Merkys License: BSD-3-Clause License: BSD-3-Clause diff -Nru phonopy-2.12.0/debian/man/phonopy.1 phonopy-2.13.1/debian/man/phonopy.1 --- phonopy-2.12.0/debian/man/phonopy.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy.1 2022-02-17 07:02:40.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY "1" "November 2021" "phonopy 2.12.0" "User Commands" +.TH PHONOPY "1" "February 2022" "phonopy 2.13.1" "User Commands" .SH NAME -phonopy \- manual page for phonopy 2.12.0 +phonopy \- manual page for phonopy 2.13.1 .SH DESCRIPTION usage: phonopy [\-h] [\-\-abinit] [\-\-aims] [\-\-cp2k] [\-\-crystal] [\-\-dftb+] [\-\-elk] .IP diff -Nru phonopy-2.12.0/debian/man/phonopy-bandplot.1 phonopy-2.13.1/debian/man/phonopy-bandplot.1 --- phonopy-2.12.0/debian/man/phonopy-bandplot.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-bandplot.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-BANDPLOT "1" "November 2021" "phonopy-bandplot 2.12.0" "User Commands" +.TH PHONOPY-BANDPLOT "1" "February 2022" "phonopy-bandplot 2.13.1" "User Commands" .SH NAME -phonopy-bandplot \- manual page for phonopy-bandplot 2.12.0 +phonopy-bandplot \- manual page for phonopy-bandplot 2.13.1 .SH DESCRIPTION usage: phonopy\-bandplot [\-h] [\-\-hdf5] [\-\-dmax DOS_MAX] [\-\-dmin DOS_MIN] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-calc-convert.1 phonopy-2.13.1/debian/man/phonopy-calc-convert.1 --- phonopy-2.12.0/debian/man/phonopy-calc-convert.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-calc-convert.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-CALC-CONVERT "1" "November 2021" "phonopy-calc-convert 2.12.0" "User Commands" +.TH PHONOPY-CALC-CONVERT "1" "February 2022" "phonopy-calc-convert 2.13.1" "User Commands" .SH NAME -phonopy-calc-convert \- manual page for phonopy-calc-convert 2.12.0 +phonopy-calc-convert \- manual page for phonopy-calc-convert 2.13.1 .SH DESCRIPTION usage: phonopy\-calc\-convert [\-h] [\-i FILE_IN] [\-o FILE_OUT] [\-\-calcin CALC_IN] .IP diff -Nru phonopy-2.12.0/debian/man/phonopy-crystal-born.1 phonopy-2.13.1/debian/man/phonopy-crystal-born.1 --- phonopy-2.12.0/debian/man/phonopy-crystal-born.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-crystal-born.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-CRYSTAL-BORN "1" "November 2021" "phonopy-crystal-born 2.12.0" "User Commands" +.TH PHONOPY-CRYSTAL-BORN "1" "February 2022" "phonopy-crystal-born 2.13.1" "User Commands" .SH NAME -phonopy-crystal-born \- manual page for phonopy-crystal-born 2.12.0 +phonopy-crystal-born \- manual page for phonopy-crystal-born 2.13.1 .SH DESCRIPTION usage: phonopy\-crystal\-born [\-h] [filename ...] .PP diff -Nru phonopy-2.12.0/debian/man/phonopy-gruneisen.1 phonopy-2.13.1/debian/man/phonopy-gruneisen.1 --- phonopy-2.12.0/debian/man/phonopy-gruneisen.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-gruneisen.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-GRUNEISEN "1" "November 2021" "phonopy-gruneisen 2.12.0" "User Commands" +.TH PHONOPY-GRUNEISEN "1" "February 2022" "phonopy-gruneisen 2.13.1" "User Commands" .SH NAME -phonopy-gruneisen \- manual page for phonopy-gruneisen 2.12.0 +phonopy-gruneisen \- manual page for phonopy-gruneisen 2.13.1 .SH DESCRIPTION usage: phonopy\-gruneisen [\-h] [\-\-abinit] [\-\-aims] [\-\-cp2k] [\-\-crystal] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-gruneisenplot.1 phonopy-2.13.1/debian/man/phonopy-gruneisenplot.1 --- phonopy-2.12.0/debian/man/phonopy-gruneisenplot.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-gruneisenplot.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-GRUNEISENPLOT "1" "November 2021" "phonopy-gruneisenplot 2.12.0" "User Commands" +.TH PHONOPY-GRUNEISENPLOT "1" "February 2022" "phonopy-gruneisenplot 2.13.1" "User Commands" .SH NAME -phonopy-gruneisenplot \- manual page for phonopy-gruneisenplot 2.12.0 +phonopy-gruneisenplot \- manual page for phonopy-gruneisenplot 2.13.1 .SH DESCRIPTION usage: phonopy\-gruneisenplot [\-h] [\-\-gnuplot] [\-o OUTPUT_FILENAME] [\-s] [\-\-fg] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-load.1 phonopy-2.13.1/debian/man/phonopy-load.1 --- phonopy-2.12.0/debian/man/phonopy-load.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-load.1 2022-02-17 07:02:41.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-LOAD "1" "November 2021" "phonopy-load 2.12.0" "User Commands" +.TH PHONOPY-LOAD "1" "February 2022" "phonopy-load 2.13.1" "User Commands" .SH NAME -phonopy-load \- manual page for phonopy-load 2.12.0 +phonopy-load \- manual page for phonopy-load 2.13.1 .SH DESCRIPTION usage: phonopy\-load [\-h] [\-\-abinit] [\-\-aims] [\-\-cp2k] [\-\-crystal] [\-\-dftb+] .TP @@ -15,8 +15,7 @@ [\-\-band\-format BAND_FORMAT] [\-\-band\-points BAND_POINTS] [\-\-bi BAND_INDICES [BAND_INDICES ...]] [\-\-config FILE] [\-\-cutoff\-freq CUTOFF_FREQUENCY] -[\-\-cutoff\-radius CUTOFF_RADIUS] [\-d] [\-\-dense\-svecs] -[\-\-dim SUPERCELL_DIMENSION [SUPERCELL_DIMENSION ...]] +[\-\-cutoff\-radius CUTOFF_RADIUS] [\-\-dense\-svecs] [\-\-dm\-decimals DYNAMICAL_MATRIX_DECIMALS] [\-\-dos] [\-\-eigvecs] [\-\-exclude\-born] [\-f CREATE_FORCE_SETS [CREATE_FORCE_SETS ...]] @@ -150,16 +149,10 @@ \fB\-\-cutoff\-radius\fR CUTOFF_RADIUS Out of cutoff radius, force constants are set zero. .TP -\fB\-d\fR, \fB\-\-displacement\fR -Create supercells with displacements -.TP \fB\-\-dense\-svecs\fR Pair shortest vectors in supercell are stored in dense format. .TP -\fB\-\-dim\fR SUPERCELL_DIMENSION [SUPERCELL_DIMENSION ...] -Same behavior as DIM tag -.TP \fB\-\-dm\-decimals\fR DYNAMICAL_MATRIX_DECIMALS Decimals of values of decimals .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-pdosplot.1 phonopy-2.13.1/debian/man/phonopy-pdosplot.1 --- phonopy-2.12.0/debian/man/phonopy-pdosplot.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-pdosplot.1 2022-02-17 07:02:43.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-PDOSPLOT "1" "November 2021" "phonopy-pdosplot 2.12.0" "User Commands" +.TH PHONOPY-PDOSPLOT "1" "February 2022" "phonopy-pdosplot 2.13.1" "User Commands" .SH NAME -phonopy-pdosplot \- manual page for phonopy-pdosplot 2.12.0 +phonopy-pdosplot \- manual page for phonopy-pdosplot 2.13.1 .SH DESCRIPTION usage: phonopy\-pdosplot [\-h] [\-\-factor FACTOR] [\-l] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-propplot.1 phonopy-2.13.1/debian/man/phonopy-propplot.1 --- phonopy-2.12.0/debian/man/phonopy-propplot.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-propplot.1 2022-02-17 07:02:43.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-PROPPLOT "1" "November 2021" "phonopy-propplot 2.12.0" "User Commands" +.TH PHONOPY-PROPPLOT "1" "February 2022" "phonopy-propplot 2.13.1" "User Commands" .SH NAME -phonopy-propplot \- manual page for phonopy-propplot 2.12.0 +phonopy-propplot \- manual page for phonopy-propplot 2.13.1 .SH DESCRIPTION usage: phonopy\-propplot [\-h] [\-\-factor FACTOR] [\-\-ymax YMAX] [\-\-ymin YMIN] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-qha.1 phonopy-2.13.1/debian/man/phonopy-qha.1 --- phonopy-2.12.0/debian/man/phonopy-qha.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-qha.1 2022-02-17 07:02:44.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-QHA "1" "November 2021" "phonopy-qha 2.12.0" "User Commands" +.TH PHONOPY-QHA "1" "February 2022" "phonopy-qha 2.13.1" "User Commands" .SH NAME -phonopy-qha \- manual page for phonopy-qha 2.12.0 +phonopy-qha \- manual page for phonopy-qha 2.13.1 .SH DESCRIPTION usage: phonopy\-qha [\-h] [\-b] [\-\-eos EOS] [\-\-exclude_imaginary] [\-p] .IP diff -Nru phonopy-2.12.0/debian/man/phonopy-tdplot.1 phonopy-2.13.1/debian/man/phonopy-tdplot.1 --- phonopy-2.12.0/debian/man/phonopy-tdplot.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-tdplot.1 2022-02-17 07:02:44.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-TDPLOT "1" "November 2021" "phonopy-tdplot 2.12.0" "User Commands" +.TH PHONOPY-TDPLOT "1" "February 2022" "phonopy-tdplot 2.13.1" "User Commands" .SH NAME -phonopy-tdplot \- manual page for phonopy-tdplot 2.12.0 +phonopy-tdplot \- manual page for phonopy-tdplot 2.13.1 .SH DESCRIPTION usage: phonopy\-tdplot [\-h] [\-i TD_INDICES] [\-\-factor FACTOR] [\-\-ymax YMAX] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-vasp-born.1 phonopy-2.13.1/debian/man/phonopy-vasp-born.1 --- phonopy-2.12.0/debian/man/phonopy-vasp-born.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-vasp-born.1 2022-02-17 07:02:44.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-VASP-BORN "1" "November 2021" "phonopy-vasp-born 2.12.0" "User Commands" +.TH PHONOPY-VASP-BORN "1" "February 2022" "phonopy-vasp-born 2.13.1" "User Commands" .SH NAME -phonopy-vasp-born \- manual page for phonopy-vasp-born 2.12.0 +phonopy-vasp-born \- manual page for phonopy-vasp-born 2.13.1 .SH DESCRIPTION usage: phonopy\-vasp\-born [\-h] [\-\-dim SUPERCELL_MATRIX] [\-\-pa PRIMITIVE_AXES] .TP diff -Nru phonopy-2.12.0/debian/man/phonopy-vasp-efe.1 phonopy-2.13.1/debian/man/phonopy-vasp-efe.1 --- phonopy-2.12.0/debian/man/phonopy-vasp-efe.1 2021-11-24 06:54:14.000000000 +0000 +++ phonopy-2.13.1/debian/man/phonopy-vasp-efe.1 2022-02-17 07:02:45.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH PHONOPY-VASP-EFE "1" "November 2021" "phonopy-vasp-efe 2.12.0" "User Commands" +.TH PHONOPY-VASP-EFE "1" "February 2022" "phonopy-vasp-efe 2.13.1" "User Commands" .SH NAME -phonopy-vasp-efe \- manual page for phonopy-vasp-efe 2.12.0 +phonopy-vasp-efe \- manual page for phonopy-vasp-efe 2.13.1 .SH DESCRIPTION usage: phonopy\-vasp\-efe [\-h] [\-\-tmax TMAX] [\-\-tmin TMIN] [\-\-tstep TSTEP] .IP diff -Nru phonopy-2.12.0/doc/animation.md phonopy-2.13.1/doc/animation.md --- phonopy-2.12.0/doc/animation.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/animation.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,32 @@ +(create_animation)= + +# How to watch animation + +To watch each phonon mode, v_sim is recommended. The file `anime.ascii` is +supposed to work with v_sim version 3.51 or later. An example how to watch +phonon modes at a **q**-point is shown as follows. + +First, you need to create a phonopy input file with, e.g., `ANIME = 0.5 0.5 0`. +After running phonopy with this input file, you get `anime.ascii` that contains +all phonon modes at the **q**-point. Then start v_sim + +```bash +% v_sim anime.ascii +``` + +After opening the graphical user interface, you can find a tab called +**Phonons**. There you can see the phonon modes at the **q**-point that you +specified in the phonopy input file. Then select one of the phonon modes and +watch by pushing the play button. Because only the unit cell shows up at the +start of v_sim, if you want to watch a phonon modulation with a longer period, +then change the values of **Expand nodes** in the **Box and symmetry** tab +(http://inac.cea.fr/L_Sim/V_Sim/user_guide.html#trans). This is especially +important when you choose a **q**-point other than the {math}`\Gamma`-point. + +V_sim has a good graphical user interface and also a lot of command line +options. To read the manual well and to check the command line options help you +to use v_sim comfortably, e.g., + +```bash +% v_sim -w oneWindow anime.ascii -x 1:1:0 -t 0.5:0.5:0.5 +``` diff -Nru phonopy-2.12.0/doc/animation.rst phonopy-2.13.1/doc/animation.rst --- phonopy-2.12.0/doc/animation.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/animation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -.. _create_animation: - -How to watch animation ------------------------ - -To watch each phonon mode, v_sim is recommended. The file -``anime.ascii`` is supposed to work with v_sim version 3.51 or later. -An example how to watch phonon modes at a *q*-point is shown as follows. - -First, you need to create a phonopy input file with, e.g., ``ANIME = -0.5 0.5 0``. After running phonopy with this input file, you get -``anime.ascii`` that contains all phonon modes at the *q*-point. Then -start v_sim - -:: - - v_sim anime.ascii - -After opening the graphical user interface, you can find a tab called -**Phonons**. There you can see the phonon modes at the *q*-point that -you specified in the phonopy input file. Then select one of the phonon -modes and watch by pushing the play button. Because only the unit cell -shows up at the start of v_sim, if you want to watch a phonon -modulation with a longer period, then change the values of **Expand -nodes** in the **Box and symmetry** tab -(http://inac.cea.fr/L_Sim/V_Sim/user_guide.html#trans). This is -especially important when you choose a *q*-point other than the -:math:`\Gamma`-point. - -V_sim has a good graphical user interface and also a lot of command -line options. To read the manual well and to check the command line -options help you to use v_sim comfortably, e.g., - -:: - - v_sim -w oneWindow anime.ascii -x 1:1:0 -t 0.5:0.5:0.5 diff -Nru phonopy-2.12.0/doc/auxiliary-tools.md phonopy-2.13.1/doc/auxiliary-tools.md --- phonopy-2.12.0/doc/auxiliary-tools.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/auxiliary-tools.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,102 @@ +(auxiliary_tools)= + +# Auxiliary tools + +A few auxiliary tools are prepared. They are stored in `bin` directory as well +as `phonopy`. + +```{contents} +:depth: 3 +:local: +``` + +(bandplot_tool)= + +## `phonopy-bandplot` + +Band structure is plotted reading phonopy output in `band.yaml` format. `-o` +option with a file name is used to save the plot into a file in PDF format. A +few more options are prepared and shown by `-h` option. If you specify more than +two yaml files, they are plotted together. + +```bash +% phonopy-bandplot band.yaml +``` + +To obtain a simple text format data: + +```bash +% phonopy-bandplot --gnuplot band.yaml +``` + +(pdosplot_tool)= + +## `phonopy-pdosplot` + +Partial density of states (PDOS) are plotted. + +`-i` option is used as + +```bash +% phonopy-pdosplot -i '1 2 4 5, 3 6' -o 'pdos.pdf' partial_dos.dat +``` + +The indices and comma in `1 2 3 4, 5 6` mean as follows. The indices are +separated into blocks by comma (1 2 4 5 and 3 6). PDOS specified by the +successive indices separated by space in each block are summed up. The PDOS of +blocks are drawn simultaneously. Indices usually correspond to atoms. A few more +options are prepared and shown by `-h` option. + +(propplot_tool)= + +## `phonopy-propplot` + +Thermal properties are plotted. Options are prepared and shown by `-h` option. +If you specify more than two yaml files, they are plotted together. + +``` +% phonopy-proplot thermal_properties_A.yaml thermal_properties_B.yaml +``` + +## `phonopy-vasp-born` + +This script is used to create a `BORN` style file from VASP output file of +`vasprun.xml`. The first argument is a `vasprun.xml` file. If it is omitted, +`vasprun.xml` at current directory are read. The Born effective charges and +dielectric tensor are symmetrized as default. To prevent symmetrization, +`--nost` option has to be specified. + +```bash +% phonopy-vasp-born +``` + +```bash +% phonopy-vasp-born --nost +``` + +### `--pa`, `--primitive-axes` + +This is same as {ref}`primitive_axis_tag`. + +### `--dim` + +This is same as {ref}`dimension_tag`. + +### `--nost` + +Dielectric constant and Born effective charge tensors are not symmetrized. + +### `--outcar` + +Read `OUTCAR` instead of `vasprun.xml`. Without specifying arguments, `OUTCAR` +and `POSCAR` at current directory are read. `POSCAR` information is necessary in +contrast to reading `vasprun.xml` where the unit cell structure is also read +from it. + +```bash +% phonopy-vasp-born --outcar +``` + +```bash +% phonopy-vasp-born --nost --outcar OUTCAR POSCAR +``` diff -Nru phonopy-2.12.0/doc/auxiliary-tools.rst phonopy-2.13.1/doc/auxiliary-tools.rst --- phonopy-2.12.0/doc/auxiliary-tools.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/auxiliary-tools.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -.. _auxiliary_tools: - -Auxiliary tools -=============== - -A few auxiliary tools are prepared. They are stored in ``bin`` -directory as well as ``phonopy``. - -.. contents:: - :depth: 3 - :local: - -.. _bandplot_tool: - -``phonopy-bandplot`` ---------------------- - -Band structure is plotted reading phonopy output in ``band.yaml`` -format. ``-o`` option with a file name is used to save the plot into a -file in PDF format. A few more options are prepared and shown by -``-h`` option. If you specify more than two yaml files, they are -plotted together. - -:: - - phonopy-bandplot band.yaml - -To obtain a simple text format data:: - - phonopy-bandplot --gnuplot band.yaml - -.. _pdosplot_tool: - -``phonopy-pdosplot`` ---------------------- - -Partial density of states (PDOS) are plotted. - -``-i`` option is used as - -:: - - phonopy-pdosplot -i '1 2 4 5, 3 6' -o 'pdos.pdf' partial_dos.dat - -The indices and comma in '1 2 3 4, 5 6' mean as follows. The indices -are separated into blocks by comma (1 2 4 5 and 3 6). PDOS specified -by the successive indices separated by space in each block are summed -up. The PDOS of blocks are drawn simultaneously. Indices usually -correspond to atoms. A few more options are prepared and shown by -``-h`` option. - -.. _propplot_tool: - -``phonopy-propplot`` ---------------------- - -Thermal properties are plotted. Options are prepared and shown by -``-h`` option. If you specify more than two yaml files, they are -plotted together. - -:: - - phonopy-proplot thermal_properties_A.yaml thermal_properties_B.yaml - -.. ``tdplot`` -.. ------------ - -.. Mean square displacements are plotted. Options are prepared and shown by -.. ``-h`` option. ``-i`` option may be important, which works such like -.. that of pdosplot. - -.. :: - -.. tdplot -i '1 2 4 5, 3 6' -o 'td.pdf' thermal_displacements.yaml - -``phonopy-vasp-born`` ----------------------- - -This script is used to create a ``BORN`` style file from VASP output -file of ``vasprun.xml``. The first argument is a ``vasprun.xml`` -file. If it is ommited, ``vasprun.xml`` at current directory are -read. The Born effective charges and dielectric tensor are symmetrized -as default. To prevent symmetrization, ``--nost`` option has to be -specified. - -:: - - phonopy-vasp-born - -:: - - phonopy-vasp-born --nost - - -``--pa``, ``--primitive-axes`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This is same as :ref:`primitive_axis_tag`. - -``--dim`` -^^^^^^^^^^ - -This is same as :ref:`dimension_tag`. - -``--nost`` -^^^^^^^^^^^ - -Dielectric constant and Born effective charge tensors are not -symmetrized. - -``--outcar`` -^^^^^^^^^^^^^^^^^ - -Read ``OUTCAR`` instead of ``vasprun.xml``. Without specifying -arguments, ``OUTCAR`` and ``POSCAR`` at current directory are -read. ``POSCAR`` information is necessary in contrast to reading -``vasprun.xml`` where the unit cell structure is also read from it. - -:: - - phonopy-vasp-born --outcar - -:: - - phonopy-vasp-born --nost --outcar OUTCAR POSCAR diff -Nru phonopy-2.12.0/doc/changelog.md phonopy-2.13.1/doc/changelog.md --- phonopy-2.12.0/doc/changelog.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/changelog.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,1003 @@ +(changelog)= + +# Change Log + +## Feb-13-2022: Version 2.13.1 + +- Bug fix of thermal property calculation (PR #184). + +## Feb-12-2022: Version 2.13.0 + +- Dorp python 3.6 support, and dependencies of numpy and matplotlib versions are + updated: + + - Python >= 3.7 + - numpy >= 1.15.0 + - matplotlib >= 2.2.2 + +## Oct-28-2021: Version 2.12.0 + +- Matplotlib built-in mathtext replaced LaTeX renderer with `text.usetex` to + avoid requiring latex installation. +- Aiming modernizing phonopy code, required python version and package versions + were changed to + + - Python >= 3.6 + - numpy >= 1.11 + - matplotlib >= 2.0 + +- For developers, flake8, black, pydocstyle, and isort were introduced. See + `REAEME.md` and `.pre-commit-config.yaml`. + +## Jul-8-2021: Version 2.11.0 + +- Maintenance release. C-methods were changed to use dense shortest vectors + (`Primitive.get_smallest_vectors()`) format. But the front end still uses + current format `shape=(size_super, size_prim, 27, 3)`. + +## Jun-10-2021: Version 2.10.0 + +- Fix the contents of `entropy-volume.dat` and `Cv-volume.dat` in QHA were + swapped. (Issue #144 by @prnvrvs) +- Implementation of writing `helmholtz-volume_fitted.dat` in QHA. (PR #149 by + @kgmat) + +## Mar-17-2021: Version 2.9.3 + +- Fix `MANIFEST.in` to provide necessary files to compile. + +## Mar-17-2021: Version 2.9.2 + +- Fix a bug to make the initial symmetry search slow. + +## Jan-29-2021: Version 2.9.1 + +- Release for making pypi wheel of py3.9 + +## Jan-28-2021: Version 2.9.0 + +- {ref}`Fleur interface ` was made by @neukirchen-212. +- Improvement of `phonopy-bandplot` by @kgmat (PR#131, #132, #134) + +## Sep-29-2020: Version 2.8.1 + +- Fix vasprun.xml expat parser (issues #129) + +## Sep-22-2020: Version 2.8.0 + +- {ref}`CASTEP interface ` was made by @ladyteam. +- It was made to give more information in `gruneisen.yaml` (@ab5424, PR#127). +- Fix and update of `phonopy-bandplot` (@kgmat PR#125, commit 816a12a9) + +## July-31-2020: Version 2.7.1 + +- Release for pypi and conda packaging + +## July-22-2020: Version 2.7.0 + +- Spglib was removed from phonopy source code tree. Now phonopy depends on + spglib. So spglib has to be installed separately. But for normal cases, it is + handled by the package manager. +- A new way of using phonopy from command line is proposed at + {ref}`phonopy_load_command`. +- Castep interface was added by @ladyteam. + +## May-3-2020: Version 2.6.1 + +- Release for pypi and conda packaging + +## May-2-2020: Version 2.6.0 + +- Collection of minor fixes and internal updates + +## Mar-29-2020: Version 2.5.0 + +- New options, `--include-*`, to write summary in `phonopy.yaml`. See + {ref}`summary_tag`. +- FHI-aims interface (`--aims`) was created by Florian Knoop. +- `phonopy-gruneisen` and `--symmetry` option were updated to be able to handle + most of build-in calculator interfaces. +- Update spglib version to v1.14.1. +- `phonopy-dispmanager` was removed. +- Let new force calculator interface be implemented easier by centralizing those + interface related stuffs in `phonopy.interface.calculator`. + +## Dec-22-2019: Version 2.4.2 + +- Collection of minor updates: adding docstrings, refactoring group velocity + code, and updating examples. + +## Nov-16-2019: Version 2.4.1 + +- Fix a bug on Phonopy.save reported by PR#104 + +## Nov-13-2019: Version 2.4.0 + +- CP2K interface is provided by Tiziano Müller. +- Many minor bug fixes and updates. + +## Sep-1-2019: Version 2.3.2 + +- It was forgotten to increment version number at v2.3.1. Now it is made to be + v2.3.2 just for incrementing the number. + +## Aug-29-2019: Version 2.3.1 + +- Fix alm wrapper to follow the lastest basis vector matrix form. + +## Aug-29-2019: Version 2.3.0 + +- New setting tag {ref}`fc_calculator_tag` was implemented. With this, an + external force constants calculator can be used. Currently only ALM + (`FC_CALCULATOR = alm` or `--alm` option) is supported. By using ALM, we can + compute force constants with any number of displacements in each supercell. + Any number of supercells with displacements can be also handled with it if + ordinary least square fitting can be solved for force constants. + {ref}`random_displacements_tag` and {ref}`random_seed_tag` were implemented to + use with ALM. +- For the external force constants calculator, new file format of `FORCE_SETS` + was introduced. See {ref}`file_forces_type_2` `FORCE_SETS` format. + +## Jul-21-2019: Version 2.2.0 + +- Collection of minor updates. +- Spglib update to v1.13.0. + +## Jun-19-2019: Version 2.1.4 + +- [Bug fix](https://github.com/atztogo/phonopy/pull/96) of + `Cp-temperature_polyfit.dat` calculation in QHA (by `@ezanardi`). + +## Apr-17-2019: Version 2.1.3 + +- TURBOMOLE interface is provided by Antti Karttunen (`--turbomole`). + +## Mar-24-2019: Version 2.1.2 + +- `PDOS = AUTO` (`--pdos="auto"`) was implemented. + +## Feb-27-2019: Version 2.1.1 + +- User interface bug fix release. + +## Feb-26-2019: Version 2.1 + +- Spglib update to v1.12.1. +- (Experimental) `phonopy` command accepts `phonopy.yaml` type file as an input + crystal structure by `-c` option. When `DIM` and any structure file are not + given, `phonopy_disp.yaml` (primary) or `phonopy.yaml` (secondary) is searched + in the current directory. Then `phonopy.yaml` type file is used as the input, + semi-automatic phonopy mode is invoked, which means: + + (1) `supercell_matrix` in the `phonopy.yaml` type file is used if it exists. + (2) `primitive_matrix` in the `phonopy.yaml` type file is used if it exists. + Otherwise, set `PRIMITIVE_AXES = AUTO` when `PRIMITIVE_AXES` is not given. (3) + NAC params are read (`NAC = .TRUE.`) if NAC params are contained (primary) in + the `phonopy.yaml` type file or if `BORN` file exists in the current directory + (secondary). (4) Forces and displacements are read from the `phonopy.yaml` + type file if those exist instead of reading `FORCE_SETS` in the current + directory. (5) Calculator name (such as `qe`) is read if it is contained in + the `phonopy.yaml` type file. + + Possible usages are: + + - For PhononDB at Kyoto-U + (http://phonondb.mtl.kyoto-u.ac.jp/ph20180417/index.html) raw data, phonons + are easily calculated, e.g., by + `% phonopy -c phonon.yaml --band auto --mesh 100 -p`. + - If `phonopy_params.yaml` is created using API of `phonopy.save()` + ({ref}`phonopy_save_parameters`), phonopy's essential data may be easily + passed to other people only by this file. + - `phonopy_disp.yaml` is used instead of calculator option and input structure + file. For example `--qe -c NaCl.in` is replaced by `-c phonopy_disp.yaml`. + +## Jan-16-2019: Version 2.0 + +- `disp.yaml` is replaced by `phonopy_disp.yaml`. For the backward + compatibility, when `phonopy_disp.yaml` is not found, `disp.yaml` is used. +- New calculator interface for DFTB+ written by Ben Hourahine. +- Minor update of the look of band structure plot. The format in `band.yaml` for + treating labels was changed. +- `MESH` accepts a length value, which works in the same way as VASP automatic + k-mesh generation (see {ref}`mp_tag`). +- For plotting DOS, it is changed to choose linear tetrahedron method as + default, but not smearing method. +- Output file name of projected DOS was renamed from `partial_dos.dat` to + `projected_dos.dat`. + +### API change at version 2.0 + +- `Phonopy.get_band_structure()` is deprecated. Instead use + `Phonopy.get_band_structure_dict()`. +- `Phonopy.get_mesh()` is deprecated. Instead use `Phonopy.get_mesh_dict()`. +- `Phonopy.set_band_structure()` is deprecated. Instead use + `Phonopy.run_band_structure()` where `is_eigenvectors` keyword argument is + replaced by `with_eigenvectors`. +- `Phonopy.set_mesh()` is deprecated. Instead use `Phonopy.run_mesh()` where + `is_eigenvectors` keyword argument is replaced by `with_eigenvectors`. +- Previous behaviour of `Phonopy.run_mesh()` is achieved by + `phonopy.mesh.run()`. +- `Phonopy.set_qpoints_phonon()` is deprecated. Use `Phonopy.run_qpoints()` + where `is_eigenvectors` keyword argument is replaced by `with_eigenvectors`. +- `Phonopy.get_qpoints_phonon()` is deprecated. Instead use + `Phonopy.get_qpoints_dict()`. +- `Phonopy.get_group_velocity()` is deprecated. Use + `Phonopy.mode.group_velocities` attribute or + `Phonopy.get_*mode*_dict()['group_velocities']`, where `*mode*` is + `band_structure`, `mesh`, or `qpoints`. +- `Phonopy.get_group_velocities_on_bands()` is deprecated. +- `Phonopy.get_mesh_grid_info()` is deprecated. +- `Phonopy.set_iter_mesh()` is deprecated. Use `Phonopy.mesh()` with + `use_iter_mesh=True`. +- `Phonopy.itermesh` was removed. IterMesh instance is stored in phonopy.mesh. +- `Phonopy.set_group_velocity()` is deprecated. No need to call. `gv_delta_q` + can be set at `Phonopy.__init__()`. +- `Phonopy.set_unitcell()` is deprecated. +- `Phonopy.set_total_DOS()` is deprecated. Use `Phonopy.run_total_dos()`. +- `Phonopy.get_total_DOS()` is deprecated. Use `Phonopy.get_total_dos_dict()`. +- `Phonopy.write_total_DOS()` is deprecated. Use `Phonopy.write_total_dos()`. +- `Phonopy.plot_total_DOS()` is deprecated. Use `Phonopy.plot_total_dos()`. +- `Phonopy.set_partial_DOS()` is deprecated. Use `Phonopy.run_projected_dos()`. +- `Phonopy.get_partial_DOS()` is deprecated. Use + `Phonopy.get_projected_dos_dict()`. +- `Phonopy.write_partial_DOS()` is deprecated. Use + `Phonopy.write_projected_dos()`. +- `Phonopy.plot_partial_DOS()` is deprecated. Use + `Phonopy.plot_projected_dos()`. +- `Phonopy.partial_dos` attribute is deprecated. Use `Phonopy.projected_dos` + attribute. +- `Phonopy.set_thermal_properties()` is deprecated. Use + `Phonopy.run_thermal_properties()`. +- `Phonopy.get_thermal_properties()` is deprecated. Use + `Phonopy.get_thermal_properties_dict()`. +- `Phonopy.set_thermal_displacements()` is deprecated. Use + `Phonopy.run_thermal_displacements()`. +- `Phonopy.get_thermal_displacements()` is deprecated. Use + `Phonopy.get_thermal_displacements_dict()`. +- `Phonopy.set_thermal_displacement_matrices()` is deprecated. Use + `Phonopy.run_thermal_displacement_matrices()`. +- `Phonopy.get_thermal_displacement_matrices()` is deprecated. Use + `Phonopy.get_thermal_displacements_matrices_dict()`. +- New `Phonopy.auto_total_dos()`. +- New `Phonopy.auto_partial_dos()`. + +## Nov-22-2018: Version 1.14.2 + +- This is the release for preparing features for future and is not well tested. +- Code refactoring to ease the development of calculator interface. Most of + calculator interface dependent codes are moved to + `phonopy.interface.__init__.py`. +- For eary adaptors, two experimental features were made: + + - Convenient Phonopy instance loader and crystal structure yaml parser + (`phonopy.load()` and `phonopy.read_cell_yaml()`). + - Automatic band paths generation using SeeKpath + (https://seekpath.readthedocs.io/) (`BAND = AUTO`). Installation of SeekPath + is needed. + +## Nov-17-2018: Version 1.14.0 + +- From this version, a trial to follow Semantic Versioning starts. +- Automatic determination of transformation matrix from the input unit cell to + the primitive is implemented (`PRIMITIVE_AXES = AUTO` or `--pa='auto'`). +- Spglib update to v1.11.1. +- Experimental support for dynamical structure factor + ({ref}`dynamic_structure_factor`). +- Experimental support in phonopy-QHA for temperature dependent energy input + ({ref}`--efe ` option) from a file. To create this + input file for a simple electron free energy was made for VASP + (`phonopy-vasp-efe`). + +## Jun-20-2018: Version 1.13.2 + +- `FULL_FORCE_CONSTANTS` tag is created ({ref}`full_force_constants_tag`). +- Minor update of script to use QE's `q2r.x` output ({ref}`this `). +- Updates and fixes of CRYSTAL and SIESTA interfaces. +- Updates of labels of irreducible representations of crystallographic point + groups. + +## Apr-21-2018: Version 1.13.0 + +- Non-analytical term correction by Gonze _et al._ ({ref}`reference_dp_dp_NAC`) + is implemented and now this is the default NAC method. The former default + method by Wang _et al._ ({ref}`reference_wang_NAC`) can be invoked by using + `NAC_METHOD` tag ({ref}`nac_method_tag`). + +## Jan-31-2018: Version 1.12.6 + +- Force constants file formats of `FORCE_CONSTANTS` and `force_constants.hdf5` + are extended to support smaller size force constants. Backward compatibility + is preserved. See {ref}`file_force_constants`. To write out force constants, + the compact format is chosen as the default for usual cases. +- Performance improvement of phonopy and spglib by Michael Lamparski which is + effective especially for larger unit cell systems. + +## Jan-7-2018: Version 1.12.4 + +- For thermal displacements (and its matrices), `FMIN` (`--fmin`) and `FMAX` + (`--fmax`) can be used to limit phonons included to the summation as the + minimum and maximum frequencies, respectively. Instead, `CUTOFF_FREQUENCY` + (`--cutoff-freq`) does not work for thermal displacements. +- The way of symmetrization for translation invariance is modified. As a result, + `FC_SYMMETRY` became a Boolean, i.e., `FC_SYMMETRY = .TRUE.` + (`--fc-symmetry`), and no need to specify a number. +- Experimental support to parse Quantum ESPRESSO `q2r.x` output from python + script. + +## Nov-8-2017: Version 1.12.2 + +- Command option parser of the phonopy tools is replaced from `optparse` to + `argparse`. +- The behaviours of `-f`, `--fz`, and `--fc` options are slightly changed. The + filenames used with these options were the positional arguments previously. + Now they are the command-line arguments, i.e., filenames have to be put just + after the option name like `-f vasprun.xml-001 vasprun.xml-002 ...`. +- New tags (options), `FC_FORMAT` (`--fc-format`), `READFC_FORMAT` + (`read-fc-format`), `WRITEFC_FORMAT` (`write-fc-format`), `BAND_FORMAT` + (`--band-format`), `MESH_FORMAT` (`--mesh-format`), and `QPOINTS_FORMAT` + (`--qpoints-format`) were implemented. `HDF5` tag is deprecated. +- New tags `READ_FORCE_CONSTANTS` and `WRITE_FORCE_CONSTANTS` were made. They + are equivalent to existing options of `--readfc` and `--writefc`. Using them, + reading and writing force constants are separably controlled. + +## Oct-19-2017: Version 1.12.0 + +- The names of auxiliary tools and `gruneisen` are changed, for which the prefix + `phonopy-` is added to the old names to avoid accidental conflict with other + filenames already existing under `bin`. `outcar-born` is renamed to + `phonopy-vasp-born`. Similarly `gruneisen` is renamed `phonopy-gruneisen`. + Please find these changes at {ref}`auxiliary_tools` and + {ref}`phonopy_gruneisen`. + +## Oct-2-2017: Version 1.11.14 + +- 6/m and 1 point groups are added for irreps dataset. +- `band.hdf5` is output instead of `band.yaml` when using `--hdf5` option + together. +- Spglib update to v1.9.10. By this, symmetry search for supercells with large + number of dimensions may become significantly faster. +- It is changed so that `mesh.yaml` or `mesh.hdf5` is not written out in thermal + displacements calculations (`TDISP`, `TDISPMAT`, `TDISPMAT_CIF`). This is done + to reduce the memory consumption of this calculation with dense mesh sampling. +- And many minor updates. + +## June-18-2017: Version 1.11.12 + +- Maintenance release with many minor fixes after v1.11.10. +- -1,and -3 point groups are added for irreps dataset. +- {ref}`pretend_real_tags` was made. +- `--vasprunxml` option for `outcar-born` + +## Mar-31-2017: Version 1.11.10 + +- Maintenance release with many fixes. + +## Feb-7-2017: Version 1.11.8 + +- CRYSTAL code interface ({ref}`crystal_mode`) is added by Antti Karttunen. +- Different vasprun.xml (expat) parser is under testing. + +## Dec-14-2016: Version 1.11.6 + +- `--fz` option comes back. See {ref}`fz_force_sets_option`. +- spglib update to v1.9.9 + +## Oct-23-2016: Version 1.11.2 + +- `TDISPMAT_CIF` (`--tdm_cif`) for CIF output for thermal displacement is added + ({ref}`thermal_displacement_cif_tag`). +- spglib update to v1.9.7 + +## Aug-29-2016: Version 1.11.0 + +- `FPITCH` (`--fpicth`) is made ({ref}`dos_fmin_fmax_tags`). +- Minor update of `gruneisen`. +- Tentatively `phonopy.yaml` and `phonopy_disp.yaml` are written when running + phonopy. +- In Phonopy-API, from this version, to create displacements in supercells + internally the phonopy object, the `generate_displacements` method has to be + called explicitly along with the `distance` argument. See + {ref}`phonopy_module`. + +## Jul-17-2016: Version 1.10.10 + +- {ref}`dos_moment_tag` tags are implemented to calculate phonon moments. +- `qpoints.hdf5` is written with the `--hdf5` option. Dynamical matrices are + also stored in `qpoints.hdf5` with `WRITEDM = .TRUE.` (`--writedm` option). + +## Apr-22-2016: Version 1.10.8 + +- {ref}`xyz_projection_tag` tag is created for PDOS. +- {ref}`vasp_mode` option is created to explicitly show VASP is used to generate + `band.yaml` as the calculator. +- spglib update to v1.9.2 + +## Feb-7-2016: Version 1.10.4 + +- More keywords are written in `band.yaml`. +- Default NAC unit conversion factors ({ref}`born_file`) +- Collection of many minor fixes and updates + +## Jan-25-2016: Version 1.10.2 + +- Python 3 support +- Many fixes +- spglib update to v1.9.0 + +## Oct-20-2015: Version 1.10.0 (release for testing) + +- An experimental release for testing python 3 support. Bug reports are very + appreciated. + +## Oct-20-2015: Version 1.9.7 + +- Siesta interface (`--elk` option) was added ({ref}`siesta_interface`) by + Henrique Pereira Coutada Miranda. +- `WRITE_MESH = .FALSE.` (`--nowritemesh`) tag was added + ({ref}`write_mesh_tag`). + +## Aug-12-2015: Version 1.9.6 + +- `--hdf5` option. Some output files can be written in hdf5 format. See + {ref}`hdf5_tag`. +- Improve tetrahedron method performance in the calculation of DOS and PDOS. +- Spglib update to version 1.8.2.1. + +## July-11-2015: Version 1.9.5 + +- Elk interface (`--elk` option) was added ({ref}`elk_interface`). +- Spglib update to version 1.8.1. + +## Feb-18-2015: Version 1.9.4 + +- Fixed to force setting `MESH_SYMMETRY = .FALSE.` (`--nomeshsym`) when PDOS is + invoked. + +## Feb-10-2015: Version 1.9.3 + +- `MAGMOM` tag is now available ({ref}`magmom_tag`). +- Spglib update. + +## Jan-4-2015: Version 1.9.2 + +- Behaviors of `--wien2k`, `--abinit`, `--pwscf` options have been changed. Now + they are just to invoke those calculator modes without a unit cell structure + file. The unit cell structure file is specified using `--cell` (`-c`) option + or `CELL_FILENAME` tag. See {ref}`force_calculators`, {ref}`wien2k_interface`, + {ref}`abinit_interface`, and {ref}`qe_interface`. +- For the `gruneisen` command, `--factor`, `--nomeshsym`, `--wien2k`, + `--abinit`, and `--pwscf` options are implemented. See + {ref}`gruneisen_calculators` and {ref}`gruneisen_command_options`. +- In phonopy-API, timing to call `Phonopy.set_dynamical_matrix` is changed to + reduce the number of calls of this function. This may raise timing issue to + phonopy-API users. +- Band-DOS (band-PDOS) plot is implemented. + +## Oct-30-2014: Version 1.9.1.3 + +- Experimental support for Abinit. See {ref}`qe_mode` and + {ref}`qe_force_sets_option`. + +## Oct-29-2014: Version 1.9.1.2 + +- Experimental support for Abinit. See {ref}`abinit_mode` and + {ref}`abinit_force_sets_option`. +- FHI-aims modulation output. Some more examples for `phonopy-FHI-aims`. + +## Oct-17-2014: Version 1.9.1.1 + +- Supercell matrix support (9 elements) for the `MODULATION` tag. +- Improve the speed to create supercell. +- Many minor changes to clean-up code badly written. + +## Aug-28-2014: Version 1.9.0 + +- Use a native cElementTree of Python as VASP XML parser and stop using lxml. + The native cElementTree is built in after Python 2.5. So Python 2.4 or before + will not be supported from this phonopy version. This migration to + cElementTree was made by shyuep. + +## Aug-12-2014: Version 1.8.5 + +- Supercell creation behavior may change due to the change of algorithm. Though + it used its own independent routine, now it uses the `Supercell` class to + build supercell +- Spglib update (1.6.1-alpha) +- Experimental option `--fc_computation_algorithm="regression"` to compute force + constants from forces and displacements using linear regression with + displaying standard deviation, by KL(m). + +## June-23-2014: Version 1.8.4.2 + +- Symmetrization of Born effective charge of `outcar-born` is improved. +- `-v` option shows Born effective charges and dielectric constants when NAC is + set. +- Bug fix to include cutoff frequency to the displacement distance matrix. +- Yaml output formats for band, mesh, q-points, modulation modes were slightly + modified. +- Bug fix in finding equivalent atoms in supercell that has lower symmetry than + the original unit cell. + +## Apr-5-2014: Version 1.8.4.1 + +- Fix irreps for non-zero q-point of nonsymmorphic case + +## Mar-31-2014: Version 1.8.4 + +- Implementation of analytical derivative of dynamical matrix in C, which + improves the performance of group velocity calculation. +- Minor change of python module for group velocity. + +## Feb-17-2014: Version 1.8.3 + +- A collection of small fixes in interface. +- Spglib update (spglib-1.6.0) +- Change in `phonopy/file_IO/write_FORCE_SETS_*`. + +## Feb-8-2014: Version 1.8.2 + +- `vasprun.xml` of VASP 5.2.8 is only specially parsed to treat special wrong + character. +- Python module interface is updated and modified. `set_post_process`, + `set_force_sets` will be obsolete. `set_displacements` is obsolete. + +## Jan-9-2014: Version 1.8.0 + +This version is dangerous. A lot of code is modified internally. + +- Tetrahedron method is implemented for total and partial DOS. This is activated + by `--thm` option. +- The display output with `-v` option is enriched. +- Symmetrization for `outcar-born` is implemented (Experimental). +- Cutoff-frequency `CUTOFF_FREQUENCY` (`--cutoff_freq`) is implemented to ignore + frequencies lower than this cutoff frequency to calculate thermal properties + and thermal displacements. + +## Dec-4-2013: Version 1.7.5 + +- `--mass` option is created to shortcut of the `MASS` tag. +- `--fc_spg_symmetry` option is created to symmetrize force constants. +- Symmetry finder update (spglib version 1.5.2) + +## Oct-3-2013: Version 1.7.4 + +- Thermal displacement matrix is implemented. See + {ref}`thermal_displacement_matrices_tag` and {ref}`thermal_displacement`. +- PDOS with projection along arbitrary direction was implemented. See + {ref}`projection_direction_tag`. +- `partial_dos.dat` format was changed. XYZ projected PDOS is not output. + Instead atom projected PDOS (sum of XYZ projected PDOS) is written. See + {ref}`output_files`. +- DOS and PDOS python interface was modified. The keyword of `omega_something` + is changed to `freq_something`. +- `gruneisen` didn't run because it didn't follow the move of the `file_IO.py` + file location. This is fixed. +- The formula of non-analytical term correction implemented in phonopy is not + translational invariant in reciprocal space. This induces tiny difference of + the choice of equivalent q-points being different by reciprocal primitive + vectors. Now in the mesh sampling mode (`MP`), q-points are automatically + moved to inside first-Brillouin-zone. +- In the mesh sampling mode, consistency of symmetry of mesh numbers to crystal + symmetry is checked. If the symmetry disagrees with crystal symmetry, mesh + symmetrization (equivalent to `MESH_SYMMETRY = .FALSE.`) is disabled. +- Wien2k interface is updated to adapt Wien2k-13. +- Fix the problem that only Vinet EOS worked in phonopy-qha. + +## Sep-17-2013: Version 1.7.3 + +- Fix. Segmentation fault happens in some specific systems (e.g. Kubuntu 12.04 + 32bit) due to a different behavior of numpy array creation. +- Group velocity for degenerate phonon mode is calculated slightly different + from older version and now it is symmetrized by site-symmetry of q-point. + +## Aug-4-2013: Version 1.7.2 + +- `group_velocity/__init__.py` is moved to `phonon` directory. +- `hphonopy/file_IO.py` is moved to top directory. +- New `harmonic/derivative_dynmat.py`: Analytical derivatives of dynamical + matrix +- Group velocity is computed by analytical derivatives of dynamical matrix in + the default configuration instead of previous finite difference method. Group + velocity calculation with the finite difference method can be still activated + by `--gv_delta_q` option. +- Force constants solver was partially rewritten. The order and shape of + matrices in the formula is rearranged ({ref}`force_constants_solver_theory`). + +## July-14-2013: Version 1.7.1 + +- `--pdos` option was created. This is same as `PDOS` tag. +- Group velocity with degenerate modes was improved. + +## Jun-21-2013: Version 1.7 + +- The tag `CHARACTER_TABLE` was renamed to `IRREPS` ({ref}`irreps_tag`), and the + option of `--ct` was renamed to `--irreps` as well. To show Ir-representations + along with characters, `SHOW_IRREPS` tag (or `--show_irreps` option) is used. + The output file name was also renamed to `irreps.yaml`. In the ir-reps + calculation, display and file outputs were modified to show the arguments of + complex value characters. +- Numpy array types of 'double' and 'intc' for those arrays passed to numpy + C-API are used. +- `thermal_displacement.py` is slightly modified for the preparation to include + thermal displacement matrix. +- Symmetry finder update (spglib 1.4.2). + +## Apr-13-2013: Version 1.6.4 + +- Group velocity can be calculated using `GROUP_VELOCITY` tag or `--gv` option + ({ref}`group_velocity_tag`). +- Non-analytical term correction is implemented in C, which accelerates the + calculation speed. + +## Feb-7-2013: Version 1.6.3 + +- Arbitral projection direction is allowed for thermal displacements + calculation. ({ref}`thermal_displacements_tag`) +- A new tag `WRITEDM` and an option `--writedm` are implemented. Dynamical + matrices are written into `qpoints.yaml` when this is used together with the + `QPOINTS` mode. ({ref}`writedm_tag`) + +## Nov-13-2012: Version 1.6.2 + +- A small fix of FHIaims.py. + +## Nov-4-2012: Version 1.6.1 + +- Implementation of database of character table for another type of point group + -3m. +- A new option `--irreps` or `IRREPS` tag (Experimental). +- `character_table.yaml` output. +- Eigenvectors output in`modulation.yaml` was recovered. + +## Oct-22-2012: Version 1.6 + +- Experimental support of band connection. ({ref}`band_connection_tag`) +- Experimental support of mode Grüneisen parameter calculation. + ({ref}`phonopy_gruneisen`) +- Format of `MODULATION` tag was modified. ({ref}`modulation_tag`) +- Phonopy is controlled by command line options more than before. `--qpoints`, + `--modulation` and `--anime` options are prepared. +- Symmetry finder update. +- Implementation of database of character table for the point group 32. Fix -3m + database. + +## June-29-2012: Version 1.5 + +- Bug fix on plotting PDOS with labels. +- The array structures of qpoints, distances, frequencies, eigenvalues, + eigenvectors in BandStructure are changed to the lists of those values of + segments of band paths. For qpoints, frequencies, eigenvalues, eigenvectors, + the previous array structures are recovered by numpy.vstack and for distances, + numpy.hstack. +- Experimental support on thermal displacement. +- Experimental support on fitting DOS to a Debye model ({ref}`debye_model_tag`) + implemented by Jörg Meyer. + +## May-22-2012: Version 1.4.2 + +- Bug fix on showing the values of thermal properties. No bug in plot and yaml. + +## May-21-2012: Version 1.4.1 + +- Avoid list comprehension with else statement, because it is not supported in + old python versions. + +## May-13-2012: Version 1.4 + +- `--writefc` option is implemented. +- In using `MODULATION` tag, phase factor for each mode can be specified as the + third value of each mode in degrees. +- Arguments of `get_modulation` in Phonopy module were modified. The phase + factor is now included in `phonon_modes`. +- Class `Phonopy` was refactored. All private variables were renamed as those + starting with an underscore. Some basic variables are obtained with the same + variable names without the underscore, which was implemented by the function + `property`. +- The labels of segments of band structure plot are specified by `BAND_LABELS` + ({ref}`band_labels_tag`). +- `--band` option is implemented. +- `GAMMA_CENTER` tag and `--gc`, `--gamma_center` option are implemented + ({ref}`mp_tag`). +- `phonopy-qha` was polished. Most of the code was moved to + `phonopy/qha/__init__.py`. +- `Phonopy::get_mesh` and `Phonopy::get_band_structure` were modified. Instead + of eigenvalues, frequencies are returned. +- The order of return values of `Phonopy::get_thermal_properties` was changed as + numpy arrays of temperatures, Helmhotlz free energies, entropies, and heat + capacities at constant volume. +- Arguments of the class `ThermalProperties`, `Dos`, and `PartialDOS` were + changed. Instead of eigenvalues, frequencies are used. +- The default sigma value used for total and partial DOS was changed to + (max_frequency - min_frequency) / 100. +- Symmetry finder update. + +## Mar-20-2012: Version 1.3 + +- C implementations of a few parts of `force_constants.py` to speed up. +- spglib update. +- Many small modifications. +- License is changed to the new BSD from the LGPL. + +## Oct-13-2011: Version 1.2.1 + +- Bug fix of the option `--dim` with 9 elements. + +## Oct-12-2011: Version 1.2 + +- Closing support of the `--nac_old` option. +- The option `--nomeshsym` is available on the manual. +- Symmetry finder update that includes the bug fix of Wyckoff letter assignment. +- Showing site-symmetry symbols with respective orientations in the output of + `--symmetry` option. +- Code cleanings of `settings.py`, `force_constant.py`, etc. +- Starting implementation of `character_table.py` ({ref}`irreps_tag`). + +## Sep-19-2011: Version 1.1 + +- `--readfc` option is implemented. +- A bit of clean-up of the code `dynamical_matrix.py`, `force_constant.py` and + `_phonopy.c` to make implementations similar to the formulations often written + in text books. + +## Sep-5-2011: Version 1.0 + +- `settings.py` is moved to `phonopy/cui/Phonopy`. The configure parser from a + file and options is modified. +- Usage of `MODULATION` tag was changed. +- The option `--nosym` is available on the manual. + +## Aug-8-2011: Version 0.9.6 + +- Symmetry finder update +- Wyckoff positions are shown with `--symmetry` option + +## Jun-7-2011: Version 0.9.5.1 + +- Bug fix of `get_surrounding_frame` in `cells.py` by Jörg Meyer and Christian + Carbogno. + +## Errata of document + +The cell matrix definition of `Atoms` class was transposed. + +## Jun-3-2011: Version 0.9.5 + +- Wien2k interface is updated ({ref}`wien2k_interface`), but this is still quite + experimental support. +- More information is involved in `disp.yaml`. Along this modification, + supercells with displacements can be created solely from `disp.yaml` using + `dispmanager`. +- Instead of `TRANSLATION` tag, `FC_SYMMETRY` is created + ({ref}`fc_symmetry_tag`). +- Closing support of `--fco` option. +- Add a few more examples in the `example` directory. +- Symmetry finder update +- `propplot` is updated for the `--gnuplot` option. + +## Errata of document + +The example of `FORCE_SETS` was wrong and was fixed. The explanation of the +document is correct. + +## Apr-18-2011: Version 0.9.4.2 + +- In the setting tag `BAND`, now comma `,` can be used to disconnect the + sequence of band paths ({ref}`band_structure_related_tags`). + +- `dispmanager`, an auxiliary tool for modifying `disp.yaml`, is developed. + +- Symmetry finder update to spglib-1.0.3.1. Almost perfect casting to a Bravais + lattice is achieved using `--symmetry` option. + +- The setting tags `TRANSLATION`, `PERMUTATION`, and `MP_REDUCE` are ceased. + +## Feb-26-2011: Version 0.9.4.1 + +- Wien2k interface bug fix + +## Feb-20-2011: Version 0.9.4 + +- Big phonopy-interface change was imposed. Some of filenames and formats of + input and output files are modified. **There is no default setting filename** + like `INPHON` (setting file is passed as the first argument). Some of tag + names and those usage are also modified. Please first check + {ref}`examples_link` for the new usage. + + List of changes: + + - Setting file has to be passed to phonopy as the first argument. + - FORCES is replaced by FORCE_SETS ({ref}`file_forces`). + - DISP is replaced by disp.yaml. + - LSUPER tag is removed. Please use -d option. + - NDIM and MATDIM tags are replaced by DIM tag ({ref}`dimension_tag`). + - Band structure setting tags are changed to BAND tag + ({ref}`band_structure_related_tags`). + - DOS tag is renamed to DOS_RANGE tag ({ref}`dos_related_tags`). + + These changes are applied only for the phonopy interface. Internal simulation + code has not been touched, so **physical results would not be affected**. If + you have any questions, please send e-mail to phonopy {ref}`mailinglist`. + +- `phonopy-FHI-aims` had not worked in some of previous versions. Now it works + by Jörg Meyer and Christian Carbogno. + +- Directory structure of the code was changed. + +- Symmetry finder update to spglib-1.0.2 + +- [**Experimental**] Finding Bravais lattice using `--symmetry` option. + +- [**Experimental**] Modulated structure along specified phonon modes by + `MODULATION` tag ({ref}`modulation_tag`). + +## Jan-21-2011: Version 0.9.3.3 + +- Animation file output update ({ref}`animation_tag`). The `ANIME` tag format + was changed. + +## Jan-12-2011: Version 0.9.3.2 + +- `phonopy-qha` is updated. A few options are added + ({ref}`phonopy_qha_options`). Calculation under pressure is supported by + `--pressure` option. + +- Primitive cell search and Bravais lattice output are integrated into the + symmetry search with `--symmetry` option. + +## Errata of document + +- There were mistakes in the documents for the `PRIMITIVE_AXIS` and `MATDIM`. + The 9 values are read from the first three to the last three as respective + rows of the matrices defined. + +## Dec-30-2010: Version 0.9.3.1 + +- Bug fix of `-f` option. +- The output filenames of `phonopy-qha` are modified and summarized at + {ref}`phonopy_qha_output_files`. + +## Dec-5-2010: Version 0.9.3 + +- The license is changed to LGPL. +- `MASS` tag is recreated ({ref}`mass_tag`). +- `--mp` option is created. This works like the `MP` tag. +- Improvement of `phonopy-qha` both in the code and {ref}`manual `. +- The bug in `--fco` option was fixed. + +## Nov-26-2010: Version 0.9.2 + +- spglib update (ver. 1.0.0) +- ASE.py is removed. Compatible class and functions, Atoms, write_vasp, and + read_vasp, are implemented. +- A `vasprun.xml` parser wrapper is implemened to avoid the broken `PRECFOCK` in + vasprun.xml of VASP 5.2.8. + +## Sep-22-2010: Version 0.9.1.4 + +- The new tag `ANIME_TYPE` supports `xyz` and `xyz_jmol` formats by Jörg Meyer + and Christian Carbogno, and also `A set of `POSCAR` files corresponding to + animation frames. + +- Fix bugs in `trim_cell` and `Primitive.__supercell_to_primitive_map` in + `cells.py`. When :math:`M_s^{-1}M_p` is not symmetric, the supercell was not + created correctly. + +- `phonopy-FHI-aims` update by jm. + +## Aug-24-2010: Version 0.9.1.3 + +- Update symmetry finder of spglib. Now precision is in Cartesian distance. + +- The animation output for `arc` didn't work. Now it works. + +- Qpoint mode didn't work with bugs. Now it works. + +- `--vasp` option is renamed to `--cell` or `-c`. + +- The new options `--symmetry`, `--displacement` or `-d`, `--dim`, + `--primitive_axis` are implemented. + +- The option `--ndim` is replaced with `--dim` with `-d` option. + +## June-10-2010: Version 0.9.1.2 + +- The code on non-analytical term correction is included in the + `DynamicalMatrix` class. Data sets read by `parse_BORN` are set by + `set_non_analytical_term` and gotten by `get_non_analytical_term`. The + q-vector direction (only direction is used in the non-analytical term + correction) is set by `set_q_non_analytical_term`. However for emprical + damping function, some distance is used, i.e., when a q-point is getting away, + non-analytical term is weaken. For this purpose, the second argument of + `set_q_non_analytical_term` is used. + + At the same time, a small problem on the previous implementation was found. + When a reduced q-point is out of the first Brillouin zone, it is not correctly + handled. Currently it is fixed so as that when absolute values of elements of + the reduced q-point are over 0.5, they are reduced into -0.5 < q < 0.5. + + [**Attention**] The previous `--nac` option is moved to `--nac_old`. `--nac` + is used for different method of the non-analytical term correction at general + q-points. This will be documented soon. + +- Bug fix on `write_FORCES` in `file_IO.py`. When order of displacements in + `DISP` file is not ascending order of atom indices, it was not correctly + re-ordered. Because the default order of phonopy is ascending order, usually + there is no problem for the most users. + +- `phonopy-FHI-aims` + + - adapted to extensions of dynamical_matrix with respect to non-analytical + corrections + - added support for animation infrastructure + - moved several options to control.in + + by Jörg Meyer and Christian Carbogno + +## May-11-2010: Version 0.9.1.1 + +- `phonopy-FHI-aims` adapted to split of dos array into the two seperate omega, + dos arrays in TotalDOS class by Jörg Meyer. + +## May-10-2010: Version 0.9.1 + +- The methods of get_partial_DOS and get_total_DOS are added to the Phonopy + class. + +## Apr-12-2010: Version 0.9.0.2 + +- spglib bug was fixed. If the crystal structure has non-standard origin, the + translation was not correctly handled. This problem happened after version + 0.9.0. + +## Apr-12-2010: Version 0.9.0.1 + +- spglib update + +## Apr-10-2010: Version 0.9.0 + +- Phonopy module (`__init.py__`) is heavily revised and the script `phonopy` is + rewritten using the phonopy module. Therefore there may be bugs. Be careful. + Document of the phonopy module will be updated gradually. +- A small Wien2k interface document is added ({ref}`wien2k_interface`). +- A script `phonopy-FHI-aims` and its examples are added by Jörg Meyer. +- spglib update + +## Mar-10-2010: Version 0.7.4 + +- spglib update +- Animation mode ({ref}`animation_tag`) + +## Feb-10-2010: Version 0.7.3 + +- Bug fix for Wien2k mode + +## Jan-12-2010: Version 0.7.2 + +- [**Experimental**] Non-analytical term correction was implemented. + +## Dec-8-2009: Version 0.7.1 released + +- {ref}`auxiliary_tools` `propplot` is added. +- Memory consumption is reduced when using `-f` option to handle large + vasprun.xml files. + +## Nov-24-2009: Version 0.7.0 released + +- {ref}`auxiliary_tools` `bandplot` and `pdosplot` are prepared. +- Formats of `band.yaml`, `mesh.yaml`, and `qpoints.yaml` are slightly modified. +- There was bug in `PERMUTATION` tag to calculate symmetrized force constants. + Now it is fixed. Usually this is not necessary to set because this does not + affect to result. +- Symmetry finder spglib is updated. +- `PM` tag is implemented. See {ref}`setting_tags`. Behaviors in the previous + versions are `PM = AUTO`. + +## Oct-14-2009: Version 0.6.2 released + +- Installation process was changed slightly. See {ref}`install`. +- The command `phonopy` is stored in the `bin` directory. `phonopy.py` is + renamed to `phonopy`. +- setup system is improved by Maxim V. Losev. +- `--fz` tag was implemented experimentally. This is supposed to enable to + subtract residual forces on atoms in equilibrium structure from those in + structure with atomic displacements. diff -Nru phonopy-2.12.0/doc/changelog.rst phonopy-2.13.1/doc/changelog.rst --- phonopy-2.12.0/doc/changelog.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/changelog.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,1152 +0,0 @@ -.. _changelog: - -Change Log -========== - -Oct-28-2021: Version 2.12.0 ---------------------------- -* Matplotlib built-in mathtext replaced LaTeX renderer with ``text.usetex`` to - avoid requiring latex installation. -* Aiming modernizing phonopy code, required python version and package - versions were changed to - - * Python >= 3.6 - * numpy >= 1.11 - * matplotlib >= 2.0 - -* For developers, flake8, black, pydocstyle, and isort were introduced. - See ``REAEME.md`` and ``.pre-commit-config.yaml``. - -Jul-8-2021: Version 2.11.0 ---------------------------- -* Maintenance release. C-methods were changed to use dense shortest vectors - (``Primitive.get_smallest_vectors()``) format. But the front end still - uses current format ``shape=(size_super, size_prim, 27, 3)``. - -Jun-10-2021: Version 2.10.0 ---------------------------- -* Fix the contents of ``entropy-volume.dat`` and ``Cv-volume.dat`` in QHA - were swapped. (Issue #144 by @prnvrvs) -* Implementation of writing ``helmholtz-volume_fitted.dat`` in QHA. (PR - #149 by @kgmat) - -Mar-17-2021: Version 2.9.3 --------------------------- -* Fix ``MANIFEST.in`` to provide necessary files to compile. - -Mar-17-2021: Version 2.9.2 --------------------------- -* Fix a bug to make the initial symmetry search slow. - -Jan-29-2021: Version 2.9.1 --------------------------- -* Release for making pypi wheel of py3.9 - -Jan-28-2021: Version 2.9.0 --------------------------- -* :ref:`Fleur interface ` was made by @neukirchen-212. -* Improvement of ``phonopy-bandplot`` by @kgmat (PR#131, #132, #134) - -Sep-29-2020: Version 2.8.1 ---------------------------- -* Fix vasprun.xml expat parser (issues #129) - -Sep-22-2020: Version 2.8.0 ---------------------------- -* :ref:`CASTEP interface ` was made by @ladyteam. -* It was made to give more information in ``gruneisen.yaml`` (@ab5424, - PR#127). -* Fix and update of ``phonopy-bandplot`` (@kgmat PR#125, commit 816a12a9) - -July-31-2020: Version 2.7.1 ---------------------------- -* Release for pypi and conda packaging - -July-22-2020: Version 2.7.0 ---------------------------- -* Spglib was removed from phonopy source code tree. Now phonopy - depends on spglib. So spglib has to be installed separately. But - for normal cases, it is handled by the package manager. -* A new way of using phonopy from command line is proposed at - :ref:`phonopy_load_command`. -* Castep interface was added by @ladyteam. - -May-3-2020: Version 2.6.1 -------------------------- -* Release for pypi and conda packaging - -May-2-2020: Version 2.6.0 -------------------------- -* Collection of minor fixes and internal updates - -Mar-29-2020: Version 2.5.0 --------------------------- -* New options, ``--include-*``, to write summary in - ``phonopy.yaml``. See :ref:`summary_tag`. -* FHI-aims interface (``--aims``) was created by Florian Knoop. -* ``phonopy-gruneisen`` and ``--symmetry`` option were updated to be - able to handle most of build-in calculator interfaces. -* Update spglib version to v1.14.1. -* ``phonopy-dispmanager`` was removed. -* Let new force calculator interface be implemented easiler by - centralizing those interface related stuffs in - ``phonopy.interface.calculator``. - -Dec-22-2019: Version 2.4.2 --------------------------- -* Collection of minor updates: adding docstrings, refactoring group - velocity code, and updating examples. - -Nov-16-2019: Version 2.4.1 --------------------------- -* Fix a bug on Phonopy.save reported by PR#104 - -Nov-13-2019: Version 2.4.0 --------------------------- -* CP2K interface is provided by Tiziano Müller. -* Many minor bug fixes and updates. - -Sep-1-2019: Version 2.3.2 ---------------------------- -* It was forgotten to increment version number at v2.3.1. Now it is - made to be v2.3.2 just for incrementing the number. - -Aug-29-2019: Version 2.3.1 ---------------------------- -* Fix alm wrapper to follow the lastet basis vector matrix form. - -Aug-29-2019: Version 2.3.0 ---------------------------- -* New setting tag :ref:`fc_calculator_tag` was implemented. With this, - an external force constants calculator can be used. Currently only - ALM (``FC_CALCULATOR = alm`` or ``--alm`` option) is supported. By - using ALM, we can compute force constants with any number of - displacements in each supercell. Any number of supercells with - displacements can be also handled with it if ordinaly least square - fitting can be solved for force constants. - :ref:`random_displacements_tag` and :ref:`random_seed_tag` were - implemented to use with ALM. -* For the external force constants calculator, new file format of - ``FORCE_SETS`` was introduced. See :ref:`file_forces_type_2` - ``FORCE_SETS`` format. - -Jul-21-2019: Version 2.2.0 ---------------------------- -* Collection of minor updates. -* Spglib update to v1.13.0. - -Jun-19-2019: Version 2.1.4 ---------------------------- -* `Bug fix `_ of - ``Cp-temperature_polyfit.dat`` calculation in QHA (by ``@ezanardi``). - -Apr-17-2019: Version 2.1.3 ---------------------------- -* TURBOMOLE interface is provided by Antti Karttunen (``--turbomole``). - -Mar-24-2019: Version 2.1.2 ---------------------------- -* ``PDOS = AUTO`` (``--pdos="auto"``) was implemented. - -Feb-27-2019: Version 2.1.1 ---------------------------- -* User interface bug fix release. - -Feb-26-2019: Version 2.1 ---------------------------- -* Spglib update to v1.12.1. -* (Experimental) ``phonopy`` command accepts ``phonopy.yaml`` type - file as an input crystal structure by ``-c`` option. When ``DIM`` - and any structure file are not given, ``phonopy_disp.yaml`` - (primary) or ``phonopy.yaml`` (secondary) is searched in the current - directory. Then ``phonopy.yaml`` type file is used as the input, - semi-automatic phonopy mode is invocked, which means: - - (1) ``supercell_matrix`` in the ``phonopy.yaml`` type file - is used if it exists. - (2) ``primitive_matrix`` in the ``phonopy.yaml`` type file - is used if it exists. Otherwise, set ``PRIMITIVE_AXES = AUTO`` - when ``PRIMITIVE_AXES`` is not given. - (3) NAC params are read (``NAC = .TRUE.``) if NAC params are - contained (primary) in the ``phonopy.yaml`` type file or if - ``BORN`` file exists in the current directory (secondary). - (4) Forces and displacements are read from the ``phonopy.yaml`` type - file if those exist instead of reading ``FORCE_SETS`` in the - current directory. - (5) Calculator name (such as ``qe``) is read if it is contained in - the ``phonopy.yaml`` type file. - - Possible usages are: - - - For PhononDB at Kyoto-U - (http://phonondb.mtl.kyoto-u.ac.jp/ph20180417/index.html) raw - data, phonons are easily calculated, e.g., by ``% - phonopy -c phonon.yaml --band auto --mesh 100 -p``. - - If ``phonopy_params.yaml`` is created using API of - ``phonopy.save()`` (:ref:`phonopy_save_parameters`), phonopy's - essential data may be easily passed to other people only by this - file. - - ``phonopy_disp.yaml`` is used instead of calculator option - and input structure file. For example ``--qe -c - NaCl.in`` is replaced by ``-c phonopy_disp.yaml``. - -Jan-16-2019: Version 2.0 ---------------------------- - -* ``disp.yaml`` is replaced by ``phonopy_disp.yaml``. For the backward - compatibility, when ``phonopy_disp.yaml`` is not found, - ``disp.yaml`` is used. -* New calculator interface for DFTB+ written by Ben Hourahine. -* Minor update of the look of band structure plot. The format in - ``band.yaml`` for treating labels was changed. -* ``MESH`` accepts a length value, whcih works in the same way as VASP - automatic k-mesh generation (see :ref:`mp_tag`). -* For plotting DOS, it is changed to choose linear tetrahedron method - as default, but not smearing method. -* Output file name of projected DOS was renamed from - ``partial_dos.dat`` to ``projected_dos.dat``. - -API change at version 2.0 -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* ``Phonopy.get_band_structure()`` is deprecated. Instead use - ``Phonopy.get_band_structure_dict()``. -* ``Phonopy.get_mesh()`` is deprecated. Instead use - ``Phonopy.get_mesh_dict()``. -* ``Phonopy.set_band_structure()`` is deprecated. Instead use - ``Phonopy.run_band_structure()`` where ``is_eigenvectors`` keyword - argument is replaced by ``with_eigenvectors``. -* ``Phonopy.set_mesh()`` is deprecated. Instead use - ``Phonopy.run_mesh()`` where ``is_eigenvectors`` keyword argument is - replaced by ``with_eigenvectors``. -* Previous behaviour of ``Phonopy.run_mesh()`` is achieved by - ``phonopy.mesh.run()``. -* ``Phonopy.set_qpoints_phonon()`` is deprecated. Use - ``Phonopy.run_qpoints()`` where ``is_eigenvectors`` keyword - argument is replaced by ``with_eigenvectors``. -* ``Phonopy.get_qpoints_phonon()`` is deprecated. Instead use - ``Phonopy.get_qpoints_dict()``. -* ``Phonopy.get_group_velocity()`` is deprecated. Use - ``Phonopy.mode.group_velocities`` attribute or - ``Phonopy.get_*mode*_dict()['group_velocities']``, where ``*mode*`` is - ``band_structure``, ``mesh``, or ``qpoints``. -* ``Phonopy.get_group_velocities_on_bands()`` is deprecated. -* ``Phonopy.get_mesh_grid_info()`` is deprecated. -* ``Phonopy.set_iter_mesh()`` is deprecated. Use ``Phonopy.mesh()`` with - ``use_iter_mesh=True``. -* ``Phonopy.itermesh`` was removed. IterMesh instance is stored in - phonopy.mesh. -* ``Phonopy.set_group_velocity()`` is deprecated. No need to call. - ``gv_delta_q`` can be set at ``Phonopy.__init__()``. -* ``Phonopy.set_unitcell()`` is deprecated. -* ``Phonopy.set_total_DOS()`` is deprecated. Use - ``Phonopy.run_total_dos()``. -* ``Phonopy.get_total_DOS()`` is deprecated. Use - ``Phonopy.get_total_dos_dict()``. -* ``Phonopy.write_total_DOS()`` is deprecated. Use - ``Phonopy.write_total_dos()``. -* ``Phonopy.plot_total_DOS()`` is deprecated. Use - ``Phonopy.plot_total_dos()``. -* ``Phonopy.set_partial_DOS()`` is deprecated. Use - ``Phonopy.run_projected_dos()``. -* ``Phonopy.get_partial_DOS()`` is deprecated. Use - ``Phonopy.get_projected_dos_dict()``. -* ``Phonopy.write_partial_DOS()`` is deprecated. Use - ``Phonopy.write_projected_dos()``. -* ``Phonopy.plot_partial_DOS()`` is deprecated. Use - ``Phonopy.plot_projected_dos()``. -* ``Phonopy.partial_dos`` attribute is - deprecated. Use ``Phonopy.projected_dos`` attribute. -* ``Phonopy.set_thermal_properties()`` is deprecated. Use - ``Phonopy.run_thermal_properties()``. -* ``Phonopy.get_thermal_properties()`` is deprecated. Use - ``Phonopy.get_thermal_properties_dict()``. -* ``Phonopy.set_thermal_displacements()`` is deprecated. Use - ``Phonopy.run_thermal_displacements()``. -* ``Phonopy.get_thermal_displacements()`` is deprecated. Use - ``Phonopy.get_thermal_displacements_dict()``. -* ``Phonopy.set_thermal_displacement_matrices()`` is deprecated. Use - ``Phonopy.run_thermal_displacement_matrices()``. -* ``Phonopy.get_thermal_displacement_matrices()`` is deprecated. Use - ``Phonopy.get_thermal_displacements_matrices_dict()``. -* New ``Phonopy.auto_total_dos()``. -* New ``Phonopy.auto_partial_dos()``. - -Nov-22-2018: Version 1.14.2 ---------------------------- - -* This is the release for preparing features for future and is not - well tested. -* Code refactoring to ease the developement of calculator - interface. Most of calculator interface dependent codes are moved to - ``phonopy.interface.__init__.py``. -* For eary adaptors, two experimental features were made: - - - Convenient Phonopy instance loader and crystal structure yaml parser - (``phonopy.load()`` and ``phonopy.read_cell_yaml()``). - - Automatic band paths generation using SeeKpath - (https://seekpath.readthedocs.io/) (``BAND = AUTO``). Installion - of SeekPath is needed. - -Nov-17-2018: Version 1.14.0 ---------------------------- - -* From this version, a trial to follow Semantic Versioning starts. -* Automatic determination of transformation matrix from the input unit - cell to the primitive is implemented (``PRIMITIVE_AXES = AUTO`` or - ``--pa='auto'``). -* Spglib update to v1.11.1. -* Experimental support for dynamical structure factor - (:ref:`dynamic_structure_factor`). -* Experimental support in phonopy-QHA for temperature dependent energy - input (:ref:`--efe ` option) from a file. To - create this input file for a simple electron free energy was made - for VASP (``phonopy-vasp-efe``). - - -Jun-20-2018: Version 1.13.2 ----------------------------- - -* ``FULL_FORCE_CONSTANTS`` tag is created - (:ref:`full_force_constants_tag`). -* Minor update of script to use QE's ``q2r.x`` output (:ref:`this - `). -* Updates and fixes of CRYSTAL and SIESTA interfaces. -* Updates of labels of irreducible representations of crystallographic - point groups. - -Apr-21-2018: Version 1.13.0 ----------------------------- - -* Non-analytical term correction by Gonze *et al.* - (:ref:`reference_dp_dp_NAC`) is implemented and now this is the - default NAC method. The former default method by Wang *et al.* - (:ref:`reference_wang_NAC`) can be invoked by using ``NAC_METHOD`` tag - (:ref:`nac_method_tag`). - -Jan-31-2018: Version 1.12.6 ----------------------------- - -* Force constants file formats of ``FORCE_CONSTANTS`` and - ``force_constants.hdf5`` are extended to support smaller size force - constants. Backward compatibility is preserved. See - :ref:`file_force_constants`. To write out force constants, the - compact format is chosen as the default for usual cases. -* Performance improvement of phonopy and spglib by Michael - Lamparski which is effective especially for larger unit cell systems. - -Jan-7-2018: Version 1.12.4 ------------------------------ - -* For thermal displacements (and its matrices), ``FMIN`` `(``--fmin``) - and ``FMAX`` (``--fmax``) can be used to limit phonons included to - the summation as the minimum and maximum frequenceis, - respectively. Instead, ``CUTOFF_FREQUENCY`` (``--cutoff-freq``) does - not work for thermal displacements. -* The way of symmetrization for translation invariance is modified. As - a result, ``FC_SYMMETRY`` became a Boolean, i.e., ``FC_SYMMETRY = - .TRUE.`` (``--fc-symmetry``), and no need to specify a number. -* Experimental support to parse Quantum ESPRESSO ``q2r.x`` output from - python script. - -Nov-8-2017: Version 1.12.2 ------------------------------ - -* Command option parser of the phonopy tools is replaced from - ``optparse`` to ``argparse``. -* The behaviours of ``-f``, ``--fz``, and ``--fc`` options are - slightly changed. The filenames used with these options were the - positional arguments previously. Now they are the command-line - arguments, i.e., filenames have to be put just after the option name - like ``-f vasprun.xml-001 vasprun.xml-002 ...``. -* New tags (options), ``FC_FORMAT`` (``--fc-format``), - ``READFC_FORMAT`` (``read-fc-format``), ``WRITEFC_FORMAT`` - (``write-fc-format``), ``BAND_FORMAT`` (``--band-format``), - ``MESH_FORMAT`` (``--mesh-format``), and ``QPOINTS_FORMAT`` - (``--qpoints-format``) were implemented. ``HDF5`` tag is deprecated. -* New tags ``READ_FORCE_CONSTANTS`` and ``WRITE_FORCE_CONSTANTS`` - were made. They are equivalent to existing options of ``--readfc`` - and ``--writefc``. Using them, reading and writing force constants - are separably controlled. - -Oct-19-2017: Version 1.12.0 ------------------------------ - -* The names of auxiliary tools and ``gruneisen`` are changed, for - which the prefix ``phonopy-`` is added to the old names to avoid - accidental conflict with other filenames already existing under - ``bin``. ``outcar-born`` is renamed to - ``phonopy-vasp-born``. Similarly ``gruneisen`` is renamed - ``phonopy-gruneisen``. Please find these changes at - :ref:`auxiliary_tools` and :ref:`phonopy_gruneisen`. - -Oct-2-2017: Version 1.11.14 -------------------------------- - -* 6/m and 1 point groups are added for irreps dataset. -* ``band.hdf5`` is output instead of ``band.yaml`` when using ``--hdf5`` - option together. -* Spglib update to v1.9.10. By this, symmetry search for supercells - with large number of dimensions may become significantly faster. -* It is changed so that ``mesh.yaml`` or ``mesh.hdf5`` is not written - out in thermal displacements calculations (``TDISP``, ``TDISPMAT``, - ``TDISPMAT_CIF``). This is done to reduce the memory consumption of - this calculation with dense mesh sampling. -* And many minor updates. - -June-18-2017: Version 1.11.12 -------------------------------- - -* Maintenance release with many minor fixes after v1.11.10. -* -1,and -3 point groups are added for irreps dataset. -* :ref:`pretend_real_tags` was made. -* ``--vasprunxml`` option for ``outcar-born`` - -Mar-31-2017: Version 1.11.10 ----------------------------- - -* Maintenance release with many fixes. - -Feb-7-2017: Version 1.11.8 ---------------------------- - -* CRYSTAL code interface (:ref:`crystal_mode`) is added by Antti Karttunen. -* Different vasprun.xml (expat) parser is under testing. - -Dec-14-2016: Version 1.11.6 ---------------------------- - -* ``--fz`` option comes back. See :ref:`fz_force_sets_option`. -* spglib update to v1.9.9 - -Oct-23-2016: Version 1.11.2 ---------------------------- - -* ``TDISPMAT_CIF`` (``--tdm_cif``) for CIF output for thermal - displacement is added (:ref:`thermal_displacement_cif_tag`). -* spglib update to v1.9.7 - -Aug-29-2016: Version 1.11.0 ---------------------------- - -* ``FPITCH`` (``--fpicth``) is made (:ref:`dos_fmin_fmax_tags`). -* Minor update of ``gruneisen``. -* Tentatively ``phonopy.yaml`` and ``phonopy_disp.yaml`` are written - when running phonopy. -* In Phonopy-API, from this version, to create displacements in - supercells internally the phonopy object, the - ``generate_displacements`` method has to be called explicitely along - with the ``distance`` argument. See :ref:`phonopy_module`. - -Jul-17-2016: Version 1.10.10 ------------------------------ - -* :ref:`dos_moment_tag` tags are implemented to calculate - phonon moments. -* ``qpoints.hdf5`` is written with the ``--hdf5`` option. Dynamical - matrices are also stored in ``qpoints.hdf5`` with ``WRITEDM = - .TRUE.`` (``--writedm`` option). - -Apr-22-2016: Version 1.10.8 ----------------------------- - -* :ref:`xyz_projection_tag` tag is created for PDOS. -* :ref:`vasp_mode` option is created to explicitly show VASP is used - to generate ``band.yaml`` as the calculator. -* spglib update to v1.9.2 - -Feb-7-2016: Version 1.10.4 ----------------------------- - -* More keywords are written in ``band.yaml``. -* Default NAC unit conversion factors (:ref:`born_file`) -* Collection of many minor fixes and updates - -Jan-25-2016: Version 1.10.2 ----------------------------- - -* Python 3 support -* Many fixes -* spglib update to v1.9.0 - -Oct-20-2015: Version 1.10.0 (release for testing) --------------------------------------------------- - -* An experimental release for testing python 3 support. Bug reports - are very appreciated. - -Oct-20-2015: Version 1.9.7 ------------------------------ - -* Siesta interface (``--elk`` option) was added (:ref:`siesta_interface`) - by Henrique Pereira Coutada Miranda. -* ``WRITE_MESH = .FALSE.`` (``--nowritemesh``) tag was added - (:ref:`write_mesh_tag`). - - -Aug-12-2015: Version 1.9.6 ------------------------------ - -* ``--hdf5`` option. Some output files can be written in hdf5 - format. See :ref:`hdf5_tag`. -* Improve tetrahedron method performance in the calculation of DOS and - PDOS. -* Spglib update to version 1.8.2.1. - - -July-11-2015: Version 1.9.5 ------------------------------ - -* Elk interface (``--elk`` option) was added (:ref:`elk_interface`). -* Spglib update to version 1.8.1. - - -Feb-18-2015: Version 1.9.4 ------------------------------ - -* Fixed to force setting ``MESH_SYMMETRY = .FALSE.`` (``--nomeshsym``) - when PDOS is invoked. - -Feb-10-2015: Version 1.9.3 ------------------------------ - -* ``MAGMOM`` tag is now available (:ref:`magmom_tag`). -* Spglib update. - -Jan-4-2015: Version 1.9.2 ------------------------------ - -* Behaviors of ``--wien2k``, ``--abinit``, ``--pwscf`` options have - been changed. Now they are just to invoke those calculator modes - without a unit cell structure file. The unit cell structure file is - specified using ``--cell`` (``-c``) option or ``CELL_FILENAME`` - tag. See :ref:`force_calculators`, :ref:`wien2k_interface`, - :ref:`abinit_interface`, and :ref:`qe_interface`. -* For the ``gruneisen`` command, ``--factor``, ``--nomeshsym``, - ``--wien2k``, ``--abinit``, and ``--pwscf`` options are - implemented. See :ref:`gruneisen_calculators` and - :ref:`gruneisen_command_options`. -* In phonopy-API, timing to call Phonopy._set_dynamical_matrix is - changed to reduce the number of calls of this function. This may - raise timing issue to phonopy-API users. -* Band-DOS (band-PDOS) plot is implemented. - -Oct-30-2014: Version 1.9.1.3 ------------------------------ - -* Experimental support for Abinit. See :ref:`qe_mode` and - :ref:`qe_force_sets_option`. - -Oct-29-2014: Version 1.9.1.2 ------------------------------ - -* Experimental support for Abinit. See :ref:`abinit_mode` and - :ref:`abinit_force_sets_option`. -* FHI-aims modulation output. Some more examples for ``phonopy-FHI-aims``. - -Oct-17-2014: Version 1.9.1.1 ------------------------------ - -* Supercell matrix support (9 elements) for the ``MODULATION`` tag. -* Improve the speed to create supercell. -* Many minor changes to clean-up code badly written. - -Aug-28-2014: Version 1.9.0 ------------------------------ - -* Use a native cElementTree of Python as VASP XML parser and stop - using lxml. The native cElementTree is built in after Python 2.5. So - Python 2.4 or before will not be suppored from this phonopy - version. This migration to cElementTree was made by shyuep. - -Aug-12-2014: Version 1.8.5 ------------------------------ - -* Supercell creation behavior may change due to the change of - algorithm. Though it used its own independent routine, now it uses - the ``Supercell`` class to build supercell -* Spglib update (1.6.1-alpha) -* Experimental option ``--fc_computation_algorithm="regression"`` to - compute force constants from forces and displacements using linear - regression with displaying standard deviation, by KL(m). - -June-23-2014: Version 1.8.4.2 ------------------------------ - -* Symmetrization of Born effective charge of ``outcar-born`` is - improved. -* ``-v`` option shows Born effective charges and dielectric constants - when NAC is set. -* Bug fix to include cutoff frequency to the displacement distance - matrix. -* Yaml output formats for band, mesh, q-points, modulation modes were - slightly modified. -* Bug fix in finding equivalent atoms in supercell that has lower - symmetry than the original unit cell. - -Apr-5-2014: Version 1.8.4.1 ------------------------------ - -* Fix irreps for non-zero q-point of nonsymmorphic case - -Mar-31-2014: Version 1.8.4 ---------------------------- - -* Implementation of analytical derivative of dynamical matrix in C, - which improves the performance of group velocity calculation. -* Minor change of python module for group velocity. - -Feb-17-2014: Version 1.8.3 ---------------------------- - -* A collection of small fixes in interface. -* Spglib update (spglib-1.6.0) -* Change in ``phonopy/file_IO/write_FORCE_SETS_*``. - -Feb-8-2014: Version 1.8.2 ---------------------------- - -* ``vasprun.xml`` of VASP 5.2.8 is only specially parsed to treat - special wrong character. -* Python module interface is updated and modified. ``set_post_process``, - ``set_force_sets`` will be obsolete. ``set_displacements`` is - obsolete. - -Jan-9-2014: Version 1.8.0 ---------------------------- - -This version is dangerous. A lot of code is modified internally. - -* Tetrahedron method is implemented for total and partial DOS. - This is activated by ``--thm`` option. -* The display output with ``-v`` option is enriched. -* Symmetrization for ``outcar-born`` is implemented (Experimental). -* Cutoff-frequency ``CUTOFF_FREQUENCY`` (``--cutoff_freq``) is - implemented to ignore frequencies lower than this cutoff frequency - to calculate thermal properties and thermal displacements. - -Dec-4-2013: Version 1.7.5 ---------------------------- - -* ``--mass`` option is created to shortcut of the ``MASS`` tag. -* ``--fc_spg_symmetry`` option is created to symmetrize force - constants. -* Symmetry finder update (spglib version 1.5.2) - -Oct-3-2013: Version 1.7.4 ---------------------------- - -* Thermal displacement matrix is implemented. See - :ref:`thermal_displacement_matrices_tag` and :ref:`thermal_displacement`. -* PDOS with projection along arbitrary direction was implemented. See - :ref:`projection_direction_tag`. -* ``partial_dos.dat`` format was changed. XYZ projected PDOS is not - output. Instead atom projected PDOS (sum of XYZ projected PDOS) - is written. See :ref:`output_files`. -* DOS and PDOS python interface was modified. The keyword of - ``omega_something`` is changed to ``freq_something``. -* ``gruneisen`` didn't run because it didn't follow the move of - the ``file_IO.py`` file location. This is fixed. -* The formula of non-analytical term correction implemented in phonopy - is not translational invariant in reciprocal space. This induces - tiny difference of the choice of equivalent q-points being different - by reciprocal primitive vectors. Now in the mesh sampling mode - (``MP``), q-points are automatically moved to inside - first-Brillouin-zone. -* In the mesh sampling mode, consistency of symmetry of mesh numbers - to crystal symmetry is checked. If the symmetry disagrees with - crystal symmetry, mesh symmetrization (equivalent to ``MESH_SYMMETRY - = .FALSE.``) is disabled. -* Wien2k interface is updated to adapt Wien2k-13. -* Fix the problem that only Vinet EOS worked in phonopy-qha. - -Sep-17-2013: Version 1.7.3 ---------------------------- - -* Fix. Segmentation fault happens in some specific systems - (e.g. Kubuntu 12.04 32bit) due to a different behavior of numpy - array creation. -* Group velocity for degenerate phonon mode is calculated slightly - different from older version and now it is symmetrized by - site-symmetry of q-point. - -Aug-4-2013: Version 1.7.2 ---------------------------- - -* ``group_velocity/__init__.py`` is moved to ``phonon`` directory. -* ``hphonopy/file_IO.py`` is moved to top directory. -* New ``harmonic/derivative_dynmat.py``: Analytical derivatives of - dynamical matrix -* Group velocity is computed by analytical derivatives of dynamical - matrix in the default configuration instead of previous finite - difference method. Group velocity calculation with the finite - difference method can be still activated by ``--gv_delta_q`` option. -* Force constants solver was partially rewritten. The order and shape - of matrices in the formula is rearranged - (:ref:`force_constants_solver_theory`). - -July-14-2013: Version 1.7.1 ---------------------------- - -* ``--pdos`` option was created. This is same as ``PDOS`` tag. -* Group velocity with degenerate modes was improved. - -Jun-21-2013: Version 1.7 ---------------------------- - -* The tag ``CHARACTER_TABLE`` was renamed to ``IRREPS`` - (:ref:`irreps_tag`), and the option of ``--ct`` was renamed to - ``--irreps`` as well. To show Ir-representations along with - characters, ``SHOW_IRREPS`` tag (or ``--show_irreps`` option) is - used. The output file name was also renamed to ``irreps.yaml``. In - the ir-reps calculation, display and file outputs were modified to - show the arguments of complex value characters. -* Numpy array types of 'double' and 'intc' for those arrays - passed to numpy C-API are used. -* ``thermal_displacement.py`` is slightly modified for the preparation - to include thermal displacement matrix. -* Symmetry finder update (spglib 1.4.2). - -Apr-13-2013: Version 1.6.4 ---------------------------- - -* Group velocity can be calculated using ``GROUP_VELOCITY`` tag or - ``--gv`` option (:ref:`group_velocity_tag`). -* Non-analytical term correction is implemented in C, which - accelerates the calculation speed. - -Feb-7-2013: Version 1.6.3 ----------------------------- - -* Arbitral projection direction is allowed for thermal displacements - calculation. (:ref:`thermal_displacements_tag`) -* A new tag `WRITEDM` and an option `--writedm` are - implemented. Dynamical matrices are written into ``qpoints.yaml`` - when this is used togather with the ``QPOINTS`` mode. (:ref:`writedm_tag`) - -Nov-13-2012: Version 1.6.2 ----------------------------- - -* A small fix of FHIaims.py. - -Nov-4-2012: Version 1.6.1 ----------------------------- - -* Implementation of database of character table for another type - of point group -3m. -* A new option ``--irreps`` or ``IRREPS`` tag (Experimental). -* ``character_table.yaml`` output. -* Eigenvectors output in``modulation.yaml`` was recovered. - - -Oct-22-2012: Version 1.6 ----------------------------- - -* Experimental support of band connection. (:ref:`band_connection_tag`) -* Experimental support of mode Grüneisen parameter calculation. (:ref:`phonopy_gruneisen`) -* Format of ``MODULATION`` tag was modified. (:ref:`modulation_tag`) -* Phonopy is controlled by command line options more than - before. ``--qpoints``, ``--modulation`` and ``--anime`` options are prepared. -* Symmetry finder update. -* Implementation of database of character table for the point - group 32. Fix -3m database. - -June-29-2012: Version 1.5 -------------------------- - -* Bug fix on plotting PDOS with labels. -* The array structures of qpoints, distances, frequencies, eigenvalues, - eigenvectors in BandStructure are changed to the lists of those - values of segments of band paths. For qpoints, frequencies, - eigenvalues, eigenvectors, the previous array structures are - recovered by numpy.vstack and for distances, numpy.hstack. -* Experimental support on thermal displacement. -* Experimental support on fitting DOS to a Debye model - (:ref:`debye_model_tag`) implemented by Jörg Meyer. - -May-22-2012: Version 1.4.2 ---------------------------- - -* Bug fix on showing the values of thermal properties. No bug in plot - and yaml. - -May-21-2012: Version 1.4.1 ---------------------------- - -* Avoid list comprehension with else statement, because it is not - supported in old python versions. - -May-13-2012: Version 1.4 ---------------------------- - -* ``--writefc`` option is implemented. -* In using ``MODULATION`` tag, phase factor for each mode can be - specified as the third value of each mode in degrees. -* Arguments of ``get_modulation`` in Phonopy module were modified. - The phase factor is now included in ``phonon_modes``. -* Class ``Phonopy`` was refactored. All private variables were renamed - as those starting with an underscore. Some basic variables are - obtained with the same variable names without the underscode, which - was implemented by the function ``property``. -* The labels of segments of band structure plot are specified by - ``BAND_LABELS`` (:ref:`band_labels_tag`). -* ``--band`` option is implemented. -* ``GAMMA_CENTER`` tag and ``--gc``, ``--gamma_center`` option are - implemented (:ref:`mp_tag`). -* ``phonopy-qha`` was polished. Most of the code was moved to - ``phonopy/qha/__init__.py``. -* ``Phonopy::get_mesh`` and ``Phonopy::get_band_structure`` were - modified. Instead of eigenvalues, frequencies are returned. -* The order of return values of ``Phonopy::get_thermal_properties`` - was changed as numpy arrays of temperatures, Helmhotlz free - energies, entropies, and heat capacities at constant volume. -* Arguments of the class ``ThermalProperties``, ``Dos``, and - ``PartialDOS`` were changed. Instead of eigenvalues, frequencies are - used. -* The default sigma value used for total and partial DOS was changed - to (max_frequency - min_frequency) / 100. -* Symmetry finder update. - -Mar-20-2012: Version 1.3 ---------------------------- - -* C implementations of a few parts of ``force_constants.py`` to speed - up. -* spglib update. -* Many small modifications. -* License is changed to the new BSD from the LGPL. - -Oct-13-2011: Version 1.2.1 ---------------------------- - -* Bug fix of the option ``--dim`` with 9 elements. - -Oct-12-2011: Version 1.2 ---------------------------- - -* Closing support of the ``--nac_old`` option. -* The option ``--nomeshsym`` is available on the manual. -* Symmetry finder update that includes the bug fix of Wyckoff letter - assignment. -* Showing site-symmetry symbols with respective orientations in the output of - ``--symmetry`` option. -* Code cleanings of ``settings.py``, ``force_constant.py``, etc. -* Starting implementation of ``character_table.py`` (:ref:`irreps_tag`). - -Sep-19-2011: Version 1.1 ---------------------------- - -* ``--readfc`` option is implemented. -* A bit of clean-up of the code ``dynamical_matrix.py``, - ``force_constant.py`` and ``_phonopy.c`` to make implementations - similar to the formulations often written in text books. - -Sep-5-2011: Version 1.0 ---------------------------- - -* ``settings.py`` is moved to ``phonopy/cui/Phonopy``. The configure - parser from a file and options is modified. -* Usage of ``MODULATION`` tag was changed. -* The option ``--nosym`` is available on the manual. - -Aug-8-2011: Version 0.9.6 ---------------------------- - -* Symmetry finder update -* Wyckoff positions are shown with ``--symmetry`` option - -Jun-7-2011: Version 0.9.5.1 ----------------------------------- - -* Bug fix of ``get_surrounding_frame`` in ``cells.py`` by Jörg Meyer and Christian Carbogno. - -Errata of document ------------------------------ - -The cell matrix definition of ``Atoms`` class was transposed. - -Jun-3-2011: Version 0.9.5 ----------------------------------- - -* Wien2k interface is updated (:ref:`wien2k_interface`), but this is - still quite experimental support. -* More information is involved in ``disp.yaml``. Along this - modification, supercells with displacements can be created solely - from ``disp.yaml`` using ``dispmanager``. -* Instead of ``TRANSLATION`` tag, ``FC_SYMMETRY`` is created - (:ref:`fc_symmetry_tag`). -* Closing support of ``--fco`` option. -* Add a few more examples in the ``example`` directory. -* Symmetry finder update -* ``propplot`` is updated for the ``--gnuplot`` option. - -Errata of document ------------------------------ - -The example of ``FORCE_SETS`` was wrong and was fixed. The explanation -of the document is correct. - -Apr-18-2011: Version 0.9.4.2 ------------------------------ - -* In the setting tag ``BAND``, now comma ``,`` can be used to - disconnect the sequence of band paths - (:ref:`band_structure_related_tags`). - -* ``dispmanager``, an auxiliary tool for modifying ``disp.yaml``, is - developed. - -* Symmetry finder update to spglib-1.0.3.1. Almost perfect casting to - a Bravais lattice is achieved using ``--symmetry`` option. - -* The setting tags ``TRANSLATION``, ``PERMUTATION``, and ``MP_REDUCE`` - are ceased. - - -Feb-26-2011: Version 0.9.4.1 ------------------------------ - -* Wien2k interface bug fix - -Feb-20-2011: Version 0.9.4 ------------------------------ - -* Big phonopy-interface change was imposed. Some of filenames and - formats of input and output files are modified. **There is no - default setting filename** like ``INPHON`` (setting file is passed - as the first argument). Some of tag names and those usage are also - modified. Please first check :ref:`examples_link` for the new usage. - - List of changes: - - - Setting file has to be passed to phonopy as the first argunment. - - FORCES is replaced by FORCE_SETS (:ref:`file_forces`). - - DISP is replaced by disp.yaml. - - LSUPER tag is removed. Please use -d option. - - NDIM and MATDIM tags are replaced by DIM tag (:ref:`dimension_tag`). - - Band structure setting tags are changed to BAND tag - (:ref:`band_structure_related_tags`). - - DOS tag is renamed to DOS_RANGE tag (:ref:`dos_related_tags`). - - These changes are applied only for the phonopy interface. Internal - simulation code has not been touched, so **physical results would not - be affected**. If you have any questions, please send e-mail to - phonopy :ref:`mailinglist`. - -* ``phonopy-FHI-aims`` had not worked in some of previous - versions. Now it works by Jörg Meyer and Christian Carbogno. - -* Directory structure of the code was changed. - -* Symmetry finder update to spglib-1.0.2 - -* [**Experimental**] Finding Bravais lattice using - ``--symmetry`` option. - -* [**Experimental**] Modulated structure along specified phonon modes - by ``MODULATION`` tag (:ref:`modulation_tag`). - -Jan-21-2011: Version 0.9.3.3 ------------------------------ - -* Animation file output update (:ref:`animation_tag`). The ``ANIME`` - tag format was changed. - -Jan-12-2011: Version 0.9.3.2 ------------------------------ - -* ``phonopy-qha`` is updated. A few options are added - (:ref:`phonopy_qha_options`). Calculation under pressure is - supported by ``--pressure`` option. - -* Primitive cell search and Bravais lattice output are integrated into - the symmetry search with ``--symmetry`` option. - -Errata of document ------------------------------ - -* There were mistakes in the documents for the ``PRIMITIVE_AXIS`` and - ``MATDIM``. The 9 values are read from the first three to - the last three as respective rows of the matrices defined. - -Dec-30-2010: Version 0.9.3.1 ------------------------------ - -* Bug fix of ``-f`` option. -* The output filenames of ``phonopy-qha`` are modified and summarized - at :ref:`phonopy_qha_output_files`. - -Dec-5-2010: Version 0.9.3 ------------------------------------- - -* The license is changed to LGPL. -* ``MASS`` tag is recreated (:ref:`mass_tag`). -* ``--mp`` option is created. This works like the ``MP`` tag. -* Improvement of ``phonopy-qha`` both in the code and :ref:`manual - `. -* The bug in ``--fco`` option was fixed. - -Nov-26-2010: Version 0.9.2 ------------------------------------- - -* spglib update (ver. 1.0.0) -* ASE.py is removed. Compatible class and functions, Atoms, - write_vasp, and read_vasp, are implemented. -* A ``vasprun.xml`` parser wrapper is implemened to avoid the broken - ``PRECFOCK`` in vasprun.xml of VASP 5.2.8. - -Sep-22-2010: Version 0.9.1.4 ------------------------------------- - -* The new tag ``ANIME_TYPE`` supports ``xyz`` and ``xyz_jmol`` formats - by Jörg Meyer and Christian Carbogno, and also `A set of ``POSCAR`` - files corresponding to animation frames. - -* Fix bugs in ``trim_cell`` and - ``Primitive.__supercell_to_primitive_map`` in ``cells.py``. When - :math:`M_s^{-1}M_p` is not symmetric, the supercell was not created - correctly. - -* ``phonopy-FHI-aims`` update by jm. - - -Aug-24-2010: Version 0.9.1.3 ------------------------------------- - -* Update symmetry finder of spglib. Now precision is in Cartesian distance. - -* The animation output for ``arc`` didn't work. Now it works. - -* Qpoint mode didn't work with bugs. Now it works. - -* ``--vasp`` option is renamed to ``--cell`` or ``-c``. - -* The new options ``--symmetry``, ``--displacement`` or ``-d``, - ``--dim``, ``--primitive_axis`` are implemented. - -* The option ``--ndim`` is replaced with ``--dim`` with ``-d`` option. - -June-10-2010: Version 0.9.1.2 ------------------------------------- - -* The code on non-analytical term correction is included in the - ``DynamicalMatrix`` class. Data sets read by ``parse_BORN`` are set - by ``set_non_analytical_term`` and gotten by - ``get_non_analytical_term``. The q-vector direction (only direction - is used in the non-analytical term correction) is set by - ``set_q_non_analytical_term``. However for emprical damping - function, some distance is used, i.e., when a q-point is getting - away, non-analytical term is weaken. For this purpose, the second - argument of ``set_q_non_analytical_term`` is used. - - At the same time, a small problem on the previous implementation was - found. When a reduced q-point is out of the first Brillouin zone, - it is not correctly handled. Currently it is fixed so as that when - absolute values of elements of the reduced q-point are over 0.5, they - are reduced into -0.5 < q < 0.5. - - - [**Attention**] The previous ``--nac`` option is moved to - ``--nac_old``. ``--nac`` is used for different method of the - non-analytical term correction at general q-points. This will be - documented soon. - -* Bug fix on ``write_FORCES`` in ``file_IO.py``. When order of - displacements in ``DISP`` file is not ascending order of atom indices, - it was not correctly re-ordered. Because the default order of - phonopy is ascending order, usually there is no problem for the most - users. - -* ``phonopy-FHI-aims`` - - - adapted to extensions of dynamical_matrix with respect to - non-analytical corrections - - added support for animation infrastructure - - moved several options to control.in - - by Jörg Meyer and Christian Carbogno - -May-11-2010: Version 0.9.1.1 ------------------------------------- - -* ``phonopy-FHI-aims`` adapted to split of dos array into the two - seperate omega, dos arrays in TotalDOS class by Jörg Meyer. - -May-10-2010: Version 0.9.1 ------------------------------------- - -* The methods of get_partial_DOS and get_total_DOS are added to the - Phonopy class. - -Apr-12-2010: Version 0.9.0.2 ------------------------------------- - -* spglib bug was fixed. If the crystal structure has non-standard origin, - the translation was not correctly handled. This problem happened - after version 0.9.0. - -Apr-12-2010: Version 0.9.0.1 ------------------------------------- - -* spglib update - -Apr-10-2010: Version 0.9.0 ------------------------------------- - -* Phonopy module (``__init.py__``) is heavily revised and the script - ``phonopy`` is rewritten using the phonopy module. Therefore there - may be bugs. Be careful. Document of the phonopy module will be - updated gradually. -* A small Wien2k interface document is added (:ref:`wien2k_interface`). -* A script ``phonopy-FHI-aims`` and its examples are added by - Jörg Meyer. -* spglib update - - -Mar-10-2010: Version 0.7.4 ------------------------------------- - -* spglib update -* Animation mode (:ref:`animation_tag`) - -Feb-10-2010: Version 0.7.3 ------------------------------------- - -* Bug fix for Wien2k mode - -Jan-12-2010: Version 0.7.2 ------------------------------------- -* [**Experimental**] Non-analytical term correction - was implemented. - -Dec-8-2009: Version 0.7.1 released ------------------------------------- - -* :ref:`auxiliary_tools` ``propplot`` is added. -* Memory consumption is reduced when using ``-f`` option to handle - large vasprun.xml files. - -Nov-24-2009: Version 0.7.0 released ------------------------------------- - -* :ref:`auxiliary_tools` ``bandplot`` and ``pdosplot`` are prepared. -* Formats of `band.yaml`, `mesh.yaml`, and `qpoints.yaml` are slightly - modified. -* There was bug in ``PERMUTATION`` tag to calculate symmetrized force - constants. Now it is fixed. Usually this is not necessary to set - because this does not affect to result. -* Symmetry finder spglib is updated. -* ``PM`` tag is implemented. See :ref:`setting_tags`. Behaviors in - the previous versions are ``PM = AUTO``. - -Oct-14-2009: Version 0.6.2 released ------------------------------------- - -* Installation process was changed slightly. - See :ref:`install`. -* The command ``phonopy`` is stored in the ``bin`` - directory. ``phonopy.py`` is renamed to ``phonopy``. -* setup system is improved by Maxim V. Losev. -* ``--fz`` tag was implemented experimentally. This is supposed to - enable to subtract residual forces on atoms in equilibrium structure - from those in structure with atomic displacements. diff -Nru phonopy-2.12.0/doc/citation.md phonopy-2.13.1/doc/citation.md --- phonopy-2.12.0/doc/citation.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/citation.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,83 @@ +# How to cite phonopy + +## Citation of phonopy + +If you have used phonopy, please cite the following article: + +- "First principles phonon calculations in materials science", + + Atsushi Togo and Isao Tanaka, Scr. Mater., **108**, 1-5 (2015) + + http://dx.doi.org/10.1016/j.scriptamat.2015.07.021 (Open access) + + ``` + @article {phonopy, + Journal = {Scr. Mater.}, + Year = {2015}, + Title = {First principles phonon calculations in materials science}, + Author = {Togo, A and Tanaka, I}, + Pages = {1--5}, + Volume = {108}, + Month = {Nov} + } + ``` + +## Some papers where phonopy was used + +### `phonopy-qha`: Thermal properties, quasi-harmonic approximation used for thermal expansion + +- "First-principles phonon calculations of thermal expansion in Ti3SiC2, + Ti3AlC2, and Ti3GeC2", + + Atsushi Togo, Laurent Chaput, Isao Tanaka, Gilles Hug, Phys. Rev. B, **81**, + 174301-1-6 (2010) + +### `MODULATION` tag: Collective atomic modulation, symmetry breaking + +- "Evolution of crystal structures in metallic elements", + + Atsushi Togo and Isao Tanaka, Phys. Rev. B, **87**, 184104-1-6 (2013) + +- "Transition pathway of CO2 crystals under high pressures", + + Atsushi Togo, Fumiyasu Oba, and Isao Tanaka, Phys. Rev. B, **77**, 184101-1-5 + (2008) + +- "Inversion Symmetry Breaking by Oxygen Octahedral Rotations in the + Ruddlesden-Popper NaRTiO4 Family", + + Hirofumi Akamatsu, Koji Fujita, Toshihiro Kuge, Arnab Sen Gupta, Atsushi Togo, + Shiming Lei, Fei Xue, Greg Stone, James M. Rondinelli, Long-Qing Chen, Isao + Tanaka, Venkatraman Gopalan, and Katsuhisa Tanaka, Phys. Rev. Lett. **112**, + 187602-1-5 (2014) + +- "First-principles calculations of the ferroelastic transition between + rutile-type and CaCl2-type SiO2 at high pressures", + + Atsushi Togo, Fumiyasu Oba, and Isao Tanaka, Phys. Rev. B, **78**, 134106 + (2008) + +### `TDISP`, `TDISPMAT` tags: Root mean square thermal atomic displacement + +- "Neutron diffraction measurements and first-principles study of thermal motion + of atoms in select Mn+1AXn and binary MX transition-metal carbide phases", + + Nina J. Lane, Sven C. Vogel, Gilles Hug, Atsushi Togo, Laurent Chaput, Lars + Hultman, and Michel W. Barsoum, Phys. Rev. B, **86**, 214301-1-9 (2012) + +- "Ab initio ORTEP drawings: a case study of N-based molecular crystals with + different chemical nature", + + Volker L. Deringer, Ralf P. Stoffel, Atsushi Togo, Bernhard Eck, Martin + Mevencd and Richard Dronskowski, Cryst. Eng. Comm., (2014) + +## A short history of phonopy + +Phonopy development started to replace and extend fropho +(http://fropho.sourceforge.net/). The implementation of fropho is also based on +{ref}`reference_plk`. Although fropho was implemented from scratch except for +the symmetry finder and input file parser, to start the development, it was +motivated by the existence of PHON code. The important part of the +implementation is the symmetry handling. In fropho, at first the symmetry finder +in Abinit code was employed, but later the symmetry finder was replaced by +spglib (https://spglib.github.io/spglib/). diff -Nru phonopy-2.12.0/doc/citation.rst phonopy-2.13.1/doc/citation.rst --- phonopy-2.12.0/doc/citation.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/citation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -How to cite phonopy -==================== - -Citation of phonopy --------------------- - -If you have used phonopy, please cite the following article: - -* "First principles phonon calculations in materials science", - - Atsushi Togo and Isao Tanaka, Scr. Mater., **108**, 1-5 (2015) - - http://dx.doi.org/10.1016/j.scriptamat.2015.07.021 (Open access) - - :: - - @article {phonopy, - Journal = {Scr. Mater.}, - Year = {2015}, - Title = {First principles phonon calculations in materials science}, - Author = {Togo, A and Tanaka, I}, - Pages = {1--5}, - Volume = {108}, - Month = {Nov} - } - -Some papers where phonopy was used ------------------------------------ - -``phonopy-qha``: Thermal properties, quasi-harmonic approximation used for thermal expansion -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* "First-principles phonon calculations of thermal expansion in - Ti3SiC2, Ti3AlC2, and Ti3GeC2", - - Atsushi Togo, Laurent Chaput, Isao Tanaka, Gilles Hug, - Phys. Rev. B, **81**, 174301-1-6 (2010) - -``MODULATION`` tag: Collective atomic modulation, symmetry breaking -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* "Evolution of crystal structures in metallic elements", - - Atsushi Togo and Isao Tanaka, - Phys. Rev. B, **87**, 184104-1-6 (2013) - -* "Transition pathway of CO2 crystals under high pressures", - - Atsushi Togo, Fumiyasu Oba, and Isao Tanaka, - Phys. Rev. B, **77**, 184101-1-5 (2008) - -* "Inversion Symmetry Breaking by Oxygen Octahedral Rotations in the - Ruddlesden-Popper NaRTiO4 Family", - - Hirofumi Akamatsu, Koji Fujita, Toshihiro Kuge, Arnab Sen Gupta, - Atsushi Togo, Shiming Lei, Fei Xue, Greg Stone, - James M. Rondinelli, Long-Qing Chen, Isao Tanaka, Venkatraman - Gopalan, and Katsuhisa Tanaka, - Phys. Rev. Lett. **112**, 187602-1-5 (2014) - -* "First-principles calculations of the ferroelastic transition between - rutile-type and CaCl2-type SiO2 at high pressures", - - Atsushi Togo, Fumiyasu Oba, and Isao Tanaka, Phys. Rev. B, **78**, 134106 (2008) - -``TDISP``, ``TDISPMAT`` tags: Root mean square thermal atomic displacement -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* "Neutron diffraction measurements and first-principles study of - thermal motion of atoms in select Mn+1AXn and binary MX - transition-metal carbide phases", - - Nina J. Lane, Sven C. Vogel, Gilles Hug, Atsushi Togo, Laurent - Chaput, Lars Hultman, and Michel W. Barsoum, Phys. Rev. B, - **86**, 214301-1-9 (2012) - -* "Ab initio ORTEP drawings: a case study of N-based molecular - crystals with different chemical nature", - - Volker L. Deringer, Ralf P. Stoffel, Atsushi Togo, Bernhard Eck, - Martin Mevencd and Richard Dronskowski, Cryst. Eng. Comm., (2014) - - -A short history of phonopy ---------------------------- - -Phonopy development started to replace and extend fropho -(http://fropho.sourceforge.net/). The implementation of fropho is also -based on :ref:`reference_plk`. Although fropho was implemented from -scratch except for the symmetry finder and input file parser, to start -the development, it was motivated by the existence of PHON code. The -important part of the implementation is the symmetry handling. In -fropho, at first the symmetry finder in Abinit code was employed, but -later the symmetry finder was replaced by spglib -(http://spglib.sourceforge.net/). diff -Nru phonopy-2.12.0/doc/command-options.md phonopy-2.13.1/doc/command-options.md --- phonopy-2.12.0/doc/command-options.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/command-options.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,433 @@ +(command_options)= + +# Command options + +```{contents} +:depth: 3 +:local: +``` + +From phonopy v1.12.2, the command option names with underscores `_` are replaced +by those with dashes `-`. Those tag names are unchanged. + +Some of command-line options are equivalent to respective setting tags: + +- `--alm` (`FC_CALCULATOR = ALM`) +- `--amplitude` (`DISPLACEMENT_DISTANCE`) +- `--anime` (`ANIME`) +- `--band` (`BAND`) +- `--band-connection` (`BAND_CONNECTION = .TRUE.`) +- `--band-format` (`BAND_FORMAT`) +- `--band-labels` (`BAND_LABELS`) +- `--band-points` (`BAND_POINTS`) +- `--cutoff-freq` (`CUTOFF_FREQUENCY`) +- `-c`, `--cell` (`CELL_FILENAME`) +- `-d` (`CREATE_DISPLACEMENTS = .TRUE.` +- `--dim` (`DIM`) +- `--dos` (`DOS = .TRUE.`) +- `--eigvecs`, `--eigenvectors` (`EIGENVECTORS = .TRUE.`) +- `--factor` (`FREQUENCY_CONVERSION_FACTOR`) +- `--fc-symmetry` (`FC_SYMMETRY = .TRUE.`) +- `--fits-debye-model` (`DEBYE_MODEL = .TRUE.`) +- `--fmax` (`FMAX`) +- `--fmin` (`FMIN`) +- `--fpitch` (`FPITCH`) +- `--full-fc` (`FULL_FORCE_CONSTANTS`) +- `--gc`, `--gamma_center` (`GAMMA_CENTER`) +- `--gv`, `--group_velocity` (`GROUP_VELOCITY = .TRUE.`) +- `--gv-delta-q` (`GV_DELTA_Q`) +- `--hdf5` (`HDF5 = .TRUE.`) +- `--irreps` (`IRREPS`) +- `--include-fc` (`INCLUDE_FC = .TRUE.`) +- `--include-fs` (`INCLUDE_FS = .TRUE.`) +- `--include-born` (`INCLUDE_BORN = .TRUE.`) +- `--include-disp` (`INCLUDE_DISP = .TRUE.`) +- `--include-all` (`INCLUDE_ALL = .TRUE.`) +- `--lcg`, `--little_cogroup` (`LITTLE_COGROUP`) +- `--modulation` (`MODULATION`) +- `--moment` (`MOMENT = .TRUE.`) +- `--moment_order` (`MOMENT_ORDER`) +- `--mesh-format` (`MESH_FORMAT`) +- `--mp`, `--mesh` (`MP` or `MESH`) +- `--nac` (`NAC = .TRUE.`) +- `--nac-method` (`NAC_METHOD`) +- `--nosym` (`SYMMETRY = .FALSE.`) +- `--nomeshsym` (`MESH_SYMMETRY = .FALSE.`) +- `--nowritemesh` (`WRITE_MESH = .FALSE.`) +- `--pa`, `--primitive-axes` (`PRIMITIVE_AXES`) +- `--pd`, `--projection-direction` (`PROJECTION_DIRECTION`) +- `--pdos` (`PDOS`) +- `--pr`, `--pretend-real` (`PRETEND_REAL = .TRUE.`) +- `--q-direction` (`Q_DIRECTION`) +- `--qpoints` (`QPOINTS`) +- `--qpoints-format` (`QPOINTS_FORMAT`) +- `--readfc` (`READ_FORCE_CONSTANTS = .TRUE.`) +- `--readfc-format` (`READFC_FORMAT`) +- `--read-qpoints` (`QPOINTS = .TRUE.`) +- `--show-irreps` (`SHOW_IRREPS`) +- `--sigma` (`SIGMA`) +- `-t` (`TPROP`) +- `--td` (`TDISP`) +- `--tdm` (`TDISPMAT`) +- `--tdm-cif` (`TDISPMAT_CIF`) +- `--tmin` (`TMIN`) +- `--tmax` (`TMAX`) +- `--tolerance` (`SYMMETRY_TOLERANCE`) +- `--tstep` (`TSTEP`) +- `--writedm` (`WRITEDM = .TRUE.`) +- `--writefc` (`WRITE_FORCE_CONSTANTS = .TRUE.`) +- `--writefc-format` (`WRITEFC_FORMAT`) +- `--xyz-projection` (`XYZ_PROJECTION = .TRUE.`) + +When both of equivalent command-line option and setting tag are set +simultaneously, the command-line option supersedes the setting tag. The +configuration file is recommended to place at the first position for the mixed +use of setting tags and command-line options, i.e., + +```bash +% phonopy setting.conf [command-line-options] +``` + +(force_calculators)= + +## Choice of force calculator + +Currently interfaces for VASP, WIEN2k, Quantum ESPRESSO (QE), ABINIT, Elk, +SIESTA, CRYSTAL, TURBOMOLE, Fleur and CP2K are prepared. These interfaces are +invoked with `--vasp`, `--wienk2`, `--qe`, `--abinit`, `--elk`, `--siesta`, +`--crystal`, `--turbomole`, `--fleur` and `--cp2k` options, respectively. When +no interface is specified, `--vasp` is selected as the default interface. + +The details about these interfaces are found at {ref}`calculator_interfaces`. + +(abinit_mode)= + +### `--abinit` + +Abinit mode is invoked with this option. + +(cp2k_mode)= + +### `--cp2k` + +CP2K mode is invoked with this option. + +(crystal_mode)= + +### `--crystal` + +CRYSTAL mode is invoked with this option. + +(elk_mode)= + +### `--elk` + +Elk mode is invoked with this option. (fleur_mode)= + +### `--fleur` + +Fleur mode is invoked with this option. + +(qe_mode)= + +### `--qe` + +Quantum ESPRESSO mode is invoked with this option. + +(siesta_mode)= + +### `--siesta` + +Siesta mode is invoked with this option. + +(turbomole_mode)= + +### `--turbomole` + +TURBOMOLE mode is invoked with this option. + +(vasp_mode)= + +### `--vasp` + +With this option, the calculator name `vasp` will appear in `phonopy.yaml` type +files. + +(wien2k_mode)= + +### `--wien2k` + +This option invokes the WIEN2k mode. + +**Only the WIEN2k struct with the P lattice is supported**. See more information +{ref}`wien2k_interface`. + +(cell_filename_option)= + +## Input cell + +### `-c` or `--cell` + +Unit cell crystal structure file is specified with this tag. + +```bash +% phonopy --cell=POSCAR-unitcell band.conf +``` + +Without specifying this tag, default file name is searched in current directory. +The default file names for the calculators are as follows: + +```{list-table} +:header-rows: 1 +:widths: 30 70 + +* - Calculator + - Default crystal structure file name +* - VASP + - `POSCAR` +* - WIEN2k + - `case.struct` +* - ABINIT + - `unitcell.in` +* - PWscf + - `unitcell.in` +* - Elk + - `elk.in` +* - CRYSTAL + - `crystal.o` +* - TURBOMOLE + - `control` +* - Fleur + - `fleur.in` +* - CP2K + - `unitcell.inp` +``` + +## Create `FORCE_SETS` + +(f_force_sets_option)= + +### `-f` or `--forces` + +(vasp_force_sets_option)= + +#### VASP interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml`, which is an output file +when creating supercells with displacements, and `vasprun.xml`'s, which are the +VASP output files. `phonopy_disp.yaml` in the current directory is automatically +read. The order of displacements written in `phonopy_disp.yaml` file has to +correpond to that of `vasprun.xml` files . + +```bash +% phonopy -f disp-001/vasprun.xml disp-002/vasprun.xml ... +``` + +```{note} +- Site-projected wave function information (the same information as `PROCAR`) + significantly increases the size of `vasprun.xml`. So parsing xml file uses + huge memory space. It is recommended +- to switch off to calculate it. If there are many displacements, shell + expansions are useful, e.g., `disp-*/vasprun.xml`, or + `disp-{001..128}/vasprun.xml` (for zsh, and recent bash). +``` + +(abinit_force_sets_option)= + +#### ABINIT interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and ABINIT output files +(`*.out`). In the reading of forces in ABINIT output files, forces in +eV/Angstrom are read. The unit conversion factor is determined with this unit. + +```bash +% phonopy -f disp-001/supercell.out disp-002/supercell.out ... +``` + +(qe_force_sets_option)= + +#### Quantum ESPRESSO interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and QE-PW output files. + +```bash +% phonopy -f disp-001/supercell.out disp-002/supercell.out ... +``` + +Here `*.out` files are the saved texts of standard outputs of PWscf +calculations. + +(wien2k_force_sets_option)= + +#### WIEN2k interface + +This is experimental support to generage `FORCE_SETS`. Insted of this, you can +use the external tool called `scf2forces` to generate `FORCE_SETS`. `scf2forces` +is found at http://www.wien2k.at/reg_user/unsupported/. + +`FORCE_SETS` file is created from `phonopy_disp.yaml`, which is an output file +when creating supercell with displacements, and `case.scf`'s, which are the +WIEN2k output files. The order of displacements in `phonopy_disp.yaml` file and +the order of `case.scf`'s have to be same. **For WIEN2k struct file, only +negative atom index with the P lattice format is supported.** + +```bash +% phonopy -f case_001/case_001.scf case_002/case_002.scf ... +``` + +For more information, {ref}`wien2k_interface`. + +(elk_force_sets_option)= + +#### Elk interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and Elk output files. + +``` +% phonopy -f disp-001/INFO.OUT disp-002/INFO.OUT ... +``` + +(crystal_force_sets_option)= + +#### CRYSTAL interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and CRYSTAL output files. + +```bash +% phonopy -f supercell-001.o supercell-002.o ... +``` + +(turbomole_force_sets_option)= + +#### TURBOMOLE interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and TURBOMOLE output +files. + +```bash +% phonopy -f supercell-001 supercell-002 ... +``` + +(fleur_force_sets_option)= + +#### Fleur interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and special Fleur FORCES +output files. + +```bash +% phonopy -f disp-001/FORCES disp-002/FORCES ... +``` + +(cp2k_force_sets_option)= + +#### CP2K interface + +`FORCE_SETS` file is created from `phonopy_disp.yaml` and CP2K output files, +with: + +```bash +% phonopy -f supercell-001-forces-1_0.xyz supercell-002-forces-1_0.xyz ... +``` + +Please note: the files containing the forces can be prefixed with the +`PROJECT_NAME` as specified in the original CP2K input file. + +(fz_force_sets_option)= + +### `--fz` + +`--fz` option is used to subtract residual forces frown the forces calculated +for the supercells with displacements. Here the residual forces mean that the +forces calculated for the perfect supercell for which the number of atoms has to +be the same as those for the supercells with displacements. If the forces are +accurately calculated by calculators, the residual forces should be canceled +when plus-minus displacements are employed (see {ref}`pm_displacement_tag`), +that is the default option in phonopy. Therefore `--fz` option is expected to be +useful when `PM = .FALSE.` is set in the phonopy setting file. + +The usage of this option is almost the same as that of `-f` option except that +one more argument is inserted at the front. Mind that `--fz` is exclusively used +with `-f` option. The example for the VASP interface is shown below: + +```bash +% phonopy --fz sposcar/vasprun.xml disp-001/vasprun.xml ... +``` + +where `sposcar/vasprun.xml` assumes the output file for the perfect supercell +containing residual forces. + +This option perhaps works for the other calculator interfaces than the VASP +interface, but it is not tested yet. It would be appreciated if you report it to +the phonopy mailing list when you find it does/doesn't work for any other +calculator interfaces. + +## Create `FORCE_CONSTANTS` + +(vasp_force_constants)= + +### `--fc` or `--force_constants` + +**Currently this option supports only VASP output.** + +VASP output of force constants is imported from `vasprun.xml` and +`FORCE_CONSTANTS` is created. + +```bash +% phonopy --fc vasprun.xml +``` + +This `FORCE_CONSTANTS` can be used instead of `FORCE_SETS`. For more details, +please refer {ref}`vasp_dfpt_interface`. + +(graph_option)= + +## Graph plotting + +### `-p` + +Result is plotted. + +```bash +% phonopy -p +``` + +(graph_save_option)= + +### `-p -s` + +Result is plotted (saved) to PDF file. + +```bash +% phonopy -p -s +``` + +## Log level + +### `-v` or `--verbose` + +More detailed log are shown + +### `-q` or `--quiet` + +No log is shown. + +## Crystal symmetry + +(symmetry_option)= + +### `--symmetry` + +Using this option, various crystal symmetry information is just printed out and +phonopy stops without going to phonon analysis. + +```bash +% phonopy --symmetry +``` + +This tag can be used together with the `--cell` (`-c`), `--abinit`, `--qe`, +`--elk`, `--wien2k`, `--siesta`, `--crystal` or `--primitive-axes` option. + +After running this, `BPOSCAR` and `PPOSCAR` files are written, which are the +symmetrized conventional unit cell and primitive cell, respectively, in the VASP +style format. diff -Nru phonopy-2.12.0/doc/command-options.rst phonopy-2.13.1/doc/command-options.rst --- phonopy-2.12.0/doc/command-options.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/command-options.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,529 +0,0 @@ -.. _command_options: - -Command options -=============== - -.. contents:: - :depth: 3 - :local: - -From phonopy v1.12.2, the command option names with underscores ``_`` -are replaced by those with dashes ``-``. Those tag names are unchanged. - -Some of command-line options are equivalent to respective setting -tags: - -* ``--alm`` (``FC_CALCULATOR = ALM``) -* ``--amplitude`` (``DISPLACEMENT_DISTANCE``) -* ``--anime`` (``ANIME``) -* ``--band`` (``BAND``) -* ``--band-connection`` (``BAND_CONNECTION = .TRUE.``) -* ``--band-format`` (``BAND_FORMAT``) -* ``--band-labels`` (``BAND_LABELS``) -* ``--band-points`` (``BAND_POINTS``) -* ``--cutoff-freq`` (``CUTOFF_FREQUENCY``) -* ``-c``, ``--cell`` (``CELL_FILENAME``) -* ``-d`` (``CREATE_DISPLACEMENTS = .TRUE.`` -* ``--dim`` (``DIM``) -* ``--dos`` (``DOS = .TRUE.``) -* ``--eigvecs``, ``--eigenvectors`` (``EIGENVECTORS = .TRUE.``) -* ``--factor`` (``FREQUENCY_CONVERSION_FACTOR``) -* ``--fc-symmetry`` (``FC_SYMMETRY = .TRUE.``) -* ``--fits-debye-model`` (``DEBYE_MODEL = .TRUE.``) -* ``--fmax`` (``FMAX``) -* ``--fmin`` (``FMIN``) -* ``--fpitch`` (``FPITCH``) -* ``--full-fc`` (``FULL_FORCE_CONSTANTS``) -* ``--gc``, ``--gamma_center`` (``GAMMA_CENTER``) -* ``--gv``, ``--group_velocity`` (``GROUP_VELOCITY = .TRUE.``) -* ``--gv-delta-q`` (``GV_DELTA_Q``) -* ``--hdf5`` (``HDF5 = .TRUE.``) -* ``--irreps`` (``IRREPS``) -* ``--include-fc`` (``INCLUDE_FC = .TRUE.``) -* ``--include-fs`` (``INCLUDE_FS = .TRUE.``) -* ``--include-born`` (``INCLUDE_BORN = .TRUE.``) -* ``--include-disp`` (``INCLUDE_DISP = .TRUE.``) -* ``--include-all`` (``INCLUDE_ALL = .TRUE.``) -* ``--lcg``, ``--little_cogroup`` (``LITTLE_COGROUP``) -* ``--modulation`` (``MODULATION``) -* ``--moment`` (``MOMENT = .TRUE.``) -* ``--moment_order`` (``MOMENT_ORDER``) -* ``--mesh-format`` (``MESH_FORMAT``) -* ``--mp``, ``--mesh`` (``MP`` or ``MESH``) -* ``--nac`` (``NAC = .TRUE.``) -* ``--nac-method`` (``NAC_METHOD``) -* ``--nosym`` (``SYMMETRY = .FALSE.``) -* ``--nomeshsym`` (``MESH_SYMMETRY = .FALSE.``) -* ``--nowritemesh`` (``WRITE_MESH = .FALSE.``) -* ``--pa``, ``--primitive-axes`` (``PRIMITIVE_AXES``) -* ``--pd``, ``--projection-direction`` (``PROJECTION_DIRECTION``) -* ``--pdos`` (``PDOS``) -* ``--pr``, ``--pretend-real`` (``PRETEND_REAL = .TRUE.``) -* ``--q-direction`` (``Q_DIRECTION``) -* ``--qpoints`` (``QPOINTS``) -* ``--qpoints-format`` (``QPOINTS_FORMAT``) -* ``--readfc`` (``READ_FORCE_CONSTANTS = .TRUE.``) -* ``--readfc-format`` (``READFC_FORMAT``) -* ``--read-qpoints`` (``QPOINTS = .TRUE.``) -* ``--show-irreps`` (``SHOW_IRREPS``) -* ``--sigma`` (``SIGMA``) -* ``-t`` (``TPROP``) -* ``--td`` (``TDISP``) -* ``--tdm`` (``TDISPMAT``) -* ``--tdm-cif`` (``TDISPMAT_CIF``) -* ``--tmin`` (``TMIN``) -* ``--tmax`` (``TMAX``) -* ``--tolerance`` (``SYMMETRY_TOLERANCE``) -* ``--tstep`` (``TSTEP``) -* ``--writedm`` (``WRITEDM = .TRUE.``) -* ``--writefc`` (``WRITE_FORCE_CONSTANTS = .TRUE.``) -* ``--writefc-format`` (``WRITEFC_FORMAT``) -* ``--xyz-projection`` (``XYZ_PROJECTION = .TRUE.``) - -When both of equivalent command-line option and setting tag are set -simultaneously, the command-line option supersedes the setting tag. -The configuration file is recommended to place at the first position for -the mixed use of setting tags and command-line options, i.e., - -:: - - phonopy setting.conf [command-line-options] - -.. _force_calculators: - -Choice of force calculator ---------------------------- - -Currently interfaces for VASP, WIEN2k, Quantum ESPRESSO (QE), ABINIT, -Elk, SIESTA, CRYSTAL, TURBOMOLE, Fleur and CP2K are prepared. These interfaces are invoked -with ``--vasp``, ``--wienk2``, ``--qe``, ``--abinit``, ``--elk``, -``--siesta``, ``--crystal``, ``--turbomole``, ``--fleur`` and ``--cp2k`` options, respectively. -When no interface is specified, ``--vasp`` is selected as the default interface. - -The details about these interfaces are found at :ref:`calculator_interfaces`. - -.. _wien2k_mode: - -``--wien2k`` -~~~~~~~~~~~~ - -**Behavior is changed at phonopy 1.9.2.** - -This option invokes the WIEN2k mode.In this mode. Usually this option -is used with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to -read WIEN2k crystal structure file. - -:: - - % phonopy --wien2k -c NaCl.struct band.conf - -**Only the WIEN2k struct with the P lattice is supported**. See more -information :ref:`wien2k_interface`. - -For previous versions than 1.9.1.3, this option is used as - -:: - - % phonopy --wien2k=NaCl.struct band.conf (version <= 1.9.1.3) - - -.. _abinit_mode: - -``--abinit`` -~~~~~~~~~~~~ - -Abinit mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read -Abinit main input file that contains the unit cell crystal structure, -e.g., - -:: - - % phonopy --abinit -c NaCl.in band.conf - -.. _qe_mode: - -``--qe`` -~~~~~~~~~~~~ - -Quantum ESPRESSO mode is invoked with this option. Usually this option -is used with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to -read QE/PWscf input file that contains the unit cell crystal structure, -e.g., - -:: - - % phonopy --qe -c NaCl.in band.conf - -.. _siesta_mode: - -``--siesta`` -~~~~~~~~~~~~ - -Siesta mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read a Siesta -input file that contains the unit cell crystal structure, e.g., - -:: - - % phonopy --siesta -c Si.fdf band.conf - -.. _elk_mode: - -``--elk`` -~~~~~~~~~~~~ - -Elk mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read Elk -input file that contains the unit cell crystal structure, e.g., - -:: - - % phonopy --elk -c elk-unitcell.in band.conf - -.. _crystal_mode: - -``--crystal`` -~~~~~~~~~~~~~ - -CRYSTAL mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read a CRYSTAL -input file that contains the unit cell crystal structure, e.g., - -:: - - % phonopy --crystal -c crystal.o band.conf - -.. _turbomole_mode: - -``--turbomole`` -~~~~~~~~~~~~~~~ - -TURBOMOLE mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read a TURBOMOLE -input file that contains the unit cell crystal structure, e.g., - -:: - - % phonopy --turbomole -c control band.conf - -.. _fleur_mode: - -``--fleur`` -~~~~~~~~~~~~ - -Fleur mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read a Fleur -input generator file that contains the unit cell crystal structure, e.g., - -:: - - % phonopy --fleur -c fleur_inpgen - -.. _cp2k_mode: - -``--cp2k`` -~~~~~~~~~~~~~~~ - -CP2K mode is invoked with this option. Usually this option is used -with ``--cell`` (``-c``) option or ``CELL_FILENAME`` tag to read a CP2K -input file that contains the unit cell crystal structure, e.g.,:: - - % phonopy --cp2k -c project.inp band.conf - -.. _vasp_mode: - -``--vasp`` -~~~~~~~~~~~~ - -This doesn't change the default behaviour, but ``vasp`` will appear as -the calculator such as in ``band.yaml``:: - - calculator: vasp - nqpoint: 204 - ... - -.. _cell_filename_option: - -Input cell ----------- - -``-c`` or ``--cell`` -~~~~~~~~~~~~~~~~~~~~ - -Unit cell crystal structure file is specified with this tag. - -:: - - % phonopy --cell=POSCAR-unitcell band.conf - -Without specifying this tag, default file name is searched in current -directory. The default file names for the calculators are as follows:: - - VASP | POSCAR - WIEN2k | case.struct - ABINIT | unitcell.in - PWscf | unitcell.in - Elk | elk.in - CRYSTAL | crystal.o - TURBOMOLE | control - Fleur | fleur.in - CP2K | unitcell.inp - -Create ``FORCE_SETS`` ----------------------- - -.. _f_force_sets_option: - -``-f`` or ``--forces`` -~~~~~~~~~~~~~~~~~~~~~~ - -.. _vasp_force_sets_option: - -VASP interface -^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml``, which is an -output file when creating supercells with displacements, and -``vasprun.xml``'s, which are the VASP output -files. ``phonopy_disp.yaml`` in the current directory is automatically -read. The order of displacements written in ``phonopy_disp.yaml`` file -has to correpond to that of ``vasprun.xml`` files . - -:: - - % phonopy -f disp-001/vasprun.xml disp-002/vasprun.xml ... - -Attention: - -* Site-projected wave function information (the same information as - ``PROCAR``) siginificantly increases the size of ``vasprun.xml``. So - parsing xml file uses huge memory space. It is recommended -* to switch off to calculate it. If there are many displacements, shell - expansions are useful, e.g., ``disp-*/vasprun.xml``, or - ``disp-{001..128}/vasprun.xml`` (for zsh, and recent bash). - -.. _abinit_force_sets_option: - -ABINIT interface -^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and ABINIT -output files (``*.out``). In the reading of forces in ABINIT output -files, forces in eV/Angstrom are read. The unit conversion factor is -determined with this unit. - -:: - - % phonopy -f disp-001/supercell.out disp-002/supercell.out ... - - -.. _qe_force_sets_option: - -Quantum ESPRESSO interface -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and QE-PW -output files. - -:: - - % phonopy -f disp-001/supercell.out disp-002/supercell.out ... - -Here ``*.out`` files are the saved texts of standard outputs of PWscf -calculations. - -.. _wien2k_force_sets_option: - -WIEN2k interface -^^^^^^^^^^^^^^^^ - -This is experimental support to generage ``FORCE_SETS``. Insted of -this, you can use the external tool called ``scf2forces`` to generate -``FORCE_SETS``. ``scf2forces`` is found at -http://www.wien2k.at/reg_user/unsupported/. - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml``, which is an -output file when creating supercell with displacements, and -``case.scf``'s, which are the WIEN2k output files. The order of -displacements in ``phonopy_disp.yaml`` file and the order of -``case.scf``'s have to be same. **For WIEN2k struct file, only -negative atom index with the P lattice format is supported.** - -:: - - % phonopy -f case_001/case_001.scf case_002/case_002.scf ... - -For more information, :ref:`wien2k_interface`. - -.. _elk_force_sets_option: - -Elk interface -^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and Elk output -files. - -:: - - % phonopy -f disp-001/INFO.OUT disp-002/INFO.OUT ... - -.. _crystal_force_sets_option: - -CRYSTAL interface -^^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and CRYSTAL output -files. - -:: - - % phonopy -f supercell-001.o supercell-002.o ... - -.. _turbomole_force_sets_option: - -TURBOMOLE interface -^^^^^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and TURBOMOLE output -files. - -:: - - % phonopy -f supercell-001 supercell-002 ... - -.. _fleur_force_sets_option: - -Fleur interface -^^^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and special Fleur -FORCES output files. - -:: - - % phonopy -f disp-001/FORCES disp-002/FORCES ... - -.. _cp2k_force_sets_option: - -CP2K interface -^^^^^^^^^^^^^^ - -``FORCE_SETS`` file is created from ``phonopy_disp.yaml`` and CP2K output files, with:: - - % phonopy -f supercell-001-forces-1_0.xyz supercell-002-forces-1_0.xyz ... - -Please note: the files containing the forces can be prefixed with the ``PROJECT_NAME`` -as specified in the original CP2K input file. - -.. _fz_force_sets_option: - -``--fz`` -~~~~~~~~~ - -``--fz`` option is used to subtract residual forces frown the forces -calculated for the supercells with displacements. Here the residual -forces mean that the forces calculated for the perfect supercell for -which the number of atoms has to be the same as those for the -supercells with displacements. If the forces are accurately calculated -by calculators, the residual forces should be canceled when plus-minus -displacements are employed (see :ref:`pm_displacement_tag`), that is -the default option in phonopy. Therefore ``--fz`` option is expected -to be useful when ``PM = .FALSE.`` is set in the phonopy setting file. - -The usage of this option is almost the same as that of ``-f`` option -except that one more argument is inserted at the front. Mind that -``--fz`` is exclusively used with ``-f`` option. The example -for the VASP interface is shown below:: - - % phonopy --fz sposcar/vasprun.xml disp-001/vasprun.xml ... - -where ``sposcar/vasprun.xml`` assumes the output file for the perfect -supercell containing residual forces. - -This option perhaps works for the other calculator interfaces than the -VASP interface, but it is not tested yet. It would be appreciated if -you report it to the phonopy mailing list when you find it -does/doesn't work for any other calculator interfaces. - -Create ``FORCE_CONSTANTS`` --------------------------- - -.. _vasp_force_constants: - -``--fc`` or ``--force_constants`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -**Currently this option supports only VASP output.** - -VASP output of force constants is imported from -``vasprun.xml`` and ``FORCE_CONSTANTS`` is created. - -:: - - % phonopy --fc vasprun.xml - -This ``FORCE_CONSTANTS`` can be used instead of ``FORCE_SETS``. For -more details, please refer :ref:`vasp_dfpt_interface`. - -.. _graph_option: - -Graph plotting ---------------- - -``-p`` -~~~~~~ - -Result is plotted. - -:: - - % phonopy -p - -.. _graph_save_option: - -``-p -s`` -~~~~~~~~~ - -Result is plotted (saved) to PDF file. - -:: - - % phonopy -p -s - - -Log level ----------- - -``-v`` or ``--verbose`` -~~~~~~~~~~~~~~~~~~~~~~~ - -More detailed log are shown - -``-q`` or ``--quiet`` -~~~~~~~~~~~~~~~~~~~~~ - -No log is shown. - -Crystal symmetry ------------------ - -.. _symmetry_option: - -``--symmetry`` -~~~~~~~~~~~~~~ - -Using this option, various crystal symmetry information is just -printed out and phonopy stops without going to phonon analysis. - -:: - - % phonopy --symmetry - -This tag can be used together with the ``--cell`` (``-c``), -``--abinit``, ``--qe``, ``--elk``, ``--wien2k``, ``--siesta``, -``--crystal`` or ``--primitive-axes`` option. - -After running this, ``BPOSCAR`` and ``PPOSCAR`` files are written, -which are the symmetrized conventional unit cell and primitive cell, -respectively, in the VASP style format. diff -Nru phonopy-2.12.0/doc/conf.py phonopy-2.13.1/doc/conf.py --- phonopy-2.12.0/doc/conf.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/conf.py 2022-02-13 03:47:08.000000000 +0000 @@ -47,9 +47,9 @@ # built documents. # # The short X.Y version. -version = "2.12" +version = "2.13" # The full version, including alpha/beta/rc tags. -release = "2.12.0" +release = "2.13.1" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru phonopy-2.12.0/doc/documentation.md phonopy-2.13.1/doc/documentation.md --- phonopy-2.12.0/doc/documentation.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/documentation.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,24 @@ +# Documentation + +```{toctree} +:maxdepth: 1 + +install +symmetry +workflow +examples +input-files +output-files +setting-tags +command-options +dynamic-structure-factor +Mode Grüneisen parameters +qha +interfaces +auxiliary-tools +external-tools +phonopy-module +formulation +citation +reference +``` diff -Nru phonopy-2.12.0/doc/documentation.rst phonopy-2.13.1/doc/documentation.rst --- phonopy-2.12.0/doc/documentation.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/documentation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Documentation -============== - -.. toctree:: - :maxdepth: 1 - - install - symmetry - workflow - examples - input-files - output-files - setting-tags - command-options - dynamic-structure-factor - Mode Grüneisen parameters - qha - interfaces - auxiliary-tools - external-tools - phonopy-module - formulation - citation - reference diff -Nru phonopy-2.12.0/doc/dynamic-structure-factor.md phonopy-2.13.1/doc/dynamic-structure-factor.md --- phonopy-2.12.0/doc/dynamic-structure-factor.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/dynamic-structure-factor.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,208 @@ +(dynamic_structure_factor)= + +# Dynamic structure factor + +From Eq. (3.120) in the book "Thermal of Neutron Scattering", coherent +one-phonon dynamic structure factor is given as + +```{math} +S(\mathbf{Q}, \nu, \omega)^{+1\text{ph}} = +\frac{k'}{k} \frac{N}{\hbar} +\sum_\mathbf{q} |F(\mathbf{Q}, \mathbf{q}\nu)|^2 +(n_{\mathbf{q}\nu} + 1) \delta(\omega - \omega_{\mathbf{q}\nu}) +\Delta(\mathbf{Q-q}), +``` + +```{math} +S(\mathbf{Q}, \nu, \omega)^{-1\text{ph}} = \frac{k'}{k} \frac{N}{\hbar} +\sum_\mathbf{q} |F(\mathbf{Q}, \mathbf{q}\nu)|^2 n_{\mathbf{q}\nu} +\delta(\omega + \omega_{\mathbf{q}\nu}) \Delta(\mathbf{Q-q}), +``` + +with + +```{math} +F(\mathbf{Q}, \mathbf{q}\nu) = \sum_j \sqrt{\frac{\hbar}{2 m_j +\omega_{\mathbf{q}\nu}}} \bar{b}_j \exp\left( -\frac{1}{2} \langle +|\mathbf{Q}\cdot\mathbf{u}(j0)|^2 \rangle \right) +\exp[-i(\mathbf{Q-q})\cdot\mathbf{r}(j0)] \mathbf{Q}\cdot\mathbf{e}(j, +\mathbf{q}\nu). +``` + +where {math}`\mathbf{Q}` is the scattering vector defined as +{math}`\mathbf{Q} = \mathbf{k} - \mathbf{k}'` with incident wave vector +{math}`\mathbf{k}` and final wavevector {math}`\mathbf{k}'`. Similarly, +{math}`\omega=1/\hbar (E-E')` where {math}`E` and {math}`E'` are the energies of +the incident and final particles. These follow the convention of the book +"Thermal of Neutron Scattering". In some other text books, their definitions +have opposite sign. {math}`\Delta(\mathbf{Q-q})` is defined so that +{math}`\Delta(\mathbf{Q-q})=1` with {math}`\mathbf{Q}-\mathbf{q}=\mathbf{G}` and +{math}`\Delta(\mathbf{Q-q})=0` with +{math}`\mathbf{Q}-\mathbf{q} \neq \mathbf{G}` where {math}`\mathbf{G}` is any +reciprocal lattice vector. Other variables are refered to {ref}`formulations` +page. Note that the phase convention of the dynamical matrix given +{ref}`here ` is used. This changes the representation +of the phase factor in {math}`F(\mathbf{Q}, \mathbf{q}\nu)` from that given in +the book "Thermal of Neutron Scattering", but the additional term +{math}`\exp(i\mathbf{q}\cdot\mathbf{r})` comes from the different phase +convention of the dynamical matrix or equivalently the eigenvector. For +inelastic neutron scattering, {math}`\bar{b}_j` is the average scattering length +over isotopes and spins. For inelastic X-ray scattering, {math}`\bar{b}_j` is +replaced by atomic form factor {math}`f_j(\mathbf{Q})` and {math}`k'/k \sim 1`. + +Currently only {math}`S(\mathbf{Q}, \nu, \omega)^{+1\text{ph}}` is calcualted +with setting {math}`N k'/k = 1` and the physical unit is +{math}`\text{m}^2/\text{J}` when {math}`\bar{b}_j` is given in Angstrom. + +## Usage + +Currently this feature is usable only from API. The following example runs with +the input files in `example/NaCl`. + +```python +import numpy as np +import phonopy +from phonopy.phonon.degeneracy import degenerate_sets +from phonopy.spectrum.dynamic_structure_factor import atomic_form_factor_WK1995 +from phonopy.units import THzToEv + + +def get_AFF_func(f_params): + def func(symbol, Q): + return atomic_form_factor_WK1995(Q, f_params[symbol]) + + return func + + +def run( + phonon, Qpoints, temperature, atomic_form_factor_func=None, scattering_lengths=None +): + # Transformation to the Q-points in reciprocal primitive basis vectors + Q_prim = np.dot(Qpoints, phonon.primitive_matrix) + # Q_prim must be passed to the phonopy dynamical structure factor code. + phonon.run_dynamic_structure_factor( + Q_prim, + temperature, + atomic_form_factor_func=atomic_form_factor_func, + scattering_lengths=scattering_lengths, + freq_min=1e-3, + ) + dsf = phonon.dynamic_structure_factor + q_cartesian = np.dot(dsf.qpoints, np.linalg.inv(phonon.primitive.get_cell()).T) + distances = np.sqrt((q_cartesian ** 2).sum(axis=1)) + + print("# [1] Distance from Gamma point,") + print("# [2-4] Q-points in cubic reciprocal space, ") + print("# [5-8] 4 band frequencies in meV (becaues of degeneracy), ") + print("# [9-12] 4 dynamic structure factors.") + print("# For degenerate bands, dynamic structure factors are summed.") + print("") + + # Use as iterator + for Q, d, f, S in zip( + Qpoints, distances, dsf.frequencies, dsf.dynamic_structure_factors + ): + bi_sets = degenerate_sets(f) # to treat for band degeneracy + text = "%f " % d + text += "%f %f %f " % tuple(Q) + text += " ".join( + ["%f" % (f[bi].sum() * THzToEv * 1000 / len(bi)) for bi in bi_sets] + ) + text += " " + text += " ".join(["%f" % (S[bi].sum()) for bi in bi_sets]) + print(text) + + +if __name__ == "__main__": + phonon = phonopy.load("phonopy_disp.yaml") + + # Q-points in reduced coordinates wrt cubic reciprocal space + Qpoints = [ + [2.970000, -2.970000, 2.970000], + [2.950000, 2.950000, -2.950000], + [2.930000, -2.930000, 2.930000], + [2.905000, -2.905000, 2.905000], + [2.895000, -2.895000, 2.895000], + [2.880000, -2.880000, 2.880000], + [2.850000, -2.850000, 2.850000], + [2.810000, -2.810000, 2.810000], + [2.735000, -2.735000, 2.735000], + [2.660000, -2.660000, 2.660000], + [2.580000, -2.580000, 2.580000], + [2.500000, -2.500000, 2.500000], + ] + + # Mesh sampling phonon calculation is needed for Debye-Waller factor. + # This must be done with is_mesh_symmetry=False and with_eigenvectors=True. + mesh = [11, 11, 11] + phonon.run_mesh(mesh, is_mesh_symmetry=False, with_eigenvectors=True) + temperature = 300 + + IXS = True + + if IXS: + # For IXS, atomic form factor is needed and given as a function as + # a parameter. + # D. Waasmaier and A. Kirfel, Acta Cryst. A51, 416 (1995) + # f(Q) = \sum_i a_i \exp((-b_i Q^2) + c + # Q is in angstron^-1 + # a1, b1, a2, b2, a3, b3, a4, b4, a5, b5, c + f_params = { + "Na": [ + 3.148690, + 2.594987, + 4.073989, + 6.046925, + 0.767888, + 0.070139, + 0.995612, + 14.1226457, + 0.968249, + 0.217037, + 0.045300, + ], # 1+ + "Cl": [ + 1.061802, + 0.144727, + 7.139886, + 1.171795, + 6.524271, + 19.467656, + 2.355626, + 60.320301, + 35.829404, + 0.000436, + -34.916604, + ], + } # 1- + AFF_func = get_AFF_func(f_params) + run(phonon, Qpoints, temperature, atomic_form_factor_func=AFF_func) + else: + # For INS, scattering length has to be given. + # The following values is obtained at (Coh b) + # https://www.nist.gov/ncnr/neutron-scattering-lengths-list + run(phonon, Qpoints, temperature, scattering_lengths={"Na": 3.63, "Cl": 9.5770}) +``` + +The output of the script is like below. + +``` +# [1] Distance from Gamma point, +# [2-4] Q-points in cubic reciprocal space, +# [5-8] 4 band frequencies in meV (becaues of degeneracy), +# [9-12] 4 dynamic structure factors. +# For degenerate bands, dynamic structure factors are summed. + +0.009132 2.970000 -2.970000 2.970000 0.990754 1.650964 19.068021 30.556134 0.000000 711.927936 0.000000 16.080929 +0.015219 2.950000 2.950000 -2.950000 1.649715 2.748809 19.026010 30.498821 0.000000 264.609349 0.000000 16.311203 +0.021307 2.930000 -2.930000 2.930000 2.306414 3.842450 18.964586 30.414407 0.000000 139.450488 0.000000 16.565746 +0.028917 2.905000 -2.905000 2.905000 3.122869 5.200999 18.863220 30.273465 0.000000 78.943639 0.000000 16.915297 +0.031961 2.895000 -2.895000 2.895000 3.447777 5.741079 18.815865 30.206915 0.000000 65.752890 0.000000 17.063832 +0.036526 2.880000 -2.880000 2.880000 3.933076 6.546928 18.738420 30.097099 0.000000 51.716404 0.000000 17.294665 +0.045658 2.850000 -2.850000 2.850000 4.895250 8.140375 18.563906 29.845228 0.000000 35.091618 0.000000 17.778807 +0.057833 2.810000 -2.810000 2.810000 6.157511 10.217162 18.300255 29.453883 0.000000 23.986023 0.000000 18.445572 +0.080662 2.735000 -2.735000 2.735000 8.440395 13.901752 17.738201 28.593810 0.000000 15.786835 0.000000 19.578157 +0.103491 2.660000 -2.660000 2.660000 10.558805 17.073109 17.174759 27.604416 0.000000 0.000000 14.340197 20.001530 +0.127842 2.580000 -2.580000 2.580000 12.497501 16.203294 19.926554 26.474368 0.000000 0.000000 18.795768 17.506617 +0.152193 2.500000 -2.500000 2.500000 13.534679 15.548262 21.156819 25.813428 0.000000 0.000000 34.118876 6.775735 +``` diff -Nru phonopy-2.12.0/doc/dynamic-structure-factor.rst phonopy-2.13.1/doc/dynamic-structure-factor.rst --- phonopy-2.12.0/doc/dynamic-structure-factor.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/dynamic-structure-factor.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -.. _dynamic_structure_factor: - -Dynamic structure factor -======================== - -**This feature is under testing.** - -From Eq. (3.120) in the book "Thermal of Neutron Scattering", coherent -one-phonon dynamic structure factor is given as - -.. math:: - - S(\mathbf{Q}, \nu, \omega)^{+1\text{ph}} = - \frac{k'}{k} \frac{N}{\hbar} - \sum_\mathbf{q} |F(\mathbf{Q}, \mathbf{q}\nu)|^2 - (n_{\mathbf{q}\nu} + 1) \delta(\omega - \omega_{\mathbf{q}\nu}) - \Delta(\mathbf{Q-q}), - -.. math:: - - S(\mathbf{Q}, \nu, \omega)^{-1\text{ph}} = - \frac{k'}{k} \frac{N}{\hbar} - \sum_\mathbf{q} |F(\mathbf{Q}, \mathbf{q}\nu)|^2 - n_{\mathbf{q}\nu} \delta(\omega + \omega_{\mathbf{q}\nu}) - \Delta(\mathbf{Q-q}), - -with - -.. math:: - - F(\mathbf{Q}, \mathbf{q}\nu) = \sum_j \sqrt{\frac{\hbar}{2 m_j - \omega_{\mathbf{q}\nu}}} \bar{b}_j \exp\left( -\frac{1}{2} \langle - |\mathbf{Q}\cdot\mathbf{u}(j0)|^2 \rangle \right) - \exp[-i(\mathbf{Q-q})\cdot\mathbf{r}(j0)] - \mathbf{Q}\cdot\mathbf{e}(j, \mathbf{q}\nu). - -where :math:`\mathbf{Q}` is the scattering vector defined as -:math:`\mathbf{Q} = \mathbf{k} - \mathbf{k}'` with incident wave -vector :math:`\mathbf{k}` and final wavevector -:math:`\mathbf{k}'`. Similarly, :math:`\omega=1/\hbar (E-E')` where -:math:`E` and :math:`E'` are the energies of the incident and final -particles. These follow the convention of the book "Thermal of Neutron -Scattering". In some other text books, their definitions have opposite -sign. :math:`\Delta(\mathbf{Q-q})` is defined so that -:math:`\Delta(\mathbf{Q-q})=1` with -:math:`\mathbf{Q}-\mathbf{q}=\mathbf{G}` and -:math:`\Delta(\mathbf{Q-q})=0` with :math:`\mathbf{Q}-\mathbf{q} \neq -\mathbf{G}` where :math:`\mathbf{G}` is any reciprocal lattice -vector. Other variables are refered to :ref:`formulations` page. Note -that the phase convention of the dynamical matrix given :ref:`here -` is used. This changes the representation of -the phase factor in :math:`F(\mathbf{Q}, \mathbf{q}\nu)` from that -given in the book "Thermal of Neutron Scattering", but the additional -term :math:`\exp(i\mathbf{q}\cdot\mathbf{r})` comes from the different -phase convention of the dynamical matrix or equivalently the -eigenvector. For inelastic neutron scattering, :math:`\bar{b}_j` is -the average scattering length over isotopes and spins. For inelastic -X-ray scattering, :math:`\bar{b}_j` is replaced by atomic form factor -:math:`f_j(\mathbf{Q})` and :math:`k'/k \sim 1`. - -Currently only :math:`S(\mathbf{Q}, \nu, \omega)^{+1\text{ph}}` is -calcualted with setting :math:`N k'/k = 1` and the physical unit is -:math:`\text{m}^2/\text{J}` when :math:`\bar{b}_j` is given in -Angstrom. - -Usage ------ - -Currently this feature is usable only from API. The following example -runs with the input files in ``example/NaCl``. - -:: - - #!/usr/bin/env python - - import numpy as np - from phonopy import load - from phonopy.spectrum.dynamic_structure_factor import atomic_form_factor_WK1995 - from phonopy.phonon.degeneracy import degenerate_sets - from phonopy.units import THzToEv - - - def get_AFF_func(f_params): - def func(symbol, Q): - return atomic_form_factor_WK1995(Q, f_params[symbol]) - return func - - - def run(phonon, - Qpoints, - temperature, - atomic_form_factor_func=None, - scattering_lengths=None): - # Transformation to the Q-points in reciprocal primitive basis vectors - Q_prim = np.dot(Qpoints, phonon.primitive_matrix) - # Q_prim must be passed to the phonopy dynamical structure factor code. - phonon.run_dynamic_structure_factor( - Q_prim, - temperature, - atomic_form_factor_func=atomic_form_factor_func, - scattering_lengths=scattering_lengths, - freq_min=1e-3) - dsf = phonon.dynamic_structure_factor - q_cartesian = np.dot(dsf.qpoints, - np.linalg.inv(phonon.primitive.get_cell()).T) - distances = np.sqrt((q_cartesian ** 2).sum(axis=1)) - - print("# [1] Distance from Gamma point,") - print("# [2-4] Q-points in cubic reciprocal space, ") - print("# [5-8] 4 band frequencies in meV (becaues of degeneracy), ") - print("# [9-12] 4 dynamic structure factors.") - print("# For degenerate bands, dynamic structure factors are summed.") - print("") - - # Use as iterator - for Q, d, f, S in zip(Qpoints, distances, dsf.frequencies, - dsf.dynamic_structure_factors): - bi_sets = degenerate_sets(f) # to treat for band degeneracy - text = "%f " % d - text += "%f %f %f " % tuple(Q) - text += " ".join(["%f" % (f[bi].sum() * THzToEv * 1000 / len(bi)) - for bi in bi_sets]) - text += " " - text += " ".join(["%f" % (S[bi].sum()) for bi in bi_sets]) - print(text) - - - if __name__ == '__main__': - phonon = load(supercell_matrix=[2, 2, 2], - primitive_matrix='F', - unitcell_filename="POSCAR") - - # Q-points in reduced coordinates wrt cubic reciprocal space - Qpoints = [[2.970000, -2.970000, 2.970000], - [2.950000, 2.950000, -2.950000], - [2.930000, -2.930000, 2.930000], - [2.905000, -2.905000, 2.905000], - [2.895000, -2.895000, 2.895000], - [2.880000, -2.880000, 2.880000], - [2.850000, -2.850000, 2.850000], - [2.810000, -2.810000, 2.810000], - [2.735000, -2.735000, 2.735000], - [2.660000, -2.660000, 2.660000], - [2.580000, -2.580000, 2.580000], - [2.500000, -2.500000, 2.500000]] - - # Mesh sampling phonon calculation is needed for Debye-Waller factor. - # This must be done with is_mesh_symmetry=False and with_eigenvectors=True. - mesh = [11, 11, 11] - phonon.run_mesh(mesh, - is_mesh_symmetry=False, - with_eigenvectors=True) - temperature = 300 - - IXS = True - - if IXS: - # For IXS, atomic form factor is needed and given as a function as - # a parameter. - # D. Waasmaier and A. Kirfel, Acta Cryst. A51, 416 (1995) - # f(Q) = \sum_i a_i \exp((-b_i Q^2) + c - # Q is in angstron^-1 - # a1, b1, a2, b2, a3, b3, a4, b4, a5, b5, c - f_params = {'Na': [3.148690, 2.594987, 4.073989, 6.046925, - 0.767888, 0.070139, 0.995612, 14.1226457, - 0.968249, 0.217037, 0.045300], # 1+ - 'Cl': [1.061802, 0.144727, 7.139886, 1.171795, - 6.524271, 19.467656, 2.355626, 60.320301, - 35.829404, 0.000436, -34.916604]} # 1- - AFF_func = get_AFF_func(f_params) - run(phonon, - Qpoints, - temperature, - atomic_form_factor_func=AFF_func) - else: - # For INS, scattering length has to be given. - # The following values is obtained at (Coh b) - # https://www.nist.gov/ncnr/neutron-scattering-lengths-list - run(phonon, - Qpoints, - temperature, - scattering_lengths={'Na': 3.63, 'Cl': 9.5770}) - -The output of the script is:: - - # [1] Distance from Gamma point, - # [2-4] Q-points in cubic reciprocal space, - # [5-8] 4 band frequencies in meV (becaues of degeneracy), - # [9-12] 4 dynamic structure factors. - # For degenerate bands, dynamic structure factors are summed. - - 0.009132 2.970000 -2.970000 2.970000 0.977517 1.648183 19.035705 30.535702 0.000000 706.475380 0.000000 16.137386 - 0.015219 2.950000 2.950000 -2.950000 1.640522 2.747087 18.994893 30.479078 0.000000 262.113412 0.000000 16.366740 - 0.021307 2.930000 -2.930000 2.930000 2.298710 3.841226 18.935185 30.395654 0.000000 138.116831 0.000000 16.619581 - 0.028917 2.905000 -2.905000 2.905000 3.116160 5.200214 18.836546 30.256295 0.000000 78.225945 0.000000 16.965983 - 0.031961 2.895000 -2.895000 2.895000 3.441401 5.740457 18.790421 30.190463 0.000000 65.174556 0.000000 17.112970 - 0.036526 2.880000 -2.880000 2.880000 3.927209 6.546550 18.714922 30.081791 0.000000 51.288627 0.000000 17.341206 - 0.045658 2.850000 -2.850000 2.850000 4.890522 8.140492 18.544488 29.832346 0.000000 34.845699 0.000000 17.819327 - 0.057833 2.810000 -2.810000 2.810000 6.154512 10.217882 18.286153 29.444246 0.000000 23.864605 0.000000 18.476926 - 0.080662 2.735000 -2.735000 2.735000 8.440068 13.902951 17.731951 28.589254 0.000000 15.762830 0.000000 19.591803 - 0.103491 2.660000 -2.660000 2.660000 10.559231 17.071210 17.175478 27.602958 0.000000 0.000000 14.349345 20.000676 - 0.127842 2.580000 -2.580000 2.580000 12.497611 16.203093 19.926659 26.474218 0.000000 0.000000 18.814845 17.496644 - 0.152193 2.500000 -2.500000 2.500000 13.534679 15.548262 21.156819 25.813428 0.000000 0.000000 34.134746 6.765951 diff -Nru phonopy-2.12.0/doc/examples.md phonopy-2.13.1/doc/examples.md --- phonopy-2.12.0/doc/examples.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/examples.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,620 @@ +(examples_link)= + +# Examples + +```{contents} +:depth: 2 +:local: +``` + +Phonopy supports various external force calculators (mainly for abinitio codes). +The examples below are given for the default system that is equivalent to VASP +style. Most of usage is universal among the force calculators. So it is also +useful for non-VASP users to see the examples below. The list of the force +calculators and the links to their specific usages are shown at +{ref}`calculator_interfaces`. + +Example files are found at +https://github.com/phonopy/phonopy/tree/master/example. The same are found in +the example directory of the phonopy package downloaded at +https://github.com/phonopy/phonopy/archive/master.zip. The followings show how +some of those examples work. Note that sometimes the followings are outdated +than the examples in the phonopy package. So the results or displace outputs can +be different. + +## Si + +### `FORCE_SETS` file creation for VASP + +``` +% phonopy -f vasprun.xml + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.7.0 + +Python version 3.7.6 +Spglib version 1.14.1 + +Displacements were read from "phonopy_disp.yaml". +counter (file index): 1 +FORCE_SETS has been created. + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +where `vasprun.xml` is the VASP output. + +### DOS + +``` +% phonopy -p mesh.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.7.0 + +Python version 3.7.6 +Spglib version 1.14.1 + +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Mesh sampling mode +Settings: + Sampling mesh: [31 31 31] + Supercell: [2 2 2] + Primitive matrix: + [1. 0. 0.] + [0. 1. 0.] + [0. 0. 1.] +Spacegroup: Fd-3m (227) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: -0.000001 (yy) -0.000001 (yy) + +Mesh numbers: [31 31 31] +Number of irreducible q-points on sampling mesh: 816/29791 +Calculating phonons on sampling mesh... +Calculating DOS... + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} Si-DOS.png +:width: 50% +``` + +### Thermal properties + +``` +% phonopy -t -p mesh.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "mesh.conf". +Crystal structure was read from "phonopy_params.yaml". +Unit of length: angstrom +Mesh sampling mode +Settings: + Sampling mesh: [31 31 31] + Supercell: [2 2 2] + Primitive matrix: + [1. 0. 0.] + [0. 1. 0.] + [0. 0. 1.] +Spacegroup: Fd-3m (227) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Forces and displacements were read from "phonopy_params.yaml". +Computing force constants... +Max drift of force constants: -0.000001 (zz) -0.000001 (zz) + +Mesh numbers: [31 31 31] +Number of irreducible q-points on sampling mesh: 816/29791 +Calculating phonons on sampling mesh... +Calculating thermal properties... +Cutoff frequency: 0.00000 +Number of phonon frequencies less than cutoff frequency: 3/178746 +# T [K] F [kJ/mol] S [J/K/mol] C_v [J/K/mol] E [kJ/mol] + + 0.000 11.7110491 0.0000000 0.0000000 11.7110491 + 10.000 11.7110004 0.0207133 0.0652014 11.7112076 + 20.000 11.7101706 0.1826665 0.5801980 11.7138239 + 30.000 11.7063148 0.6494417 1.9566658 11.7257980 + 40.000 11.6959680 1.4755146 3.9391312 11.7549886 + 50.000 11.6758626 2.5838026 6.0729959 11.8050528 + 60.000 11.6436849 3.8753235 8.1398561 11.8762043 + 70.000 11.5979858 5.2789840 10.1081937 11.9675147 + 80.000 11.5378706 6.7536681 12.0151391 12.0781640 + 90.000 11.4627490 8.2777067 13.8988296 12.2077426 + 100.000 11.3721917 9.8393078 15.7763730 12.3561224 +... +``` + +```{image} Si-props.png +:width: 50% +``` + +## NaCl + +### Band structure + +``` +% phonopy -p band.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "band.conf". +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Band structure mode +Settings: + Supercell: [2 2 2] + Primitive matrix (Auto): + [0. 0.5 0.5] + [0.5 0. 0.5] + [0.5 0.5 0. ] +Spacegroup: Fm-3m (225) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: 0.040159 (yy) 0.000009 (xx) + +Reciprocal space paths in reduced coordinates: +[ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] +[ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] +[ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] +[ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} NaCl-band.png +:width: 50% +``` + +### Band structure with non-analytical term correction + +This requires to prepare BORN file. + +``` +% phonopy -p --nac band.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "band.conf". +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Band structure mode +Settings: + Non-analytical term correction (NAC): on + Supercell: [2 2 2] + Primitive matrix (Auto): + [0. 0.5 0.5] + [0.5 0. 0.5] + [0.5 0.5 0. ] +Spacegroup: Fm-3m (225) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: 0.040159 (yy) 0.000009 (xx) + +NAC parameters were not found in "phonopy_disp.yaml". +NAC parameters were read from "BORN". +Use NAC by Gonze et al. (no real space sum in current implementation) + PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) + G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 + +Reciprocal space paths in reduced coordinates: +[ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] +[ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] +[ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] +[ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} NaCl-band-NAC.png +:width: 50% +``` + +(example_pdos)= + +### PDOS + +``` +% phonopy -p pdos.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "pdos.conf". +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Mesh sampling mode +Settings: + Sampling mesh: [41 41 41] + Supercell: [2 2 2] + Primitive matrix (Auto): + [0. 0.5 0.5] + [0.5 0. 0.5] + [0.5 0.5 0. ] +Spacegroup: Fm-3m (225) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: 0.040159 (yy) 0.000009 (xx) + +Mesh numbers: [41 41 41] +Number of q-points on sampling mesh: 68921 +Calculating phonons on sampling mesh... +Calculating projected DOS... + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} NaCl-PDOS.png +:width: 50% +``` + +With non-analytical term correction, the PDOS may not change very much because +it mainly affects phonon modes in the reciprocal region close to {math}`\Gamma` +point. + +``` +% phonopy --nac -p pdos.conf + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "pdos.conf". +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Mesh sampling mode +Settings: + Non-analytical term correction (NAC): on + Sampling mesh: [41 41 41] + Supercell: [2 2 2] + Primitive matrix (Auto): + [0. 0.5 0.5] + [0.5 0. 0.5] + [0.5 0.5 0. ] +Spacegroup: Fm-3m (225) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: 0.040159 (yy) 0.000009 (xx) + +NAC parameters were not found in "phonopy_disp.yaml". +NAC parameters were read from "BORN". +Use NAC by Gonze et al. (no real space sum in current implementation) + PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) + G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 + +Mesh numbers: [41 41 41] +Number of q-points on sampling mesh: 68921 +Calculating phonons on sampling mesh... +Calculating projected DOS... + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} NaCl-PDOS-nac.png +:width: 50% +``` + +### Plot band structure and DOS at once + +Band structure and DOS or PDOS can be plotted on one figure together by + +``` +% phonopy band-pdos.conf --nac -p + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Phonopy configuration was read from "band-pdos.conf". +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Band structure and mesh sampling mode +Settings: + Non-analytical term correction (NAC): on + Sampling mesh: [41 41 41] + Supercell: [2 2 2] + Primitive matrix (Auto): + [0. 0.5 0.5] + [0.5 0. 0.5] + [0.5 0.5 0. ] +Spacegroup: Fm-3m (225) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: 0.040159 (yy) 0.000009 (xx) + +NAC parameters were not found in "phonopy_disp.yaml". +NAC parameters were read from "BORN". +Use NAC by Gonze et al. (no real space sum in current implementation) + PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) + G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 + +Reciprocal space paths in reduced coordinates: +[ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] +[ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] +[ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] +[ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] +Mesh numbers: [41 41 41] +Number of q-points on sampling mesh: 68921 +Calculating phonons on sampling mesh... +Calculating projected DOS... + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +```{image} NaCl-band-PDOS-NAC.png +:width: 50% +``` + +## MgB2 characters of ireducible representations + +``` +% phonopy -f vasprun.xml-{001,002} +% phonopy --dim="3 3 2" --irreps="0 0 0" + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Ir-representation mode +Settings: + Supercell: [3 3 2] + Primitive matrix (Auto): + [1. 0. 0.] + [0. 1. 0.] + [0. 0. 1.] +Spacegroup: P6/mmm (191) +Use -v option to watch primitive cell, unit cell, and supercell structures. + +Force sets were not found in "phonopy_disp.yaml". +Forces and displacements were read from "FORCE_SETS". +Computing force constants... +Max drift of force constants: -0.039930 (zz) -0.000007 (zz) + + +------------------------------- + Irreducible representations +------------------------------- +q-point: [0. 0. 0.] +Point group: 6/mmm + +Original rotation matrices: + + 1 2 3 4 5 6 + -------- -------- -------- -------- -------- -------- + 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 + 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 + 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 + + 7 8 9 10 11 12 + -------- -------- -------- -------- -------- -------- + -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 + 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 + 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 + + 13 14 15 16 17 18 + -------- -------- -------- -------- -------- -------- + 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 + -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 + 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 + + 19 20 21 22 23 24 + -------- -------- -------- -------- -------- -------- + 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 + 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 + 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 + +Transformation matrix: + + 1.000 0.000 0.000 + 0.000 1.000 0.000 + 0.000 0.000 1.000 + +Rotation matrices by transformation matrix: + + E i C6 S3 C3 S6 + -------- -------- -------- -------- -------- -------- + 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 + 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 + 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 + + C2 sgh C3 S6 C6 S3 + -------- -------- -------- -------- -------- -------- + -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 + 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 + 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 + + C2'' sgv C2' sgd C2'' sgv + -------- -------- -------- -------- -------- -------- + 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 + -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 + 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 + + C2' sgd C2'' sgv C2' sgd + -------- -------- -------- -------- -------- -------- + 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 + 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 + 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 + +Character table: + + 1 ( -0.019): A2u + ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) + ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) + ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) + ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) + + 2 ( 0.004): E1u + ( 2, 0.0) ( 2, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) + ( 2, 180.0) ( 2, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + + 4 ( 9.953): E1u + ( 2, 0.0) ( 2, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) + ( 2, 180.0) ( 2, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + + 6 ( 11.982): A2u + ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) + ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) + ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) + ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) + + 7 ( 17.269): E2g + ( 2, 0.0) ( 2, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) + ( 2, 0.0) ( 2, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) + + 9 ( 20.565): B1g + ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) + ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) + ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) + ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) + + +Summary of calculation was written in "phonopy.yaml". + _ + ___ _ __ __| | + / _ \ '_ \ / _` | + | __/ | | | (_| | + \___|_| |_|\__,_| +``` + +## Al-QHA + +``` +% phonopy-qha e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} --sparse=50 -p +# Vinet EOS +# T E_0 B_0 B'_0 V_0 + 0.000000 -14.814330 75.358945 4.746862 66.684166 + 2.000000 -14.814330 75.358944 4.746862 66.684166 + 4.000000 -14.814330 75.358934 4.746864 66.684167 + 6.000000 -14.814330 75.358891 4.746869 66.684169 + 8.000000 -14.814330 75.358779 4.746883 66.684174 + 10.000000 -14.814331 75.358553 4.746911 66.684185 +... +``` + +```{image} Al-QHA.png +:width: 50% +``` + +## Si-gruneisen + +See {ref}`phonopy_gruneisen`. diff -Nru phonopy-2.12.0/doc/examples.rst phonopy-2.13.1/doc/examples.rst --- phonopy-2.12.0/doc/examples.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/examples.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,624 +0,0 @@ -.. _examples_link: - -Examples -======== - -.. contents:: - :depth: 2 - :local: - -Phonopy supports various external force calculators (mainly for -abinitio codes). The examples below are given for the default system -that is equivalent to VASP style. Most of usage is universal among the -force calculators. So it is also useful for non-VASP users to see the -examples below. The list of the force calculators and the links to -their specific usages are shown at :ref:`calculator_interfaces`. - -Example files are found at -https://github.com/phonopy/phonopy/tree/master/example. The same are -found in the example directory of the phonopy package downloaded at -https://github.com/phonopy/phonopy/archive/master.zip. The followings -show how some of those examples work. Note that sometimes the -followings are outdated than the examples in the phonopy package. So -the results or displace outputs can be different. - - -Si ---- - -``FORCE_SETS`` file creation for VASP -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -:: - - % phonopy -f vasprun.xml - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Displacements were read from "phonopy_disp.yaml". - counter (file index): 1 - FORCE_SETS has been created. - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -where ``vasprun.xml`` is the VASP output. - -DOS -~~~~ - -:: - - % phonopy -p mesh.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Mesh sampling mode - Settings: - Sampling mesh: [31 31 31] - Supercell: [2 2 2] - Primitive matrix: - [1. 0. 0.] - [0. 1. 0.] - [0. 0. 1.] - Spacegroup: Fd-3m (227) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: -0.000001 (yy) -0.000001 (yy) - - Mesh numbers: [31 31 31] - Number of irreducible q-points on sampling mesh: 816/29791 - Calculating phonons on sampling mesh... - Calculating DOS... - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |Si-DOS| image:: Si-DOS.png - :width: 50% - -|Si-DOS| - - -Thermal properties -~~~~~~~~~~~~~~~~~~ - -:: - - % phonopy -t -p mesh.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Mesh sampling mode - Settings: - Sampling mesh: [31 31 31] - Supercell: [2 2 2] - Primitive matrix: - [1. 0. 0.] - [0. 1. 0.] - [0. 0. 1.] - Spacegroup: Fd-3m (227) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: -0.000001 (yy) -0.000001 (yy) - - Mesh numbers: [31 31 31] - Number of irreducible q-points on sampling mesh: 816/29791 - Calculating phonons on sampling mesh... - Calculating thermal properties... - # T [K] F [kJ/mol] S [J/K/mol] C_v [J/K/mol] E [kJ/mol] - 0.000 11.7110491 0.0000000 0.0000000 11.7110491 - 10.000 11.7110004 0.0207133 0.0652014 11.7112076 - 20.000 11.7101706 0.1826665 0.5801980 11.7138239 - 30.000 11.7063148 0.6494417 1.9566658 11.7257980 - 40.000 11.6959680 1.4755146 3.9391312 11.7549886 - 50.000 11.6758626 2.5838026 6.0729959 11.8050528 - 60.000 11.6436849 3.8753235 8.1398561 11.8762043 - 70.000 11.5979858 5.2789840 10.1081937 11.9675147 - 80.000 11.5378706 6.7536681 12.0151391 12.0781640 - 90.000 11.4627490 8.2777067 13.8988296 12.2077426 - 100.000 11.3721917 9.8393078 15.7763730 12.3561224 - ... - - -.. |Si-props| image:: Si-props.png - :width: 50% - -|Si-props| - -NaCl ----- - -Band structure -~~~~~~~~~~~~~~ - -:: - - % phonopy -p band.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Band structure mode - Settings: - Supercell: [2 2 2] - Primitive matrix (Auto): - [0. 0.5 0.5] - [0.5 0. 0.5] - [0.5 0.5 0. ] - Spacegroup: Fm-3m (225) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: 0.040159 (xx) 0.000009 (xx) - - Reciprocal space paths in reduced coordinates: - [ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] - [ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] - [ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] - [ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |NaCl-band| image:: NaCl-band.png - :width: 50% - -|NaCl-band| - -Band structure with non-analytical term correction -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This requires to prepare BORN file. - -:: - - % phonopy -p --nac band.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Band structure mode - Settings: - Non-analytical term correction (NAC): on - Supercell: [2 2 2] - Primitive matrix (Auto): - [0. 0.5 0.5] - [0.5 0. 0.5] - [0.5 0.5 0. ] - Spacegroup: Fm-3m (225) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: 0.040159 (xx) 0.000009 (xx) - - NAC parameters were not found in "phonopy_disp.yaml". - NAC parameters were read from "BORN". - Use NAC by Gonze et al (no real space sum in current implementation) - PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) - G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 - - Reciprocal space paths in reduced coordinates: - [ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] - [ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] - [ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] - [ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |NaCl-band-NAC| image:: NaCl-band-NAC.png - :width: 50% - -|NaCl-band-NAC| - - -.. _example_pdos: - -PDOS -~~~~~~~ - -:: - - % phonopy -p pdos.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Mesh sampling mode - Settings: - Sampling mesh: [41 41 41] - Supercell: [2 2 2] - Primitive matrix (Auto): - [0. 0.5 0.5] - [0.5 0. 0.5] - [0.5 0.5 0. ] - Spacegroup: Fm-3m (225) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: 0.040159 (xx) 0.000009 (xx) - - Mesh numbers: [41 41 41] - Number of q-points on sampling mesh: 68921 - Calculating phonons on sampling mesh... - Calculating projected DOS... - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |NaCl-PDOS| image:: NaCl-PDOS.png - :width: 50% - -|NaCl-PDOS| - -With non-analytical term correction, the PDOS may not change very much -because it mainly affects phonon modes in the reciprocal -region close to :math:`\Gamma` point. - -:: - - % phonopy --nac -p pdos.conf - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Mesh sampling mode - Settings: - Non-analytical term correction (NAC): on - Sampling mesh: [41 41 41] - Supercell: [2 2 2] - Primitive matrix (Auto): - [0. 0.5 0.5] - [0.5 0. 0.5] - [0.5 0.5 0. ] - Spacegroup: Fm-3m (225) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: 0.040159 (xx) 0.000009 (xx) - - NAC parameters were not found in "phonopy_disp.yaml". - NAC parameters were read from "BORN". - Use NAC by Gonze et al (no real space sum in current implementation) - PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) - G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 - - Mesh numbers: [41 41 41] - Number of q-points on sampling mesh: 68921 - Calculating phonons on sampling mesh... - Calculating projected DOS... - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |NaCl-PDOS-nac| image:: NaCl-PDOS-nac.png - :width: 50% - -|NaCl-PDOS-nac| - - -Plot band structure and DOS at once -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Band structure and DOS or PDOS can be plotted on one figure together by - -:: - - % phonopy band-pdos.conf --nac -p - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - Crystal structure was read from "phonopy_disp.yaml". - Unit of length: angstrom - Band structure and mesh sampling mode - Settings: - Non-analytical term correction (NAC): on - Sampling mesh: [41 41 41] - Supercell: [2 2 2] - Primitive matrix (Auto): - [0. 0.5 0.5] - [0.5 0. 0.5] - [0.5 0.5 0. ] - Spacegroup: Fm-3m (225) - Use -v option to watch primitive cell, unit cell, and supercell structures. - - Force sets were not found in "phonopy_disp.yaml". - Forces and displacements were read from "FORCE_SETS". - Computing force constants... - Max drift of force constants: 0.040159 (xx) 0.000009 (xx) - - NAC parameters were not found in "phonopy_disp.yaml". - NAC parameters were read from "BORN". - Use NAC by Gonze et al (no real space sum in current implementation) - PRB 50, 13035(R) (1994), PRB 55, 10355 (1997) - G-cutoff distance: 1.16, Number of G-points: 307, Lambda: 0.19 - - Reciprocal space paths in reduced coordinates: - [ 0.000 0.000 0.000] --> [ 0.500 0.000 0.000] - [ 0.500 0.000 0.000] --> [ 0.500 0.500 0.000] - [ 0.500 0.500 0.000] --> [ 0.000 0.000 0.000] - [ 0.000 0.000 0.000] --> [ 0.500 0.500 0.500] - Mesh numbers: [41 41 41] - Number of q-points on sampling mesh: 68921 - Calculating phonons on sampling mesh... - Calculating projected DOS... - - Summary of calculation was written in "phonopy.yaml". - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - -.. |NaCl-band-PDOS-NAC| image:: NaCl-band-PDOS-NAC.png - :width: 50% - -|NaCl-band-PDOS-NAC| - -MgB2 characters of ireducible representations ----------------------------------------------- - -:: - - % phonopy -f vasprun.xml-{001,002} - % phonopy --dim="3 3 2" --irreps="0 0 0" - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 1.11.10 - - Python version 3.6.0 - Spglib version 1.9.9 - Ir-representation mode - Settings: - Supercell: [3 3 2] - Spacegroup: P6/mmm (191) - Computing force constants... - - ------------------------------- - Irreducible representations - ------------------------------- - q-point: [ 0. 0. 0.] - Point group: 6/mmm - - Original rotation matrices: - - 1 2 3 4 5 6 - -------- -------- -------- -------- -------- -------- - 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 - 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 - 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 - - 7 8 9 10 11 12 - -------- -------- -------- -------- -------- -------- - -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 - 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 - 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 - - 13 14 15 16 17 18 - -------- -------- -------- -------- -------- -------- - 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 - -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 - 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 - - 19 20 21 22 23 24 - -------- -------- -------- -------- -------- -------- - 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 - 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 - 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 - - Transformation matrix: - - 1.000 0.000 0.000 - 0.000 1.000 0.000 - 0.000 0.000 1.000 - - Rotation matrices by transformation matrix: - - E i C6 S3 C3 S6 - -------- -------- -------- -------- -------- -------- - 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 - 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 - 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 - - C2 sgh C3 S6 C6 S3 - -------- -------- -------- -------- -------- -------- - -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 - 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 - 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 - - C2' sgd C2'' sgv C2' sgd - -------- -------- -------- -------- -------- -------- - 0 -1 0 0 1 0 -1 0 0 1 0 0 -1 1 0 1 -1 0 - -1 0 0 1 0 0 -1 1 0 1 -1 0 0 1 0 0 -1 0 - 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 - - C2'' sgv C2' sgd C2'' sgv - -------- -------- -------- -------- -------- -------- - 0 1 0 0 -1 0 1 0 0 -1 0 0 1 -1 0 -1 1 0 - 1 0 0 -1 0 0 1 -1 0 -1 1 0 0 -1 0 0 1 0 - 0 0 -1 0 0 1 0 0 -1 0 0 1 0 0 -1 0 0 1 - - Character table: - - 1 ( -0.019): A2u - ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) - ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) - ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) - ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) - - 2 ( 0.004): E1u - ( 2, 0.0) ( 2, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) - ( 2, 180.0) ( 2, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - - 4 ( 9.953): E1u - ( 2, 0.0) ( 2, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) - ( 2, 180.0) ( 2, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - - 6 ( 11.982): A2u - ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) - ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) - ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) - ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) ( 1, 180.0) ( 1, 0.0) - - 7 ( 17.269): E2g - ( 2, 0.0) ( 2, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) - ( 2, 0.0) ( 2, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) ( 1, 180.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) ( 0, 0.0) - - 9 ( 20.565): B2g - ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) - ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) - ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) - ( 1, 0.0) ( 1, 0.0) ( 1, 180.0) ( 1, 180.0) ( 1, 0.0) ( 1, 0.0) - - _ - ___ _ __ __| | - / _ \ '_ \ / _` | - | __/ | | | (_| | - \___|_| |_|\__,_| - - -Al-QHA -------- - -:: - - % phonopy-qha e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} --sparse=50 - # Vinet EOS - # T E_0 B_0 B'_0 V_0 - 0.000000 -14.796263 75.231724 4.758283 66.697923 - 2.000000 -14.796263 75.231723 4.758283 66.697923 - 4.000000 -14.796263 75.231718 4.758284 66.697923 - 6.000000 -14.796263 75.231695 4.758286 66.697924 - 8.000000 -14.796263 75.231634 4.758294 66.697928 - 10.000000 -14.796264 75.231510 4.758308 66.697934 - ... - -.. |Al-QHA| image:: Al-QHA.png - :width: 50% - -|Al-QHA| - - -Si-gruneisen ------------------------------ - -See :ref:`phonopy_gruneisen`. diff -Nru phonopy-2.12.0/doc/external-tools.md phonopy-2.13.1/doc/external-tools.md --- phonopy-2.12.0/doc/external-tools.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/external-tools.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,74 @@ +(external_tools)= + +# External tools + +Here external tools related to phonopy but supported by the groups out of the +phonopy project are introduced. + +Each of the tools is not supported by the phonopy project because of the +difficulties of the maintenance and the test by main developers of phonopy under +current style of phonopy development. However useful tools should be known. If +developers want to use here to notify their tools, please contact via the +phonopy mailing list. + +```{contents} +:depth: 2 +:local: +``` + +## Phonopy-Spectroscopy + +Phonopy-Spectroscopy is a project to add the capability to simulate vibrational +spectra to the phonopy code. + +https://github.com/JMSkelton/Phonopy-Spectroscopy + +### Features + +- Calculate infrared (IR) intensities from phonopy or VASP calculations. +- Calculate Raman-activity tensors and scalar-averaged intensities within the + far-from-resonance approximation. +- Prepare peak tables including assigning modes to irreducible representations + (phonopy interface). +- Output customisable simulated spectra with support for multiple unit systems + and simulated instrumental broadening. +- Include first-principles mode linewidths from Phono3py calculations (phonopy + interface). + +### Examples + +- https://github.com/JMSkelton/Phonopy-Spectroscopy/tree/master/Examples/a-SiO2 +- https://github.com/JMSkelton/Phonopy-Spectroscopy/tree/master/Examples/Benzene-Derivatives + +(external_tools_phonolammps)= + +## phonolammps + +LAMMPS interface for phonon calculations using phonopy + +https://github.com/abelcarreras/phonolammps + +## LADYtools + +A set of helpful tolls for ab initio calculation software packages like ABINIT +VASP CRYSTAL etc. + +https://github.com/ladyteam/ladytools/wiki + +## SNAXS interface + +Simulating Neutron And X-ray Scans; a tool for condensed-matter scientists +studying phonons using neutron scattering. + +https://github.com/danparshall/snaxs + +## Ascii-phonons + +Ascii-phonons is a visualisation code which uses Blender (an open-source 3D +graphics package) to generate animated GIFs and static arrow diagrams of phonon +eigenmodes. These may be rendered at publication quality. The input format is +the .ascii file generated by phonopy when called with the --anime flag, and +supercells can be used to visualise off-gamma phonon modes. The code is still +being developed but the core features are in place and new users are welcome. + +https://github.com/ajjackson/ascii-phonons diff -Nru phonopy-2.12.0/doc/external-tools.rst phonopy-2.13.1/doc/external-tools.rst --- phonopy-2.12.0/doc/external-tools.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/external-tools.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -.. _external_tools: - -External tools -=============== - -Here external tools related to phonopy but supported by the groups out -of the phonopy project are introduced. - -Each of the tools is not supported by the phonopy project because of -the difficulties of the maintenance and the test by main developers -of phonopy under current style of phonopy development. However -useful tools should be known. If developers want to use here to notify -their tools, please contact via the phonopy mailing list. - -.. contents:: - :depth: 2 - :local: - - -Phonopy-Spectroscopy ---------------------- - -Phonopy-Spectroscopy is a project to add the capability to simulate -vibrational spectra to the Phonopy code. - -https://github.com/JMSkelton/Phonopy-Spectroscopy - -Features -^^^^^^^^^ - -* Calculate infrared (IR) intensities from Phonopy or VASP calculations. -* Calculate Raman-activity tensors and scalar-averaged intensities within the far-from-resonance approximation. -* Prepare peak tables including assigning modes to irreducible representations (Phonopy interface). -* Output customisable simulated spectra with support for multiple unit systems and simulated instrumental broadening. -* Include first-principles mode linewidths from Phono3py calculations - (Phonopy interface). - -Examples -^^^^^^^^ - -* https://github.com/JMSkelton/Phonopy-Spectroscopy/tree/master/Examples/a-SiO2 -* https://github.com/JMSkelton/Phonopy-Spectroscopy/tree/master/Examples/Benzene-Derivatives - - -.. _external_tools_phonolammps: - -phonolammps ------------ - -LAMMPS interface for phonon calculations using phonopy - -https://github.com/abelcarreras/phonolammps - - -LADYtools ----------- - -A set of helpful tolls for ab initio calculation software packages like -ABINIT VASP CRYSTAL etc. - -https://github.com/ladyteam/ladytools/wiki - -SNAXS interface ----------------- - -Simulating Neutron And X-ray Scans; a tool for condensed-matter -scientists studying phonons using neutron scattering. - -https://github.com/danparshall/snaxs - -Ascii-phonons --------------- - -Ascii-phonons is a visualisation code which uses Blender (an -open-source 3D graphics package) to generate animated GIFs and static -arrow diagrams of phonon eigenmodes. These may be rendered at -publication quality. The input format is the .ascii file generated by -Phonopy when called with the --anime flag, and supercells can be used -to visualise off-gamma phonon modes. The code is still being -developed but the core features are in place and new users are -welcome. - -https://github.com/ajjackson/ascii-phonons diff -Nru phonopy-2.12.0/doc/formulation.md phonopy-2.13.1/doc/formulation.md --- phonopy-2.12.0/doc/formulation.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/formulation.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,570 @@ +(formulations)= + +# Formulations + +```{contents} +:depth: 2 +:local: +``` + +## Second-order force constants + +Potential energy of phonon system is represented as functions of atomic +positions: + +```{math} +V[\mathbf{r}(j_1 l_1),\ldots,\mathbf{r}(j_n l_N)], +``` + +where {math}`\mathbf{r}(jl)` is the point of the {math}`j`-th atom in the +{math}`l`-th unit cell and {math}`n` and {math}`N` are the number of atoms in a +unit cell and the number of unit cells, respectively. A force and a second-order +force constant {math}`\Phi_{\alpha \beta}` are given by + +```{math} +F_\alpha(jl) = -\frac{\partial V }{\partial r_\alpha(jl)} +``` + +and + +```{math} +\Phi_{\alpha\beta}(jl, j'l') = \frac{\partial^2 V}{\partial r_\alpha(jl) +\partial r_\beta(j'l')} = -\frac{\partial F_\beta(j'l')}{\partial +r_\alpha(jl)}, +``` + +respectively, where {math}`\alpha`, {math}`\beta`, ..., are the Cartesian +indices, {math}`j`, {math}`j'`, ..., are the indices of atoms in a unit cell, +and {math}`l`, {math}`l'`, ..., are the indices of unit cells. In the finite +displacement method, the equation for the force constants is approximated as + +```{math} +\Phi_{\alpha\beta}(jl, j'l') \simeq -\frac{ F_\beta(j'l';\Delta +r_\alpha{(jl)}) - F_\beta(j'l')} {\Delta r_\alpha(jl)}, +``` + +where {math}`F_\beta(j'l'; \Delta r_\alpha{(jl)})` are the forces on atoms with +a finite displacement {math}`\Delta r_\alpha{(jl)}` and usually +{math}`F_\beta(j'l') \equiv 0`. + +(force_constants_solver_theory)= + +## Modified Parlinski-Li-Kawazoe method + +The following is a modified and simplified version of the Parlinski-Li-Kawazoe +method, which is just a numerical fitting approach to obtain force constants +from forces and displacements. + +The last equation above is represented by matrices as + +```{math} +\mathbf{F} = - \mathbf{U} \mathbf{P}, +``` + +where {math}`\mathbf{F}`, {math}`\mathbf{P}`, and {math}`\mathbf{U}` for a pair +of atoms, e.g. {math}`\{jl, j'l'\}`, are given by + +```{math} +\mathbf{F} = \begin{pmatrix} F_{x} & F_{y} & F_{z} \end{pmatrix}, +``` + +```{math} +\mathbf{P} = \begin{pmatrix} \Phi_{xx} & \Phi_{xy} & \Phi_{xz} \\ +\Phi_{yx} & \Phi_{yy} & \Phi_{yz} \\ \Phi_{zx} & \Phi_{zy} & \Phi_{zz} +\end{pmatrix}, +``` + +```{math} +\mathbf{U} = \begin{pmatrix} \Delta r_{x} & \Delta r_{y} & \Delta r_{z} \\ +\end{pmatrix}. +``` + +The matrix equation is expanded for number of forces and displacements as +follows: + +```{math} +\begin{pmatrix} \mathbf{F}_1 \\ \mathbf{F}_2 \\ \vdots \end{pmatrix} = - +\begin{pmatrix} \mathbf{U}_1 \\ \mathbf{U}_2 \\ \vdots \end{pmatrix} +\mathbf{P}. +``` + +With sufficient number of atomic displacements, this may be solved by pseudo +inverse such as + +```{math} +\mathbf{P} = - \begin{pmatrix} \mathbf{U}_1 \\ \mathbf{U}_2 \\ \vdots +\end{pmatrix}^{+} \begin{pmatrix} \mathbf{F}_1 \\ \mathbf{F}_2 \\ \vdots +\end{pmatrix}. +``` + +Required number of atomic displacements to solve the simultaneous equations may +be reduced using site-point symmetries. The matrix equation can be written using +a symmetry operation as + +```{math} +\hat{R}(\mathbf{F}) = -\hat{R}(\mathbf{U})\mathbf{P}, +``` + +where {math}`\hat{R}` is the site symmetry operation centring at +{math}`\mathbf{r}(jl)`. {math}`\hat{R}(\mathbf{F})` and +{math}`\hat{R}(\mathbf{U})` are defined as +{math}`\mathbf{RF}(\hat{R^{-1}}(j'l'))` and {math}`\mathbf{RU}`, respectively, +where {math}`\mathbf{R}` is the matrix representation of the rotation operation. +The combined simultaneous equations are built such as + +```{math} +\begin{pmatrix} \mathbf{F}^{(1)}_1 \\ \mathbf{F}^{(2)}_1 \\ \vdots \\ +\mathbf{F}^{(1)}_2 \\ \mathbf{F}^{(2)}_2 \\ \vdots \end{pmatrix} = - +\begin{pmatrix} \mathbf{U}^{(1)}_1 \\ \vdots \\ \mathbf{U}^{(2)}_1 \\ +\mathbf{U}^{(1)}_2 \\ \mathbf{U}^{(2)}_2 \\ \vdots \end{pmatrix} \mathbf{P}. +``` + +where the superscript with parenthesis gives the index of site-symmetry +operations. This is solved by pseudo inverse. + +(dynacmial_matrix_theory)= + +## Dynamical matrix + +In phonopy, a phase convention of dynamical matrix is used as follows: + +```{math} +:label: eq_dynmat +D_{\alpha\beta}(jj',\mathbf{q}) = \frac{1}{\sqrt{m_j m_{j'}}} \sum_{l'} +\Phi_{\alpha\beta}(j0, j'l') +\exp(i\mathbf{q}\cdot[\mathbf{r}(j'l')-\mathbf{r}(j0)]), +``` + +where {math}`m` is the atomic mass and {math}`\mathbf{q}` is the wave vector. An +equation of motion is written as + +```{math} +\sum_{j'\beta} D_{\alpha\beta}(jj',\mathbf{q}) e_\beta(j', \mathbf{q}\nu) = m_j +[ \omega(\mathbf{q}\nu) ]^2 e_\alpha(j, \mathbf{q}\nu). +``` + +where the eigenvector of the band index {math}`\nu` at {math}`\mathbf{q}` is +obtained by the diagonalization of {math}`\mathbf{D}(\mathbf{q})`: + +```{math} +\sum_{j \alpha j' \beta}e_\alpha(j',\mathbf{q}\nu)^* +D_{\alpha\beta}(jj',\mathbf{q}) e_\beta(j',\mathbf{q}\nu') = +[\omega(\mathbf{q}\nu)]^2 \delta_{\nu\nu'}. +``` + +The atomic displacements {math}`\mathbf{u}` are given as + +```{math} +u_\alpha(jl,t) = \left(\frac{\hbar}{2Nm_j}\right)^{\frac{1}{2}} +\sum_{\mathbf{q},\nu}\left[\omega(\mathbf{q}\nu)\right]^{-\frac{1}{2}} +\left[\hat{a}(\mathbf{q}\nu)\exp(-i\omega(\mathbf{q}\nu)t)+ +\hat{a}^\dagger(\mathbf{-q}\nu)\exp({i\omega(\mathbf{q}\nu)}t)\right] +\exp({i\mathbf{q}\cdot\mathbf{r}(jl)}) e_\alpha(j,\mathbf{q}\nu), +``` + +where {math}`\hat{a}^\dagger` and {math}`\hat{a}` are the creation and +annihilation operators of phonon, {math}`\hbar` is the reduced Planck constant, +and {math}`t` is the time. + +(non_analytical_term_correction_theory)= + +## Non-analytical term correction + +To treat long range interaction of macroscopic electric field induced by +polarization of collective ionic motions near the {math}`\Gamma`-point, +non-analytical term is added to dynamical matrix ({ref}`reference_NAC`). At +{math}`\mathbf{q}\to\mathbf{0}`, the dynamical matrix with non-analytical term +is given by, + +```{math} +D_{\alpha\beta}(jj',\mathbf{q}\to \mathbf{0}) = +D_{\alpha\beta}(jj',\mathbf{q}=\mathbf{0}) + \frac{1}{\sqrt{m_j m_{j'}}} +\frac{4\pi}{\Omega_0} +\frac{\left[\sum_{\gamma}q_{\gamma}Z^{*}_{j,\gamma\alpha}\right] +\left[\sum_{\gamma'}q_{\gamma'}Z^{*}_{j',\gamma'\beta}\right]} +{\sum_{\alpha\beta}q_{\alpha}\epsilon_{\alpha\beta}^{\infty} q_{\beta}}. +``` + +Phonon frequencies at general **q**-points with long-range dipole-dipole +interaction are calculated by the method of Gonze _et al._ +({ref}`reference_dp_dp_NAC`). + +(thermal_properties_expressions)= + +## Thermodynamic properties + +### Phonon number + +```{math} +n = \frac{1}{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1} +``` + +### Harmonic phonon energy + +```{math} +E = \sum_{\mathbf{q}\nu}\hbar\omega(\mathbf{q}\nu)\left[\frac{1}{2} + +\frac{1}{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1}\right] +``` + +### Constant volume heat capacity + +```{math} +C_V &= \left(\frac{\partial E}{\partial T} \right)_V \\ + &= \sum_{\mathbf{q}\nu} k_\mathrm{B} + \left(\frac{\hbar\omega(\mathbf{q}\nu)}{k_\mathrm{B} T} \right)^2 + \frac{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} + T)}{[\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1]^2} +``` + +### Partition function + +```{math} +Z = \exp(-\varphi/k_\mathrm{B} T) \prod_{\mathbf{q}\nu} + \frac{\exp(-\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B} + T)}{1-\exp(-\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)} +``` + +### Helmholtz free energy + +```{math} +F &= -k_\mathrm{B} T \ln Z \\ +&= \varphi + \frac{1}{2} \sum_{\mathbf{q}\nu} +\hbar\omega(\mathbf{q}\nu) + k_\mathrm{B} T \sum_{\mathbf{q}\nu} \ln +\bigl[1 -\exp(-\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T) \bigr] +``` + +### Entropy + +```{math} +S &= -\frac{\partial F}{\partial T} \\ &= \frac{1}{2T} +\sum_{\mathbf{q}\nu} \hbar\omega(\mathbf{q}\nu) +\coth(\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B}T)-k_\mathrm{B} +\sum_{\mathbf{q}\nu} +\ln\left[2\sinh(\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B}T)\right] +``` + +(thermal_displacement)= + +## Thermal displacement + +### Mean square displacement + +From Eq. (10.71) in the book "Thermodynamics of Crystal", atomic displacement, +**u**, is written by + +```{math} +u^\alpha(jl,t) = \left(\frac{\hbar}{2Nm_j}\right)^{\frac{1}{2}} +\sum_{\mathbf{q},\nu}\left[\omega_\nu(\mathbf{q})\right]^{-\frac{1}{2}} +\left[\hat{a}_\nu(\mathbf{q})\exp(-i\omega_\nu(\mathbf{q})t)+ +\hat{a}^\dagger_\nu(\mathbf{-q})\exp({i\omega_\nu(\mathbf{q})}t)\right] +\exp({i\mathbf{q}\cdot\mathbf{r}(jl)}) +e^\alpha_\nu(j,\mathbf{q}) +``` + +where _j_ and _l_ are the labels for the _j_-th atomic position in the _l_-th +unit cell, _t_ is the time, {math}`\alpha` is an axis (a Cartesian axis in the +default behavior of phonopy), _m_ is the atomic mass, _N_ is the number of the +unit cells, {math}`\mathbf{q}` is the wave vector, {math}`\nu` is the index of +phonon mode. _e_ is the polarization vector of the atom _jl_ and the band +{math}`\nu` at {math}`\mathbf{q}`. {math}`\mathbf{r}(jl)` is the atomic position +and {math}`\omega` is the phonon frequency. {math}`\hat{a}^\dagger` and +{math}`\hat{a}` are the creation and annihilation operators of phonon. The +expectation value of the squared atomic displacement is calculated as, + +```{math} +\left\langle |u^\alpha(jl, t)|^2 \right\rangle = \frac{\hbar}{2Nm_j} +\sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} +(1+2n_\nu(\mathbf{q},T))|e^\alpha_\nu(j,\mathbf{q})|^2, +``` + +where {math}`n_\nu(\mathbf{q},T)` is the phonon population, which is give by, + +```{math} +n_\nu(\mathbf{q},T) = +\frac{1}{\exp(\hbar\omega_\nu(\mathbf{q})/\mathrm{k_B}T)-1}, +``` + +where _T_ is the temperature, and {math}`\mathrm{k_B}` is the Boltzmann +constant. The equation is calculated using the commutation relation of the +creation and annihilation operators and the expectation values of the +combination of the operations, e.g., + +```{math} +[ \hat{a}_\nu(\mathbf{q}), \hat{a}^\dagger_{\nu'}(\mathbf{q'}) ] &= +\delta(\mathbf{q}-\mathbf{q}')\delta_{\nu\nu'},\\ [ \hat{a}_\nu(\mathbf{q}), +\hat{a}_{\nu'}(\mathbf{q'}) ] &= 0,\\ [ \hat{a}^\dagger_\nu(\mathbf{q}), +\hat{a}^\dagger_{\nu'}(\mathbf{q'}) ] &= 0,\\ +\langle|\hat{a}_\nu(\mathbf{q})\hat{a}_{\nu'}(\mathbf{q'})|\rangle &= 0,\\ +\langle|\hat{a}^\dagger_\nu(\mathbf{q})\hat{a}^\dagger_{\nu'}(\mathbf{q'})|\rangle +&= 0. +``` + +(thermal_displacement_matrix)= + +### Mean square displacement matrix + +Mean square displacement matrix is defined as follows: + +```{math} +\mathrm{U}_\text{cart}(j, T) = \frac{\hbar}{2Nm_j} +\sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} (1+2n_\nu(\mathbf{q},T)) +\mathbf{e}_\nu(j,\mathbf{q}) \otimes \mathbf{e}^*_\nu(j,\mathbf{q}). +``` + +This is a symmetry matrix and diagonal elements are same as mean square +displacement calculated along Cartesian x, y, z directions. + +### Projection to an arbitrary axis + +In phonopy, eigenvectors are calculated in the Cartesian axes that are defined +in the input structure file. Mean square displacement along an arbitrary axis is +obtained projecting eigenvectors in the Cartesian axes as follows: + +```{math} +\left\langle |u(jl, t)|^2 \right\rangle = \frac{\hbar}{2Nm_j} +\sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} (1+2n_\nu(\mathbf{q},T))| +\hat{\mathbf{n}}\cdot\mathbf{e}_\nu(j,\mathbf{q})|^2 +``` + +where {math}`\hat{\mathbf{n}}` is an arbitrary unit direction. + +### Mean square displacement matrix in cif format + +According to the paper by Grosse-Kunstleve and Adams [J. Appl. Cryst., 35, +477-480 (2002)], mean square displacement matrix in the cif definition +(`aniso_U`), {math}`\mathrm{U}_\text{cif}`, is obtained by + +```{math} +\mathrm{U}_\text{cif} = (\mathrm{AN})^{-1}\mathrm{U}_\text{cart} +(\mathrm{AN})^{-\mathrm{T}}, +``` + +where {math}`\mathrm{A}` is the matrix to transform a point in fractional +coordinates to the Cartesian coordinates and {math}`\mathrm{N}` is the diagonal +matrix made of reciprocal basis vector lengths as follows: + +```{math} +\mathrm{A} = \begin{pmatrix} a_x & b_x & c_x \\ a_y & b_y & c_y \\ a_z & b_z & +c_z \end{pmatrix} +``` + +and + +```{math} +\mathrm{N} = \begin{pmatrix} a^* & 0 & 0 \\ 0 & b^* & 0 \\ 0 & 0 & c^* +\end{pmatrix}. +``` + +{math}`a^*`, {math}`b^*`, {math}`c^*` are defined without {math}`2\pi`. + +(group_velocity)= + +## Group velocity + +### Method + +Phonopy calculates group velocity of phonon as follows: + +```{math} +\mathbf{v}_\mathrm{g}(\mathbf{q}\nu) = & \nabla_\mathbf{q} \omega(\mathbf{q}\nu) \\ +=&\frac{\partial\omega(\mathbf{q}\nu)}{\partial \mathbf{q}} \\ +=&\frac{1}{2\omega(\mathbf{q}\nu)}\frac{\partial[\omega(\mathbf{q}\nu)]^2}{\partial +\mathbf{q}} \\ +=&\frac{1}{2\omega(\mathbf{q}\nu)}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| +\frac{\partial D(\mathbf{q})} {\partial +\mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>, +``` + +where the meanings of the variables are found at {ref}`formulations`. + +### Finite difference method + +In the previous versions, group velocity was calculated using finite difference +method: + +```{math} +\mathbf{v}_\mathrm{g}(\mathbf{q}\nu) = +\frac{1}{2\omega(\mathbf{q}\nu)}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| +\frac{\partial D(\mathbf{q})} {\partial +\mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right> \simeq +\frac{1}{2\omega(\mathbf{q}\nu)} \left<\mathbf{e}(\mathbf{q}\nu)\biggl| +\frac{\Delta D(\mathbf{q})} {\Delta +\mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>. +``` + +Group velocity calculation with the finite difference method is still able to be +activated using `GV_DELTA_Q` tag or `--gv_delta_q` option. +{math}`\Delta\mathbf{q} = (\Delta q_x, \Delta q_y, \Delta q_z)` is described in +Cartesian coordinated in reciprocal space. In the implementation, central +difference is employed, and {math}`+\Delta q_\alpha` and +{math}`-\Delta q_\alpha` are taken to calculate group velocity, where +{math}`\alpha` is the Cartesian index in reciprocal space. +{math}`\Delta q_\alpha` is specified in the unit of reciprocal space distance +({math}`\text{Angstrom}^{-1}` for the default case) by `--gv_delta_q` option or +`GV_DELTA_Q` tag. + +(physical_unit_conversion)= + +## Physical unit conversion + +Phonopy calculates phonon frequencies based on input values from users. In the +default case, the physical units of distance, atomic mass, force, and force +constants are supposed to be {math}`\text{Angstrom}`, {math}`\text{AMU}`, +{math}`\text{eV/Angstrom}`, and {math}`\text{eV/Angstrom}^2`, respectively, and +the physical unit of the phonon frequency is converted to THz. This conversion +is made as follows: + +Internally phonon frequency has the physical unit of +{math}`\sqrt{\text{eV/}(\text{Angstrom}^2\cdot \text{AMU})}` in angular +frequency. To convert this unit to THz (not angular frequency), the calculation +of `sqrt(EV/AMU)/Angstrom/(2*pi)/1e12` is made. `EV`, `AMU`, `Angstrom` are the +values to convert them to those in the SI base unit, i.e., to Joule, kg, and +metre, respectively. These values implemented in phonopy are found at +[a phonopy github page](https://github.com/phonopy/phonopy/blob/master/phonopy/units.py). +This unit conversion factor can be manually specified. See +{ref}`frequency_conversion_factor_tag`. + +The unit conversion factor in the `BORN` file is multiplied with the second term +of the right hand side of the equation in +{ref}`non_analytical_term_correction_theory` where this equation is written with +atomic units ({ref}`Gonze and Lee, 1997 `). The physical unit of +the part of the equation corresponding to force constants: + +```{math} +\frac{4\pi}{\Omega_0} +\frac{[\sum_{\gamma}q_{\gamma}Z^{*}_{j,\gamma\alpha}] +[\sum_{\gamma'}q_{\gamma'}Z^{*}_{j',\gamma'\beta}]} +{\sum_{\alpha\beta}q_{\alpha}\epsilon_{\alpha\beta}^{\infty} q_{\beta}}. +``` + +is {math}`[\text{hartree}/\text{bohr}^2]`. In the default case for the VASP +interface, internally {math}`\Omega_0` is given in {math}`\text{Angstrom}^3`. In +total, the necessary unit conversion is +{math}`(\text{hartree} \rightarrow \text{eV}) \times (\text{bohr} \rightarrow \text{Angstrom})=14.4`. +In the default case of the Wien2k interface, the conversion factor is +{math}`(\text{hartree} \rightarrow \text{mRy})=2000`. For the other interfaces, +the conversion factors are similarly calculated following the unit systems +employed in phonopy ({ref}`calculator_interfaces`). + +(definition_of_commensurate_points)= + +## Crystal structure + +### Coordinates in direct and reciprocal spaces + +As usual, in phonopy, the Born-von Karman boundary condition is assumed. Basis +vectors of a primitive lattice are defined in three column vectors +{math}`( \mathbf{a} \; \mathbf{b} \; \mathbf{c} )`. Coordinates of a point in +the direct space {math}`\mathbf{r}` is represented with respect to these basis +vectors. The direct lattice points are given by +{math}`i \mathbf{a} + j \mathbf{b} + k \mathbf{a}, \{i, j, k \in \mathbb{Z}\}`, +and the points for atoms in a unit cell +{math}`x \mathbf{a} + y \mathbf{b} + z \mathbf{a}, \{0 \le x, y, z < 1\}`. Basis +vectors of the reciprocal lattice may be given by three row vectors, +{math}`( \mathbf{a}^{*T} /\; \mathbf{b}^{*T} /\; \mathbf{c}^{*T} )`, but here +they are defined as three column vectors as +{math}`( \mathbf{a}^{*} \; \mathbf{b}^{*} \; \mathbf{c}^{*} )` with + +```{math} +:label: eq_rec_basis_vectors + +\mathbf{a}^{*} &= \frac{\mathbf{b} \times \mathbf{c}}{\mathbf{a} \cdot +(\mathbf{b} \times \mathbf{c})}, \\ \mathbf{b}^{*} &= \frac{\mathbf{c} \times +\mathbf{a}}{\mathbf{b} \cdot (\mathbf{c} \times \mathbf{a})}, \\ \mathbf{c}^{*} +&= \frac{\mathbf{a} \times \mathbf{b}}{\mathbf{c} \cdot (\mathbf{a} \times +\mathbf{b})}. +``` + +Coordinates of a point in the reciprocal space {math}`\mathbf{q}` is represented +with respect to these basis vectors, therefore +{math}`q_x \mathbf{a}^{*} + q_y \mathbf{b}^{*} + q_z \mathbf{c}^{*}`. The +reciprocal lattice points are given by +{math}`G_x\mathbf{a}^{*} + G_y \mathbf{b}^{*} + G_z \mathbf{c}^{*}, \{G_x, G_y, G_z \in \mathbb{Z}\}`. +Following these definition, phase factor should be represented as +{math}`\exp(2\pi i\mathbf{q}\cdot\mathbf{r})`, however in phonopy documentation, +{math}`2\pi` is implicitly included and not shown, i.e., it is represented like +{math}`\exp(i\mathbf{q}\cdot\mathbf{r})` (e.g., see Eq. {eq}`eq_dynmat`). In the +output of the reciprocal basis vectors, {math}`2\pi` is not included, e.g., in +`band.yaml`. + +In phonopy, unless {ref}`primitive_axis_tag` (or `--pa` option) is specified, +basis vectors in direct space {math}`( \mathbf{a} \; \mathbf{b} \; \mathbf{c})` +are set from the input unit cell structure even if it is a supercell or a +conventional unit cell having centring, therefore the basis vectors in the +reciprocal space are given by Eq. {eq}`eq_rec_basis_vectors`. When using +{ref}`primitive_axis_tag`, {math}`( \mathbf{a} \; \mathbf{b} \; \mathbf{c})` are +set from those transformed by the transformation matrix {math}`M_\text{p}` as +written at {ref}`primitive_axis_tag`, therefore +{math}`( \mathbf{a}^{*} \; \mathbf{b}^{*} \; \mathbf{c}^{*} )` are given by +those calculated following Eq. {eq}`eq_rec_basis_vectors` with this +{math}`( \mathbf{a} \; \mathbf{b} \; \mathbf{c})`. + +### Commensurate points + +In phonopy, so-called commensurate points mean the q-points whose waves are +confined in the supercell used in the phonon calculation. + +To explain about the commensurate points, let basis vectors of a primitive cell +in direct space cell be the column vectors +{math}`(\mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p})` +and those of the supercell be +{math}`(\mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s})`. +The transformation of the basis vectors from the primitive cell to the supercell +is written as + +```{math} +( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) += ( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; +\mathbf{c}_\mathrm{p} ) \boldsymbol{P}. +``` + +{math}`\boldsymbol{P}` is given as a {math}`3\times 3` matrix and its elements +are all integers, which is a constraint we have. The resolution for q-points +being the commensurate points is determined by {math}`\boldsymbol{P}` since one +period of a wave has to be bound by any of lattice points inside the supercell. +Therefore the number of commensurate points becomes the same as the number of +the primitive cell that can be contained in the supercell, i.e., +{math}`\det(\boldsymbol{P})`. + +Then let the basis vectors in reciprocal space be the column vectors +{math}`(\mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; \mathbf{c}^*_\mathrm{p})`. +Note that often reciprocal vectors are deifned by row vectors, but column +vectors are chosen here to formulate. Formally we see the set of besis vectors +are {math}`3\times 3` matrices, we have the following relation: + +```{math} +( \mathbf{a}^*_\mathrm{p} \; +\mathbf{b}^*_\mathrm{p} \; \mathbf{c}^*_\mathrm{p} ) = ( +\mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; +\mathbf{c}_\mathrm{p} )^{-\mathbf{T}}. +``` + +Similarly for the supercell, we define a relation + +```{math} +( \mathbf{a}^*_\mathrm{s} \; +\mathbf{b}^*_\mathrm{s} \; \mathbf{c}^*_\mathrm{s} ) = ( +\mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; +\mathbf{c}_\mathrm{s} )^{-\mathbf{T}}. +``` + +Then + +```{math} +( \mathbf{a}^*_\mathrm{s} \; \mathbf{b}^*_\mathrm{s} \; +\mathbf{c}^*_\mathrm{s} ) \boldsymbol{P}^{\mathrm{T}} = ( +\mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; +\mathbf{c}^*_\mathrm{p} ). +``` + +To multiply an arbitrary q-point {math}`\mathbf{q}` on both sides + +```{math} +( \mathbf{a}^*_\mathrm{s} \; \mathbf{b}^*_\mathrm{s} \; +\mathbf{c}^*_\mathrm{s} ) \boldsymbol{P}^{\mathrm{T}} \mathbf{q} = ( +\mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; +\mathbf{c}^*_\mathrm{p} ) \mathbf{q}, +``` + +we find the constraint of a q-point being one of the commensurate points is the +elements of {math}`\boldsymbol{P}^{\mathrm{T}} \mathbf{q}` to be integers. diff -Nru phonopy-2.12.0/doc/formulation.rst phonopy-2.13.1/doc/formulation.rst --- phonopy-2.12.0/doc/formulation.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/formulation.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,485 +0,0 @@ -.. _formulations: - -Formulations -============= - -.. contents:: - :depth: 2 - :local: - -Second-order force constants ------------------------------ - -Potential energy of phonon system is represented as functions of atomic -positions: - -.. math:: - - V[\mathbf{r}(j_1 l_1),\ldots,\mathbf{r}(j_n l_N)], - -where :math:`\mathbf{r}(jl)` is the point of the :math:`j`-th atom in -the :math:`l`-th unit cell and :math:`n` and :math:`N` are the number -of atoms in a unit cell and the number of unit cells, respectively. A -force and a second-order force constant :math:`\Phi_{\alpha \beta}` -are given by - -.. math:: - - F_\alpha(jl) = -\frac{\partial V }{\partial r_\alpha(jl)} - -and - -.. math:: - - \Phi_{\alpha\beta}(jl, j'l') = \frac{\partial^2 - V}{\partial r_\alpha(jl) \partial r_\beta(j'l')} = - -\frac{\partial F_\beta(j'l')}{\partial r_\alpha(jl)}, - -respectively, where :math:`\alpha`, :math:`\beta`, ..., are the -Cartesian indices, :math:`j`, :math:`j'`, ..., are the indices of -atoms in a unit cell, and :math:`l`, :math:`l'`, ..., are -the indices of unit cells. In the finite displacement method, the -equation for the force constants is approximated as - -.. math:: - - \Phi_{\alpha\beta}(jl, j'l') \simeq -\frac{ - F_\beta(j'l';\Delta r_\alpha{(jl)}) - F_\beta(j'l')} {\Delta - r_\alpha(jl)}, - -where :math:`F_\beta(j'l'; \Delta r_\alpha{(jl)})` are the forces on -atoms with a finite displacement :math:`\Delta r_\alpha{(jl)}` and -usually :math:`F_\beta(j'l') \equiv 0`. - -.. _force_constants_solver_theory: - -Modified Parlinski-Li-Kawazoe method -------------------------------------- - -The following is a modified and simplified version of the -Parlinski-Li-Kawazoe method, which is just a numerical fitting -approach to obtain force constants from forces and displacements. - -The last equation above is represented by matrices as - -.. math:: - - \mathbf{F} = - \mathbf{U} \mathbf{P}, - -where :math:`\mathbf{F}`, :math:`\mathbf{P}`, and :math:`\mathbf{U}` -for a pair of atoms, e.g. :math:`\{jl, j'l'\}`, are given by - -.. math:: - - \mathbf{F} = - \begin{pmatrix} - F_{x} & F_{y} & F_{z} - \end{pmatrix}, - -.. math:: - \mathbf{P} = - \begin{pmatrix} - \Phi_{xx} & \Phi_{xy} & \Phi_{xz} \\ - \Phi_{yx} & \Phi_{yy} & \Phi_{yz} \\ - \Phi_{zx} & \Phi_{zy} & \Phi_{zz} - \end{pmatrix}, - -.. math:: - - \mathbf{U} = - \begin{pmatrix} - \Delta r_{x} & \Delta r_{y} & \Delta r_{z} \\ - \end{pmatrix}. - -The matrix equation is expanded for number of -forces and displacements as follows: - -.. math:: - - \begin{pmatrix} - \mathbf{F}_1 \\ - \mathbf{F}_2 \\ - \vdots - \end{pmatrix} - = - - \begin{pmatrix} - \mathbf{U}_1 \\ - \mathbf{U}_2 \\ - \vdots - \end{pmatrix} - \mathbf{P}. - -With sufficient number of atomic displacements, this -may be solved by pseudo inverse such as - -.. math:: - - \mathbf{P} = - - \begin{pmatrix} - \mathbf{U}_1 \\ - \mathbf{U}_2 \\ - \vdots - \end{pmatrix}^{+} - \begin{pmatrix} - \mathbf{F}_1 \\ - \mathbf{F}_2 \\ - \vdots - \end{pmatrix}. - -Required number of atomic displacements to solve the simultaneous -equations may be reduced using site-point symmetries. The matrix -equation can be written using a symmetry operation as - -.. math:: - - \hat{R}(\mathbf{F}) = -\hat{R}(\mathbf{U})\mathbf{P}, - -where :math:`\hat{R}` is the site symmetry -operation centring at -:math:`\mathbf{r}(jl)`. :math:`\hat{R}(\mathbf{F})` and :math:`\hat{R}(\mathbf{U})` are defined as -:math:`\mathbf{RF}(\hat{R^{-1}}(j'l'))` and :math:`\mathbf{RU}`, -respectively, where :math:`\mathbf{R}` is the matrix -representation of the rotation operation. The combined -simultaneous equations are built such as - -.. math:: - - \begin{pmatrix} - \mathbf{F}^{(1)}_1 \\ - \mathbf{F}^{(2)}_1 \\ - \vdots \\ - \mathbf{F}^{(1)}_2 \\ - \mathbf{F}^{(2)}_2 \\ - \vdots \end{pmatrix} = - - \begin{pmatrix} - \mathbf{U}^{(1)}_1 \\ - \vdots \\ - \mathbf{U}^{(2)}_1 \\ - \mathbf{U}^{(1)}_2 \\ - \mathbf{U}^{(2)}_2 \\ - \vdots - \end{pmatrix} - \mathbf{P}. - -where the superscript with parenthesis gives the index of -site-symmetry operations. This is solved by pseudo inverse. - -.. _dynacmial_matrix_theory: - -Dynamical matrix ------------------ - -In phonopy, a phase convention of dynamical matrix is used as follows: - -.. math:: - :label: eq_dynmat - - D_{\alpha\beta}(jj',\mathbf{q}) = \frac{1}{\sqrt{m_j m_{j'}}} - \sum_{l'} - \Phi_{\alpha\beta}(j0, j'l') - \exp(i\mathbf{q}\cdot[\mathbf{r}(j'l')-\mathbf{r}(j0)]), - -where :math:`m` is the atomic mass and :math:`\mathbf{q}` is the wave -vector. An equation of motion is written as - -.. math:: - - \sum_{j'\beta} D_{\alpha\beta}(jj',\mathbf{q}) e_\beta(j', \mathbf{q}\nu) = - m_j [ \omega(\mathbf{q}\nu) ]^2 e_\alpha(j, \mathbf{q}\nu). - -where the eigenvector of the band index :math:`\nu` at -:math:`\mathbf{q}` is obtained by the diagonalization of -:math:`\mathbf{D}(\mathbf{q})`: - -.. math:: - - \sum_{j \alpha j' \beta}e_\alpha(j',\mathbf{q}\nu)^* D_{\alpha\beta}(jj',\mathbf{q}) - e_\beta(j',\mathbf{q}\nu') = [\omega(\mathbf{q}\nu)]^2 \delta_{\nu\nu'}. - - -The atomic displacements :math:`\mathbf{u}` are given as - -.. math:: - - u_\alpha(jl,t) = \left(\frac{\hbar}{2Nm_j}\right)^{\frac{1}{2}} - \sum_{\mathbf{q},\nu}\left[\omega(\mathbf{q}\nu)\right]^{-\frac{1}{2}} - \left[\hat{a}(\mathbf{q}\nu)\exp(-i\omega(\mathbf{q}\nu)t)+ - \hat{a}^\dagger(\mathbf{-q}\nu)\exp({i\omega(\mathbf{q}\nu)}t)\right] - \exp({i\mathbf{q}\cdot\mathbf{r}(jl)}) - e_\alpha(j,\mathbf{q}\nu), - -where :math:`\hat{a}^\dagger` and :math:`\hat{a}` are the creation and -annihilation operators of phonon, :math:`\hbar` is the reduced Planck -constant, and :math:`t` is the time. - -.. _non_analytical_term_correction_theory: - -Non-analytical term correction -------------------------------------- - -To treat long range interaction of macroscopic electric field -induced by polarization of collective ionic motions near the -:math:`\Gamma`-point, non-analytical term is added to dynamical matrix -(:ref:`reference_NAC`). At -:math:`\mathbf{q}\to\mathbf{0}`, the dynamical matrix with -non-analytical term is given by, - -.. math:: - - D_{\alpha\beta}(jj',\mathbf{q}\to \mathbf{0}) = - D_{\alpha\beta}(jj',\mathbf{q}=\mathbf{0}) - + \frac{1}{\sqrt{m_j m_{j'}}} \frac{4\pi}{\Omega_0} - \frac{\left[\sum_{\gamma}q_{\gamma}Z^{*}_{j,\gamma\alpha}\right] - \left[\sum_{\gamma'}q_{\gamma'}Z^{*}_{j',\gamma'\beta}\right]} - {\sum_{\alpha\beta}q_{\alpha}\epsilon_{\alpha\beta}^{\infty} - q_{\beta}}. - -Phonon frequencies at general **q**-points with long-range -dipole-dipole interaction are calculated by the -method of Gonze *et al.* (:ref:`reference_dp_dp_NAC`). - -.. _thermal_properties_expressions: - -Thermodynamic properties -------------------------- - -Phonon number -~~~~~~~~~~~~~~ - -.. math:: - - n = \frac{1}{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1} - -Harmonic phonon energy -~~~~~~~~~~~~~~~~~~~~~~~ - -.. math:: - - E = \sum_{\mathbf{q}\nu}\hbar\omega(\mathbf{q}\nu)\left[\frac{1}{2} + - \frac{1}{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1}\right] - - -Constant volume heat capacity -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. math:: - - C_V &= \left(\frac{\partial E}{\partial T} \right)_V \\ - &= \sum_{\mathbf{q}\nu} k_\mathrm{B} - \left(\frac{\hbar\omega(\mathbf{q}\nu)}{k_\mathrm{B} T} \right)^2 - \frac{\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} - T)}{[\exp(\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)-1]^2} - -Partition function -~~~~~~~~~~~~~~~~~~~ - -.. math:: - - Z = \exp(-\varphi/k_\mathrm{B} T) \prod_{\mathbf{q}\nu} - \frac{\exp(-\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B} - T)}{1-\exp(-\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T)} - -Helmholtz free energy -~~~~~~~~~~~~~~~~~~~~~~ - -.. math:: - - F &= -k_\mathrm{B} T \ln Z \\ - &= \varphi + \frac{1}{2} \sum_{\mathbf{q}\nu} - \hbar\omega(\mathbf{q}\nu) + k_\mathrm{B} T \sum_{\mathbf{q}\nu} \ln - \bigl[1 -\exp(-\hbar\omega(\mathbf{q}\nu)/k_\mathrm{B} T) \bigr] - -Entropy -~~~~~~~~ - -.. math:: - - S &= -\frac{\partial F}{\partial T} \\ &= \frac{1}{2T} - \sum_{\mathbf{q}\nu} \hbar\omega(\mathbf{q}\nu) - \coth(\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B}T)-k_\mathrm{B} - \sum_{\mathbf{q}\nu} - \ln\left[2\sinh(\hbar\omega(\mathbf{q}\nu)/2k_\mathrm{B}T)\right] - -.. include:: thermal-displacement.inc - -.. include:: group-velocity.inc - -.. _physical_unit_conversion: - -Physical unit conversion -------------------------- - -Phonopy calculates phonon frequencies based on input values from -users. In the default case, the physical units of distance, atomic -mass, force, and force constants are supposed to be -:math:`\text{Angstrom}`, :math:`\text{AMU}`, :math:`\text{eV/Angstrom}`, and -:math:`\text{eV/Angstrom}^2`, respectively, and the physical unit of the -phonon frequency is converted to THz. This conversion is made as -follows: - -Internally phonon frequency has the physical unit of -:math:`\sqrt{\text{eV/}(\text{Angstrom}^2\cdot \text{AMU})}` in angular -frequency. To convert this unit to THz (not angular frequency), the -calculation of ``sqrt(EV/AMU)/Angstrom/(2*pi)/1e12`` is made. ``EV``, -``AMU``, ``Angstrom`` are the values to convert them to those in the -SI base unit, i.e., to Joule, kg, and metre, respectively. These values -implemented in phonopy are found at `a phonopy github page -`_. This -unit conversion factor can be manually specified. See -:ref:`frequency_conversion_factor_tag`. - -The unit conversion factor in the ``BORN`` file is multiplied with the second -term of the right hand side of the equation in -:ref:`non_analytical_term_correction_theory` where this equation is written -with atomic units (:ref:`Gonze and Lee, 1997 `). -The physical unit of the part of the equation corresponding to force -constants: - -.. math:: - - \frac{4\pi}{\Omega_0} - \frac{[\sum_{\gamma}q_{\gamma}Z^{*}_{j,\gamma\alpha}] - [\sum_{\gamma'}q_{\gamma'}Z^{*}_{j',\gamma'\beta}]} - {\sum_{\alpha\beta}q_{\alpha}\epsilon_{\alpha\beta}^{\infty} q_{\beta}}. - -is :math:`[\text{hartree}/\text{bohr}^2]`. In the default case for the -VASP interface, internally :math:`\Omega_0` is given in -:math:`\text{Angstrom}^3`. In total, the necessary unit conversion is -:math:`(\text{hartree} \rightarrow \text{eV}) \times (\text{bohr} -\rightarrow \text{Angstrom})=14.4`. In the default case of the Wien2k -interface, the conversion factor is :math:`(\text{hartree} -\rightarrow \text{mRy})=2000`. For the other interfaces, the -conversion factors are similarly calculated following the unit -systems employed in phonopy (:ref:`calculator_interfaces`). - -.. _definition_of_commensurate_points: - -Crystal structure ------------------- - -Coordinates in direct and reciprocal spaces -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -As usual, in phonopy, the Born-von Karman boundary condition is -assumed. Basis vectors of a primitive lattice are defined in three -column vectors :math:`( \mathbf{a} \; \mathbf{b} \; \mathbf{c} -)`. Coordinates of a point in the direct space :math:`\mathbf{r}` is -represented with respect to these basis vectors. The direct lattice -points are given by :math:`i -\mathbf{a} + j \mathbf{b} + k \mathbf{a}, \{i, -j, k \in \mathbb{Z}\}`, and the points for atoms in a unit cell :math:`x -\mathbf{a} + y \mathbf{b} + z \mathbf{a}, \{0 \le x, y, z -< 1\}`. Basis vectors of the reciprocal -lattice may be given by three row vectors, :math:`( \mathbf{a}^{*T} -/\; \mathbf{b}^{*T} /\; \mathbf{c}^{*T} )`, but here they are defined -as three column vectors as :math:`( \mathbf{a}^{*} \; \mathbf{b}^{*} -\; \mathbf{c}^{*} )` with - -.. math:: - :label: eq_rec_basis_vectors - - \mathbf{a}^{*} &= \frac{\mathbf{b} \times \mathbf{c}}{\mathbf{a} \cdot - (\mathbf{b} \times \mathbf{c})}, \\ - \mathbf{b}^{*} &= \frac{\mathbf{c} \times \mathbf{a}}{\mathbf{b} \cdot - (\mathbf{c} \times \mathbf{a})}, \\ - \mathbf{c}^{*} &= \frac{\mathbf{a} \times \mathbf{b}}{\mathbf{c} \cdot - (\mathbf{a} \times \mathbf{b})}. - -Coordinates of a point in the reciprocal space :math:`\mathbf{q}` is -represented with respect to these basis vectors, therefore :math:`q_x -\mathbf{a}^{*} + q_y \mathbf{b}^{*} + q_z \mathbf{c}^{*}`. The -reciprocal lattice points are given by :math:`G_x\mathbf{a}^{*} + G_y -\mathbf{b}^{*} + G_z \mathbf{c}^{*}, \{G_x, -G_y, G_z \in \mathbb{Z}\}`. Following these definition, phase -factor should be represented as :math:`\exp(2\pi -i\mathbf{q}\cdot\mathbf{r})`, however in phonopy documentation, -:math:`2\pi` is implicitly included and not shown, i.e., it is -represented like :math:`\exp(i\mathbf{q}\cdot\mathbf{r})` (e.g., see -Eq. :eq:`eq_dynmat`). In the output of the reciprocal basis vectors, -:math:`2\pi` is not included, e.g., in ``band.yaml``. - -In phonopy, unless :ref:`primitive_axis_tag` (or ``--pa`` option) is -specified, basis vectors in direct space :math:`( \mathbf{a} \; -\mathbf{b} \; \mathbf{c})` are set from the input unit celll structure -even if it is a supercell or a conventional unit cell having centring, -therefore the basis vectors in the reciprocal space are given by -Eq. :eq:`eq_rec_basis_vectors`. When using :ref:`primitive_axis_tag`, -:math:`( \mathbf{a} \; \mathbf{b} \; \mathbf{c})` are set from those -transformed by the transformation matrix :math:`M_\text{p}` as written -at :ref:`primitive_axis_tag`, therefore :math:`( \mathbf{a}^{*} \; -\mathbf{b}^{*} \; \mathbf{c}^{*} )` are given by those calculated -following Eq. :eq:`eq_rec_basis_vectors` with this :math:`( \mathbf{a} -\; \mathbf{b} \; \mathbf{c})`. - -Commensurate points -~~~~~~~~~~~~~~~~~~~~ - -In phonopy, so-called commensurate points mean the q-points whose waves are -confined in the supercell used in the phonon calculation. - -To explain about the commensurate points, let basis vectors of a -primitive cell in direct space cell be the column vectors -:math:`(\mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; -\mathbf{c}_\mathrm{p})` and those of the supercell be -:math:`(\mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; -\mathbf{c}_\mathrm{s})`. The transformation of the basis vectors from -the primitive cell to the supercell is written as - -.. math:: - - ( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) - = ( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; - \mathbf{c}_\mathrm{p} ) \boldsymbol{P}. - -:math:`\boldsymbol{P}` is given as a :math:`3\times 3` matrix and its -elements are all integers, which is a constraint we have. The -resolution for q-points being the commensurate points is determined by -:math:`\boldsymbol{P}` since one period of a wave has to be bound by -any of lattice points inside the supercell. Therefore the number of -commensurate points becomes the same as the number of the primitive -cell that can be contained in the supercell, i.e., -:math:`\det(\boldsymbol{P})`. - -Then let the basis vectors in reciprocal space be the column vectors -:math:`(\mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; -\mathbf{c}^*_\mathrm{p})`. Note that often reciprocal vectors are -deifned by row vectors, but column vectors are chosen here to -formulate. Formally we see the set of besis vectors are :math:`3\times -3` matrices, we have the following relation: - -.. math:: - - ( \mathbf{a}^*_\mathrm{p} \; - \mathbf{b}^*_\mathrm{p} \; \mathbf{c}^*_\mathrm{p} ) = ( - \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; - \mathbf{c}_\mathrm{p} )^{-\mathbf{T}}. - -Similarly for the supercell, we define a relation - -.. math:: - - ( \mathbf{a}^*_\mathrm{s} \; - \mathbf{b}^*_\mathrm{s} \; \mathbf{c}^*_\mathrm{s} ) = ( - \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; - \mathbf{c}_\mathrm{s} )^{-\mathbf{T}}. - -Then - -.. math:: - - ( \mathbf{a}^*_\mathrm{s} \; \mathbf{b}^*_\mathrm{s} \; - \mathbf{c}^*_\mathrm{s} ) \boldsymbol{P}^{\mathrm{T}} = ( - \mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; - \mathbf{c}^*_\mathrm{p} ). - -To multiply an arbitrary q-point :math:`\mathbf{q}` on both sides - -.. math:: - - ( \mathbf{a}^*_\mathrm{s} \; \mathbf{b}^*_\mathrm{s} \; - \mathbf{c}^*_\mathrm{s} ) \boldsymbol{P}^{\mathrm{T}} \mathbf{q} = ( - \mathbf{a}^*_\mathrm{p} \; \mathbf{b}^*_\mathrm{p} \; - \mathbf{c}^*_\mathrm{p} ) \mathbf{q}, - -we find the constraint of a q-point being one of the commensurate points is -the elements of :math:`\boldsymbol{P}^{\mathrm{T}} \mathbf{q}` to be integers. diff -Nru phonopy-2.12.0/doc/group-velocity.inc phonopy-2.13.1/doc/group-velocity.inc --- phonopy-2.12.0/doc/group-velocity.inc 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/group-velocity.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -.. _group_velocity: - -Group velocity ---------------- - -Method -~~~~~~~ - -Phonopy calculates group velocity of phonon as follows: - -.. math:: - - \mathbf{v}_\mathrm{g}(\mathbf{q}\nu) = & \nabla_\mathbf{q} \omega(\mathbf{q}\nu) \\ - =&\frac{\partial\omega(\mathbf{q}\nu)}{\partial \mathbf{q}} \\ - =&\frac{1}{2\omega(\mathbf{q}\nu)}\frac{\partial[\omega(\mathbf{q}\nu)]^2}{\partial - \mathbf{q}} \\ - =&\frac{1}{2\omega(\mathbf{q}\nu)}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| - \frac{\partial D(\mathbf{q})} {\partial - \mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>, - -where the meanings of the variables are found at :ref:`formulations`. - -Finite difference method -~~~~~~~~~~~~~~~~~~~~~~~~~ - -In the previous versions, group velocity was calculated using finite -difference method: - -.. math:: - - \mathbf{v}_\mathrm{g}(\mathbf{q}\nu) = - \frac{1}{2\omega(\mathbf{q}\nu)}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| - \frac{\partial D(\mathbf{q})} {\partial - \mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right> - \simeq \frac{1}{2\omega(\mathbf{q}\nu)} - \left<\mathbf{e}(\mathbf{q}\nu)\biggl| - \frac{\Delta D(\mathbf{q})} - {\Delta \mathbf{q}}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>. - -Group velocity calculation with the finite difference method is still -able to be activated using ``GV_DELTA_Q`` tag or ``-gv_delta_q`` -option. :math:`\Delta\mathbf{q} = (\Delta q_x, \Delta q_y, \Delta -q_z)` is described in Cartesian coordinated in reciprocal space. In -the implementation, central difference is employed, and :math:`+\Delta -q_\alpha` and :math:`-\Delta q_\alpha` are taken to calculate group -velocity, where :math:`\alpha` is the Cartesian index in reciprocal -space. :math:`\Delta q_\alpha` is specified in the unit of reciprocal -space distance (:math:`\text{Angstrom}^{-1}` for the default case) by -``--gv_delta_q`` option or ``GV_DELTA_Q`` tag. diff -Nru phonopy-2.12.0/doc/gruneisen.md phonopy-2.13.1/doc/gruneisen.md --- phonopy-2.12.0/doc/gruneisen.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/gruneisen.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,130 @@ +(phonopy_gruneisen)= + +# Calculation of mode Grüneisen parameters + +```{contents} +:depth: 2 +:local: +``` + +## How to run + +It is necessary to run three phonon calculations. One is calculated at the +equilibrium volume and the remaining two are calculated at the slightly larger +volume and smaller volume than the equilibrium volume. The unit cells at these +volumes have to be fully relaxed under the constraint of each volume. + +Let files named `POSCAR-unitcell`, `FORCE_SETS` (or `FORCE_CONSTANTS` with +`--readfc` option), and optionally `BORN` stored in three different directories +named, e.g., `equiv`, `plus`, and `minus`. + +The calculated results are written into the file `gruneisen.yaml`. + +In the example directory, an example of silicon (`Si-gruneisen`) is prepared. A +calculation along paths in reciprocal space can be made by + +``` +% phonopy-gruneisen orig plus minus --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --band="1/2 1/4 3/4 0 0 0 1/2 1/2 1/2 1/2 0.0 1/2" -p -c POSCAR-unitcell +``` + +```{image} Si-gruneisen-band.png +:scale: 50 +``` + +In this calculation, neighboring **q**-points in each band segment are connected +considering their phonon symmetry to treat band crossing correctly. Therefore +the phonon frequencies may not be ordered in `gruneisen.yaml`. In the plot (`-p` +option), the colors of phonon bands correspond to those of mode Grüneinen +parameters. + +A calculation on a reciprocal mesh is made by + +``` +% phonopy-gruneisen orig plus minus --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --mesh="20 20 20" -p -c POSCAR-unitcell --color="RB" +``` + +```{image} Si-gruneisen-mesh.png +:scale: 50 +``` + +In the plot (`-p` option), the colors of mode Grüneinen parameters are set for +band indices with ascending order of phonon frequencies. + +Mode Grüneinen parameter may diverge around {math}`\Gamma`-point. In the above +example for band paths, mode Grüneinen parameters are calculated at +{math}`\Gamma`-point, but `phonopy-gruneisen` script avoids showing the values +on the plot. Instead the values at the neighboring **q**-points of +{math}`\Gamma`-point are used for the plot. + +(gruneisen_calculators)= + +## Force calculator interfaces + +Options of force calculator interfaces such as `--abinit`, `--qe`, ... can be +specified for corresponding calculators and the crystal structure file format +should be different from that of the VASP format. An Abinit example is as +follows: + +``` +% phonopy-gruneisen orig plus minus --abinit --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --band="1/2 1/4 3/4 0 0 0 1/2 1/2 1/2 1/2 0.0 1/2" -p -c Si.in +``` + +(gruneisen_command_options)= + +## Command options + +If one of the force calculator options is specified, the interface mode is +changed to it. The unit conversion factor to THz is appropriately selected and +its crystal structure file format is accepted. If none of them is specified, as +the VASP interface mode is invoked as the default interface. + +The following command options can be used for all interface modes. They work +similarly to those for `phonopy` script. + +- `--dim` +- `--mp`, `--mesh` +- `--band` +- `--pa`, `--primitive_axis` +- `--readfc` +- `--band_points` +- `--nac` +- `--factor` +- `--nomeshsym` +- `-p` +- `-c` +- `-s`, `--save` +- `-o` + +Currently `--pa="auto"` works but `--band="auto"` doesn't. The `--color` option +(`RB`, `RG`, `RGB`) is used to gradually change the marker colors with respect +to band indices. For the mesh-sampling plot, a few more options to control +matplotlib parameters are prepared. + +## Method to calculate mode Grüneisen parameters + +Mode Grüneisen parameter {math}`\gamma(\mathbf{q}\nu)` at the wave vector +{math}`\mathbf{q}` and band index {math}`\nu` is given by + +```{math} +\gamma(\mathbf{q}\nu) =& -\frac{V}{\omega(\mathbf{q}\nu)}\frac{\partial +\omega(\mathbf{q}\nu)}{\partial V}\\ +=&-\frac{V}{2[\omega(\mathbf{q}\nu)]^2}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| +\frac{\partial D(\mathbf{q})} {\partial +V}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>, +``` + +where {math}`V` is the volume, {math}`\omega(\mathbf{q}\nu)` is the phonon +frequency, {math}`D(\mathbf{q})` is the dynamical matrix, and +{math}`\mathbf{e}(\mathbf{q}\nu)` is the eigenvector. This is approximated by +the finite difference method: + +```{math} +\gamma(\mathbf{q}\nu) \simeq -\frac{V}{2[\omega(\mathbf{q}\nu)]^2} +\left<\mathbf{e}(\mathbf{q}\nu)\biggl| \frac{\Delta D(\mathbf{q})} {\Delta +V}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>. +``` + +The `phonopy-gruneisen` script requires three phonon calculations at +corresponding three volume points. One is for eigenvectors at the equilibrium +volume ({math}`V`) and the remaining two are for {math}`\Delta D(\mathbf{q})` +with slightly larger and smaller volumes than {math}`V`. diff -Nru phonopy-2.12.0/doc/gruneisen.rst phonopy-2.13.1/doc/gruneisen.rst --- phonopy-2.12.0/doc/gruneisen.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/gruneisen.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -.. _phonopy_gruneisen: - -Calculation of mode Grüneisen parameters -======================================== - -.. contents:: - :depth: 2 - :local: - -How to run ------------ - -It is necessary to run three phonon calculations. One is calculated at -the equilibrium volume and the remaining two are calculated at the -slightly larger volume and smaller volume than the equilibrium -volume. The unitcells at these volumes have to be fully relaxed under -the constraint of each volume. - -Let files named ``POSCAR-unitcell``, ``FORCE_SETS`` (or ``FORCE_CONSTANTS`` -with ``--readfc`` option), -and optionally ``BORN`` stored in three different directories -named, e.g., ``equiv``, ``plus``, and ``minus``. - -The calculated results are written into the file ``gruneisen.yaml``. - -In the example directory, an example of silicon (``Si-gruneisen``) is -prepared. A calculation along paths in reciprocal space can be made by - -:: - - % phonopy-gruneisen orig plus minus --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --band="1/2 1/4 3/4 0 0 0 1/2 1/2 1/2 1/2 0.0 1/2" -p -c POSCAR-unitcell - -.. |i0| image:: Si-gruneisen-band.png - :scale: 50 - -|i0| - -In this calculation, neighboring **q**-points in each band segment are -connected considering their phonon symmetry to treat band crossing -correctly. Therefore the phonon frequencies may not be ordered in -``gruneisen.yaml``. In the plot (``-p`` option), the colors of phonon -bands correspond to those of mode Grüneinen parameters. - -A calculation on a reciprocal mesh is made by - -:: - - % phonopy-gruneisen orig plus minus --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --mesh="20 20 20" -p -c POSCAR-unitcell --color="RB" - -.. |i1| image:: Si-gruneisen-mesh.png - :scale: 50 - -|i1| - -In the plot (``-p`` option), the colors of mode Grüneinen parameters -are set for band indices with ascending order of phonon frequencies. - -Mode Grüneinen parameter may diverge around :math:`\Gamma`-point. In -the above example for band paths, mode Grüneinen parameters are -calculated at :math:`\Gamma`-point, but ``phonopy-gruneisen`` script -avoids showing the values on the plot. Instead the values at the -neighboring **q**-points of :math:`\Gamma`-point are used for the -plot. - -.. _gruneisen_calculators: - -Force calculator interfaces ---------------------------- - -Options of force calculator interfaces such as ``--abinit``, ``--qe``, -... can be specified for corresponding calculators and the crystal -structure file format should be different from that of the VASP -format. An Abinit example is as follows:: - - % phonopy-gruneisen orig plus minus --abinit --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --band="1/2 1/4 3/4 0 0 0 1/2 1/2 1/2 1/2 0.0 1/2" -p -c Si.in - - -.. _gruneisen_command_options: - -Command options ----------------- - -If one of the force calculator options is specified, the interface -mode is changed to it. The unit conversion factor to THz is -appropriately selected and its crystal structure file format is -accepted. If none of them is specified, as the VASP interface mode is -invoked as the default interface. - -The following command options can be used for all interface -modes. They work similarly to those for ``phonopy`` script. - -* ``--dim`` -* ``--mp``, ``--mesh`` -* ``--band`` -* ``--pa``, ``--primitive_axis`` -* ``--readfc`` -* ``--band_points`` -* ``--nac`` -* ``--factor`` -* ``--nomeshsym`` -* ``-p`` -* ``-c`` -* ``-s``, ``--save`` -* ``-o`` - -Currently ``--pa="auto"`` works but ``--band="auto"`` doesn't. -The ``--color`` option (``RB``, ``RG``, ``RGB``) is used to gradually -change the marker colors with respect to band indices. For the -mesh-sampling plot, a few more options to control matplotlib -parameters are prepared. - -Method to calculate mode Grüneisen parameters ---------------------------------------------- - -Mode Grüneisen parameter :math:`\gamma(\mathbf{q}\nu)` at the wave -vector :math:`\mathbf{q}` and band index :math:`\nu` is given by - -.. math:: - - \gamma(\mathbf{q}\nu) =& -\frac{V}{\omega(\mathbf{q}\nu)}\frac{\partial - \omega(\mathbf{q}\nu)}{\partial V}\\ - =&-\frac{V}{2[\omega(\mathbf{q}\nu)]^2}\left<\mathbf{e}(\mathbf{q}\nu)\biggl| - \frac{\partial D(\mathbf{q})} - {\partial V}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>, - -where :math:`V` is the volume, :math:`\omega(\mathbf{q}\nu)` is the -phonon frequency, :math:`D(\mathbf{q})` is the dynamical matrix, -and :math:`\mathbf{e}(\mathbf{q}\nu)` is the eigenvector. This is -approximated by the finite difference method: - -.. math:: - - \gamma(\mathbf{q}\nu) \simeq -\frac{V}{2[\omega(\mathbf{q}\nu)]^2} - \left<\mathbf{e}(\mathbf{q}\nu)\biggl| - \frac{\Delta D(\mathbf{q})} - {\Delta V}\biggl|\mathbf{e}(\mathbf{q}\nu)\right>. - -The ``phonopy-gruneisen`` script requires three phonon calculations at -corresponding three volume points. One is for eigenvectors at the -equilibrium volume (:math:`V`) and the remaining two are for -:math:`\Delta D(\mathbf{q})` with slightly larger and smaller volumes -than :math:`V`. diff -Nru phonopy-2.12.0/doc/index.md phonopy-2.13.1/doc/index.md --- phonopy-2.12.0/doc/index.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/index.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,117 @@ +# Welcome to phonopy + +**Phonopy** is an open source package for phonon calculations at harmonic and +quasi-harmonic levels. + +**Phono3py** is another open source package for phonon-phonon interaction and +lattice thermal conductivity calculations. See the documentation at +http://phonopy.github.io/phono3py/ + +**Phonon database**: A collection of first principles phonon calculations is +available as open data at http://phonondb.mtl.kyoto-u.ac.jp/ , where the raw +data of phonopy & VASP results are downloaded. + +The following features of phonopy are highlighted: + +- {ref}`Phonon band structure `, + {ref}`phonon DOS and partial-DOS ` +- {ref}`Phonon thermal properties `: Free energy, heat + capacity (Cv), and entropy +- {ref}`Phonon group velocity ` +- {ref}`Thermal ellipsoids ` / + {ref}`Mean square displacements ` +- {ref}`Irreducible representations of normal modes ` +- {ref}`Dynamic structure factor for INS and IXS ` +- {ref}`Non-analytical-term correction `: LO-TO splitting + ({ref}`Born effective charges and dielectric constant are required. `) +- {ref}`Mode Grüneisen parameters ` +- {ref}`Quasi-harmonic approximation `: Thermal expansion, heat + capacity at constant pressure (Cp) +- {ref}`Interfaces to calculators `: + {ref}`VASP `, {ref}`VASP DFPT `, + {ref}`ABINIT `, {ref}`Quantu ESPRESSO `, + {ref}`SIESTA `, {ref}`Elk `, + {ref}`WIEN2k `, {ref}`CRYSTAL `, + {ref}`DFTB+ `, {ref}`TURBOMOLE `, + {ref}`CP2K `, {ref}`FHI-aims `, + {ref}`CASTEP `, {ref}`Fleur `, + {ref}`LAMMPS (external) ` +- {ref}`Phonopy API for Python ` + +A presentation in pdf for introduction to phonopy is downloaded +[here](https://sf.net/projects/phonopy/files/phonopy.pdf/download). + +```{image} band.png +:width: 15% +``` + +```{image} pdos.png +:width: 15% +``` + +```{image} thermalprop.png +:width: 15% +``` + +```{image} QHA.png +:width: 15% +``` + +# Documentation + +```{toctree} +:maxdepth: 1 +install +symmetry +workflow +examples +input-files +output-files +setting-tags +command-options +dynamic-structure-factor +Mode Grüneisen parameters +qha +interfaces +auxiliary-tools +external-tools +phonopy-module +phonopy-load +formulation +citation +reference +changelog +``` + + + + + +(mailinglist)= + +# Mailing list + +For questions, bug reports, and comments, please visit +https://lists.sourceforge.net/lists/listinfo/phonopy-users to subscribe the +phonopy mailing list and send them to phonopy-users@lists.sourceforge.net. +Message body including attached files has to be smaller than 300 KB. + +# License + +New BSD from version 1.3. + +(LGPL from ver. 0.9.3 to version 1.2.1., GPL to version 0.9.2.) + +# Contact + +- Author: [Atsushi Togo](http://atztogo.github.io/) + +# Indices and tables + +- {ref}`genindex` +- {ref}`modindex` +- {ref}`search` diff -Nru phonopy-2.12.0/doc/index.rst phonopy-2.13.1/doc/index.rst --- phonopy-2.12.0/doc/index.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/index.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -.. phonopy documentation master file, created by - sphinx-quickstart on Mon Apr 13 15:11:21 2009. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - - -Welcome to phonopy -=================== - -**Phonopy** is an open source package for phonon calculations at -harmonic and quasi-harmonic levels. - -**Phono3py** is another open source package for phonon-phonon interaction and lattice thermal -conductivity calculations. See the documentation at http://phonopy.github.io/phono3py/ - -**Phonon database**: A collection of first principles phonon -calculations is available as open data at -http://phonondb.mtl.kyoto-u.ac.jp/ , where the raw data of phonopy & VASP -results are downloaded. - -The following features of phonopy are highlighted: - - -.. |i0| image:: band.png - :width: 15% - -.. |i1| image:: pdos.png - :width: 15% - -.. |i2| image:: thermalprop.png - :width: 15% - -.. |i3| image:: QHA.png - :width: 15% - -- :ref:`Phonon band structure `, - :ref:`phonon DOS and partial-DOS ` -- :ref:`Phonon thermal properties `: - Free energy, heat capacity (Cv), and entropy -- :ref:`Phonon group velocity ` -- :ref:`Thermal ellipsoids ` / - :ref:`Mean square displacements ` -- :ref:`Irreducible representations of normal modes ` -- :ref:`Dynamic structure factor for INS and IXS ` -- :ref:`Non-analytical-term correction `: LO-TO splitting - (:ref:`Born effective charges and dielectric constant are required. `) -- :ref:`Mode Grüneisen parameters ` -- :ref:`Quasi-harmonic approximation `: Thermal expansion, heat - capacity at constant pressure (Cp) -- :ref:`Interfaces to calculators `: - :ref:`VASP `, - :ref:`VASP DFPT `, - :ref:`ABINIT `, - :ref:`Quantu ESPRESSO `, - :ref:`SIESTA `, - :ref:`Elk `, - :ref:`WIEN2k `, - :ref:`CRYSTAL `, - :ref:`DFTB+ `, - :ref:`TURBOMOLE `, - :ref:`CP2K `, - :ref:`FHI-aims `, - :ref:`CASTEP `, - :ref:`Fleur `, - :ref:`LAMMPS (external) ` -- :ref:`Phonopy API for Python ` - - -.. - A presentation in pdf for introduction to phonopy is downloaded `***here*** - `_. - -|i0| |i1| |i2| |i3| - - -Documentation -============== - -.. toctree:: - :maxdepth: 1 - - install - symmetry - workflow - examples - input-files - output-files - setting-tags - command-options - dynamic-structure-factor - Mode Grüneisen parameters - qha - interfaces - auxiliary-tools - external-tools - phonopy-module - phonopy-load - formulation - citation - reference - changelog - -.. - Latex master doc is documentation.rst. - But documentation.rst is not included for html. - -.. toctree:: - :hidden: - - documentation - -.. _mailinglist: - -Mailing list -============ - -For questions, bug reports, and comments, please visit -https://lists.sourceforge.net/lists/listinfo/phonopy-users to -subscribe the phonopy mailing list -and send them to phonopy-users@lists.sourceforge.net. -Message body including attached files has to be smaller than 300 KB. - -License -======= - -New BSD from version 1.3. - -(LGPL from ver. 0.9.3 to version 1.2.1., GPL to version 0.9.2.) - -Contact -======= - -* Author: `Atsushi Togo `_ - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff -Nru phonopy-2.12.0/doc/input-files.md phonopy-2.13.1/doc/input-files.md --- phonopy-2.12.0/doc/input-files.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/input-files.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,423 @@ +# Input files + +```{contents} +:depth: 2 +:local: +``` + +## Setting file + +A setting file contains phonopy settings which are summarized at +{ref}`setting_tags`. This file is passed to phonopy as an argument, e.g., + +```bash +% phonopy phonopy.conf +``` + +where the filename is arbitrary. + +## `phonopy.yaml` and `phonopy_disp.yaml` + +These are output files after the calculation or creating the displacements. +These files contain the crystal structure information, primitive cell and +supercell sizes, and also the calculator interface. Therefore with this file, +users will not need to specify those crystal sturcutre related tags. This file +format can be used with {ref}`cell_filename_tag` tag or `-c` option: + +``` +$ phonopy -c phonopy_disp.yaml +``` + +`FORCE_SETS`, `BORN`, and `FORCE_CONSTANTS` information can be also stored in +`phonopy.yaml` as the output after running phonopy, e.g., + +``` +$ phonopy -c phonopy_disp.yaml --include-all --nac +``` + +## Structure file + +Crystal structure is described by a file with specific format for each +calculator, though the default crystal structure is written in VASP POSCAR +format. See the detail of the calculator interfaces at +{ref}`calculator_interfaces`. + +### VASP POSCAR like format + +In the following, the VASP POSCAR format that phonopy can parse is explained. +The format is simple. The first line is for your comment, where you can write +anything you want. The second line is the ratio for lattice parameters. You can +multiply by this number. The third to fifth lines give the lattice parameters, +_a_, _b_, and _c_ for the respective lines. The sixth line contains the number +of atoms for each atomic species, which have to correspond to the atomic +positions in the order. The seventh line should be written as `Direct`. This +means that the atomic positions are represented in fractional (reduced) +coordinates. When you write chemical symbols in the first line, they are read +and those defined by the `ATOM_NAME` tag are overwritten. + +(example_POSCAR1)= + +#### Example of rutile-type silicon oxide crystal structure (VASP 4 style) + +``` +Si O + 1.00000000000000 + 4.2266540199664249 0.0000000000000000 0.0000000000000000 + 0.0000000000000000 4.2266540199664249 0.0000000000000000 + 0.0000000000000000 0.0000000000000000 2.6888359272289208 + 2 4 +Direct + 0.0000000000000000 0.0000000000000000 0.0000000000000000 + 0.5000000000000000 0.5000000000000000 0.5000000000000000 + 0.3067891334429594 0.3067891334429594 0.0000000000000000 + 0.6932108665570406 0.6932108665570406 0.0000000000000000 + 0.1932108665570406 0.8067891334429594 0.5000000000000000 + 0.8067891334429594 0.1932108665570406 0.5000000000000000 +``` + +#### Example of rutile-type silicon oxide crystal structure (VASP 5 style) + +The VASP 5.x style is also supported. Chemical symbols are inserted just before +the line of the numbers of atoms. The chemical symbols in this line overwrite +those defined by the `ATOM_NAME` tag and those defined by the first line of +`POSCAR`. + +``` +Stishovite + 1.00000000000000 + 4.2266540199664249 0.0000000000000000 0.0000000000000000 + 0.0000000000000000 4.2266540199664249 0.0000000000000000 + 0.0000000000000000 0.0000000000000000 2.6888359272289208 +Si O + 2 4 +Direct + 0.0000000000000000 0.0000000000000000 0.0000000000000000 + 0.5000000000000000 0.5000000000000000 0.5000000000000000 + 0.3067891334429594 0.3067891334429594 0.0000000000000000 + 0.6932108665570406 0.6932108665570406 0.0000000000000000 + 0.1932108665570406 0.8067891334429594 0.5000000000000000 + 0.8067891334429594 0.1932108665570406 0.5000000000000000 +``` + +(file_forces)= + +## Force file (`FORCE_SETS`) + +Two types of `FORCE_SETS` formats are supported. + +(file_forces_type_1)= + +### Type 1 + +This format is the default format of phonopy and force constants can be +calculated by built-in force constants calculator of phonopy by finite +difference method, though external force constants calculator can be also used +to obtain force constants with this format by the fitting approach. + +This file gives sets of forces in supercells with finite atomic displacements. +Each supercell involves one displaced atom. The first line is the number of +atoms in supercell. The second line gives number of calculated supercells with +displacements. Below the lines, sets of forces with displacements are written. +In each set, firstly the atom number in supercell is written. Secondary, the +atomic displacement in **Cartesian coordinates** is written. Below the +displacement line, atomic forces in **Cartesian coordinates** are successively +written. This is repeated for the set of displacements. Blank likes are simply +ignored. + +In the following example, the third line is the displaced atom number that +corresponds to the atom number in the supercell created by phonopy. The fourth +line gives the displacements in **Cartesian coordinates**. The lines below, the +atomic forces in **Cartesian coordinates** are written. Once all the forces for +a supercell are written, the next set of forces are written. This routine is +repeated until the forces of all the displacements have been written. + +#### Example + +``` +48 +2 + +1 + 0.0050650623043761 0.0000000000000000 0.0086223630086415 + -0.0347116200 -0.0000026500 -0.0679795200 + 0.0050392400 -0.0015711700 -0.0079514600 + 0.0027380900 -0.0017851900 -0.0069206400 +... (continue until all the forces for this displacement have written) + +25 + 0.0050650623043761 0.0000000000000000 0.0086223630086415 + -0.0017134500 -0.0001539800 0.0017333400 + 0.0013248100 0.0001984300 -0.0001203700 + -0.0001310200 -0.0007955600 0.0003889300 +... (continue until all the forces for this displacement have written) +``` + +(file_forces_type_2)= + +### Type 2 + +Equivalent to `DFSET` of +[ALM code](https://alm.readthedocs.io/en/develop/format-dfset.html#format-of-dfset). + +Each line has exactly 6 elements. The first three and second three elements give +displacement and force of an atom in a supercell, respectively. One set with the +number of lines of supercell atoms corresponds to one supercell calculation and +the number of supercell calculations are concatenated as many as the user likes. +This file is parsed to finally get displacements and forces to have the array +shapes of `displacements.shape = (num_supercells, num_atoms, 3)` and +`forces.shape = (num_supercells, num_atoms, 3)`. + +Force constants can be calculated by the fitting approach and this force +constants calculation requires external force constants calculator such as +[ALM](https://alm.readthedocs.io/en/develop/index.html) (invoked by `--alm` +option). All the data are used for calculating force constants in the fitting +(usually least square fitting) by the force constants calculator. + +#### Example + +``` + 0.00834956 0.00506291 0.00215683 -0.01723508 -0.00418148 -0.00376513 +-0.00494556 0.00866021 -0.00073630 0.00849148 -0.01091833 -0.00458456 +-0.00403290 -0.00837741 0.00368169 0.00476247 0.00907379 -0.00210179 +-0.00462319 0.00361350 -0.00809745 0.00996582 -0.00320343 0.01904460 + 0.00496785 -0.00596540 -0.00630352 -0.01882121 -0.00100787 0.01681980 +... +``` + +(file_force_constants)= + +## `FORCE_CONSTANTS` and `force_constants.hdf5` + +If the force constants of a supercell are known, it is not necessary to prepared +`FORCES`. Phonopy has an interface to read and write `FORCE_CONSTANTS` or +`force_constants.hdf5`. To read and write these files are controlled by +{ref}`force constants tags ` and {ref}`fc_format_tag`. VASP +users can use {ref}`VASP DFPT interface ` to create +`FORCE_CONSTANTS` from `vasprun.xml`. Quantum ESPRESSO users can use `q2r.x` to +create force constants file by followng the instraction shown at {ref}`qe_q2r` + +Force constants are stored in either array shape of + +- Compact format: `(n_patom, n_satom, 3, 3)` +- Full format: `(n_satom, n_satom, 3, 3)` + +where `n_satom` and `n_patom` are the numbers of atoms in supercell and +primitive cell, respectively. + +### Format of `FORCE_CONSTANTS` + +First line contains the first two elements of the shape of the force constants +array, i.e., for `(n_satom, n_satom, 3, 3)`, the first and second numbers are +the same and are the number of atoms in the supercell, and for +`(n_patom, n_satom, 3, 3)`, they are the numbers of atoms in the primitive cell +and supercell. If the first line contains only one number, it is assumed same as +that of the former case. + +Below second line, force constants between atoms are written by every four +lines. In first line of the four lines, anything can be written, i.e., just +ignored. Second to fourth lines of the four lines are for the second rank tensor +of force constant in Cartesian coordinates, i.e.: + +``` +xx xy xz +yx yy yz +zx zy zz +``` + +### Example + +``` +32 32 +1 1 + 4.635786969900131 -0.000000000000000 -0.000000000000000 + -0.000000000000000 4.635786969900130 -0.000000000000000 + -0.000000000000000 -0.000000000000000 4.635786969900130 +1 2 + -0.246720998398056 -0.000000000000000 -0.000000000000000 + -0.000000000000000 0.018256999881458 -0.000000000000000 + -0.000000000000000 -0.000000000000000 0.018256999881458 +... +1 32 + 0.002646999982813 0.018011999883049 -0.000000000000000 + 0.018011999883049 0.002646999982813 -0.000000000000000 + -0.000000000000000 -0.000000000000000 0.035303999770773 +2 1 + -0.246720998398056 0.000000000000000 0.000000000000000 + 0.000000000000000 0.018256999881458 0.000000000000000 + 0.000000000000000 0.000000000000000 0.018256999881458 +... +32 32 + 4.635786969900131 0.000000000000000 0.000000000000000 + 0.000000000000000 4.635786969900130 0.000000000000000 + 0.000000000000000 0.000000000000000 4.635786969900130 +``` + +### Format of `force_constants.hdf5` + +This is an alternative of `FORCE_CONSTANTS` but the data is stored in HDF5 +format. See the detail of how to obtain this file, {ref}`fc_format_tag`. + +The data are stored as follows. `p2s_map` is introduced at version 1.12.6. Force +constants data can be stored in the array shape of either +`(n_satom, n_satom, 3, 3)` or `(n_patom, n_satom, 3, 3)`. In the later case, +`p2s_map` is necessary for the consistency check and this gives the indices of +atoms in the primitive cell in supercell index system. + +``` +In [1]: import h5py + +In [2]: f = h5py.File("force_constants.hdf5", 'r') + +In [3]: list(f) +Out[3]: ['force_constants', 'p2s_map'] + +In [4]: f['force_constants'].shape +Out[4]: (2, 64, 3, 3) + +In [5]: f['p2s_map'][:] +Out[5]: array([ 0, 32], dtype=int32) +``` + +(qpoints_file)= + +## `QPOINTS` (optional) + +Specific q-points are calculated using `QPOINTS = .TRUE.` tag and `QPOINTS` +file. The file format of `QPOINTS` is as follows. The first line gives the +number of q-points. Then the successive lines give q-points in reduced +coordinate of reciprocal space of the input unit cell. + +### Example + +``` +512 +-0.437500000000000 -0.437500000000000 -0.437500000000000 +-0.312500000000000 -0.437500000000000 -0.437500000000000 +-0.187500000000000 -0.437500000000000 -0.437500000000000 +... +``` + +(born_file)= + +## `BORN` (optional) + +This file is used with the `--nac` option or `NAC` tag. + +The formula implemented is refered to +{ref}`non_analytical_term_correction_theory`. + +### Format + +In the first line, unit conversion factor is given. In versions 1.10.4 or later, +the default value for each calculater can be used if characters than numerical +number are given. The default values for the calculaters are found at +{ref}`nac_default_value_interfaces`. + +In the second line, dielectric constant {math}`\epsilon` is specifed in +Cartesian coordinates. The nine values correspond to the tensor elements of xx, +xy, xz, yx, yy, yz, zx, zy, and zz. + +From the third line, Born effective charges {math}`Z` for the independent atoms +in the **primitive cell** have to be written in Cartesian coordinates. The +independent atoms can be found using the `-v` option. As shown below in the +Al2O3 example, the independent atoms are marked by `*` in front of atomic +positions: + +``` +% phonopy --pa R -v + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + +Crystal structure was read from "phonopy_disp.yaml". +Unit of length: angstrom +Settings: + Supercell: [2 2 1] + Primitive matrix: + [0.6666666666666666, -0.3333333333333333, -0.3333333333333333] + [0.3333333333333333, 0.3333333333333333, -0.6666666666666666] + [0.3333333333333333, 0.3333333333333333, 0.3333333333333333] +Spacegroup: R-3c (167) +------------------------------ primitive cell ------------------------------ +Lattice vectors: + a 2.387113172649497 1.378200432815288 4.337119797109073 + b -2.387113172649497 1.378200432815288 4.337119797109073 + c 0.000000000000000 -2.756400865630577 4.337119797109073 +Atomic positions (fractional): + *1 Al 0.35209370789580 0.35209370789579 0.35209370789580 26.982 + 2 Al 0.64790629210421 0.64790629210420 0.64790629210421 26.982 + 3 Al 0.14790629210421 0.14790629210421 0.14790629210421 26.982 + 4 Al 0.85209370789579 0.85209370789580 0.85209370789579 26.982 + *5 O 0.55580865378801 0.94419134621199 0.25000000000000 15.999 + 6 O 0.44419134621199 0.05580865378802 0.75000000000000 15.999 + 7 O 0.25000000000000 0.55580865378801 0.94419134621199 15.999 + 8 O 0.75000000000000 0.44419134621200 0.05580865378801 15.999 + 9 O 0.94419134621199 0.25000000000000 0.55580865378801 15.999 + 10 O 0.05580865378801 0.75000000000001 0.44419134621199 15.999 +-------------------------------- unit cell --------------------------------- +Lattice vectors: + a 4.774226345298994 0.000000000000000 -0.000000000000000 + b -2.387113172649497 4.134601298445865 0.000000000000000 + c -0.000000000000000 0.000000000000000 13.011359391327222 +Atomic positions (fractional): + *1 Al 0.33333333333334 0.66666666666666 0.01876037456246 26.982 > 1 + 2 Al 0.33333333333334 0.66666666666666 0.31457295877087 26.982 > 2 + 3 Al 0.00000000000000 0.00000000000000 0.14790629210421 26.982 > 3 + 4 Al 0.66666666666666 0.33333333333334 0.18542704122913 26.982 > 4 + 5 Al 0.00000000000000 0.00000000000000 0.35209370789579 26.982 > 1 + 6 Al 0.00000000000000 0.00000000000000 0.64790629210421 26.982 > 2 + 7 Al 0.66666666666666 0.33333333333334 0.48123962543754 26.982 > 3 + 8 Al 0.33333333333334 0.66666666666666 0.51876037456246 26.982 > 4 + 9 Al 0.66666666666666 0.33333333333334 0.68542704122913 26.982 > 1 + 10 Al 0.66666666666666 0.33333333333334 0.98123962543754 26.982 > 2 + 11 Al 0.33333333333334 0.66666666666666 0.81457295877087 26.982 > 3 + 12 Al 0.00000000000000 0.00000000000000 0.85209370789579 26.982 > 4 + *13 O 0.30580865378801 0.00000000000000 0.25000000000000 15.999 > 5 + 14 O 0.36085801287865 0.33333333333334 0.08333333333334 15.999 > 6 + 15 O 0.00000000000000 0.30580865378801 0.25000000000000 15.999 > 7 + 16 O 0.66666666666666 0.02752467954532 0.08333333333334 15.999 > 8 + 17 O 0.69419134621199 0.69419134621199 0.25000000000000 15.999 > 9 + 18 O 0.97247532045468 0.63914198712135 0.08333333333334 15.999 > 10 + 19 O 0.97247532045468 0.33333333333334 0.58333333333334 15.999 > 5 + 20 O 0.02752467954532 0.66666666666666 0.41666666666666 15.999 > 6 + 21 O 0.66666666666666 0.63914198712135 0.58333333333334 15.999 > 7 + 22 O 0.33333333333334 0.36085801287865 0.41666666666666 15.999 > 8 + 23 O 0.36085801287865 0.02752467954532 0.58333333333334 15.999 > 9 + 24 O 0.63914198712135 0.97247532045468 0.41666666666666 15.999 > 10 + 25 O 0.63914198712135 0.66666666666666 0.91666666666666 15.999 > 5 + 26 O 0.69419134621199 0.00000000000000 0.75000000000000 15.999 > 6 + 27 O 0.33333333333334 0.97247532045468 0.91666666666666 15.999 > 7 + 28 O -0.00000000000000 0.69419134621199 0.75000000000000 15.999 > 8 + 29 O 0.02752467954532 0.36085801287865 0.91666666666666 15.999 > 9 + 30 O 0.30580865378801 0.30580865378801 0.75000000000000 15.999 > 10 +-------------------------------- super cell -------------------------------- +... +``` + +If VASP is used as the calculator for Born effective charge, and the hexagonal +unit cell is used for the calculation, the Born effective charge tensors of +atoms No. 1 and 13 have to be written in `BORN` file. + +### Example + +``` + 14.400 + 3.269 0.000 0.000 0.000 3.269 0.000 0.000 0.000 3.234 + 2.981 0.000 0.000 0.000 2.981 0.000 0.000 0.000 2.952 +-1.935 0.000 0.000 0.000 -2.036 -0.261 0.000 -0.261 -1.968 +``` + +or using the default NAC unit conversion factor (version 1.10.4 or later), + +``` +default value + 3.269 0.000 0.000 0.000 3.269 0.000 0.000 0.000 3.234 + 2.981 0.000 0.000 0.000 2.981 0.000 0.000 0.000 2.952 +-1.935 0.000 0.000 0.000 -2.036 -0.261 0.000 -0.261 -1.968 +``` diff -Nru phonopy-2.12.0/doc/input-files.rst phonopy-2.13.1/doc/input-files.rst --- phonopy-2.12.0/doc/input-files.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/input-files.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,446 +0,0 @@ -Input files -=========== - -.. contents:: - :depth: 2 - :local: - -Setting file -------------- - -A setting file contains phonopy settings which are summarized at -:ref:`setting_tags`. This file is passed to phonopy as an argument, -e.g., - -:: - - % phonopy phonopy.conf - -where the filename is arbitrary. - -``phonopy.yaml`` and ``phonopy_disp.yaml`` ------------------------------------------- - -These are output files after the calculation or creating the -displacements. These files contain the crystal structure information, -primitive cell and supercell sizes, and also the calculator -interface. Therefore with this file, users will not need to specify -those crystal sturcutre related tags. This file format can be used -with :ref:`cell_filename_tag` tag or ``-c`` option:: - - $ phonopy -c phonopy_disp.yaml - -``FORCE_SETS``, ``BORN``, and ``FORCE_CONSTANTS`` information can be -also stored in ``phonopy.yaml`` as the output after running phonopy, e.g., - -:: - - $ phonopy -c phonopy_disp.yaml --include-all --nac - -Structure file --------------- - -Crystal structure is described by a file with specific format for each -calculator, though the default crystal structure is written in VASP -POSCAR format. See the detail of the calculator interfaces at -:ref:`calculator_interfaces`. - -VASP POSCAR like format -~~~~~~~~~~~~~~~~~~~~~~~ - -In the following, the VASP POSCAR format that phonopy can parse is -explained. The format is simple. The first line is for your comment, -where you can write anything you want. The second line is the ratio -for lattice parameters. You can multiply by this number. The third to -fifth lines give the lattice parameters, *a*, *b*, and *c* for the -respective lines. The sixth line contains the number of atoms for each -atomic species, which have to correspond to the atomic positions in -the order. The seventh line should be written as ``Direct``. This -means that the atomic positions are represented in fractional -(reduced) coordinates. When you write chemical symbols in the first -line, they are read and those defined by the ``ATOM_NAME`` tag are -overwritten. - -.. _example_POSCAR1: - -Example of rutile-type silicon oxide crystal structure (VASP 4 style) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -:: - - Si O - 1.00000000000000 - 4.2266540199664249 0.0000000000000000 0.0000000000000000 - 0.0000000000000000 4.2266540199664249 0.0000000000000000 - 0.0000000000000000 0.0000000000000000 2.6888359272289208 - 2 4 - Direct - 0.0000000000000000 0.0000000000000000 0.0000000000000000 - 0.5000000000000000 0.5000000000000000 0.5000000000000000 - 0.3067891334429594 0.3067891334429594 0.0000000000000000 - 0.6932108665570406 0.6932108665570406 0.0000000000000000 - 0.1932108665570406 0.8067891334429594 0.5000000000000000 - 0.8067891334429594 0.1932108665570406 0.5000000000000000 - -Example of rutile-type silicon oxide crystal structure (VASP 5 style) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The VASP 5.x style is also supported. Chemical symbols are inserted -just before the line of the numbers of atoms. The chemical symbols in -this line overwrite those defined by the ``ATOM_NAME`` tag and those -defined by the first line of ``POSCAR``. - -:: - - Stishovite - 1.00000000000000 - 4.2266540199664249 0.0000000000000000 0.0000000000000000 - 0.0000000000000000 4.2266540199664249 0.0000000000000000 - 0.0000000000000000 0.0000000000000000 2.6888359272289208 - Si O - 2 4 - Direct - 0.0000000000000000 0.0000000000000000 0.0000000000000000 - 0.5000000000000000 0.5000000000000000 0.5000000000000000 - 0.3067891334429594 0.3067891334429594 0.0000000000000000 - 0.6932108665570406 0.6932108665570406 0.0000000000000000 - 0.1932108665570406 0.8067891334429594 0.5000000000000000 - 0.8067891334429594 0.1932108665570406 0.5000000000000000 - -.. _file_forces: - -Force file (``FORCE_SETS``) ----------------------------- - -Two types of ``FORCE_SETS`` formats are supported. - -.. _file_forces_type_1: - -Type 1 -~~~~~~ - -This format is the default format of phonopy and force constants can -be calculated by built-in force constants calculator of phonopy by -finite difference method, though external force constants calculator -can be also used to obtain force constants with this format by the -fitting approach. - -This file gives sets of forces in supercells with finite atomic -displacements. Each supercell involves one displaced atom. The first -line is the number of atoms in supercell. The second line gives number -of calculated supercells with displacements. Below the lines, sets of -forces with displacements are written. In each set, firstly the atom -number in supercell is written. Secondary, the atomic displacement in -**Cartesian coordinates** is written. Below the displacement line, -atomic forces in **Cartesian coordinates** are successively -written. This is repeated for the set of displacements. Blank likes -are simply ignored. - -In the following example, the third line is the displaced atom number -that corresponds to the atom number in the supercell created by -phonopy. The fourth line gives the displacements in **Cartesian -coordinates**. The lines below, the atomic forces in **Cartesian -coordinates** are written. Once all the forces for a supercell are -written, the next set of forces are written. This routine is repeated -until the forces of all the displacements have been written. - -Example -^^^^^^^ -:: - - 48 - 2 - - 1 - 0.0050650623043761 0.0000000000000000 0.0086223630086415 - -0.0347116200 -0.0000026500 -0.0679795200 - 0.0050392400 -0.0015711700 -0.0079514600 - 0.0027380900 -0.0017851900 -0.0069206400 - ... (continue until all the forces for this displacement have written) - - 25 - 0.0050650623043761 0.0000000000000000 0.0086223630086415 - -0.0017134500 -0.0001539800 0.0017333400 - 0.0013248100 0.0001984300 -0.0001203700 - -0.0001310200 -0.0007955600 0.0003889300 - ... (continue until all the forces for this displacement have written) - -.. _file_forces_type_2: - -Type 2 -~~~~~~~ - -Equivalent to ``DFSET`` of `ALM code -`_. - -Each line has exactly 6 elements. The first three and second three -elements give displacement and force of an atom in a supercell, -respectively. One set with the number of lines of supercell atoms -corresponds to one supercell calculation and the number of supercell -calculations are concatenated as many as the user likes. This file is -parsed to finally get displacements and forces to have the array -shapes of ``displacements.shape = (num_supercells, num_atoms, 3)`` and -``forces.shape = (num_supercells, num_atoms, 3)``. - -Force constants can be calculated by the fitting approach and this -force constants calculation requires external force constants -calculator such as `ALM -`_ (invoked by -``--alm`` option). All the data are used for calculating force -constants in the fitting (usually least square fitting) by the force -constants calculator. - -Example -^^^^^^^ - -:: - - 0.00834956 0.00506291 0.00215683 -0.01723508 -0.00418148 -0.00376513 - -0.00494556 0.00866021 -0.00073630 0.00849148 -0.01091833 -0.00458456 - -0.00403290 -0.00837741 0.00368169 0.00476247 0.00907379 -0.00210179 - -0.00462319 0.00361350 -0.00809745 0.00996582 -0.00320343 0.01904460 - 0.00496785 -0.00596540 -0.00630352 -0.01882121 -0.00100787 0.01681980 - ... - -.. _file_force_constants: - -``FORCE_CONSTANTS`` and ``force_constants.hdf5`` --------------------------------------------------- - -If the force constants of a supercell are known, it is not necessary -to prepared ``FORCES``. Phonopy has an interface to read and write -``FORCE_CONSTANTS`` or ``force_constants.hdf5``. To read and write -these files are controlled by :ref:`force constants tags -` and :ref:`fc_format_tag`. VASP users can use -:ref:`VASP DFPT interface ` to create -``FORCE_CONSTANTS`` from ``vasprun.xml``. Quantum ESPRESSO users can -use ``q2r.x`` to create force constants file by followng the -instraction shown at :ref:`qe_q2r` - -Force constants are stored in either array shape of - -- Compact format: ``(n_patom, n_satom, 3, 3)`` -- Full format: ``(n_satom, n_satom, 3, 3)`` - -where ``n_satom`` and ``n_patom`` are the numbers of atoms in -supercell and primitive cell, respectively. - -Format of ``FORCE_CONSTANTS`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -First line contains the first two elements of the shape of the force -constants array, i.e., for ``(n_satom, n_satom, 3, 3)``, the first and -second numbers are the same and are the number of atoms in the -supercell, and for ``(n_patom, n_satom, 3, 3)``, they are the numbers -of atoms in the primitive cell and supercell. If the first line -contains only one number, it is assumed same as that of the former case. - -Below second line, -force constants between atoms are written by every four lines. In -first line of the four lines, anything can be written, i.e., just -ignored. Second to fourth lines of the four lines are for the second -rank tensor of force constant in Cartesian coordinates, i.e.::: - - xx xy xz - yx yy yz - zx zy zz - -Example -~~~~~~~ - -:: - - 32 32 - 1 1 - 4.635786969900131 -0.000000000000000 -0.000000000000000 - -0.000000000000000 4.635786969900130 -0.000000000000000 - -0.000000000000000 -0.000000000000000 4.635786969900130 - 1 2 - -0.246720998398056 -0.000000000000000 -0.000000000000000 - -0.000000000000000 0.018256999881458 -0.000000000000000 - -0.000000000000000 -0.000000000000000 0.018256999881458 - ... - 1 32 - 0.002646999982813 0.018011999883049 -0.000000000000000 - 0.018011999883049 0.002646999982813 -0.000000000000000 - -0.000000000000000 -0.000000000000000 0.035303999770773 - 2 1 - -0.246720998398056 0.000000000000000 0.000000000000000 - 0.000000000000000 0.018256999881458 0.000000000000000 - 0.000000000000000 0.000000000000000 0.018256999881458 - ... - 32 32 - 4.635786969900131 0.000000000000000 0.000000000000000 - 0.000000000000000 4.635786969900130 0.000000000000000 - 0.000000000000000 0.000000000000000 4.635786969900130 - -Format of ``force_constants.hdf5`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is an alternative of ``FORCE_CONSTANTS`` but the data is stored -in HDF5 format. See the detail of how to obtain this file, -:ref:`fc_format_tag`. - -The data are stored as follows. ``p2s_map`` is introduced at version -1.12.6. Force constants data can be stored in the array shape of -either ``(n_satom, n_satom, 3, 3)`` or ``(n_patom, n_satom, 3, 3)``. -In the later case, ``p2s_map`` is necessary for the consistency check -and this gives the indices of atoms in the primitive cell in supercell -index system. - -:: - - In [1]: import h5py - f - In [2]: f = h5py.File("force_constants.hdf5", 'r') - - In [3]: list(f) - Out[3]: ['force_constants', 'p2s_map'] - - In [4]: f['force_constants'].shape - Out[4]: (2, 64, 3, 3) - - In [5]: f['p2s_map'][:] - Out[5]: array([ 0, 32], dtype=int32) - -.. _qpoints_file: - -``QPOINTS`` (optional) ------------------------ - -Specific q-points are calculated using ``QPOINTS = .TRUE.`` tag and -``QPOINTS`` file. The file format of ``QPOINTS`` is as follows. The -first line gives the number of q-points. Then the successive lines -give q-points in reduced coordinate of reciprocal space of the input -unit cell. - -Example -~~~~~~~ -:: - - 512 - -0.437500000000000 -0.437500000000000 -0.437500000000000 - -0.312500000000000 -0.437500000000000 -0.437500000000000 - -0.187500000000000 -0.437500000000000 -0.437500000000000 - ... - -.. _born_file: - -``BORN`` (optional) ------------------------ - -This file is used with the ``--nac`` option or ``NAC`` tag. - -The formula implemented is refered to :ref:`non_analytical_term_correction_theory`. - -Format -~~~~~~ - -In the first line, unit conversion factor is given. In versions 1.10.4 -or later, the default value for each calculater can be used if -characters than numerical number are given. The default values for the -calculaters are found at :ref:`nac_default_value_interfaces`. - -In the second line, dielectric constant :math:`\epsilon` is specifed -in Cartesian coordinates. The nine values correspond to the tensor -elements of xx, xy, xz, yx, yy, yz, zx, zy, and zz. - -From the third line, Born effective charges :math:`Z` for the -independent atoms in the **primitive cell** have to be written in -Cartesian coordinates. The independent atoms can be found using the -``-v`` option. As shown below in the Al2O3 example, the independent -atoms are marked by ``*`` in front of atomic positions:: - - % phonopy --dim="2 2 1" --pa="2/3 -1/3 -1/3 1/3 1/3 -2/3 1/3 1/3 1/3" -v - _ - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - - 1.8.4.2 - - Settings: - Supercell: [2 2 1] - Primitive axis: - [ 0.66666667 -0.33333333 -0.33333333] - [ 0.33333333 0.33333333 -0.66666667] - [ 0.33333333 0.33333333 0.33333333] - Spacegroup: R-3c (167) - ---------------------------- primitive cell ------------------------------- - Lattice vectors: - a 2.403817201137804 1.387844508159565 4.372423306604251 - b -2.403817201137804 1.387844508159565 4.372423306604251 - c 0.000000000000000 -2.775689016319131 4.372423306604251 - Atomic positions (fractional): - *1 Al 0.35218509422890 0.35218509422890 0.35218509422890 26.982 - 2 Al 0.64781490577110 0.64781490577110 0.64781490577110 26.982 - 3 Al 0.14781490577110 0.14781490577110 0.14781490577110 26.982 - 4 Al 0.85218509422890 0.85218509422890 0.85218509422890 26.982 - *5 O 0.55616739064549 0.94383260935451 0.25000000000000 15.999 - 6 O 0.44383260935451 0.05616739064549 0.75000000000000 15.999 - 7 O 0.25000000000000 0.55616739064549 0.94383260935451 15.999 - 8 O 0.75000000000000 0.44383260935451 0.05616739064549 15.999 - 9 O 0.94383260935451 0.25000000000000 0.55616739064549 15.999 - 10 O 0.05616739064549 0.75000000000000 0.44383260935451 15.999 - ------------------------------ unit cell ---------------------------------- - Lattice vectors: - a 4.807634402275609 0.000000000000000 0.000000000000000 - b -2.403817201137805 4.163533524478696 0.000000000000000 - c 0.000000000000000 0.000000000000000 13.117269919812754 - Atomic positions (fractional): - *1 Al 0.00000000000000 0.00000000000000 0.35218509422890 26.982 > 1 - 2 Al 0.66666666666666 0.33333333333334 0.68551842756224 26.982 > 1 - 3 Al 0.33333333333334 0.66666666666666 0.01885176089557 26.982 > 1 - 4 Al 0.00000000000000 0.00000000000000 0.64781490577110 26.982 > 2 - 5 Al 0.66666666666666 0.33333333333334 0.98114823910443 26.982 > 2 - 6 Al 0.33333333333334 0.66666666666666 0.31448157243776 26.982 > 2 - 7 Al 0.00000000000000 0.00000000000000 0.14781490577110 26.982 > 3 - 8 Al 0.66666666666666 0.33333333333334 0.48114823910443 26.982 > 3 - 9 Al 0.33333333333334 0.66666666666666 0.81448157243776 26.982 > 3 - 10 Al 0.00000000000000 0.00000000000000 0.85218509422890 26.982 > 4 - 11 Al 0.66666666666666 0.33333333333334 0.18551842756224 26.982 > 4 - 12 Al 0.33333333333334 0.66666666666666 0.51885176089557 26.982 > 4 - *13 O 0.30616739064549 0.00000000000000 0.25000000000000 15.999 > 5 - 14 O 0.97283405731215 0.33333333333334 0.58333333333334 15.999 > 5 - 15 O 0.63950072397883 0.66666666666666 0.91666666666666 15.999 > 5 - 16 O 0.69383260935451 0.00000000000000 0.75000000000000 15.999 > 6 - 17 O 0.36049927602117 0.33333333333334 0.08333333333334 15.999 > 6 - 18 O 0.02716594268785 0.66666666666666 0.41666666666666 15.999 > 6 - 19 O 0.00000000000000 0.30616739064549 0.25000000000000 15.999 > 7 - 20 O 0.66666666666666 0.63950072397883 0.58333333333334 15.999 > 7 - 21 O 0.33333333333334 0.97283405731215 0.91666666666666 15.999 > 7 - 22 O 0.00000000000000 0.69383260935451 0.75000000000000 15.999 > 8 - 23 O 0.66666666666666 0.02716594268785 0.08333333333334 15.999 > 8 - 24 O 0.33333333333334 0.36049927602117 0.41666666666666 15.999 > 8 - 25 O 0.69383260935451 0.69383260935451 0.25000000000000 15.999 > 9 - 26 O 0.36049927602117 0.02716594268785 0.58333333333334 15.999 > 9 - 27 O 0.02716594268785 0.36049927602117 0.91666666666666 15.999 > 9 - 28 O 0.30616739064549 0.30616739064549 0.75000000000000 15.999 > 10 - 29 O 0.97283405731215 0.63950072397883 0.08333333333334 15.999 > 10 - 30 O 0.63950072397883 0.97283405731215 0.41666666666666 15.999 > 10 - ------------------------------ supercell ---------------------------------- - ... - -If VASP is used as the calculator for Born effective charge, and the -hexagonal unit cell is used for the calculation, the Born effective -charge tensors of atoms No. 1 and 13 have to be written in ``BORN`` -file. - -Example -~~~~~~~ -:: - - 14.400 - 3.269 0.000 0.000 0.000 3.269 0.000 0.000 0.000 3.234 - 2.981 0.000 0.000 0.000 2.981 0.000 0.000 0.000 2.952 - -1.935 0.000 0.000 0.000 -2.036 -0.261 0.000 -0.261 -1.968 - -or using the default NAC unit conversion factor (version 1.10.4 or later), - -:: - - default value - 3.269 0.000 0.000 0.000 3.269 0.000 0.000 0.000 3.234 - 2.981 0.000 0.000 0.000 2.981 0.000 0.000 0.000 2.952 - -1.935 0.000 0.000 0.000 -2.036 -0.261 0.000 -0.261 -1.968 diff -Nru phonopy-2.12.0/doc/install.md phonopy-2.13.1/doc/install.md --- phonopy-2.12.0/doc/install.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/install.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,213 @@ +(install)= + +# Installation + +```{contents} +:depth: 3 +:local: +``` + +(install_conda)= + +## Installation via conda + +Conda is a software package management system. Once the conda system is set-up +(see [miniforge](https://github.com/conda-forge/miniforge)), the installation of +phonopy is super easy for any of Linux, MacOSX, and Windows. Phonopy is +installed using conda by + +```bash +% conda install -c conda-forge phonopy +``` + +This phonopy's conda package is prepared and maintained by Paweł T. Jochym at +conda-forge channel (please be aware that this is not a trivial job). + +### Minimum steps to install and use phonopy via conda + +In the following procedure, conda's environment (see +[miniforge](https://github.com/conda-forge/miniforge)) is used not to interfere +existing environment (mainly python environment). + +```bash +% conda create -n phonopy -c conda-forge +% conda activate phonopy +% conda install -c conda-forge phonopy +``` + +To exit from this conda's environment: + +```bash +% conda deactivate +``` + +To use this phonopy, entering this environment is necessary like below. + +``` +% conda activate phonopy +(phonopy) % phonopy + _ + _ __ | |__ ___ _ __ ___ _ __ _ _ + | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | + | |_) | | | | (_) | | | | (_) || |_) | |_| | + | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | + |_| |_| |___/ + 2.12.0 + +Python version 3.9.6 +Spglib version 1.16.2 + + +Supercell matrix (DIM or --dim) was not explicitly specified. +By this reason, phonopy_yaml mode was invoked. +But "phonopy_params.yaml", "phonopy_disp.yaml" and "phonopy.yaml" could not be found. + ___ _ __ _ __ ___ _ __ + / _ \ '__| '__/ _ \| '__| +| __/ | | | | (_) | | + \___|_| |_| \___/|_| +``` + +(install_from_source)= + +## Using HDF5 on NFS mounted file system + +Recent hdf5 versions just as installed may not work on NFS mounted file systems. +In this case, setting the following environment variable may solve the problem: + +```bash +export HDF5_USE_FILE_LOCKING=FALSE +``` + +## Installation from source code + +### System requirement + +The procedure to setup phonopy is explained in this section. It is supposed that +phonopy is installed on the recent linux distribution like Ubuntu or Fedora with +Python version 3.6 or later. Mac OS X users may use conda (conda-forge channel) +packages. Windows users should use conda (conda-forge channel) packages as well. + +Prepare the following Python libraries: + +- Python (>=3.6) and its header files +- numpy (>=1.11) +- matplotlib (>=2.0) +- python-yaml (pyyaml) +- python-h5py (h5py) +- spglib + +It is recommended to install seekpath to plot phonon band structure: + +- seekpath + +Scipy is optional because most of features of phonopy can work without scipy, +but scipy is needed for fitting to equations of states for quasi-harmonic phonon +calculation. + +- scipy + +For the CP2K interface, the following package will be needed to install: + +- cp2k-input-tools + +### Installing required packages by conda + +The python libraries can be installed using conda. Conda packages are +distributed in binary. Minimum setup of conda envrironment is done by miniforge, +which is downloaded at https://github.com/conda-forge/miniforge. It is strongly +recommended to create conda's virtual environment by +`conda create -n ` as written above. The installation of necessary +libraries is done as follows: + +```bash +% conda install -c conda-forge numpy scipy h5py pyyaml matplotlib-base seekpath spglib +``` + +A libblas library installed can be chosen among `[openblas, mkl, blis, netlib]`. +If specific one is expected, it is installed by (e.g. `openblas`) + +``` +% conda install -c conda-forge "libblas=*=*openblas" +``` + +If you need a compiler, + +``` +% conda install -c conda-forge complilers +``` + +(install_setup_py)= + +### Building using setup.py + +If package installation is not possible or you want to compile with special +compiler or special options, phonopy is built using `setup.py`. In this case, +manual modification of `setup.py` may be needed. + +1. Get the source code from github + + ```bash + % git clone https://github.com/phonopy/phonopy.git + % cd phonopy + % git checkout master + ``` + +2. Run `setup.py` script + + ``` + % python setup.py build + % pip install -e . + ``` + +(install_trouble_shooting)= + +## Trouble shooting + +### Remove previous phonopy installations + +Sometimes previous installations of phonopy prevent from loading newly installed +phonopy. In this case, it is recommended to uninstall all the older phonopy +packages by + +1. Running `pip uninstall phonopy` as many times as no phonopy packages will be + found. Error message may be shown, but don't mind it. Similarly do + `conda uninstall phonopy`. + +2. There may still exist litter of phonopy packages. So it is also recommend to + remove them if it is found, e.g.: + + ``` + % rm -fr ~/.local/lib/python*/site-packages/phonopy* + ``` + +Set correct environment variables `PATH` and `PYTHONPATH` + +### When using conda environment, this information is not applicable. + +In phonopy, `PATH` and `PYTHONPATH` play important roles. Of course the +information about them can be easily found in internet (e.g. +https://en.wikipedia.org/wiki/PATH_(variable)), so you really have to find +information by yourself and read them. Even if you can't understand them, first +you must ask to your colleagues or people before sending this unnecessary +question (as a researcher using computer simulation) to the mailing list. + +The problem appears when phonopy execution and library paths are set multiple +times in those environment variable. It is easy to check current environment +variables by: + +``` +% echo $PATH +``` + +``` +% echo $PYTHONPATH +``` + +When multiple different phonopy paths are found, remove all except for what you +really need. Then logout from the current shell (terminal) and open new shell +(terminal) to confirm that the modification is activated. + +### Missing Intel libraries when building from source using icc + +`LDSHARED="icc -shared"` may be of help. See this github issues, +https://github.com/phonopy/phonopy/issues/123. diff -Nru phonopy-2.12.0/doc/install.rst phonopy-2.13.1/doc/install.rst --- phonopy-2.12.0/doc/install.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/install.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,211 +0,0 @@ -.. _install: - -Installation -============= - -.. contents:: - :depth: 3 - :local: - -.. _install_conda: - -Installation via conda ----------------------- - -Conda is an open source package management system. Once the conda -system is set-up (see `details about conda setting up -`_), the installation -of phonopy is super easy for any of Linux, MacOSX, and Windows. -To install:: - - % conda install -c conda-forge phonopy - -This phonopy's conda package is prepared and maintained by -Paweł T. Jochym at conda-forge channel (please be aware that this is -not a trivial job). - -Minimum steps to install and use phonopy via conda -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In the following procedure, conda's environment (see `details at conda -web site -`_) -is used not to interfere existing environment (mainly python -environment). - -:: - - % conda create -n phonopy -c conda-forge - % conda activate phonopy - % conda install -c conda-forge phonopy - -To exit from this conda's environment:: - - % conda deactivate - -To use this phonopy, entering this environment is necessary like below. - -:: - - % conda activate phonopy - (phonopy) % phonopy - _ __ | |__ ___ _ __ ___ _ __ _ _ - | '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | | - | |_) | | | | (_) | | | | (_) || |_) | |_| | - | .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, | - |_| |_| |___/ - 2.7.0 - - Python version 3.7.6 - Spglib version 1.14.1 - - - Supercell matrix (DIM or --dim) was not explicitly specified. - By this reason, phonopy_yaml mode was invoked. - But "phonopy_params.yaml", "phonopy_disp.yaml" and "phonopy.yaml" could not be found. - ___ _ __ _ __ ___ _ __ - / _ \ '__| '__/ _ \| '__| - | __/ | | | | (_) | | - \___|_| |_| \___/|_| - -.. _install_from_source: - -Using HDF5 on NFS mounted file system -------------------------------------- - -Recent hdf5 versions just as installed may not work on NFS mounted -file systems. In this case, setting the following environment variable -may solve the problem:: - - export HDF5_USE_FILE_LOCKING=FALSE - - -Installation from source code ------------------------------ - -System requirement -~~~~~~~~~~~~~~~~~~ - -The procedure to setup phonopy is explained in this section. It is -supposed that phonopy is installed on the recent linux distribution -like Ubuntu or Fedora with Python version 2.7 or later. Python version -3.4 or later is expected to work. Mac OS X users may use conda -(conda-forge channel) packages. Windows users should use conda -(conda-forge channel) packages as well. - -Prepare the following Python libraries: - -* Python (>=3.6) and its header files -* numpy (>=1.11) -* matplotlib (>=2.0) -* python-yaml (pyyaml) -* python-h5py (h5py) - -For the CP2K interface, the following package will be needed to install: - -* cp2k-input-tools - - -Installing required packages by conda -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The python libraries can be installed using conda. Conda packages are -distributed in binary. Minimum setup of conda envrironment is done by -miniconda, which is downloaded at https://conda.io/miniconda.html. It -is strongly recommended to create conda's virtual environment by -``conda create -n `` as written above. The installation of -necessary libraries is done as follows:: - - % conda install -c conda-forge numpy scipy h5py pyyaml matplotlib-base spglib - -A libblas library installed can be chosen among ``[openblas, mkl, blis, -netlib]``. If specific one is expected, it is installed by (e.g. ``openblas``) - -:: - - % conda install -c conda-forge "libblas=*=*openblas" - -If you need a compiler, - -:: - - % conda install -c conda-forge complilers - -.. _install_setup_py: - -Building using setup.py -~~~~~~~~~~~~~~~~~~~~~~~~ - -If package installation is not possible or you want to compile with -special compiler or special options, phonopy is built using -setup.py. In this case, manual modification of ``setup.py`` may be -needed. - -1. Get the source code from github - - :: - - % git clone https://github.com/phonopy/phonopy.git - % cd phonopy - % git checkout master - -2. Run ``setup.py`` script - - :: - - % python setup.py build - % pip install -e . - -.. _install_trouble_shooting: - -Trouble shooting ------------------ - -Remove previous phonopy installations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Sometimes previous installations of phonopy prevent from loading newly -installed phonopy. In this case, it is recommended to uninstall all -the older phonopy packages by - -1. Running ``pip uninstall phonopy`` as many times as no phonopy - packages will be found. Error message may be shown, but don't mind - it. Similarly do ``conda uninstall phonopy``. - -2. There may still exist litter of phonopy packages. So it is also - recommend to remove them if it is found, e.g.:: - - % rm -fr ~/.local/lib/python*/site-packages/phonopy* - -Set correct environment variables ``PATH`` and ``PYTHONPATH`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When using conda environment, this information is not applicable. - -In phonopy, ``PATH`` and ``PYTHONPATH`` play important roles. Of -course the information about them can be easily found in internet -(e.g. https://en.wikipedia.org/wiki/PATH_(variable)), so you really -have to find information by yourself and read them. Even if you can't -understand them, first you must ask to your colleagues or people -before sending this unnecessary question (as a researcher using -computer simulation) to the mailing list. - -The problem appears when phonopy execution and library paths are set -multiple times in those environment variable. It is easy to check -current environment variables by:: - - % echo $PATH - -:: - - % echo $PYTHONPATH - -When multiple different phonopy paths are found, remove all except for -what you really need. Then logout from the current shell (terminal) -and open new shell (terminal) to confirm that the modification is activated. - -Missing Intel libraries when building from source using icc -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``LDSHARED="icc -shared"`` may be of help. See this github issues, -https://github.com/phonopy/phonopy/issues/123. diff -Nru phonopy-2.12.0/doc/interfaces.md phonopy-2.13.1/doc/interfaces.md --- phonopy-2.12.0/doc/interfaces.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/interfaces.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,148 @@ +(calculator_interfaces)= + +# Interfaces to calculators + +```{contents} +:depth: 3 +:local: +``` + +The interfaces for VASP, WIEN2k, Quantum ESPRESSO (QE), ABINIT, Elk, SIESTA, +CRYSTAL, DFTB+, TURBOMOLE, FHI-AIMS, and CASTEP are built in to the usual +phonopy command. See the command options and how to invoke each of them at +{ref}`force_calculators`. {ref}`LAMMPS interface ` +is provided as an external tool by Abel Carreras. + +(interfaces_to_force_calculators)= + +## List of force calculators + +Short tutorials for the force calculators are found in the following pages. + +```{toctree} +:maxdepth: 1 +vasp +wien2k +qe +abinit +siesta +elk +crystal +dftb+ +turbomole +cp2k +aims +castep +Fleur +``` + +The VASP DFPT interface reads `vasprun.xml` and creates `FORCE_CONSTANTS` file. + +```{toctree} +:maxdepth: 1 +vasp-dfpt +``` + +## Physical unit system for calculator + +Physical unit systems used for the calculators are as follows: + +``` + | Distance Atomic mass Force Force constants +----------------------------------------------------------------- +VASP | Angstrom AMU eV/Angstrom eV/Angstrom^2 +WIEN2k | au (bohr) AMU mRy/au mRy/au^2 +QE | au (bohr) AMU Ry/au Ry/au^2 +ABINIT | au (bohr) AMU eV/Angstrom eV/Angstrom.au +SIESTA | au (bohr) AMU eV/Angstrom eV/Angstrom.au +Elk | au (bohr) AMU hartree/au hartree/au^2 +CRYSTAL | Angstrom AMU eV/Angstrom eV/Angstrom^2 +TURBOMOLE | au (bohr) AMU hartree/au hartree/au^2 +CP2K | Angstrom AMU hartree/au hartree/Angstrom.au +FHI-AIMS | Angstrom AMU eV/Angstrom eV/Angstrom^2 +Fleur | au (bohr) AMU hartree/au hartree/au^2 +``` + +For these sets of physical properties, phonon frequency is calculated in THz. + +## Default file name, value, and conversion factor + +### Default unit cell file name for calculator + +Without specifying `-c` option, default file name for unit cell is used as shown +below: + +``` +VASP | POSCAR +WIEN2k | case.struct +QE | unitcell.in +ABINIT | unitcell.in +SIESTA | input.fdf +Elk | elk.in +CRYSTAL | crystal.o +DFTB+ | geo.gen +TURBOMOLE | control +CP2K | unitcell.inp +FHI-AIMS | geometry.in +Fleur | fleur.in +``` + +### Default displacement distances + +Without specifying `DISPLACEMENT_DISTANCE` tag or `--amplitude` option, default +displacement distance is used when creating supercells with displacements +`CREATE_DISPLACEMENTS = .TRUE.` or `-d` option. The default value is dependent +on calculator, and the list is shown below: + +``` +VASP | 0.01 Angstrom +WIEN2k | 0.02 au (bohr) +QE | 0.02 au (bohr) +ABINIT | 0.02 au (bohr) +SIESTA | 0.02 au (bohr) +Elk | 0.02 au (bohr) +CRYSTAL | 0.01 Angstrom +DFTB+ | 0.01 au (bohr) +TURBOMOLE | 0.02 au (bohr) +CP2K | 0.01 Angstrom +FHI-AIMS | 0.01 Angstrom +Fleur | 0.02 au (bohr) +``` + +(frequency_default_value_interfaces)= + +### Default unit conversion factor of phonon frequency to THz + +``` +VASP | 15.633302 +WIEN2k | 3.44595837 +QE | 108.97077 +ABINIT | 21.49068 +SIESTA | 21.49068 +Elk | 154.10794 +CRYSTAL | 15.633302 +DFTB+ | 154.10794 +TURBOMOLE | 154.10794 +CP2K | 112.10516 +FHI-AIMS | 15.633302 +Fleur | 154.10794 +``` + +(nac_default_value_interfaces)= + +### Default unit conversion factor for non-analytical term correction + +``` +VASP | 14.399652 +WIEN2k | 2000 +QE | 2 +ABINIT | 51.422090 +SIESTA | 51.422090 +Elk | 1 +CRYSTAL | 14.399652 +DFTB+ | 14.399652 +TURBOMOLE | 1 +CP2K | None (N/A) +FHI-AIMS | 14.399652 +Fleur | 1 (but feature N/A) +``` diff -Nru phonopy-2.12.0/doc/interfaces.rst phonopy-2.13.1/doc/interfaces.rst --- phonopy-2.12.0/doc/interfaces.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/interfaces.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,155 +0,0 @@ -.. _calculator_interfaces: - -Interfaces to calculators -========================== - -.. contents:: - :depth: 3 - :local: - -The interfaces for VASP, WIEN2k, Quantum ESPRESSO (QE), ABINIT, Elk, -SIESTA, CRYSTAL, DFTB+, TURBOMOLE, FHI-AIMS, and CASTEP are built in -to the usual phonopy command. See the -command options and how to invoke each of them at -:ref:`force_calculators`. :ref:`LAMMPS interface -` is provided as an external tool by Abel -Carreras. - -.. _interfaces_to_force_calculators: - -List of force calculators -------------------------- - -Short tutorials for the force calculators are found in the following -pages. - -.. toctree:: - :maxdepth: 1 - - vasp - wien2k - qe - abinit - siesta - elk - crystal - dftb+ - turbomole - cp2k - aims - castep - Fleur - -The VASP DFPT -interface reads ``vasprun.xml`` and creates ``FORCE_CONSTANTS`` file. - -.. toctree:: - :maxdepth: 1 - - vasp-dfpt - -Physical unit system for calculator ------------------------------------- - -Physical unit systems used for the calculators are as follows:: - - | Distance Atomic mass Force Force constants - ----------------------------------------------------------------- - VASP | Angstrom AMU eV/Angstrom eV/Angstrom^2 - WIEN2k | au (bohr) AMU mRy/au mRy/au^2 - QE | au (bohr) AMU Ry/au Ry/au^2 - ABINIT | au (bohr) AMU eV/Angstrom eV/Angstrom.au - SIESTA | au (bohr) AMU eV/Angstrom eV/Angstrom.au - Elk | au (bohr) AMU hartree/au hartree/au^2 - CRYSTAL | Angstrom AMU eV/Angstrom eV/Angstrom^2 - TURBOMOLE | au (bohr) AMU hartree/au hartree/au^2 - CP2K | Angstrom AMU hartree/au hartree/Angstrom.au - FHI-AIMS | Angstrom AMU eV/Angstrom eV/Angstrom^2 - Fleur | au (bohr) AMU hartree/au hartree/au^2 - -For these sets of physical properties, phonon frequency is calculated -in THz. - -Default file name, value, and conversion factor ---------------------------------------------------- - -Default unit cell file name for calculator -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Without specifying ``-c`` option, default file name for unit cell is -used as shown below:: - - VASP | POSCAR - WIEN2k | case.struct - QE | unitcell.in - ABINIT | unitcell.in - SIESTA | input.fdf - Elk | elk.in - CRYSTAL | crystal.o - DFTB+ | geo.gen - TURBOMOLE | control - CP2K | unitcell.inp - FHI-AIMS | geometry.in - Fleur | fleur.in - -Default displacement distances -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Without specifying ``DISPLACEMENT_DISTANCE`` tag or ``--amplitude`` -option, default displacement distance is used when creating supercells -with displacements ``CREATE_DISPLACEMENTS = .TRUE.`` or ``-d`` -option. The default value is dependent on calculator, and the list is -shown below:: - - VASP | 0.01 Angstrom - WIEN2k | 0.02 au (bohr) - QE | 0.02 au (bohr) - ABINIT | 0.02 au (bohr) - SIESTA | 0.02 au (bohr) - Elk | 0.02 au (bohr) - CRYSTAL | 0.01 Angstrom - DFTB+ | 0.01 au (bohr) - TURBOMOLE | 0.02 au (bohr) - CP2K | 0.01 Angstrom - FHI-AIMS | 0.01 Angstrom - Fleur | 0.02 au (bohr) - -.. _frequency_default_value_interfaces: - -Default unit conversion factor of phonon frequency to THz -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:: - - VASP | 15.633302 - WIEN2k | 3.44595837 - QE | 108.97077 - ABINIT | 21.49068 - SIESTA | 21.49068 - Elk | 154.10794 - CRYSTAL | 15.633302 - DFTB+ | 154.10794 - TURBOMOLE | 154.10794 - CP2K | 112.10516 - FHI-AIMS | 15.633302 - Fleur | 154.10794 - -.. _nac_default_value_interfaces: - -Default unit conversion factor for non-analytical term correction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:: - - VASP | 14.399652 - WIEN2k | 2000 - QE | 2 - ABINIT | 51.422090 - SIESTA | 51.422090 - Elk | 1 - CRYSTAL | 14.399652 - DFTB+ | 14.399652 - TURBOMOLE | 1 - CP2K | None (N/A) - FHI-AIMS | 14.399652 - Fleur | 1 (but feature N/A) diff -Nru phonopy-2.12.0/doc/output-files.md phonopy-2.13.1/doc/output-files.md --- phonopy-2.12.0/doc/output-files.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/output-files.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,220 @@ +(output_files)= + +# Output files + +```{contents} +:depth: 2 +:local: +``` + +The output data are stored in the following files on the current directory. + +## List of files + +### `band.yaml` + +Sets of phonon frequencies on band paths calculated by the +{ref}`band-structure mode ` (e.g. `BAND` tag) are +stored in the YAML format. + +`band.yaml` is viewed using the tool `phonopy-bandplot` ({ref}`bandplot_tool`). +`phonopy-bandplot` can convert the data in the YAML format to that in the +gnuplot-style format using the `--gnuplot` option. + +### `mesh.yaml` + +A set of frequencies on irreducible q-points of a q-point mesh by the +{ref}`mesh-sampling mode ` (`MESH` tag) is stored in the YAML +format. + +### `qpoints.yaml` + +A set of frequencies calculated by the {ref}`q-points mode ` +(`QPOINTS` tag) is stored in the YAML format. + +### `thermal_properties.yaml` + +{ref}`Thermal properties ` calculated are stored in the +YAML format. + +The auxiliary tool `phonopy-propplot` ({ref}`propplot_tool`) can be used to plot +the content of `thermal_properties.yaml`. + +### `thermal_displacements.yaml` + +{ref}`Mean square displcements of atoms ` are stored +in the YAML format. Without projecting eigenvectors along a specific direction, +the results projected along Cartesianl coordinates, therefore three values for +each atom at a temperature, are written into the file. + +### `thermal_displacement_matrices.yaml` + +{ref}`Mean square displacement matricies of atoms ` +are stored in the YAML format. Since the matrix for each atom at a temperature +is symmetric, only six elements of it, xx, yy, zz, yz, xz, xy, are written in +this order. + +### `total_dos.dat` and `projected_dos.dat` + +{ref}`Total and projected DOS ` are stored in the simple +format, respectively. + +`total_dos.dat` and `projected_dos.dat` are viewed using the auxiliary tool +`phonopy-pdosplot` ({ref}`pdosplot_tool`). + +#### File format of `projected_dos.dat` + +The first column is the phonon frequency. The following colums are the projected +density of states for atoms in the primitive cell. In the +{ref}`NaCl example `, there are two atoms in the primitive cell, +which are one Na and one Cl atoms. The order of atoms in the primitive cell is +confirmed running phonopy with the `-v` option. The `projected_dos.dat` of this +example is starting with the following lines: + +``` +# Sigma = 0.063253 + -0.6695362607 0.0000000000 0.0000000000 + -0.6379098952 0.0000000000 0.0000000000 + -0.6062835296 0.0000000000 0.0000000000 + -0.5746571641 0.0000000000 0.0000000000 + -0.5430307986 0.0000000000 0.0000000000 + -0.5114044331 0.0000000000 0.0000000000 + -0.4797780675 0.0000000000 0.0000000000 + -0.4481517020 0.0000000000 0.0000000000 + -0.4165253365 0.0000000000 0.0000000000 + -0.3848989710 0.0000000000 0.0000000000 + -0.3532726054 0.0000000004 0.0000000006 + -0.3216462399 0.0000000044 0.0000000066 + -0.2900198744 0.0000000370 0.0000000551 + -0.2583935089 0.0000002410 0.0000003596 + -0.2267671433 0.0000012239 0.0000018260 +... +``` + +where from the left to right in each line, frequency, PDOS of Na and PDOS of Cl. +The first line is just a comment to remember the sigma value used. + +With {ref}`xyz_projection_tag` tag specified, the format changes to represent x, +y, and z components: + +``` +# Sigma = 0.063253 + + -0.6695362607 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.6315846221 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.5936329834 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.5556813448 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.5177297062 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.4797780675 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.4418264289 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.4038747903 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 + -0.3659231516 0.0000000000 0.0000000000 0.0000000000 0.0000000001 0.0000000001 0.0000000001 + -0.3279715130 0.0000000009 0.0000000009 0.0000000009 0.0000000014 0.0000000014 0.0000000014 + -0.2900198744 0.0000000123 0.0000000123 0.0000000123 0.0000000184 0.0000000184 0.0000000184 +... +``` + +### `phonopy.yaml` and `phonopy_disp.yaml` + +Phonopy configurations and crystal structures are stored in these files when +running pre-process (`phonopy_disp.yaml`) or post-process (`phonopy.yaml`). + +`phonopy_disp.yaml` contains information used to create supercells with +displacements. The format is hopefully understood just looking into it. +`displacement` is written in Cartesian coordinates. + +### `.hdf5` files + +See {ref}`hdf5_tag`. + +## How to read phonopy YAML files + +Most phonopy results are written in the YAML format. YAML files are easily +translated to the combination of lists and dictionaries in the python case. For +each computer language, e.g., Ruby, each YAML parser is prepared and you can use +those libraries to parse YAML files and analyze the data easily in conjunction +with your favorite language. See http://www.yaml.org/. The basic of the YAML +format is found easily on the web. In python, it is very easy to parse phonopy's +yaml files, e.g., + +```python +import yaml +with open("band.yaml") as f: + data = yaml.load(f) +``` + +### `mesh.yaml`, `band.yaml`, `qpoints.yaml` + +#### General + +```{list-table} +:header-rows: 1 +:widths: 20 80 + +* - Key + - Description +* - nqpoint + - Number of q-points calculated. +* - natom + - Number of atoms in the primitive cell. +* - phonon + - Key name of list for q-points. +* - q-position + - Position of q-vector in reduced coordinates. +* - band + - Key name of list for bands. +* - frequency + - Phonon frequency in a specified unit at each phonon mode +* - eigenvector + - Eigenvector at each phonon mode. + Each eigenvector :math:`\mathbf{e}` of + {ref}`dynamical matrix ` + is shown as sets of three + complex values of each atom along the Cartesian axes in + the primitive cell. The real and imaginary values + correspond to the left and right, respectively. + A set of eigenvectors comprising all bands at a q-point + forms a unitary matrix obtained as the result of + numpy.linalg.eigh, i.e., LAPACK of routine _heevd. + Therefore eigenvectors correspond to the column vectors + of the unitary matrix. +* - group_velocity + - Group velocity at each phonon mode in the + Cartesian coordinates defined in the unit cell. +``` + +#### Mesh sampling mode + +```{list-table} +:header-rows: 1 +:widths: 20 80 + +* - Key + - Description +* - mesh + - Numbers of mesh sampling points along axes of the primitive cell. +* - weight + - In the mesh sampling mode, only phonons at irreducible q-points + are calculated in the default behavior. This value means the + multiplicity of a q-point in the reciprocal space of the primitive cell. +``` + +#### Band structure mode + +```{list-table} +:header-rows: 1 +:widths: 20 80 + +* - Key + - Description +* - distance + - In the band structure mode, this value means the distance from the + origin in the reciprocal space of the primitive cell. The unit is + the reciprocal of length unit used in the real space. +``` + +### `thermal_properties.yaml` + +The physical units of the thermal properties are given in the unit section of +this YAML file. However the physical units are only correct when phonopy ran +with proper physical units. See {ref}`thermal_properties_tag`. diff -Nru phonopy-2.12.0/doc/output-files.rst phonopy-2.13.1/doc/output-files.rst --- phonopy-2.12.0/doc/output-files.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/output-files.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -.. _output_files: - -Output files -============ - -.. contents:: - :depth: 2 - :local: - -The output data are stored in the following files on the current -directory. - -List of files --------------- - -``band.yaml`` -^^^^^^^^^^^^^^ - -Sets of phonon frequencies on band paths calculated by the -:ref:`band-structure mode ` -(e.g. ``BAND`` tag) are stored in the YAML format. - -``band.yaml`` is viewed using the tool ``phonopy-bandplot`` -(:ref:`bandplot_tool`). ``phonopy-bandplot`` can convert the data in the YAML -format to that in the gnuplot-style format using the ``--gnuplot`` option. - -``mesh.yaml`` -^^^^^^^^^^^^^^ - -A set of frequencies on irreducible q-points of a q-point mesh by the -:ref:`mesh-sampling mode ` (``MESH`` tag) is stored in -the YAML format. - -``qpoints.yaml`` -^^^^^^^^^^^^^^^^^ - -A set of frequencies calculated by the -:ref:`q-points mode ` -(``QPOINTS`` tag) is stored in the YAML format. - -``thermal_properties.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:ref:`Thermal properties ` calculated -are stored in the YAML format. - -The auxiliary tool ``phonopy-propplot`` (:ref:`propplot_tool`) can be used to -plot the content of ``thermal_properties.yaml``. - -``thermal_displacements.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:ref:`Mean square displcements of atoms ` -are stored in the YAML format. Without projecting eigenvectors along a -specific direction, the results projected along Cartesianl -coordinates, therefore three values for each atom at a temperature, -are written into the file. - -``thermal_displacement_matrices.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:ref:`Mean square displacement matricies of atoms -` are stored in the YAML -format. Since the matrix for each atom at a temperature is symmetric, -only six elements of it, xx, yy, zz, yz, xz, xy, are written in this -order. - -``total_dos.dat`` and ``projected_dos.dat`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:ref:`Total and projected DOS ` are stored in the -simple format, respectively. - -``total_dos.dat`` and ``projected_dos.dat`` are viewed using the -auxiliary tool ``phonopy-pdosplot`` (:ref:`pdosplot_tool`). - -File format of ``projected_dos.dat`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The first column is the phonon frequency. The following colums are the -projected density of states for atoms in the primitive cell. In the -:ref:`NaCl example `, there are two atoms in the -primitive cell, which are one Na and one Cl atoms. The order of atoms -in the primitive cell is confirmed running phonopy with the ``-v`` -option. The ``projected_dos.dat`` of this example is starting with the -following lines:: - - # Sigma = 0.063253 - -0.6695362607 0.0000000000 0.0000000000 - -0.6379098952 0.0000000000 0.0000000000 - -0.6062835296 0.0000000000 0.0000000000 - -0.5746571641 0.0000000000 0.0000000000 - -0.5430307986 0.0000000000 0.0000000000 - -0.5114044331 0.0000000000 0.0000000000 - -0.4797780675 0.0000000000 0.0000000000 - -0.4481517020 0.0000000000 0.0000000000 - -0.4165253365 0.0000000000 0.0000000000 - -0.3848989710 0.0000000000 0.0000000000 - -0.3532726054 0.0000000004 0.0000000006 - -0.3216462399 0.0000000044 0.0000000066 - -0.2900198744 0.0000000370 0.0000000551 - -0.2583935089 0.0000002410 0.0000003596 - -0.2267671433 0.0000012239 0.0000018260 - ... - -where from the left to right in each line, frequency, PDOS of Na and -PDOS of Cl. The first line is just a comment to remember the sigma -value used. - -With :ref:`xyz_projection_tag` tag specified, the format changes to -represent x, y, and z components:: - - # Sigma = 0.063253 - -0.6695362607 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.6315846221 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.5936329834 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.5556813448 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.5177297062 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.4797780675 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.4418264289 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.4038747903 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 - -0.3659231516 0.0000000000 0.0000000000 0.0000000000 0.0000000001 0.0000000001 0.0000000001 - -0.3279715130 0.0000000009 0.0000000009 0.0000000009 0.0000000014 0.0000000014 0.0000000014 - -0.2900198744 0.0000000123 0.0000000123 0.0000000123 0.0000000184 0.0000000184 0.0000000184 - ... - -``phonopy.yaml`` and ``phonopy_disp.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Phonopy configurations and crystal structures are stored in these -files when running pre-process (``phonopy_disp.yaml``) or post-process -(``phonopy.yaml``). - -``phonopy_disp.yaml`` contains information used to create supercells -with displacements. The format is hopefully understood just looking -into it. ``displacement`` is written in Cartesian coordinates. - -``.hdf5`` files -^^^^^^^^^^^^^^^^^ - -See :ref:`hdf5_tag`. - - -How to read phonopy YAML files -------------------------------- - -Most phonopy results are written in the YAML format. YAML files are -easily translated to the combination of lists and dictionaries in the -python case. For each computer language, e.g., Ruby, each YAML parser -is prepared and you can use those libraries to parse YAML files and -analyze the data easily in conjunction with your favorite -language. See http://www.yaml.org/. The basic of the YAML format is -found easily on the web. In python, it is very easy to parse phonopy's -yaml files, e.g., - -:: - - import yaml - with open("band.yaml") as f: - data = yaml.load(f) - -``mesh.yaml``, ``band.yaml``, ``qpoints.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - -General -~~~~~~~~~~~ - -============== ======================================================= -============== ======================================================= -nqpoint Number of q-points calculated. -natom Number of atoms in the primitive cell. -phonon Key name of list for q-points. -q-position Position of q-vector in reduced coordinates. -band Key name of list for bands. -frequency Phonon frequency in a specified unit at each phonon - mode -eigenvector Eigenvector at each phonon mode. - Each eigenvector :math:`\mathbf{e}` of - :ref:`dynamical matrix ` - is shown as sets of three - complex values of each atom along the Cartesian axes in - the primitive cell. The real and imaginary values - correspond to the left and right, respectively. - A set of eigenvectors comprising all bands at a q-point - forms a unitary matrix obtained as the result of - numpy.linalg.eigh, i.e., LAPACK of routine _heevd. - Therefore eigenvectors correspond to the column vectors - of the unitary matrix. -group_velocity Group velocity at each phonon mode in the - Cartesian coordinates defined in the unit cell. -============== ======================================================= - -Mesh sampling mode -~~~~~~~~~~~~~~~~~~~ - -============== ======================================================= -============== ======================================================= -mesh Numbers of mesh sampling points along axes of the - primitive cell. -weight In the mesh sampling mode, only phonons at irreducible - q-points are calculated in the default behavior. This - value means the multiplicity of a q-point in the - reciprocal space of the primitive cell. -============== ======================================================= - -Band structure mode -~~~~~~~~~~~~~~~~~~~ - -============== ======================================================= -============== ======================================================= -distance In the band structure mode, this value means the - distance from the origin in the reciprocal space of the - primitive cell. The unit is the reciprocal of length - unit used in the real space. -============== ======================================================= - - -``thermal_properties.yaml`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The physical units of the thermal properties are given in the unit -section of this YAML file. However the physical units are only correct -when phonopy ran with proper physical units. See -:ref:`thermal_properties_tag`. diff -Nru phonopy-2.12.0/doc/phonopy-load.md phonopy-2.13.1/doc/phonopy-load.md --- phonopy-2.12.0/doc/phonopy-load.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/phonopy-load.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,68 @@ +(phonopy_load_command)= + +# phonopy-load command + +At phonopy v2.7.0, `phonopy-load` command is installed. This behaves similarly +to `phonopy.load` ({ref}`phonopy_load`) in the phonopy python module. The main +aim of introducing this command is to provide uniform usage over many different +force calculators. Once `phonopy_disp.yaml` is created, the following operations +will be the same using this command. + +The following default behaviours are different from that of those of `phonopy` +command: + +1. `phonopy_xxx.yaml` type file is always necessary in either of two ways: + + - `phonopy_xxx.yaml` type file is given as the first argument of the command. + - `phonopy_xxx.yaml` type file is put in the current directory with one of + the default filenames of `phonopy_params.yaml`, `phonopy_disp.yaml`, + `phonopy.yaml`. The searching preference order is `phonopy_params.yaml` > + `phonopy_disp.yaml` > `phonopy.yaml`. + +2. `-c` option (read crystal structure) does not exist. + +3. Use of command options is recommended, but phonopy configuration file can be + read through `--config` option. + +4. If parameters for non-analytical term correction (NAC) are found, NAC is + automatically enabled. This can be disabled by `--nonac` option. + +5. When force constants are calculated from displacements and forces dataset, + force constants are automatically symmetrized. To disable this, `--no-sym-fc` + option is used. + +6. `--save-params` option is added. With this option, `phonopy_params.yaml` that + contains most of the information to run phonopy, i.e., crystal structure, + displacement-force dataset, and non-analytical term correction parameters. + When displacement-force dataset didn't exist, force constants are written. + +## Examples + +In the NaCl-qe example, + +```bash +% phonopy --qe -d --dim 2 2 2 --pa auto -c NaCl.in +% phonopy-load -f NaCl-00{1,2}.out +``` + +With these commands, `phonopy_disp.yaml` and `FORCE_SETS` are created. After +this step, it is unnecessary to specify `--qe` option to run with +`phonopy-load`. The following command works to draw band structure. + +```bash +% phonopy-load --band auto -p +``` + +Data in `FORCE_SETS` and `BORN` can be saved in `phonopy_params.yaml` using +`--save-params` option. Then phonons can be calculated only with this file as +fillows: + +``` +% phonopy-load --save-params +% mkdir test && cd test +% mv ../phonopy_params.yaml . +% phonopy-load --band auto -p +``` + +In the last line, `phonopy_params.yaml` is read without specifying because this +filename is reserved name to be searched. diff -Nru phonopy-2.12.0/doc/phonopy-load.rst phonopy-2.13.1/doc/phonopy-load.rst --- phonopy-2.12.0/doc/phonopy-load.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/phonopy-load.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -.. _phonopy_load_command: - -phonopy-load command -==================== - -At phonopy v2.7.0, ``phonopy-load`` command is installed. This behaves -similarly to ``phonopy.load`` (:ref:`phonopy_load`) in the phonopy -python module. The main aim of introducing this command is to provide -uniform usage over many different force calculators. Once -``phonopy_disp.yaml`` is created, the following operations will be the -same using this command. - -The following default behaviours are different from that of those -of ``phonopy`` command: - -1. ``phonopy_xxx.yaml`` type file is always necessary in either of two - ways: - - * ``phonopy_xxx.yaml`` type file is given as the first argument of - the command. - * ``phonopy_xxx.yaml`` type file is put in the current directory - with one of the default filenames of ``phonopy_params.yaml``, - ``phonopy_disp.yaml``, ``phonopy.yaml``. The searching - preference order is ``phonopy_params.yaml`` > - ``phonopy_disp.yaml`` > ``phonopy.yaml``. - -4. ``-c`` option (read crystal structure) does not exist. - -5. Use of command options is recommended, but phonopy configuration - file can be read through ``--config`` option. - -6. If parameters for non-analytical term correction (NAC) are - found, NAC is automatically enabled. This can be disabled by - ``--nonac`` option. - -7. When force constants are calculated from displacements and forces - dataset, force constants are automatically symmetrized. To disable - this, ``--no-sym-fc`` option is used. - -8. ``--save-params`` option is added. With this option, - ``phonopy_params.yaml`` that contains most of the information - to run phonopy, i.e., crystal structure, displacement-force - dataset, and non-analytical term correction parameters. When - displacement-force dataset didn't exist, force constants are - written. - -Examples --------- - -In the NaCl-qe example, - -:: - - % phonopy --qe -d --dim 2 2 2 --pa auto -c NaCl.in - % phonopy-load -f NaCl-00{1,2}.out - -With these commands, ``phonopy_disp.yaml`` and ``FORCE_SETS`` are -created. After this step, it is unnecessary to specify ``--qe`` option -to run with ``phonopy-load``. The following command works to draw band -structure. - -:: - - % phonopy-load --band auto -p - -Data in ``FORCE_SETS`` and ``BORN`` can be saved in -``phonopy_params.yaml`` using ``--save-params`` option. Then phonons -can be calculated only with this file as fillows:: - - % phonopy-load --save-params - % mkdir test && cd test - % mv ../phonopy_params.yaml . - % phonopy-load --band auto -p - -In the last line, ``phonopy_params.yaml`` is read without specifying -because this filename is researved name to be searched. diff -Nru phonopy-2.12.0/doc/phonopy-module.md phonopy-2.13.1/doc/phonopy-module.md --- phonopy-2.12.0/doc/phonopy-module.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/phonopy-module.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,759 @@ +(phonopy_module)= + +# Phonopy API for Python + +```{contents} +:depth: 2 +:local: +``` + +**This is under development. Configurations may alter.** Requests or suggestions +are very welcome. + +## Import modules + +After setting the phonopy python path, the phonopy module is imported by: + +```python +from phonopy import Phonopy +``` + +Crystal structure is defined by the `PhonopyAtoms` class. The `PhonopyAtoms` +module is imported by: + +```python +from phonopy.structure.atoms import PhonopyAtoms +``` + +The instance of `PhonopyAtoms` can be made by reading a crystal structure in a +variety of calculator formats found at {ref}`calculator_interfaces`. + +```python +from phonopy.interface.calculator import read_crystal_structure +unitcell, _ = read_crystal_structure("POSCAR-unitcell", interface_mode='vasp') +``` + +For VASP format, the keyword argument of `interface_mode` can be omitted. For +QE, + +```python +unitcell, _ = read_crystal_structure("NaCl.in", interface_mode='qe') +``` + +Note that `read_crystal_structure` returns a tuple and the first element is th +`PhonopyAtoms` instance. + +## Work flow + +The work flow is schematically shown in {ref}`workflow`. + +### Pre-process + +The first step is to create a `Phonopy` object with at least two arguments, a +unit cell (`PhonopyAtoms` object, see {ref}`phonopy_Atoms`) and a supercell +matrix (3x3 array, see {ref}`variable_supercell_matrix`). In the following +example, a {math}`2\times 2\times 2` supercell is created. The displacements to +be introduced to the supercell are internally generated by the +`generate_displacements()` method with the `distance` keyword argument. The +supercells with displacements are obtained by +`get_supercells_with_displacements()` method as a list of `PhonopyAtoms` +objects. + +```python +import numpy as np +from phonopy import Phonopy +from phonopy.structure.atoms import PhonopyAtoms + +a = 5.404 +unitcell = PhonopyAtoms(symbols=['Si'] * 8, + cell=(np.eye(3) * a), + scaled_positions=[[0, 0, 0], + [0, 0.5, 0.5], + [0.5, 0, 0.5], + [0.5, 0.5, 0], + [0.25, 0.25, 0.25], + [0.25, 0.75, 0.75], + [0.75, 0.25, 0.75], + [0.75, 0.75, 0.25]]) +phonon = Phonopy(unitcell, + supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]], + primitive_matrix=[[0, 0.5, 0.5], + [0.5, 0, 0.5], + [0.5, 0.5, 0]]) +phonon.generate_displacements(distance=0.03) +supercells = phonon.supercells_with_displacements +``` + +In this example, the displacement distance is set to 0.03 (in Angstrom if the +crystal structure uses the Angstrom unit and the default value is 0.01.) + +The frequency unit conversion factor to THz has to be set by using the `factor` +keyword in `Phonopy` class. The factors are `VaspToTHz` for VASP, `Wien2kToTHz` +for Wien2k, `AbinitToTHz` for Abinit, `PwscfToTHz` for Pwscf, `ElkToTHz` for +Elk, `SiestaToTHz` for Siesta, `CrystalToTHz` for CRYSTAL, `FleurToTHz` for +Fleur, `VaspToTHz`, and `DftbpToTHz` for DFTB+ is the default value. For +example: + +```python +from phonopy.units import AbinitToTHz + +phonon = Phonopy(unitcell, + supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]], + primitive_matrix=[[0, 0.5, 0.5], + [0.5, 0, 0.5], + [0.5, 0.5, 0]], + factor=AbinitToTHz) +``` + +Some more information on physical unit conversion is found at +{ref}`frequency_conversion_factor_tag`, {ref}`physical_unit_conversion`, and +{ref}`calculator_interfaces`. + +### Post process + +Forces on atoms are supposed to be obtained by running force calculator (e.g. +VASP) with each supercell with a displacement. Then the forces in the +calculation outputs have to be collected by users. However output parsers for +selected calculators are found under `phonopy.interface`, which may be useful. +The forces have to be stored in a specific structure: a numpy array (or nested +list) as follows: + +```python +[ [ [ f_1x, f_1y, f_1z ], [ f_2x, f_2y, f_2z ], ... ], # first supercell + [ [ f_1x, f_1y, f_1z ], [ f_2x, f_2y, f_2z ], ... ], # second supercell + ... ] +``` + +This array (`sets_of_forces`) is set to the `Phonopy` object by: + +```python +phonon.forces = sets_of_forces +``` + +This is the case when the set of atomic displacements is generated internally. +The information of displacements is already stored in the `Phonopy` object. But +if you want to input the forces together with the corresponding custom set of +displacements, `displacement_dataset` has to be prepared as a python dictionary +as follows: + +```python +displacement_dataset = + {'natom': number_of_atoms_in_supercell, + 'first_atoms': [ + {'number': atom index of displaced atom (starting with 0), + 'displacement': displacement in Cartesian coordinates, + 'forces': forces on atoms in supercell}, + {...}, ...]} +``` + +This is set to the `Phonopy` object by: + +```python +phonopy.dataset = displacement_dataset +``` + +From the set of displacements and forces, force constants internally with +calculated supercell sets of forces by + +```python +phonon.produce_force_constants() +``` + +If you have force constants and don't need to create force constants from forces +and displacements, simply set your force constants by + +```python +phonon.force_constants = force_constants +``` + +The force constants matrix is given in 4 dimensional array (better to be a numpy +array of `dtype='double', order='C'`). The shape of force constants matrix is +`(N, N, 3, 3)` where `N` is the number of atoms in the supercell and 3 gives +Cartesian axes. The compact force constants matrix with `(Np, N, 3, 3)` where +`Np` is the number of atoms in the primitive cell is also supported. See the +details at {ref}`file_force_constants`. + +## Phonon calculation + +(phonopy_save_parameters)= + +### Save parameters (`phonopy.save`) + +Basic information and parameters needed for phonon calculation are saved into a +file by `phonopy.save`. + +```python +phonon.save() +``` + +The default file name is `phonopy_params.yaml`. Force sets, displacements, Born +effective charges, and dielectric constant are written in the default behaviour. +If force constants are needed to be written in the yaml file, the argument +`settings` is set as follows: + +```python +phonon.save(settings={'force_constants': True}) +``` + +(phonopy_load)= + +### Shortcut to load input files (`phonopy.load`) + +`phonopy.load` is a convenient python method to create `Phonopy` instance +loading forces, displacements, and parameters for non-analytical term +correction. The details are found in the docstring that can be seen by (e.g., in +ipython) + +```python +In [1]: import phonopy +In [2]: help(phonopy.load) +``` + +Examples of how to use `phonopy.load` are listed below. + +`phonopy_params.yaml` may contain all information needed to prepare phonon +calculation: + +```python +phonon = phonopy.load("phonopy_params.yaml") +``` + +More detailed configuration can be given as follows: + +```python +phonon = phonopy.load(supercell_matrix=[2, 2, 2], + primitive_matrix='auto', + unitcell_filename="POSCAR", + force_constants_filename="force_constants.hdf5") +``` + +With `is_nac=True` (default), `BORN` file in the current directory is read if it +exists. If supercell is passed and `primitive matrix` and `supercell_matrix` are +not set, the primitive cell is automatically searched: + +```python +phonon = phonopy.load(supercell_filename="SPOSCAR", + force_constants_filename="force_constants.hdf5") +``` + +If `FORCE_SETS` exists in the current directory, this below works to be ready +for post-process calculation with automatic choice of primitive matrix: + +```python +phonon = phonopy.load(supercell_filename="SPOSCAR") +``` + +For example, in the `example/NaCl` directory, phonon band structure of NaCl is +easily plotted by + +```python +In [1]: import phonopy + +In [2]: ph = phonopy.load(supercell_filename="SPOSCAR", log_level=1) +Supercell structure was read from "SPOSCAR". +NAC params were read from "BORN". +Force constants were read from "FORCE_CONSTANTS". + +In [3]: print(ph.primitive) +lattice: +- [ 0.000000000000000, 2.845150738087836, 2.845150738087836 ] # a +- [ 2.845150738087836, 0.000000000000000, 2.845150738087836 ] # b +- [ 2.845150738087836, 2.845150738087836, 0.000000000000000 ] # c +points: +- symbol: Na # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 +- symbol: Cl # 2 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + +In [4]: ph.nac_params +Out[4]: +{'born': array([[[ 1.08703000e+00, -5.17677526e-34, -1.06309751e-33], + [-5.45419984e-34, 1.08703000e+00, 1.06309751e-33], + [ 0.00000000e+00, 3.08148791e-33, 1.08703000e+00]], + + [[-1.08672000e+00, -2.93244455e-35, 5.15939995e-34], + [ 5.45264441e-34, -1.08672000e+00, -5.15939995e-34], + [ 0.00000000e+00, 0.00000000e+00, -1.08672000e+00]]]), + 'factor': 14.4, + 'dielectric': array([[2.43533967, 0. , 0. ], + [0. , 2.43533967, 0. ], + [0. , 0. , 2.43533967]])} + +In [5]: ph.auto_band_structure(plot=True).show() +``` + +### Band structure + +Set band paths (`run_band_structure()`) and get the results +(`get_band_structure_dict()`). + +A dictionary with `qpoints`, `distances`, `frequencies`, `eigenvectors`, +`group_velocities` is returned by `get_band_structure_dict()`. Eigenvectors can +be obtained when `with_eigenvectors=True` at `run_band_structure()`. See the +details at docstring of `Phonopy.get_band_structure_dict`. Phonon frequency is +sqrt(eigenvalue). A negative eigenvalue has to correspond to the imaginary +frequency, but for the plotting, it is set as the negative value in the above +example. In addition, you need to multiply by your unit conversion factor. In +the case of VASP to transform to THz, the factor is 15.633302. + +In `example/NaCl`, the phonopy is executed from python script, e.g., + +```python +import phonopy +from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections + +path = [[[0, 0, 0], [0.5, 0, 0.5], [0.625, 0.25, 0.625]], + [[0.375, 0.375, 0.75], [0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0.25, 0.75]]] +labels = ["$\\Gamma$", "X", "U", "K", "$\\Gamma$", "L", "W"] +qpoints, connections = get_band_qpoints_and_path_connections(path, npoints=51) +phonon = phonopy.load("phonopy_disp.yaml") +phonon.run_band_structure(qpoints, path_connections=connections, labels=labels) +phonon.plot_band_structure().show() + +# To plot DOS next to band structure +phonon.run_mesh([20, 20, 20]) +phonon.run_total_dos() +phonon.plot_band_structure_and_dos().show() + +# To plot PDOS next to band structure +phonon.run_mesh([20, 20, 20], with_eigenvectors=True, is_mesh_symmetry=False) +phonon.run_projected_dos() +phonon.plot_band_structure_and_dos(pdos_indices=[[0], [1]]).show() +``` + +`path_connections` and `labels` are unnecessary to set unless nice looking +plotting is needed. To obtain eigenvectors, it is necessary to inform to store +eigenvectors by: + +```python +phonon.run_band_structure(bands, with_eigenvectors=True) +``` + +To obtain group velocities: + +```python +phonon.run_band_structure(bands, with_group_velocities=True) +``` + +Automatic selection of band paths using +[SeeK-path](https://seekpath.readthedocs.io/en/latest/) is invoked by + +```python +phonon.auto_band_structure() +``` + +and to plot + +```python +phonon.auto_band_structure(plot=True).show() +``` + +To use this method, `seekpath` python module is needed. + +### Mesh sampling + +Set sampling mesh (`set_mesh`) in reciprocal space. The irreducible _q_-points +and corresponding _q_-point weights, eigenvalues, and eigenvectors are obtained +by `get_mesh_dict()`. `mesh` gives the sampling mesh with Monkhorst-Pack scheme. +The keyword `shift` gives the fractional mesh shift with respect to the +neighboring grid points. + +```python +mesh = [20, 20, 20] +phonon.run_mesh(mesh) +mesh_dict = phonon.get_mesh_dict() +qpoints = mesh_dict['qpoints'] +weights = mesh_dict['weights'] +frequencies = mesh_dict['frequencies'] +eigenvectors = mesh_dict['eigenvectors'] +group_velocities = mesh_dict['group_velocities'] +``` + +To obtain eigenvectors, it is necessary to inform to store eigenvectors by: + +```python +phonon.run_mesh([20, 20, 20], with_eigenvectors=True) +``` + +and for group velocities: + +```python +phonon.run_mesh([20, 20, 20], with_group_velocities=True) +``` + +The first argument of `run_mesh()` can be a float value, which is a length +measure as explained at {ref}`mp_tag`, for example: + +```python +phonon.run_mesh(100.0) +``` + +### DOS and PDOS + +Before starting mesh sampling has to be finished. Then set parameters +(`run_total_dos()` or `run_projected_dos()`) and write the results into files +(`write_total_dos()` and `write_projected_dos()`). In the case of PDOS, the +eigenvectors have to be calculated in the mesh sampling. To get the results +`get_total_dos_dict()` and `get_projected_dos_dict()` can be used. + +To plot total DOS, + +```python +phonon.run_mesh([20, 20, 20]) phonon.run_total_dos() +phonon.plot_total_dos().show() +``` + +and projected DOS + +```python +phonon.run_mesh([20, 20, 20], with_eigenvectors=True, is_mesh_symmetry=False) +phonon.run_projected_dos() +phonon.plot_projected_dos().show() +``` + +Convenient shortcuts exist as follows: + +```python +phonon.auto_total_dos(plot=True).show() +``` + +and + +```python +phonon.auto_projected_dos(plot=True).show() +``` + +### Thermal properties + +Before starting the thermal property calculation, the mesh sampling calculation +has to be done in the **THz unit**. The unit conversion factor for phonon +frequency is set in the pre-process of Phonopy with the `factor` keyword. +Calculation range of temperature is set by the parameters +`run_thermal_properties`. Helmholtz free energy, entropy, heat capacity at +constant volume at temperatures are obtained by `get_thermal_properties_dict`, +where the results are given as a dictionary of temperatures, Helmholtz free +energy, entropy, and heat capacity with keys `temperatures`, `free_energy`, +`entropy`, and `heat_capacity`, respectively. + +```python +phonon.run_mesh([20, 20, 20]) +phonon.run_thermal_properties(t_step=10, + t_max=1000, + t_min=0) +tp_dict = phonon.get_thermal_properties_dict() +temperatures = tp_dict['temperatures'] +free_energy = tp_dict['free_energy'] +entropy = tp_dict['entropy'] +heat_capacity = tp_dict['heat_capacity'] + +for t, F, S, cv in zip(temperatures, free_energy, entropy, heat_capacity): + print(("%12.3f " + "%15.7f" * 3) % ( t, F, S, cv )) + +phonon.plot_thermal_properties().show() +``` + +### Non-analytical term correction + +To apply non-analytical term correction, Born effective charge tensors for all +atoms in **primitive** cell, dielectric constant tensor, and the unit conversion +factor have to be correctly set. The tensors are given in Cartesian coordinates. + +```python +born = [[[1.08878299, 0, 0], + [0, 1.08878299, 0], + [0, 0, 1.08878299]], + [[-1.08878299, 0, 0], + [0, -1.08878299, 0], + [0, 0, -1.08878299]]] +epsilon = [[2.56544559, 0, 0], + [0, 2.56544559, 0], + [0, 0, 2.56544559]] +factors = 14.400 +phonon.nac_params = {'born': born, + 'factor': factors, + 'dielectric': epsilon} +``` + +## Data structure + +### Eigenvectors + +Eigenvectors are given as the column vectors. Internally phonopy uses +`numpy.linalg.eigh` and `eigh` is a wrapper of LAPACK. So eigenvectors follow +the convention of LAPACK, which can be shown at +http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eigh.html + +Eigenvectors corresponding to phonopy yaml output are obtained as follows. + +#### Band structure + +```python +if eigvecs is not None: + for eigvecs_on_path in eigvecs: + for eigvecs_at_q in eigvecs_on_path: + for vec in eigvecs_at_q.T: + print(vec) +``` + +#### Mesh sampling + +```python +if eigvecs is not None: + for eigvecs_at_q in eigvecs: + for vec in eigvecs_at_q.T: + print(vec) +``` + +(phonopy_Atoms)= + +## `PhonopyAtoms` class + +### Initialization + +The usable keywords in the initialization are: + +```python +cell=None, +scaled_positions=None, +positions=None, +numbers=None, +symbols=None, +masses=None, +magnetic_moments=None, +``` + +At least three arguments have to be given at the initialization, which are + +- `cell` +- `positions` or `scaled_positions` +- `symbols` or `numbers` + +(phonopy_Atoms_variables)= + +### Variables + +The following variables are implemented in the `PhonopyAtoms` class in +`phonopy/structure/atoms.py`. + +(phonopy_Atoms_cell)= + +#### `cell` + +Basis vectors are given in the matrix form in Cartesian coordinates. + +```python +[ [ a_x, a_y, a_z ], [ b_x, b_y, b_z ], [ c_x, c_y, c_z ] ] +``` + +#### `scaled_positions` + +Atomic positions in fractional coordinates. + +```python +[ [ x1_a, x1_b, x1_c ], [ x2_a, x2_b, x2_c ], [ x3_a, x3_b, x3_c ], ... ] +``` + +#### `positions` + +Cartesian positions of atoms. + +```python +positions = np.dot(scaled_positions, cell) +``` + +where `np` means the numpy module (`import numpy as np`). + +#### `symbols` + +Chemical symbols, e.g., + +```python +['Zn', 'Zn', 'O', 'O'] +``` + +for the ZnO unit cell. + +#### `numbers` + +Atomic numbers, e.g., + +```python +[30, 30, 8, 8] +``` + +for the ZnO unit cell. + +#### `masses` + +Atomic masses, e.g., + +```python +[65.38, 65.38, 15.9994, 15.9994] +``` + +for the ZnO unit cell. + +### Attributes + +``` +cell +positions +scaled_positions +masses +magnetic_moments +symbols +numbers +volume +``` + +where `volume` is the getter only. + +### Methods + +`unitcell.get_number_of_atoms()` is equivalent to `len(unitcell)`. An instance +can be deep-copied by `unitcell.copy()`. Human-readable crystal structure in +Yaml format is shown by `print(unitcell)`. `unitcell.to_tuple` converts to +spglib crystal structure +(https://spglib.github.io/spglib/python-spglib.html#crystal-structure-cell). + +## Definitions of variables + +(variable_primitive_matrix)= + +### Primitive matrix + +Primitive matrix {math}`M_\mathrm{p}` is a tranformation matrix from lattice +vectors to those of a primitive cell if there exists the primitive cell in the +lattice vectors. Following a crystallography convention, the transformation is +given by + +```{math} +( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p} ) = ( +\mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} ) +M_\mathrm{p} +``` + +where {math}`\mathbf{a}_\mathrm{u}`, {math}`\mathbf{b}_\mathrm{u}`, and +{math}`\mathbf{c}_\mathrm{u}` are the column vectors of the original lattice +vectors, and {math}`\mathbf{a}_\mathrm{p}`, {math}`\mathbf{b}_\mathrm{p}`, and +{math}`\mathbf{c}_\mathrm{p}` are the column vectors of the primitive lattice +vectors. Be careful that the lattice vectors of the `PhonopyAtoms` class are the +row vectors ({ref}`phonopy_Atoms_cell`). Therefore the phonopy code, which +relies on the `PhonopyAtoms` class, is usually written such as + +```python +primitive_lattice = np.dot(original_lattice.T, primitive_matrix).T, +``` + +or equivalently, + +```python +primitive_lattice = np.dot(primitive_matrix.T, original_lattice) +``` + +(variable_supercell_matrix)= + +### Supercell matrix + +Supercell matrix {math}`M_\mathrm{s}` is a transformation matrix from lattice +vectors to those of a super cell. Following a crystallography convention, the +transformation is given by + +```{math} +( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) = ( +\mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} ) +M_\mathrm{s} +``` + +where {math}`\mathbf{a}_\mathrm{u}`, {math}`\mathbf{b}_\mathrm{u}`, and +{math}`\mathbf{c}_\mathrm{u}` are the column vectors of the original lattice +vectors, and {math}`\mathbf{a}_\mathrm{s}`, {math}`\mathbf{b}_\mathrm{s}`, and +{math}`\mathbf{c}_\mathrm{s}` are the column vectors of the supercell lattice +vectors. Be careful that the lattice vectors of the `PhonopyAtoms` class are the +row vectors ({ref}`phonopy_Atoms_cell`). Therefore the phonopy code, which +relies on the `PhonopyAtoms` class, is usually written such as + +```python +supercell_lattice = np.dot(original_lattice.T, supercell_matrix).T, +``` + +or equivalently, + +```python +supercell_lattice = np.dot(supercell_matrix.T, original_lattice) +``` + +### Symmetry search tolerance + +Symmetry search tolerance (often the name `symprec` is used in phonopy) is used +to determine symmetry operations of the crystal structures. The physical unit +follows that of input crystal structure. + +## Getting parameters for non-analytical term correction + +Parameters for non-analytical term correction may be made as follows. This +example assumes that the user knows what are the unit cell and primitive cell +and that the Born effective charge and dielectric constant were calculated using +VASP code by the unit cell. + +```python +import io +import numpy as np +from phonopy.units import Hartree, Bohr +from phonopy.structure.symmetry import symmetrize_borns_and_epsilon +from phonopy.interface.vasp import VasprunxmlExpat + +with io.open("vasprun.xml", "rb") as f: + vasprun = VasprunxmlExpat(f) + vasprun.parse(): + epsilon = vasprun.epsilon + borns = vasprun.born + unitcell = vasprun.cell + +borns_, epsilon_ = symmetrize_borns_and_epsilon( + borns, + epsilon, + unitcell, + primitive_matrix=[[0, 0.5, 0.5], + [0.5, 0, 0.5], + [0.5, 0.5, 0]], + supercell_matrix=np.diag([2, 2, 2]), + symprec=1e-5) + +nac_params = {'born': borns_, + 'factor': Hartree * Bohr, + 'dielectric': epsilon_} +``` + +## PhononDB at Kyoto university + +The phonon calculation database at +http://phonondb.mtl.kyoto-u.ac.jp/ph20180417/index.html can be easily used from +phonopy-API. Downloading the raw data, e.g., `mp-361-20180417.tar.lzma` and +expand it. In the directory `mp-361-20180417`, + +```python +% ipython +``` + +or we can use jupyter notebook. The data is loaded by + +```python +In [1]: import phonopy + +In [2]: ph = phonopy.load("phonon.yaml") +``` + +For example, the band structure is plotted by + +```python +In [3]: ph.auto_band_structure(plot=True).show() +``` + +and similarly for PDOS + +```python +In [4]: ph.auto_projected_dos(plot=True).show() +``` diff -Nru phonopy-2.12.0/doc/phonopy-module.rst phonopy-2.13.1/doc/phonopy-module.rst --- phonopy-2.12.0/doc/phonopy-module.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/phonopy-module.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,803 +0,0 @@ -.. _phonopy_module: - -Phonopy API for Python -================================= - -.. contents:: - :depth: 2 - :local: - -**This is under development. Configurations may alter.** Requests or -suggestions are very welcome. - -Import modules ---------------- - -After setting the phonopy python path, the phonopy module is imported by:: - - from phonopy import Phonopy - -Crystal structure is defined by the ``PhonopyAtoms`` class. The -``PhonopyAtoms`` module is imported by:: - - from phonopy.structure.atoms import PhonopyAtoms - -The instance of ``PhonopyAtoms`` can be made by reading a crystal -structure in a variety of calculator formats found at :ref:`calculator_interfaces`. - -:: - - from phonopy.interface.calculator import read_crystal_structure - unitcell, _ = read_crystal_structure("POSCAR-unitcell", interface_mode='vasp') - -For VASP format, the keyward argument of ``interface_mode`` can be -omitted. For QE, - -:: - - unitcell, _ = read_crystal_structure("NaCl.in", interface_mode='qe') - -Note that ``read_crystal_structure`` returns a tuple and the first element is -the ``PhonopyAtoms`` instance. - -Work flow ----------- - -The work flow is schematically shown in :ref:`workflow`. - -Pre-process -^^^^^^^^^^^^ - -The first step is to create a ``Phonopy`` object with at least two -arguments, a unit cell (``PhonopyAtoms`` object, see -:ref:`phonopy_Atoms`) and a supercell matrix (3x3 array, see -:ref:`variable_supercell_matrix`). In the following example, a -:math:`2\times 2\times 2` supercell is created. The displacements to -be introduced to the supercell are internally generated by the -``generate_displacements()`` method with the ``distance`` keyword -argument. The supercells with displacements are obtained by -``get_supercells_with_displacements()`` method as a list of -``PhonopyAtoms`` objects. - -:: - - import numpy as np - from phonopy import Phonopy - from phonopy.structure.atoms import PhonopyAtoms - - a = 5.404 - unitcell = PhonopyAtoms(symbols=['Si'] * 8, - cell=(np.eye(3) * a), - scaled_positions=[[0, 0, 0], - [0, 0.5, 0.5], - [0.5, 0, 0.5], - [0.5, 0.5, 0], - [0.25, 0.25, 0.25], - [0.25, 0.75, 0.75], - [0.75, 0.25, 0.75], - [0.75, 0.75, 0.25]]) - phonon = Phonopy(unitcell, - [[2, 0, 0], [0, 2, 0], [0, 0, 2]], - primitive_matrix=[[0, 0.5, 0.5], - [0.5, 0, 0.5], - [0.5, 0.5, 0]]) - phonon.generate_displacements(distance=0.03) - supercells = phonon.supercells_with_displacements - -In this example, the displacement distance is set to 0.03 (in Angstrom -if the crystal structure uses the Angstrom unit and the default value -is 0.01.) - -The frequency unit conversion factor to THz has to be set by using the -``factor`` keyword in ``Phonopy`` class. The factors are ``VaspToTHz`` -for VASP, ``Wien2kToTHz`` for Wien2k, ``AbinitToTHz`` for Abinit, -``PwscfToTHz`` for Pwscf, ``ElkToTHz`` for Elk, ``SiestaToTHz`` for -Siesta, ``CrystalToTHz`` for CRYSTAL, ``FleurToTHz`` for Fleur, -`VaspToTHz``, and ``DftbpToTHz`` for DFTB+ is the default value. For -example:: - - - from phonopy.units import AbinitToTHz - - phonon = Phonopy(unitcell, - [[2, 0, 0], [0, 2, 0], [0, 0, 2]], - primitive_matrix=[[0, 0.5, 0.5], - [0.5, 0, 0.5], - [0.5, 0.5, 0]], - factor=AbinitToTHz) - -Some more information on physical unit conversion is found at -:ref:`frequency_conversion_factor_tag`, -:ref:`physical_unit_conversion`, and :ref:`calculator_interfaces`. - - -Post process -^^^^^^^^^^^^^ - -Forces on atoms are supposed to be obtained by running force -calculator (e.g. VASP) with each supercell with a displacement. Then -the forces in the calculation outputs have to be collected by -users. However output parsers for selected calculators are found under -``phonopy.interface``, which may be useful. The forces have to be -stored in a specific structure: a numpy array (or nested list) as follows:: - - [ [ [ f_1x, f_1y, f_1z ], [ f_2x, f_2y, f_2z ], ... ], # first supercell - [ [ f_1x, f_1y, f_1z ], [ f_2x, f_2y, f_2z ], ... ], # second supercell - ... ] - -This array (``sets_of_forces``) is set to the ``Phonopy`` object by:: - - phonon.set_forces(sets_of_forces) - -This is the case when the set of atomic displacements is generated -internally. The information of displacements is already stored in the -``Phonopy`` object. But if you want to input the forces together with -the corresponding custom set of displacements, -``displacement_dataset`` has to be prepared as a python dictionary as -follows:: - - displacement_dataset = - {'natom': number_of_atoms_in_supercell, - 'first_atoms': [ - {'number': atom index of displaced atom (starting with 0), - 'displacement': displacement in Cartesian coordinates, - 'forces': forces on atoms in supercell}, - {...}, ...]} - -This is set to the ``Phonopy`` object by:: - - phonopy.dataset = displacement_dataset - -From the set of displacements and forces, force constants internally -with calculated suuprcell sets of forces by - -:: - - phonon.produce_force_constants() - -If you have force constants and don't need to create force constants -from forces and displacements, simply set your force constants by - -:: - - phonon.force_constants = force_constants - -The force constants matrix is given in 4 dimensional array (better to -be a numpy array of ``dtype='double', order='C'``). The shape of -force constants matrix is ``(N, N, 3, 3)`` where ``N`` is the number -of atoms in the supercell and 3 gives Cartesian axes. The compact -force constants matrix with ``(Np, N, 3, 3)`` where ``Np`` is the -number of atoms in the primitive cell is also supported. See the -details at :ref:`file_force_constants`. - -Phonon calculation -------------------- - -.. _phonopy_save_parameters: - -Save parameters (``phonopy.save``) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Basic information and parameters needed for phonon calculation are -saved into a file by ``phonopy.save``. - -:: - - phonon.save() - -The default file name is ``phonopy_params.yaml``. Force sets, -displacements, Born effective charges, and dielectric constant are -written in the default behaviour. If force constants are needed to be -written in the yaml file, the argument ``settings`` is set as follows:: - - phonon.save(settings={'force_constants': True}) - - -.. _phonopy_load: - -Shortcut to load input files (``phonopy.load``) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -``phonopy.load`` is a convenient python method to create ``Phonopy`` -instance loading forces, displacements, and parameters for -non-analytical term correction. The details are found in the docstring -that can be seen by (e.g., in ipython) - -:: - - In [1]: import phonopy - In [2]: help(phonopy.load) - -Examples of how to use ``phonopy.load`` are listed below. - -``phonopy_params.yaml`` may contain all information needed to prepare -phonon calculation:: - - phonon = phonopy.load("phonopy_params.yaml") - -More detailed configuration can be given as follows:: - - phonon = phonopy.load(supercell_matrix=[2, 2, 2], - primitive_matrix='auto', - unitcell_filename="POSCAR", - force_constants_filename="force_constants.hdf5") - -With ``is_nac=True`` (default), ``BORN`` file in the current directory -is read if it exists. If supercell is passed and ``primitive matrix`` -and ``supercell_matrix`` are not set, the primitive cell is -automatically searched:: - - phonon = phonopy.load(supercell_filename="SPOSCAR", - force_constants_filename="force_constants.hdf5") - -If ``FORCE_SETS`` exists in the current directory, this below works to -be ready for post-process calculation with automatic choice of -primitive matrix:: - - phonon = phonopy.load(supercell_filename="SPOSCAR") - -For example, in the ``example/NaCl`` directory, phonon band structure -of NaCl is easily plotted by - -:: - - In [1]: import phonopy - - In [2]: ph = phonopy.load(supercell_filename="SPOSCAR", log_level=1) - Supercell structure was read from "SPOSCAR". - NAC params were read from "BORN". - Force constants were read from "FORCE_CONSTANTS". - - In [3]: print(ph.primitive) - lattice: - - [ 0.000000000000000, 2.845150738087836, 2.845150738087836 ] # a - - [ 2.845150738087836, 0.000000000000000, 2.845150738087836 ] # b - - [ 2.845150738087836, 2.845150738087836, 0.000000000000000 ] # c - points: - - symbol: Na # 1 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 22.989769 - - symbol: Cl # 2 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 35.453000 - - In [4]: ph.nac_params - Out[4]: - {'born': array([[[ 1.08703000e+00, -5.17677526e-34, -1.06309751e-33], - [-5.45419984e-34, 1.08703000e+00, 1.06309751e-33], - [ 0.00000000e+00, 3.08148791e-33, 1.08703000e+00]], - - [[-1.08672000e+00, -2.93244455e-35, 5.15939995e-34], - [ 5.45264441e-34, -1.08672000e+00, -5.15939995e-34], - [ 0.00000000e+00, 0.00000000e+00, -1.08672000e+00]]]), - 'factor': 14.4, - 'dielectric': array([[2.43533967, 0. , 0. ], - [0. , 2.43533967, 0. ], - [0. , 0. , 2.43533967]])} - - In [5]: ph.auto_band_structure(plot=True).show() - -Band structure -^^^^^^^^^^^^^^^ - -Set band paths (``run_band_structure()``) and get the results -(``get_band_structure_dict()``). - -A dictionary with ``qpoints``, ``distances``, ``frequencies``, -``eigenvectors``, ``group_velocities`` is returned by -``get_band_structure_dict()``. Eigenvectors can be obtained when -``with_eigenvectors=True`` at ``run_band_structure()``. See the -details at docstring of ``Phonopy.get_band_structure_dict``. Phonon -frequency is sqrt(eigenvalue). A negative eigenvalue has to correspond -to the imaginary frequency, but for the plotting, it is set as the -negative value in the above example. In addition, you need to multiply -by your unit conversion factor. In the case of VASP to transform to -THz, the factor is 15.633302. - -In ``example/NaCl``, the phonopy is executed from python script, e.g., - -:: - - import phonopy - from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections - - path = [[[0, 0, 0], [0.5, 0, 0.5], [0.625, 0.25, 0.625]], - [[0.375, 0.375, 0.75], [0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0.25, 0.75]]] - labels = ["$\\Gamma$", "X", "U", "K", "$\\Gamma$", "L", "W"] - qpoints, connections = get_band_qpoints_and_path_connections(path, npoints=51) - phonon = phonopy.load("phonopy_disp.yaml") - phonon.run_band_structure(qpoints, path_connections=connections, labels=labels) - phonon.plot_band_structure().show() - - # To plot DOS next to band structure - phonon.run_mesh([20, 20, 20]) - phonon.run_total_dos() - phonon.plot_band_structure_and_dos().show() - - # To plot PDOS next to band structure - phonon.run_mesh([20, 20, 20], with_eigenvectors=True, is_mesh_symmetry=False) - phonon.run_projected_dos() - phonon.plot_band_structure_and_dos(pdos_indices=[[0], [1]]).show() - -``path_connections`` and ``labels`` are unnecessary to set unless nice -looking plotting is needed. To obtain eigenvectors, it is necessary to -inform to store eigenvectors by:: - - phonon.run_band_structure(bands, with_eigenvectors=True) - -To obtain group velocities:: - - phonon.run_band_structure(bands, with_group_velocities=True) - -Automatic selection of band paths using `SeeK-path -`_ is invoked by - -:: - - phonon.auto_band_structure() - -and to plot - -:: - - phonon.auto_band_structure(plot=True).show() - -To use this method, ``seekpath`` python module is needed. - - -Mesh sampling -^^^^^^^^^^^^^^ - -Set sampling mesh (``set_mesh``) in reciprocal space. The irreducible -*q*-points and corresponding *q*-point weights, eigenvalues, and -eigenvectors are obtained by ``get_mesh_dict()``. ``mesh`` gives the -sampling mesh with Monkhorst-Pack scheme. The keyword ``shift`` gives -the fractional mesh shift with respect to the neighboring grid points. - -:: - - mesh = [20, 20, 20] - phonon.run_mesh(mesh) - mesh_dict = phonon.get_mesh_dict() - qpoints = mesh_dict['qpoints'] - weights = mesh_dict['weights'] - frequencies = mesh_dict['frequencies'] - eigenvectors = mesh_dict['eigenvectors'] - group_velocities = mesh_dict['group_velocities'] - -To obtain eigenvectors, it is necessary to inform to store -eigenvectors by:: - - phonon.run_mesh([20, 20, 20], with_eigenvectors=True) - -and for group velocities:: - - phonon.run_mesh([20, 20, 20], with_group_velocities=True) - -The first argument of ``run_mesh()`` can be a float value, which is a -length measure as explained at :ref:`mp_tag`, for example:: - - phonon.run_mesh(100.0) - -DOS and PDOS -^^^^^^^^^^^^^ - -Before starting mesh sampling has to be finished. Then set parameters -(``run_total_dos()`` or ``run_projected_dos()``) and write the results into -files (``write_total_dos()`` and ``write_projected_dos()``). In the case of -PDOS, the eigenvectors have to be calculated in the mesh -sampling. To get the results ``get_total_dos_dict()`` and -``get_projected_dos_dict()`` can be used. - -To plot total DOS, - -:: - - phonon.run_mesh([20, 20, 20]) - phonon.run_total_dos() - phonon.plot_total_dos().show() - -and projected DOS - -:: - - phonon.run_mesh([20, 20, 20], with_eigenvectors=True, is_mesh_symmetry=False) - phonon.run_projected_dos() - phonon.plot_projected_dos().show() - -Convenient shortcuts exist as follows:: - - - phonon.auto_total_dos(plot=True).show() - -and - -:: - - phonon.auto_projected_dos(plot=True).show() - - -Thermal properties -^^^^^^^^^^^^^^^^^^^ - -Before starting the thermal property calculation, the mesh sampling -calclation has to be done in the **THz unit**. The unit conversion -factor for phonon frequency is set in the pre-process of Phonopy with -the ``factor`` keyword. Calculation range of temperature is set by the -parameters ``run_thermal_properties``. Helmholtz free energy, entropy, -heat capacity at contant volume at temperaturs are obtained by -``get_thermal_properties_dict``, where the results are given as a -dictionary of temperaturs, Helmholtz free energy, entropy, and heat -capacity with keys ``temperatures``, ``free_energy``, ``entropy``, and -``heat_capacity``, respectively. - -:: - - phonon.run_mesh([20, 20, 20]) - phonon.run_thermal_properties(t_step=10, - t_max=1000, - t_min=0) - tp_dict = phonon.get_thermal_properties_dict() - temperatures = tp_dict['temperatures'] - free_energy = tp_dict['free_energy'] - entropy = tp_dict['entropy'] - heat_capacity = tp_dict['heat_capacity'] - - for t, F, S, cv in zip(temperatures, free_energy, entropy, heat_capacity): - print(("%12.3f " + "%15.7f" * 3) % ( t, F, S, cv )) - - phonon.plot_thermal_properties().show() - - - -Non-analytical term correction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -To apply non-analytical term correction, Born effective charge tensors -for all atoms in **primitive** cell, dielectric constant tensor, and -the unit conversion factor have to be correctly set. The tensors are -given in Cartesian coordinates. - -:: - - born = [[[1.08878299, 0, 0], - [0, 1.08878299, 0], - [0, 0, 1.08878299]], - [[-1.08878299, 0, 0], - [0, -1.08878299, 0], - [0, 0, -1.08878299]]] - epsilon = [[2.56544559, 0, 0], - [0, 2.56544559, 0], - [0, 0, 2.56544559]] - factors = 14.400 - phonon.nac_params = {'born': born, - 'factor': factors, - 'dielectric': epsilon} - - -Data structure ---------------- - -Eigenvectors -^^^^^^^^^^^^^ - -Eigenvectors are given as the column vectors. Internally phonopy uses -numpy.linalg.eigh and eigh is a wrapper of LAPACK. So eigenvectors -follow the convention of LAPACK, which can be shown at -http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eigh.html - -Eigenvectors corresponding to phonopy yaml output are obtained as follows. - -Band structure -""""""""""""""" - -:: - - if eigvecs is not None: - for eigvecs_on_path in eigvecs: - for eigvecs_at_q in eigvecs_on_path: - for vec in eigvecs_at_q.T: - print vec - -Mesh sampling -"""""""""""""" - -:: - - if eigvecs is not None: - for eigvecs_at_q in eigvecs: - for vec in eigvecs_at_q.T: - print vec - - -.. _phonopy_Atoms: - -``PhonopyAtoms`` class ------------------------ - -Initialization -^^^^^^^^^^^^^^ - -The usable keywords in the initialization are:: - - symbols=None, - positions=None, - numbers=None, - masses=None, - scaled_positions=None, - cell=None - -At least three arguments have to be given at the initialization, which -are - -- ``cell`` -- ``positions`` or ``scaled_positions`` -- ``symbols`` or ``numbers`` - -.. _phonopy_Atoms_variables: - -Variables -^^^^^^^^^^ - -The following variables are implemented in the ``PhonopyAtoms`` class -in ``phonopy/structure/atoms.py``. - -.. _phonopy_Atoms_cell: - -``lattice_vectors`` -""""""""""""""""""" - -Basis vectors are given in the matrix form in Cartesian coordinates. - -:: - - [ [ a_x, a_y, a_z ], - [ b_x, b_y, b_z ], - [ c_x, c_y, c_z ] ] - -``scaled_positions`` -""""""""""""""""""""" - -Atomic positions in fractional coordinates. - -:: - - [ [ x1_a, x1_b, x1_c ], - [ x2_a, x2_b, x2_c ], - [ x3_a, x3_b, x3_c ], - ... ] - -``positions`` -"""""""""""""" - -Cartesian positions of atoms. - -:: - - positions = np.dot(scaled_positions, lattice_vectors) - -where ``np`` means the numpy module (``import numpy as np``). - - -``symbols`` -"""""""""""" - -Chemical symbols, e.g., - -:: - - ['Zn', 'Zn', 'O', 'O'] - -for the ZnO unit cell. - -``numbers`` -"""""""""""" - -Atomic numbers, e.g., - -:: - - [30, 30, 8, 8] - -for the ZnO unit cell. - -``masses`` -""""""""""" - -Atomic masses, e.g., - -:: - - [65.38, 65.38, 15.9994, 15.9994] - -for the ZnO unit cell. - -Methods and attributes -^^^^^^^^^^^^^^^^^^^^^^ - -:: - - set_cell(basis_vectors) - get_cell() - set_positions(positions) - get_positions() - set_scaled_positions(scaled_positions) - get_scaled_positions() - set_masses(masses) - get_masses() - set_chemical_symbols(symbols) - get_chemical_symbols() - get_magnetic_moments() - set_magnetic_moments(magmoms) - get_atomic_numbers() - set_atomic_numbers(numbers) - get_volume() - get_number_of_atoms() - -The arguments have to be set in the structures shown in -:ref:`phonopy_Atoms_variables`. There are the respective attributes:: - - cell - positions - scaled_positions - masses - magnetic_moments - symbols - numbers - volume - -``unitcell.get_number_of_atoms()`` is equivalent to -``len(unitcell)``. The instance can be deep-copied by -``unitcell.copy()``. ``print(unitcell)`` shows human-readable crystal -structure in Yaml format. ``unitcell.to_tuple`` converts to spglib -crystal structure -(https://spglib.github.io/spglib/python-spglib.html#crystal-structure-cell). - -Definitions of variables -------------------------- - -.. _variable_primitive_matrix: - -Primitive matrix -^^^^^^^^^^^^^^^^^ - -Primitive matrix :math:`M_\mathrm{p}` is a tranformation matrix from -lattice vectors to those of a primitive cell if there exists the -primitive cell in the lattice vectors. Following a crystallography -convention, the transformation is given by - -.. math:: - - ( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p} ) - = ( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; - \mathbf{c}_\mathrm{u} ) M_\mathrm{p} - -where :math:`\mathbf{a}_\mathrm{u}`, :math:`\mathbf{b}_\mathrm{u}`, -and :math:`\mathbf{c}_\mathrm{u}` are the column vectors of the -original lattice vectors, and :math:`\mathbf{a}_\mathrm{p}`, -:math:`\mathbf{b}_\mathrm{p}`, and :math:`\mathbf{c}_\mathrm{p}` are -the column vectors of the primitive lattice vectors. Be careful that -the lattice vectors of the ``PhonopyAtoms`` class are the row vectors -(:ref:`phonopy_Atoms_cell`). Therefore the phonopy code, which relies -on the ``PhonopyAtoms`` class, is usually written such as - -:: - - primitive_lattice = np.dot(original_lattice.T, primitive_matrix).T, - -or equivalently, - -:: - - primitive_lattice = np.dot(primitive_matrix.T, original_lattice) - - -.. _variable_supercell_matrix: - -Supercell matrix -^^^^^^^^^^^^^^^^^ - -Supercell matrix :math:`M_\mathrm{s}` is a tranformation matrix from -lattice vectors to those of a super cell. Following a crystallography -convention, the transformation is given by - -.. math:: - - ( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) - = ( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; - \mathbf{c}_\mathrm{u} ) M_\mathrm{s} - -where :math:`\mathbf{a}_\mathrm{u}`, :math:`\mathbf{b}_\mathrm{u}`, -and :math:`\mathbf{c}_\mathrm{u}` are the column vectors of the -original lattice vectors, and :math:`\mathbf{a}_\mathrm{s}`, -:math:`\mathbf{b}_\mathrm{s}`, and :math:`\mathbf{c}_\mathrm{s}` are -the column vectors of the supercell lattice vectors. Be careful that -the lattice vectors of the ``PhonopyAtoms`` class are the row vectors -(:ref:`phonopy_Atoms_cell`). Therefore the phonopy code, which relies -on the ``PhonopyAtoms`` class, is usually written such as - -:: - - supercell_lattice = np.dot(original_lattice.T, supercell_matrix).T, - -or equivalently, - -:: - - supercell_lattice = np.dot(supercell_matrix.T, original_lattice) - -Symmetry search tolerance -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Symmetry search tolerance (often the name ``symprec`` is used in -phonopy) is used to determine symmetry operations of the crystal -structures. The physical unit follows that of input crystal structure. - -Getting parameters for non-analytical term correction ------------------------------------------------------- - -Parameters for non-analytical term correction may be made as -follows. This example assumes that the user knows what are the unit -cell and primitive cell and that the Born effective charge and -dielectric constant were calculated using VASP code by the unit cell. - -:: - - import io - import numpy as np - from phonopy.units import Hartree, Bohr - from phonopy.structure.symmetry import symmetrize_borns_and_epsilon - from phonopy.interface.vasp import VasprunxmlExpat - - with io.open("vasprun.xml", "rb") as f: - vasprun = VasprunxmlExpat(f) - vasprun.parse(): - epsilon = vasprun.epsilon - borns = vasprun.born - unitcell = vasprun.cell - - borns_, epsilon_ = symmetrize_borns_and_epsilon( - borns, - epsilon, - unitcell, - primitive_matrix=[[0, 0.5, 0.5], - [0.5, 0, 0.5], - [0.5, 0.5, 0]], - supercell_matrix=np.diag([2, 2, 2]), - symprec=1e-5) - - nac_params = {'born': borns_, - 'factor': Hartree * Bohr, - 'dielectric': epsilon_} - -PhononDB at Kyoto university ----------------------------- - -The phonon calculation database at -http://phonondb.mtl.kyoto-u.ac.jp/ph20180417/index.html can be easily -used from phonopy-API. Downloading the raw data, e.g., -``mp-361-20180417.tar.lzma`` and expand it. In the directory -``mp-361-20180417``, - -:: - - % ipython - -or we can use jupyter notebook. The data is loaded by - -:: - - In [1]: import phonopy - - In [2]: ph = phonopy.load("phonon.yaml") - -For example, the band structure is plotted by -:: - - In [3]: ph.auto_band_structure(plot=True).show() - -and similarly for PDOS - -:: - - In [4]: ph.auto_projected_dos(plot=True).show() diff -Nru phonopy-2.12.0/doc/qha.md phonopy-2.13.1/doc/qha.md --- phonopy-2.12.0/doc/qha.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/qha.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,271 @@ +(phonopy_qha)= + +# Quasi harmonic approximation + +```{contents} +:depth: 2 +:local: +``` + +## Usage of `phonopy-qha` + +Using phonopy results of thermal properties, thermal expansion and heat capacity +at constant pressure can be calculated under the quasi-harmonic approximation. +`phonopy-qha` is the script to run fitting and calculation to perform it. Mind +that at leave 5 volume points are needed to run `phonopy-qha` for fitting. + +An example of the usage for `example/Si-QHA` is as follows. + +To watch selected plots: + +``` +% phonopy-qha -p e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} +``` + +```{figure} Si-QHA.png + +``` + +Without plots: + +``` +% phonopy-qha e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} +``` + +The first argument is the filename of volume-energy data (in the above example, +`e-v.dat`). The volumes and energies are given in {math}`\text{Angstrom}^3` and +eV, respectively. Theses energies are only dependent on volume but not on +temperature unless using `--efe` option. Therefore in the simplest case, these +are taken as the electronic total energies at 0K. An example of the +volume-energy file is: + +``` +# cell volume energy of cell other than phonon + 140.030000 -42.132246 + 144.500000 -42.600974 + 149.060000 -42.949142 + 153.720000 -43.188162 + 158.470000 -43.326751 + 163.320000 -43.375124 + 168.270000 -43.339884 + 173.320000 -43.230619 + 178.470000 -43.054343 + 183.720000 -42.817825 + 189.070000 -42.527932 +``` + +Lines starting with `#` are ignored. + +The following arguments of `phonopy-qha` are the filenames of +`thermal_properties.yaml`'s calculated at the volumes given in the volume-energy +file. These filenames have to be ordered in the same order as the volumes +written in the volume-energy file. Since the volume v.s. free energy fitting is +done at each temperature given in `thermal_properties.yaml`, all +`thermal_properties.yaml`'s have to be calculated in the same temperature ranges +and with the same temperature step. `phonopy-qha` can calculate thermal +properties at constant pressure up to the temperature point that is one point +less than that in `thermal_properties.yaml` because of the numerical +differentiation with respect to temperature points. Therefore +`thermal_properties.yaml` has to be calculated up to higher temperatures than +that expected by `phonopy-qha`. + +Another example for Aluminum is found in the `example/Al-QHA` directory. + +If the condition under pressure is expected, {math}`PV` terms may be included in +the energies, or equivalent effect is applied using `--pressure` option. + +Experimentally, temperature dependent energies are supported by `--efe` option. +The usage is written at +https://github.com/phonopy/phonopy/blob/develop/example/Cu-QHA/README. + +(phonopy_qha_options)= + +### Options + +#### `-h` + +Show help. The available options are shown. Without any option, the results are +saved into text files in simple data format. + +#### `--tmax` + +The maximum temperature calculated is specified. This temperature has to be +lower than the maximum temperature calculated in `thermal_properties.yaml` to +let at least one temperature points fewer. The default value is `--tmax=1000`. + +#### `--pressure` + +Pressure is specified in GPa. This corresponds to the {math}`pV` term described +in the following section {ref}`theory_of_qha`. Note that bulk modulus obtained +with this option than 0 GPa is incorrect. + +#### `-b` + +Fitting volume-energy data to an EOS, and show bulk modulus (without considering +phonons). This is made by: + +``` +% phonopy-qha -b e-v.dat +``` + +#### `--eos` + +EOS is chosen among `vinet`, `birch_murnaghan`, and `murnaghan`. The default EOS +is `vinet`. + +``` +% phonopy-qha --eos='birch_murnaghan' -b e-v.dat +``` + +#### `-p` + +The fitting results, volume-temperature relation, and thermal expansion +coefficient are plotted on the display. + +#### `-s` + +The calculated values are written into files. + +#### `--sparse` + +This is used with `-s` or `-p` to thin out the number of plots of the fitting +results at temperatures. For example with `--sparse=10`, 1 in 10 temperature +curves is only plotted. + +(phonopy_qha_efe_option)= + +#### `--efe` + +**Experimental** + +Temperature dependent energies other than phonon free energy are included with +this option. This is used such as: + +``` +% phonopy-qha -p --tmax=1300 --efe fe-v.dat e-v.dat thermal_properties.yaml-{00..10} +``` + +```{figure} Cu-QHA.png + +``` + +The temperature dependent energies are stored in `fe-v.dat`. The file format is: + +``` +# volume: 43.08047896 43.97798894 44.87549882 45.77300889 46.67051887 47.56802885 48.46553883 49.36304881 50.26055878 51.15806876 52.05557874 +# T(K) Free energies + 0.0000 -17.27885993 -17.32227490 -17.34336569 -17.34479760 -17.32843604 -17.29673896 -17.25081954 -17.19263337 -17.12356816 -17.04467997 -16.95752155 + 10.0000 -17.27886659 -17.32228126 -17.34337279 -17.34481060 -17.32844885 -17.29675204 -17.25083261 -17.19264615 -17.12358094 -17.04469309 -16.95753464 + 20.0000 -17.27887453 -17.32228804 -17.34338499 -17.34482383 -17.32846353 -17.29676491 -17.25084547 -17.19265900 -17.12359399 -17.04470709 -16.95754774 +... +``` + +The first column gives temperatures in K and the following columns give +electronic free energies in eV at temperatures and at unit (primitive) cell +volumes. The lines starting with `#` are ignored. This file doesn't contain the +information about cell volumes. Instead, the volumes are obtained from `e-v.dat` +file. The energies in `e-v.dat` are not used when `--efe` option is used. The +temperature points are expected to be the same as those in +`thermal_properties.yaml` at least up to the maximum temperature specified for +`phonopy-qha`. + +An example is given in `example/Cu-QHA`. The `fe-v.dat` contains electronic free +energy calculated following, e.g., Eqs. (11) and (12) in the paper by Wolverton +and Zunger, Phys. Rev. B, **52**, 8813 (1994) (of course this paper is not the +first one that showed these equations): + +```{math} +S_\text{el}(V) = -gk_{\mathrm{B}}\Sigma_i \{ f_i(V) \ln f_i(V) + [1-f_i(V)]\ln +[1-f_i(V)] \} +``` + +with + +```{math} +f_i(V) = \left\{ 1 + \exp\left[\frac{\epsilon_i(V) - \mu(V)}{T}\right] +\right\}^{-1} +``` + +and + +```{math} +E_\text{el}(V) = g\sum_i f_i(V) \epsilon_i(V), +``` + +where {math}`g` is 1 or 2 for collinear spin polarized and non-spin polarized +systems, respectively. For VASP, a script to create `fe-v.dat` and `e-v.dat` by +these equations is prepared as `phonopy-vasp-efe`, which is used as: + +``` +% phonopy-vasp-efe --tmax=1500 vasprun.xml-{00..10} +``` + +where `vasprun.xml-{00..10}` have to be computed for the same unit cells as +those used for `thermal_properties.yaml`. When `phonopy` was run with +`PRIMITIVE_AXES` or `--pa` option, the unit cells for computing electronic +eigenvalues have to be carefully chosen to agree with those after applying +`PRIMITIVE_AXES`, or energies are scaled a posteriori. + +(phonopy_qha_output_files)= + +### Output files + +The physical units of V and T are {math}`\text{Angstrom}^3` and K, respectively. +The unit of eV for Helmholtz and Gibbs energies, J/K/mol for {math}`C_V` and +entropy, GPa for for bulk modulus and pressure are used. + +- Bulk modulus {math}`B_T` (GPa) vs {math}`T` (`bulk_modulus-temperature.*`) +- Gibbs free energy {math}`G` (eV) vs {math}`T` (`gibbs-temperature.*`) +- Heat capacity at constant pressure {math}`C_p` (J/K/mol) vs {math}`T` computed + by {math}`-T\frac{\partial^2 G}{\partial T^2}` from three {math}`G(T)` points + (`Cp-temperature.*`) +- Heat capacity at constant pressure {math}`C_p` (J/K/mol) vs {math}`T` computed + by polynomial fittings of {math}`C_V(V)` (`Cv-volume.dat`) and {math}`S(V)` + (`entropy-volume.dat`) for {math}`\partial S/\partial V` + (`dsdv-temperature.dat`) and numerical differentiation of + {math}`\partial V/\partial T`, e.g., see Eq.(5) of PRB **81**, 174301 by Togo + _et al._ (`Cp-temperature_polyfit.*`). This may give smoother {math}`C_p` than + that from {math}`-T\frac{\partial^2 G}{\partial T^2}`. +- Volumetric thermal expansion coefficient {math}`\beta` vs {math}`T` computed + by numerical differentiation (`thermal_expansion.*`) +- Volume vs {math}`T` (`volume-temperature.*`) +- Thermodynamics Grüneisen parameter {math}`\gamma = V\beta B_T/C_V` (no unit) + vs {math}`T` (`gruneisen-temperature.dat`) +- Helmholtz free energy (eV) vs volume (`helmholtz-volume.*`). When `--pressure` + option is specified, energy offset of {math}`pV` is added. See also the + following section ({ref}`theory_of_qha`). + +(theory_of_qha)= + +## Thermal properties in (_T_, _p_) space calculated under QHA + +Here the word 'quasi-harmonic approximation' is used for an approximation that +introduces volume dependence of phonon frequencies as a part of anharmonic +effect. + +A part of temperature effect can be included into total energy of electronic +structure through phonon (Helmholtz) free energy at constant volume. But what we +want to know is thermal properties at constant pressure. We need some +transformation from function of _V_ to function of _p_. Gibbs free energy is +defined at a constant pressure by the transformation: + +```{math} +G(T, p) = \min_V \left[ U(V) + F_\mathrm{phonon}(T;\,V) + pV \right], +``` + +where + +```{math} +\min_V[ \text{function of } V ] +``` + +means to find unique minimum value in the brackets by changing volume. Since +volume dependencies of energies in electronic and phonon structures are +different, volume giving the minimum value of the energy function in the square +brackets shifts from the value calculated only from electronic structure even at +0 K. By increasing temperature, the volume dependence of phonon free energy +changes, then the equilibrium volume at temperatures changes. This is considered +as thermal expansion under this approximation. + +`phonopy-qha` collects the values at volumes and transforms into the thermal +properties at constant pressure. diff -Nru phonopy-2.12.0/doc/qha.rst phonopy-2.13.1/doc/qha.rst --- phonopy-2.12.0/doc/qha.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/qha.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,281 +0,0 @@ -.. _phonopy_qha: - -Quasi harmonic approximation -============================================= - -.. contents:: - :depth: 2 - :local: - -Usage of ``phonopy-qha`` ------------------------- - -Using phonopy results of thermal properties, thermal expansion and -heat capacity at constant pressure can be calculated under the -quasi-harmonic approximation. ``phonopy-qha`` is the script to run -fitting and calculation to perform it. Mind that at leave 5 volume -points are needed to run ``phonopy-qha`` for fitting. - -An example of the usage for ``example/Si-QHA`` is as -follows. - -To watch selected plots:: - - phonopy-qha -p e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} - -.. figure:: Si-QHA.png - -Without plots:: - - phonopy-qha e-v.dat thermal_properties.yaml-{-{5..1},{0..5}} - -The first argument is the filename of volume-energy data (in the above -expample, ``e-v.dat``). The volumes and energies are given in -:math:`\text{Angstrom}^3` and eV, respectively. Theses energies are -only dependent on volume but not on temperature unless using ``--efe`` -option. Therefore in the simplest case, these are taken as the -electronic total energies at 0K. An example of the volume-energy file -is:: - - # cell volume energy of cell other than phonon - 140.030000 -42.132246 - 144.500000 -42.600974 - 149.060000 -42.949142 - 153.720000 -43.188162 - 158.470000 -43.326751 - 163.320000 -43.375124 - 168.270000 -43.339884 - 173.320000 -43.230619 - 178.470000 -43.054343 - 183.720000 -42.817825 - 189.070000 -42.527932 - -Lines starting with ``#`` are ignored. - -The following arguments of ``phonopy-qha`` are the filenames of -``thermal_properties.yaml``'s calculated at the volumes given in the -volume-energy file. These filenames have to be ordered in the same -order as the volumes written in the volume-energy file. Since the -volume v.s. free energy fitting is done at each temperature given in -``thermal_properties.yaml``, all ``thermal_properties.yaml``'s have to -be calculated in the same temperature ranges and with the same -temperature step. ``phonopy-qha`` can calculate thermal properties at -constant pressure up to the temperature point that is one point less -than that in ``thermal_properties.yaml`` because of the numerical -differentiation with respect to temperature points. Therefore -``thermal_properties.yaml`` has to be calculated up to higher -temperatures than that expected by ``phonopy-qha``. - -Another example for Aluminum is found in the ``example/Al-QHA`` directory. - -If the condition under puressure is expected, :math:`PV` terms may be -included in the energies, or equivalent effect is applied using -``--pressure`` option. - -Experimentally, temperature dependent energies are supported by -``--efe`` option. The usage is written at -https://github.com/phonopy/phonopy/blob/develop/example/Cu-QHA/README. - -.. _phonopy_qha_options: - -Options -^^^^^^^ - -``-h`` -~~~~~~~ - -Show help. The available options are shown. Without any option, the -results are saved into text files in simple data format. - -``--tmax`` -~~~~~~~~~~~~ - -The maximum temperature calculated is specified. This temperature has -to be lower than the maximum temperature calculated in -``thermal_properties.yaml`` to let at least one temperature points -fewer. The default value is ``--tmax=1000``. - -``--pressure`` -~~~~~~~~~~~~~~~~ - -Pressure is specified in GPa. This corresponds to the :math:`pV` term -described in the following section :ref:`theory_of_qha`. Note that -bulk modulus obtained with this option than 0 GPa is incorrect. - -``-b`` -~~~~~~~ - -Fitting volume-energy data to an EOS, and show bulk -modulus (without considering phonons). This is made by:: - - % phonopy-qha -b e-v.dat - -``--eos`` -~~~~~~~~~~~ - -EOS is chosen among ``vinet``, ``birch_murnaghan``, and -``murnaghan``. The default EOS is ``vinet``. - -:: - - % phonopy-qha --eos='birch_murnaghan' -b e-v.dat - -``-p`` -~~~~~~~ - -The fitting results, volume-temperature relation, and thermal expansion -coefficient are plotted on the display. - -``-s`` -~~~~~~~ - -The calculated values are written into files. - -``--sparse`` -~~~~~~~~~~~~~~ - -This is used with ``-s`` or ``-p`` to thin out the number of plots of -the fitting results at temperatures. For example with ``--sparse=10``, -1 in 10 temperature curves is only plotted. - -.. _phonopy_qha_efe_option: - -``--efe`` -~~~~~~~~~~ - -**Experimental** - -Temperature dependent energies other than phonon free energy are -included with this option. This is used such as:: - - % phonopy-qha -p --tmax=1300 --efe fe-v.dat e-v.dat thermal_properties.yaml-{00..10} - -.. figure:: Cu-QHA.png - -The temperature dependent energies are stored in ``fe-v.dat``. The -file format is:: - - # volume: 43.08047896 43.97798894 44.87549882 45.77300889 46.67051887 47.56802885 48.46553883 49.36304881 50.26055878 51.15806876 52.05557874 - # T(K) Free energies - 0.0000 -17.27885993 -17.32227490 -17.34336569 -17.34479760 -17.32843604 -17.29673896 -17.25081954 -17.19263337 -17.12356816 -17.04467997 -16.95752155 - 10.0000 -17.27886659 -17.32228126 -17.34337279 -17.34481060 -17.32844885 -17.29675204 -17.25083261 -17.19264615 -17.12358094 -17.04469309 -16.95753464 - 20.0000 -17.27887453 -17.32228804 -17.34338499 -17.34482383 -17.32846353 -17.29676491 -17.25084547 -17.19265900 -17.12359399 -17.04470709 -16.95754774 - ... - -The first column gives temperatures in K and the following columns -give electronic free energies in eV at temperatures and at unit -(primitive) cell volumes. The lines starting with ``#`` are -ignored. This file doesn't contain the information about cell -volumes. Instead, the volumes are obtained from ``e-v.dat`` file. The -energies in ``e-v.dat`` are not used when ``--efe`` option is -used. The temperature points are expected to be the same as those in -``thermal_properties.yaml`` at least up to the maximum temperature -specified for ``phonopy-qha``. - -An example is given in ``example/Cu-QHA``. The ``fe-v.dat`` contains -electronic free energy calculated following, e.g., Eqs. (11) and (12) -in the paper by Wolverton and Zunger, Phys. Rev. B, **52**, 8813 -(1994) (of course this paper is not the first one that showed these -equations): - -.. math:: - - S_\text{el}(V) = -gk_{\mathrm{B}}\Sigma_i \{ f_i(V) \ln f_i(V) + - [1-f_i(V)]\ln [1-f_i(V)] \} - -with - -.. math:: - - f_i(V) = \left\{ 1 + \exp\left[\frac{\epsilon_i(V) - \mu(V)}{T}\right] \right\}^{-1} - -and - -.. math:: - - E_\text{el}(V) = g\sum_i f_i(V) \epsilon_i(V), - -where :math:`g` is 1 or 2 for collinear spin polarized and non-spin -polarized systems, respectively. For VASP, a script to create -``fe-v.dat`` and ``e-v.dat`` by these equations is prepared as -``phonopy-vasp-efe``, which is used as:: - - % phonopy-vasp-efe --tmax=1500 vasprun.xml-{00..10} - -where ``vasprun.xml-{00..10}`` have to be computed for the same unit -cells as those used for ``thermal_properties.yaml``. When ``phonopy`` -was run with ``PRIMITIVE_AXES`` or ``--pa`` option, the unit cells for -computing electronic eigenvalues have to be carefully chosen to agree -with those after applying ``PRIMITIVE_AXES``, or energies are scaled a -posteriori. - -.. _phonopy_qha_output_files: - -Output files -^^^^^^^^^^^^^ - -The physical units of V and T are :math:`\text{Angstrom}^3` and K, -respectively. The unit of eV for Helmholtz and Gibbs energies, J/K/mol -for :math:`C_V` and entropy, GPa for for bulk modulus and pressure -are used. - -- Bulk modulus :math:`B_T` (GPa) vs :math:`T` (``bulk_modulus-temperature.*``) -- Gibbs free energy :math:`G` (eV) vs :math:`T` (``gibbs-temperature.*``) -- Heat capacity at constant pressure :math:`C_p` (J/K/mol) vs - :math:`T` computed by :math:`-T\frac{\partial^2 G}{\partial T^2}` - from three :math:`G(T)` points (``Cp-temperature.*``) -- Heat capacity at constant puressure :math:`C_p` (J/K/mol) vs - :math:`T` computed by polynomial fittings of :math:`C_V(V)` - (``Cv-volume.dat``) and :math:`S(V)` (``entropy-volume.dat``) for - :math:`\partial S/\partial V` (``dsdv-temperature.dat``) and - numerical differentiation of :math:`\partial V/\partial T`, e.g., see - Eq.(5) of PRB **81**, 174301 by Togo *et al.* - (``Cp-temperature_polyfit.*``). - This may give smoother :math:`C_p` than that from - :math:`-T\frac{\partial^2 G}{\partial T^2}`. -- Volumetric thermal expansion coefficient :math:`\beta` vs :math:`T` - computed by numerical differentiation (``thermal_expansion.*``) -- Volume vs :math:`T` (``volume-temperature.*``) -- Thermodynamics Grüneisen parameter :math:`\gamma = V\beta B_T/C_V` - (no unit) vs :math:`T` (``gruneisen-temperature.dat``) -- Helmholtz free energy (eV) vs volume - (``helmholtz-volume.*``). When ``--pressure`` option is specified, - energy offset of :math:`pV` is added. See also the following section - (:ref:`theory_of_qha`). - -.. _theory_of_qha: - -Thermal properties in (*T*, *p*) space calculated under QHA ------------------------------------------------------------- - -Here the word 'quasi-harmonic approximation' is used for an -approximation that introduces volume dependence of phonon frequencies -as a part of anharmonic effect. - -A part of temperature effect can be included into total energy of -electronic structure through phonon (Helmholtz) free energy at -constant volume. But what we want to know is thermal properties at -constant pressure. We need some transformation from function of *V* to -function of *p*. Gibbs free energy is defined at a constant pressure by -the transformation: - -.. math:: - - G(T, p) = \min_V \left[ U(V) + F_\mathrm{phonon}(T;\,V) + pV \right], - -where - -.. math:: - \min_V[ \text{function of } V ] - -means to find unique minimum value in the brackets by changing -volume. Since volume dependencies of energies in electronic and phonon -structures are different, volume giving the minimum value of the -energy function in the square brackets shifts from the value -calculated only from electronic structure even at 0 K. By increasing -temperature, the volume dependence of phonon free energy changes, then -the equilibrium volume at temperatures changes. This is considered as -thermal expansion under this approximation. - -``phonopy-qha`` collects the values at volumes and transforms into the -thermal properties at constant pressure. diff -Nru phonopy-2.12.0/doc/reference.md phonopy-2.13.1/doc/reference.md --- phonopy-2.12.0/doc/reference.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/reference.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,142 @@ +# References + +## Method used in phonopy + +(reference_force_constants)= + +### Generation of force constants + +In phonopy, force constants are generated based on finite displacement method. +Crystal symmetry is used to reduce the calculation cost and numerical noise of +the force constants. Firstly a symmetry reduced set of atomic displacements is +generated. After the atomic force calculations, the set of atomic displacements +are expanded using the symmetry and then all the elements of force constans +between atoms in a primitive cell and the supercell are fit to the symmetry +expanded forces of atoms in supercells using Moore–Penrose pseudoinverse. This +procedure may considered as a variant of {ref}`reference_plk`. Some of the +details are found in the appendix of the following paper: + +- L. Chaput, A. Togo, I. Tanaka, and G. Hug, Phys. Rev. B, 84, 094302 (2011) + +(reference_plk)= + +### Parlinski-Li-Kawazoe method + +Parlinski-Li-Kawazoe method is based on the supercell approach with the finite +displacement method. + +Force constants are calculated using Moore–Penrose pseudoinverse by fitting +symmetry reduced elements of force constans to the linear relations between +atomic forces and atomic displacements. The pseudoinverse is easy to handle +arbitrary number of displacements amplitudes and directions, and can rely on the +existing library, e.g., LAPACK. + +- K. Parlinski, Z. Q. Li, and Y. Kawazoe, Phys. Rev. Lett. 78, 4063 (1997) + +(reference_thermal_expansion)= + +### Thermal expansion using quasi-harmonic approximation + +In {ref}`phonopy-qha `, thermal properties at constant pressure is +obtained from the thermodynamic definition. To achieve Legendre transformation, +volume-energy function is generated from a set of Helmholtz free energies and +_pV_ terms at volumes by fitting to a smooth function for which equations of +states are prepared in phonopy-qha. + +The volume dependence of the Helmholtz free energy is included from +quasi-harmonicity. When using DFT-GGA (-LDA), often we should have some amount +of error in the absolute value since phonon frequencies are underestimated +(overestimated). However the value of some ratio like thermal expansion +coefficient is often very well estimated. An example is shown in the following +paper: + +- A. Togo, L. Chaput, I. Tanaka, G. Hug, Phys. Rev. B, 81, 174301-1-6 (2010) + +(reference_NAC)= + +### Non-analytical term correction + +Non-metallic crystals are polarized by atomic displacements and the generated +macroscopic field changes force constants near {math}`\Gamma` point. This +contribution is included through non-analytical term correction. + +- R. M. Pick, M. H. Cohen, and R. M. Martin, Phys. Rev. B 1, 910, (1970) + +(reference_dp_dp_NAC)= + +### Correction by dipole-dipole interaction + +1. P. Giannozzi, S. Degironcoli, P. Pavone, and S. Baroni, Phys. Rev. B 43, 7231 + (1991) +2. X. Gonze, J.-C. Charlier, D.C. Allan, and M.P. Teter Phys. Rev. B 50, + 13035(R) (1994) +3. X. Gonze, and C. Lee, Phys. Rev. B 55, 10355 (1997) + +Currently phonopy implements the method by Gonze _et al._ written in the above +two papers (2 and 3) as the default method. + +(reference_wang_NAC)= + +### Interpolation scheme at general _q_-points with non-analytical term correction + +This is an interpolation scheme using phonons at +{math}`\mathbf{q}\rightarrow \mathbf{0}` with the correction by Pick _et al._ +and other commensurate points. + +- Y. Wang , J. J. Wang , W. Y. Wang , Z. G. Mei , S. L. Shang , L. Q. Chen and Z + K Liu, J. Phys.: Condens. Matter. 22, 202201 (2010) + +The first derivative of this expression, which is for example used for group +velocity calculation, is described in the following paper: + +- Atsushi Togo, Laurent Chaput, and Isao Tanaka, Phys. Rev. B, 91, 094306-1-31 + (2015) + +## Other methods and software for calculating force constants + +(reference_small_displacement)= + +### Parlinsk-Li-Kawazoe method + +[PHONON](http://wolf.ifj.edu.pl/phonon/) is the original implementation of the +Parlinsk-Li-Kawazoe method. + +### Small displacement method + +- Dario Alfè, Computer Physics Communications, 180, 2622 (2009) + +[PHON](http://www.homepages.ucl.ac.uk/~ucfbdxa/phon/) is based on the small +displacement method. + +(reference_dfpt)= + +### DFPT + +- Paolo Giannozzi, Stefano de Gironcoli, Pasquale Pavone, and Stefano Baroni, + Phys. Rev. B, **43**, 7231 (1991) +- Xavier Gonze and Changyol Lee, Phys. Rev. B **55**, 10355 (1997) + +Currently there are several many implementations such as +[Abinit](http://www.abinit.org/) +[Quantum espresso](http://www.quantum-espresso.org/) +[Elk](http://elk.sourceforge.net/), etc. VASP can calculate force constants +using DFPT however only at Gamma-point. + +## For the study of basics + +### Phonons + +- Introduction to Lattice Dynamics, Martin. T. Dove, Cambridge university press +- Thermodynamics of Crystals, Duane C. Wallace, Dover Publications +- Electrons and Phonons by J. M. Ziman, Oxford University Press +- The Physics of Phonons by G. P. Srivastava, CRC Press + +### Symmetry + +- International Tables for Crystallography - IUCr +- Symmetry Relationships between Crystal Structures by Ulrich Müller, Oxford + University Press +- Bilbao crystallographic server, https://www.cryst.ehu.es/ +- Supplementary Material for the Lekeitio School, + https://www.cryst.ehu.es/html/lekeitio.html, the presentation by B. Mihailova + (phonons) is considered nice for beginners. diff -Nru phonopy-2.12.0/doc/reference.rst phonopy-2.13.1/doc/reference.rst --- phonopy-2.12.0/doc/reference.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/reference.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -References -=========== - -Method used in phonopy ------------------------ - -.. _reference_force_constants: - -Generation of force constants -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In phonopy, force constants are generated based on finite displacement -method. Crystal symmetry is used to reduce the calculation cost and -numerical noise of the force constants. Firstly a symmetry reduced set -of atomic displacements is generated. After the atomic force -calculations, the set of atomic displacements are expanded using the -symmetry and then all the elements of force constans between atoms in -a primitive cell and the supercell are fit to the symmetry expanded -forces of atoms in supercells using Moore–Penrose pseudoinverse. This -procedure may considered as a variant of :ref:`reference_plk`. Some of -the details are found in the appendix of the following paper: - -- \L. Chaput, A. Togo, I. Tanaka, and G. Hug, Phys. Rev. B, 84, - 094302 (2011) - -.. _reference_plk: - -Parlinski-Li-Kawazoe method -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Parlinski-Li-Kawazoe method is based on the supercell approach with -the finite displacement method. - -Force constants are calculated using Moore–Penrose pseudoinverse by -fitting symmetry reduced elements of force constans to the linear -relations between atomic forces and atomic displacements. The -pseudoinverse is easy to handle arbitrary number of displacements -amplitudes and directions, and can rely on the exisiting library, -e.g., LAPACK. - -- \K. Parlinski, Z. Q. Li, and Y. Kawazoe, Phys. Rev. Lett. 78, 4063 (1997) - - -.. _reference_thermal_expansion: - -Thermal expansion using quasi-harmonic approximation -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In :ref:`phonopy-qha `, thermal properties at constant -pressure is obtained from the thermodynamic definition. To achieve -Legendre transformation, volume-energy function is generated from a -set of Helmholtz free energies and *pV* terms at volumes by fitting to -a smooth function for which equations of states are prepared in phonopy-qha. - -The volume dependence of the Helmholtz free energy is included from -quasi-harmonicity. When using DFT-GGA (-LDA), often we should have -some amount of error in the absolute value since phonon frequencies -are underestimated (overestimated). However the value of some ratio -like thermal expansion coefficient is often very well estimated. An -example is shown in the following paper: - -- \A. Togo, L. Chaput, I. Tanaka, G. Hug, Phys. Rev. B, 81, 174301-1-6 (2010) - -.. _reference_NAC: - -Non-analytical term correction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Non-metallic crystals are polarized by atomic displacements and the -generated macroscopic field changes force constants near -:math:`\Gamma` point. This contribution is included through -non-analytical term correction. - -- \R. M. Pick, M. H. Cohen, and R. M. Martin, Phys. Rev. B 1, 910, (1970) - -.. _reference_dp_dp_NAC: - -Correction by dipole-dipole interaction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -1. \P. Giannozzi, S. Degironcoli, P. Pavone, and S. Baroni, - Phys. Rev. B 43, 7231 (1991) -2. X. Gonze, J.-C. Charlier, D.C. Allan, and M.P. Teter - Phys. Rev. B 50, 13035(R) (1994) -3. \X. Gonze, and C. Lee, Phys. Rev. B 55, 10355 (1997) - -Currently phonopy implements the method by Gonze *et al.* written in the -above two papers (2 and 3) as the default method. - -.. _reference_wang_NAC: - -Interpolation scheme at general *q*-points with non-analytical term correction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This is an interpolation scheme using phonons at -:math:`\mathbf{q}\rightarrow \mathbf{0}` with the correction by Pick -*et al.* and other commensurate points. - -- \Y. Wang , J. J. Wang , W. Y. Wang , Z. G. Mei , S. L. Shang , L. Q. Chen and - Z K Liu, J. Phys.: Condens. Matter. 22, 202201 (2010) - -The first derivative of this expression, which is for example used for -group velocity calclation, is described in the following paper: - -- Atsushi Togo, Laurent Chaput, and Isao Tanaka, Phys. Rev. B, 91, 094306-1-31 (2015) - -Other methods and software for calculating force constants ------------------------------------------------------------ - -.. _reference_small_displacement: - -Parlinsk-Li-Kawazoe method -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -`PHONON `_ is the original -implementation of the Parlinsk-Li-Kawazoe method. - -Small displacement method -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- Dario Alfè, Computer Physics Communications, 180, 2622 (2009) - -`PHON `_ is based on the -small displacement method. - - -.. _reference_dfpt: - -DFPT -^^^^^^^^^^^^ - -- Xavier Gonze and Changyol Lee, Phys. Rev. B 55, 10355 (1997) - -Currently there are several many implementations such as `Abinit -`_, `Quantum espresso -`_, `Elk -`_, etc. VASP can calculate force constants -using DFPT however only at Gamma-point. - -For the study of basics ------------------------- - -Phonons -^^^^^^^ -- Introduction to Lattice Dynamics, Martin. T. Dove, Cambridge - university press -- Thermodynamics of Crystals, Duane C. Wallace, Dover Publications -- Electrons and Phonons by J. M. Ziman, Oxford University Press - -Symmetry -^^^^^^^^ -- International Tables for Crystallography - IUCr -- Symmetry Relationships between Crystal Structures by Ulrich Müller, - Oxford University Press -- Bilbao crystallographic server, https://www.cryst.ehu.es/ -- Supplementary Material for the Lekeitio School, - https://www.cryst.ehu.es/html/lekeitio.html, the presentation - by B. Mihailova (phonons) is considered nice for beginners. diff -Nru phonopy-2.12.0/doc/setting-tags.md phonopy-2.13.1/doc/setting-tags.md --- phonopy-2.12.0/doc/setting-tags.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/setting-tags.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,1389 @@ +(setting_tags)= + +# Setting tags + +```{contents} +:depth: 2 +:local: +``` + +Most of the setting tags have respective command-line options +({ref}`command_options`). When both of equivalent command-line option and +setting tag are set simultaneously, the command-line option supersedes the +setting tag. The configuration file is recommended to place at the first +position for the mixed use of setting tags and command-line options, i.e., + +```bash +% phonopy setting.conf [command-line-options] +``` + +For specifying real and reciprocal points, fractional values (e.g. `1/3`) are +accepted. However fractional values must not have space among characters (e.g. +`1 / 3`) are not allowed. + +## Basic tags + +(dimension_tag)= + +### `DIM` + +The supercell is created from the input unit cell. When three integers are +specified, a supercell elongated along axes of unit cell is created. + +``` +DIM = 2 2 3 +``` + +In this case, a 2x2x3 supercell is created. + +When nine integers are specified, the supercell is created by multiplying the +supercell matrix {math}`\mathrm{M}_\mathrm{s}` with the unit cell. For example, + +``` +DIM = 0 1 1 1 0 1 1 1 0 +``` + +the supercell matrix is + +```{math} +\mathrm{M}_\mathrm{s} = \begin{pmatrix} +0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 +\end{pmatrix} +``` + +where the rows correspond to the first three, second three, and third three sets +of numbers, respectively. When lattice parameters of unit cell are the column +vectors of {math}`\mathbf{a}_\mathrm{u}`, {math}`\mathbf{b}_\mathrm{u}`, and +{math}`\mathbf{c}_\mathrm{u}`, those of supercell, +{math}`\mathbf{a}_\mathrm{s}`, {math}`\mathbf{b}_\mathrm{s}`, +{math}`\mathbf{c}_\mathrm{s}`, are determined by, + +```{math} +( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) = ( +\mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} ) +M_\mathrm{s} +``` + +Be careful that the axes in `POSCAR` is defined by three row vectors, i.e., +{math}`( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} )^T`. + +(primitive_axis_tag)= + +### `PRIMITIVE_AXES` or `PRIMITIVE_AXIS` + +When specified, transformation from the input unit cell to the primitive cell is +performed. With this, the primitive cell basis vectors are used as the +coordinate system for the phonon calculation. The transformation matrix is +specified by nine values. The first, second, and third three values give the +rows of the 3x3 matrix as follows: + +``` +PRIMITIVE_AXES = 0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0 +``` + +Likewise, + +``` +PRIMITIVE_AXES = 0 1/2 1/2 1/2 0 1/2 1/2 1/2 0 +``` + +The primitive cell for building the dynamical matrix is created by multiplying +primitive-axis matrix {math}`\mathrm{M}_\mathrm{p}`. Let the matrix as, + +```{math} +\mathrm{M}_\mathrm{p} = \begin{pmatrix} +0.0 & 0.5 & 0.5 \\ 0.5 & 0.0 & 0.5 \\ 0.5 & 0.5 & 0.0 +\end{pmatrix} +``` + +where the rows correspond to the first three, second three, and third three sets +of numbers, respectively. + +When lattice parameters of unit cell (set by `POSCAR`) are the column vectors of +{math}`\mathbf{a}_\mathrm{u}`, {math}`\mathbf{b}_\mathrm{u}`, and +{math}`\mathbf{c}_\mathrm{u}`, those of supercell, +{math}`\mathbf{a}_\mathrm{p}`, {math}`\mathbf{b}_\mathrm{p}`, +{math}`\mathbf{c}_\mathrm{p}`, are determined by, + +```{math} +( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p} ) = ( +\mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} ) +\mathrm{M}\_\mathrm{p}. +``` + +{math}`\mathrm{M}_\mathrm{p}` is a change of basis matrix and so +{math}`\mathrm{M}_\mathrm{p}^{-1}` must be an integer matrix. Be careful that +{math}the axes in `POSCAR` is defined by three row vectors, i.e., +{math}`( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; \mathbf{c}_\mathrm{u} )^T`. + +**New in v1.14.0** `PRIMITIVE_AXES = AUTO` is supported. This enables to choose +the transformation matrix automatically. Since the choice of the primitive cell +is arbitrary, it is recommended to use `PRIMITIVE_AXES = AUTO` to check if a +possible transformation matrix exists or not. + +### `ATOM_NAME` + +When a crystal structure format has no information about chemical symbols, this +tag is used to specify chemical symbols. + +``` +ATOM_NAME = Si O +``` + +### `EIGENVECTORS` + +When this tag is `.TRUE.`, eigenvectors are calculated. + +(mass_tag)= + +### `MASS` + +This tag is not necessary to use usually, because atomic masses are +automatically set from the chemical symbols. + +Atomic masses of a **primitive cell** are overwritten by the values specified. +The order of atoms in the primitive cell that is defined by `PRIMITIVE_AXIS` tag +can be shown using `-v` option. It must be noted that this tag does not affect +to the symmetry search. + +For example, when there are six atoms in a primitive cell, `MASS` is set as +follows : + +``` +MASS = 28.085 28.085 16.000 16.000 16.000 16.000 +``` + +(magmom_tag)= + +### `MAGMOM` + +Symmetry of spin such as collinear magnetic moments is considered using this +tag. The number of values has to be equal to the number of atoms in the unit +cell, not the primitive cell or supercell. If this tag is used with `-d` option +(`CREATE_DISPLACEMENTS` tag), `MAGMOM` file is created. This file contains the +`MAGMOM` information of the supercell used for VASP. Unlike `MAGMOM` in VASP, +`*` can not be used, i.e., all the values (the same number of times to the +number of atoms in unit cell) have to be explicitly written. + +``` +MAGMOM = 1.0 1.0 -1.0 -1.0 +``` + +(cell_filename_tag)= + +### `CELL_FILENAME` + +``` +CELL_FILENAME = POSCAR-unitcell +``` + +See {ref}`cell_filename_option`. + +(frequency_conversion_factor_tag)= + +### `FREQUENCY_CONVERSION_FACTOR` + +Unit conversion factor of frequency from input values to your favorite unit can +be specified, but the use should be limited and it is recommended to use this +tag to convert the frequency unit to THz in some exceptional case, for example, +a special force calculator whose physical unit system is different from the +default setting of phonopy is used. If the frequency unit is different from THz, +though it works just for seeing results of frequencies, e.g., band structure or +DOS, it doesn't work for derived values like thermal properties and mean square +displacements. + +The default values for calculators are those to convert frequency units to THz. +The default conversion factors are shown at +{ref}`frequency_default_value_interfaces`. These are determined following the +physical unit systems of the calculators. How to calculated these conversion +factors is explained at {ref}`physical_unit_conversion`. + +## Displacement creation tags + +### `CREATE_DISPLACEMENTS` + +Supercells with displacements are created. This tag is used as the post process +of phonon calculation. + +``` +CREATE_DISPLACEMENTS = .TRUE. +DIM = 2 2 2 +``` + +(displacement_distance_tag)= + +### `DISPLACEMENT_DISTANCE` + +Finite atomic displacement distance is set as specified value when creating +supercells with displacements. The default displacement amplitude is 0.01 +Angstrom, but when the `wien2k`, `abinit`, `Fleur` or `turbomole` option is +specified, the default value is 0.02 Bohr. + +### `DIAG` + +When this tag is set `.FALSE.`, displacements in diagonal directions are not +searched, i.e. all the displacements are along the lattice vectors. +`DIAG = .FALSE.` is recommended if one of the lattice parameter of your +supercell is much longer or much shorter than the other lattice parameters. + +(pm_displacement_tag)= + +### `PM` + +This tag specified how displacements are found. When `PM = .FALSE.`, least +displacements that can calculate force constants are found. This may cause less +accurate result. When `PM = .TRUE.`, all the displacements that are opposite +directions to the least displacements are also found, which is called plus-minus +displacements here. The default setting is `PM = AUTO`. Plus-minus displacements +are considered with this tag. If the plus and minus displacements are +symmetrically equivalent, only the plus displacement is found. This may be in +between `.FALSE.` and `.TRUE.`. You can check how it works to see the file +`DISP` where displacement directions on atoms are written. + +(random_displacements_tag)= + +### `RANDOM_DISPLACEMENTS` + +The number of random displacement supercells are created by the specified +positive integer values. In each supercell, all atoms are displaced in random +direction with a constant displacement distance specified by +{ref}`displacement_distance_tag` tag. The random seed can be specified by +{ref}`random_seed_tag` tag. + +To obtain force constants with random displacements and respective forces, +external force constants calculator is necessary. + +``` +CREATE_DISPLACEMENTS = .TRUE. +DIM = 2 2 2 +RANDOM_DISPLACEMENTS = 20 +DISPLACEMENT_DISTANCE = 0.03 +``` + +(random_seed_tag)= + +### `RANDOM_SEED` + +The random seed used for creating random displacements by +{ref}`random_displacements_tag` tag. The value has to be 32bit unsigned int. The +random seed is useful for crating the same random displacements with using the +same number. + +(band_structure_related_tags)= + +## Band structure tags + +### `BAND` and `BAND_POINTS` + +`BAND` gives sampling band paths. The reciprocal points are specified in reduced +coordinates. The given points are connected for defining band paths. When comma +`,` is inserted between the points, the paths are disconnected. + +`BAND_POINTS` gives the number of sampling points including the path ends. The +default value is `BAND_POINTS = 51`. + +An example of three paths, (0,0,0) to (1/2,0,1/2), (1/2,1/2,1) to (0,0,0), and +(0,0,0) to (1/2,1/2,1/2), with 101 sampling points of each path are as follows: + +``` +BAND = 0 0 0 1/2 0 1/2, 1/2 1/2 1 0 0 0 1/2 1/2 1/2 +BAND_POINTS = 101 +``` + +(band_labels_tag)= + +### `BAND_LABELS` + +Labels specified are depicted in band structure plot at the points of band +segments. The number of labels has to correspond to the number of band paths +specified by `BAND` plus one. When LaTeX math style expression such as +{math}`\Gamma` (`\Gamma`) is expected, it is probably necessary to place it +between two $ characters. + +``` +BAND = 1/2 0 1/2 0 0 0 1/2 1/2 1/2 +BAND_LABELS = X $\Gamma$ L +``` + +```{image} band-labels.png +:scale: 25 +``` + +The colors of curves are automatically determined by matplotlib. The same color +in a band segment shows the same kind of band. Between different band segments, +the correspondence of colors doesn't mean anything. + +(band_connection_tag)= + +### `BAND_CONNECTION` + +With this option, band connections are estimated from eigenvectors and band +structure is drawn considering band crossings. In sensitive cases, to obtain +better band connections, it requires to increase number of points calculated in +band segments by the `BAND_POINTS` tag. + +``` +BAND = 1/2 0 1/2 0 0 0 1/2 1/2 1/2 +BAND_POINTS = 101 +BAND_CONNECTION = .TRUE. +``` + +```{image} band-connection.png +:scale: 25 +``` + +(mesh_sampling_tags)= + +## Mesh sampling tags + +Mesh sampling tags are used commonly for calculations of thermal properties and +density of states. + +(mp_tag)= + +### `MESH`, `MP`, or `MESH_NUMBERS` + +`MESH` numbers give uniform meshes in each axis. As the default behavior, the +center of mesh is determined by the Monkhorst-Pack scheme, i.e., for odd number, +a point comes to the center, and for even number, the center is shifted half in +the distance between neighboring mesh points. + +Examples of an even mesh with {math}`\Gamma` center in two ways, + +``` +MESH = 8 8 8 +GAMMA_CENTER = .TRUE. +``` + +``` +MESH = 8 8 8 +MP_SHIFT = 1/2 1/2 1/2 +``` + +If only one float value is given, e.g., `MESH = 100.0`, {math}`\Gamma` centred +sampling mesh is generated with the mesh numbers +{math}`(N_{\mathbf{a}^*}, N_{\mathbf{b}^*}, N_{\mathbf{c}^*})` computed +following the convention of the VASP automatic k-point generation, which is + +```{math} +N_{\mathbf{a}^*} = \max[1, \mathrm{nint}(l|\mathbf{a}^*|)], \; N_{\mathbf{b}^*} += \max[1, \mathrm{nint}(l|\mathbf{b}^*|)], \; N_{\mathbf{c}^*} = \max[1, +\mathrm{nint}(l|\mathbf{c}^*|)], +``` + +where {math}`l` is the value to be specified. With this, `GAMMA_CENTER` becomes +simply ignored, but `MP_SHIFT` works on top of the {math}`\Gamma` centred +sampling mesh. + +``` +MESh = 100 +``` + +### `MP_SHIFT` + +`MP_SHIFT` gives the shifts in direction along the corresponding reciprocal axes +({math}`a^*`, {math}`b^*`, {math}`c^*`). 0 or 1/2 (0.5) can be used as these +values. 1/2 means the half mesh shift with respect to neighboring grid points in +each direction. + +### `GAMMA_CENTER` + +Instead of employing the Monkhorst-Pack scheme for the mesh sampling, +{math}`\Gamma` center mesh is used. The default value is `.FALSE.`. + +``` +GAMMA_CENTER = .TRUE. +``` + +(write_mesh_tag)= + +### `WRITE_MESH` + +With a dense mesh, with eigenvectors, without mesh symmetry, sometimes its +output file `mesh.yaml` or `mesh.hdf5` can be huge. However when those files are +not needed, e.g., in (P)DOS calculation, `WRITE_MESH = .FALSE.` can disable to +write out those files. With (P)DOS calculation, DOS output files are obtained +even with `WRITE_MESH = .FALSE.`. The default setting is `.TRUE.`. + +``` +WRITE_MESH = .FALSE. +``` + +(dos_related_tags)= + +## Phonon density of states (DOS) tags + +Phonon density of states (DOS) is calculated either with a linear tetrahedron +method (default) or smearing method. Phonons are calculated on a sampling mesh, +therefore these tags must be used with {ref}`mesh_sampling_tags`. The physical +unit of horizontal axis is that of frequency that the user employs, e.g., THz, +and that of vertical axis is {no. of states}/({unit cell} x {unit of the +horizontal axis}). If the DOS is integrated over the frequency range, it will be +{math}`3N_\mathrm{a}` states, where {math}`N_\mathrm{a}` is the number of atoms +in the unit cell. + +Phonon-DOS is formally defined as + +```{math} +g(\omega) = \frac{1}{N} \sum_\lambda \delta(\omega - \omega_\lambda) +``` + +where {math}`N` is the number of unit cells and +{math}`\lambda = (\nu, \mathbf{q})` with {math}`\nu` as the band index and +{math}`\mathbf{q}` as the q-point. This is computed on a set of descritized +sampling frequency points for which {math}`\omega` is specified arbitrary using +{ref}`dos_range_tag`. The phonon frequencies {math}`\omega_\lambda` are obtained +on a sampling mesh whose the number of grid points being {math}`N`. In the +smearing method, the delta function is replaced by normal distribution (Gaussian +function) with the standard deviation specified by {ref}`sigma_tag`. In the +tetrahedron method, the Brillouin integration is made analytically within +tetrahedra in reciprocal space. + +### `DOS` + +This tag enables to calculate DOS. This tag is automatically set when `PDOS` tag +or `-p` option. + +``` +DOS = .TRUE. +``` + +(dos_range_tag)= + +### `DOS_RANGE` + +``` +DOS_RANGE = 0 40 0.1 +``` + +Total and partial density of states are drawn with some parameters. The example +makes DOS be calculated from frequency=0 to 40 with 0.1 pitch. + +{ref}`dos_fmin_fmax_tags` can be alternatively used to specify the minimum and +maximum frequencies (the first and second values). + +(dos_fmin_fmax_tags)= + +### `FMIN`, `FMAX`, and `FPITCH` + +The uniform frequency sampling points for phonon-DOS calculation are specified. +`FMIN` and `FMAX` give the minimum, maximum frequencies of the range, +respectively, and `FPITCH` gives the frequency pitch to be sampled. These three +values are the same as those that can be specified by `DOS_RANGE`. + +### `PDOS` + +Projected DOS is calculated using this tag. The formal definition is written as + +```{math} +g^j(\omega, \hat{\mathbf{n}}) = \frac{1}{N} \sum_\lambda \delta(\omega - +\omega_\lambda) |\hat{\mathbf{n}} \cdot \mathbf{e}^j_\lambda|^2, +``` + +where {math}`j` is the atom indices and {math}`\hat{\mathbf{n}}` is the unit +projection direction vector. Without specifying {ref}`projection_direction_tag` +or {ref}`xyz_projection_tag`, PDOS is computed as sum of +{math}`g^j(\omega, \hat{\mathbf{n}})` projected onto Cartesian axes +{math}`x,y,z`, i.e., + +```{math} +g^j(\omega) = \sum_{\hat{\mathbf{n}} = \{x, y, z\}} g^j(\omega, +\hat{\mathbf{n}}). +``` + +The atom indices {math}`j` are specified by + +``` +PDOS = 1 2, 3 4 5 6 +``` + +These numbers are those in the primitive cell. `,` separates the atom sets. In +this example, atom 1 and 2 are summarized as one curve and atom 3, 4, 5, and, 6 +are summarized as another curve. + +`PDOS = AUTO` is supported To group symmetrically equivalent atoms +automatically. + +``` +PDOS = AUTO +``` + +`EIGENVECTORS = .TRUE.` and `MESH_SYMMETRY = .FALSE.` are automatically set, +therefore the calculation takes much more time than usual DOS calculation. With +a very dense sampling mesh, writing data into `mesh.yaml` or `mesh.hdf5` can be +unexpectedly huge. If only PDOS is necessary but these output files are +unnecessary, then it is good to consider using `WRITE_MESH = .FALSE.` +({ref}`write_mesh_tag`). + +(projection_direction_tag)= + +### `PROJECTION_DIRECTION` + +Eigenvectors are projected along the direction specified by this tag. Projection +direction is specified in reduced coordinates, i.e., with respect to _a_, _b_, +_c_ axes. + +``` +PDOS = 1, 2 +PROJECTION_DIRECTION = -1 1 1 +``` + +(xyz_projection_tag)= + +### `XYZ_PROJECTION` + +PDOS is calculated using eigenvectors projected along x, y, and z Cartesian +coordinates. The format of output file `projected_dos.dat` becomes different +when using this tag, where phonon-mode-frequency and x, y, and z components of +PDOS are written out in the order: + +``` +frequency atom1_x atom1_y atom1_z atom2_x atom2_y atom2_z ... +``` + +With `-p` option, three curves are drawn. These correspond to sums of all +projections to x, sums of all projections to y, and sums of all projections to z +components of eigenvectors, respectively. + +``` +XYZ_PROJECTION = .TRUE. +``` + +(sigma_tag)= + +### `SIGMA` + +A smearing method is used instead of a linear tetrahedron method. This tag also +specifies the smearing width. The unit is same as that used for phonon +frequency. The default value is the value given by the difference of maximum and +minimum frequencies divided by 100. + +``` +SIGMA = 0.1 +``` + +(debye_model_tag)= + +### `DEBYE_MODEL` + +By setting `.TRUE.`, DOS at lower phonon frequencies are fit to a Debye model. +By default, the DOS from 0 to 1/4 of the maximum phonon frequencies are used for +the fitting. The function used to the fitting is {math}`D(\omega)=a\omega^2` +where {math}`a` is the parameter and the Debye frequency is {math}`(9N/a)^{1/3}` +where {math}`N` is the number of atoms in unit cell. Users have to unserstand +that this is **not** a unique way to determine Debye frequency. Debye frequency +is dependent on how to parameterize it. + +``` +DEBYE_MODEL = .TRUE. +``` + +(dos_moment_tag)= + +### `MOMEMT` and `MOMENT_ORDER` + +Phonon moments for DOS and PDOS defined below are calculated using these tags up +to arbitrary order. The order is specified with `MOMENT_ORDER` ({math}`n` in the +formula). Unless `MOMENT_ORDER` specified, the first and second moments are +calculated. + +The moments for DOS are given as + +```{math} +M_n(\omega_\text{min}, \omega_\text{max}) +=\frac{\int_{\omega_\text{min}}^{\omega_\text{max}} \omega^n g(\omega) d\omega} +{\int_{\omega_\text{min}}^{\omega\_\text{max}} g(\omega) d\omega}. +``` + +The moments for PDOS are given as + +```{math} +M_n^j(\omega_\text{min}, \omega_\text{max}) +=\frac{\int_{\omega_\text{min}}^{\omega_\text{max}} \omega^n g^j(\omega) +d\omega} {\int_{\omega_\text{min}}^{\omega\_\text{max}} g^j(\omega) d\omega}. +``` + +{math}`\omega_\text{min}` and {math}`\omega_\text{max}` are specified :using +ref:`dos_fmin_fmax_tags` tags. When these are not specified, the moments are +computed with the range of {math}`\epsilon < \omega < \infty`, where +{math}`\epsilon` is a small positive value. Imaginary frequencies are treated as +negative real values in this computation, therefore it is not a good idea to set +negative {math}`\omega_\text{min}`. + +``` +MOMENT = .TRUE. +MOMENT_ORDER = 3 +``` + +(thermal_properties_tag)= + +## Thermal properties related tags + +See {ref}`cutoff_frequency_tags` on the treatment of the imaginary modes. + +### `TPROP`, `TMIN`, `TMAX`, and `TSTEP` + +Thermal properties, free energy, heat capacity, and entropy, are calculated from +their statistical thermodynamic expressions (see +{ref}`thermal_properties_expressions`). Thermal properties are calculated from +phonon frequencies on a sampling mesh in the reciprocal space. Therefore these +tags must be used with {ref}`mesh_sampling_tags` and their convergence with +respect to the sampling mesh has to be checked. Usually this calculation is not +computationally demanding, so the convergence is easily achieved with increasing +the density of the sampling mesh. `-p` option can be used together to plot the +thermal properties. + +Phonon frequencies in THz, which is the default setting of phonopy, are used to +obtain the thermal properties, therefore physical units have to be set properly +for it (see {ref}`calculator_interfaces`.) + +The calculated values are written into `thermal_properties.yaml`. The unit +systems of free energy, heat capacity, and entropy are kJ/mol, J/K/mol, and +J/K/mol, respectively, where 1 mol means {math}`\mathrm{N_A}\times` your input +unit cell (not formula unit), i.e. you have to divide the value by number of +formula unit in your unit cell by yourself. For example, in MgO (conventional) +unit cell, if you want to compare with experimental results in kJ/mol, you have +to divide the phonopy output by four. + +`TMIN`, `TMAX`, and `TSTEP` tags are used to specify the temperature range to be +calculated. The default values of them are 0, 1000, and 10, respectively. + +``` +TPROP = .TRUE. +TMAX = 2000 +``` + +(pretend_real_tags)= + +### `PRETEND_REAL` + +This enables to take imaginary frequencies as real for thermal property +calculation. This does give false thermal properties, therefore for a testing +purpose only, when a small amount of imaginary branches obtained. + +``` +TPROP = .TRUE. +PRETEND_REAL = .TRUE. +``` + +(cutoff_frequency_tags)= + +### `CUTOFF_FREQUENCY` + +This is given by a real value and the default value is 0. This tag works as +follows. + +Phonon thermal properties are computed as sum over phonon modes. See +{ref}`thermal_properties_expressions`. When we treat imaginary frequencies as +negative values by +{math}`\text{sgn}(\nu^2) |\nu| \rightarrow \nu_\text{phonopy}`, all phonon modes +with {math}`\nu_\text{phonopy}` smaller than this `CUTOFF_FREQUENCY` are simply +excluded in the summation. + +In the `thermal_properties.yaml`, the total number of calculated phonon modes +and the number of phonon modes included for the thermal property calculation are +shown as `num_modes:` and `num_integrated_modes:`, respectively. + +``` +CUTOFF_FREQUENCY = 0.1 +``` + +(thermal_atomic_displacements_tags)= + +## Thermal displacements + +(thermal_displacements_tag)= + +### `TDISP`, `TMAX`, `TMIN`, and `TSTEP` + +Mean square displacements projected to Cartesian axes as a function of +temperature are calculated from the number of phonon excitations. The usages of +`TMAX`, `TMIN`, `TSTEP` tags are same as those in +{ref}`thermal properties tags `. Phonon frequencies in +THz, which is the default setting of phonopy, are used to obtain the mean square +displacements, therefore physical units have to be set properly for it (see +{ref}`calculator_interfaces`.) The result is given in {math}`\text{Angstrom}^2` +and writen into `thermal_displacements.yaml`. See the detail of the method, +{ref}`thermal_displacement`. These tags must be used with +{ref}`mesh_sampling_tags` + +Optionally, `FMIN` tag (`--fmin` option) with a small value is recommened to be +set when q-points at {math}`\Gamma` point or near {math}`\Gamma` point (e.g. +using very dense sampling mesh) are sampled to avoid divergence. `FMAX` tag +(`--fmax` option) can be used to specify an upper bound of phonon frequencies +where the phonons are considered in the summation. The projection is applied +along arbitrary direction using `PROJECTION_DIRECTION` tag +({ref}`projection_direction_tag`). + +`mesh.yaml` or `mesh.hdf5` is not written out from phonopy-1.11.14. + +``` +TDISP = .TRUE. +PROJECTION_DIRECTION = 1 1 0 +``` + +(thermal_displacement_matrices_tag)= + +### `TDISPMAT`, `TMAX`, `TMIN`, and `TSTEP` + +Mean square displacement matrices are calculated. The definition is shown at +{ref}`thermal_displacement`. Phonon frequencies in THz, which is the default +setting of phonopy, are used to obtain the mean square displacement matrices, +therefore physical units have to be set properly for it (see +{ref}`calculator_interfaces`.) The result is given in {math}`\text{Angstrom}^2` +and written into `thermal_displacement_matrices.yaml` where six matrix elements +are given in the order of xx, yy, zz, yz, xz, xy. In this yaml file, +`displacement_matrices` and `displacement_matrices_cif` correspond to +{math}`\mathrm{U}_\text{cart}` and {math}`\mathrm{U}_\text{cif}` defined at +{ref}`thermal_displacement_matrix`, respectively. + +Optionally, `FMIN` tag (`--fmin` option) with a small value is recommended to be +set when q-points at {math}`\Gamma` point or near {math}`\Gamma` point (e.g. +using very dense sampling mesh) are sampled to avoid divergence. `FMAX` tag +(`--fmax` option) can be used to specify an upper bound of phonon frequencies +where the phonons are considered in the summation. + +The 3x3 matrix restricts distribution of each atom around the equilibrium +position to be ellipsoid. But the distribution is not necessarily to be so. + +`mesh.yaml` or `mesh.hdf5` is not written out from phonopy-1.11.14. + +``` +TDISPMAT = .TRUE. +``` + +(thermal_displacement_cif_tag)= + +### `TDISPMAT_CIF` + +This tag specifies a temperature (K) at which thermal displacement is calculated +and the mean square displacement matrix is written to the cif file +`tdispmat.cif` with the dictionary item `aniso_U`. Phonon frequencies in THz, +which is the default setting of phonopy, are used to obtain the mean square +displacement matrices, therefore physical units have to be set properly for it +(see {ref}`calculator_interfaces`.) The result is given in +{math}`\textrm{Angstrom}^2`. + +`mesh.yaml` or `mesh.hdf5` is not written out from phonopy-1.11.14. + +``` +TDISPMAT_CIF = 1273.0 +``` + +## Specific q-points + +(qpoints_tag)= + +### `QPOINTS` + +When q-points are supplied, those phonons are calculated. Q-points are specified +successive values separated by spaces and collected by every three values as +vectors in reciprocal reduced coordinates. + +``` +QPOINTS = 0 0 0 1/2 1/2 1/2 1/2 0 1/2 +``` + +With `QPOINTS = .TRUE.`, q-points are read from `QPOITNS` file (see the file +format at {ref}`QPOINTS`) in current directory phonons at the +q-points are calculated. + +``` +QPOINTS = .TRUE. +``` + +(writedm_tag)= + +### `WRITEDM` + +``` +WRITEDM = .TRUE. +``` + +Dynamical matrices {math}`D` are written into `qpoints.yaml` in the following +{math}`6N\times3N` format, where _N_ is the number of atoms in the primitive +cell. + +The physical unit of dynamical matrix is +`[unit of force] / ([unit of displacement] * [unit of mass])`, i.e., square of +the unit of phonon frequency before multiplying the unit conversion factor (see +{ref}`frequency_conversion_factor_tag`). + +```{math} +D = \begin{pmatrix} D_{11} & D_{12} & D_{13} & \\ D_{21} & D_{22} & D_{23} & +\cdots \\ D_{31} & D_{32} & D_{33} & \\ & \vdots & & \\ \end{pmatrix}, +``` + +and {math}`D_{jj'}` is + +```{math} +D_{jj'} = \begin{pmatrix} Re(D_{jj'}^{xx}) & Im(D_{jj'}^{xx}) & +Re(D_{jj'}^{xy}) & Im(D_{jj'}^{xy}) & Re(D_{jj'}^{xz}) & Im(D_{jj'}^{xz}) \\ +Re(D_{jj'}^{yx}) & Im(D_{jj'}^{yx}) & Re(D_{jj'}^{yy}) & Im(D_{jj'}^{yy}) & +Re(D_{jj'}^{yz}) & Im(D_{jj'}^{yz}) \\ Re(D_{jj'}^{zx}) & Im(D_{jj'}^{zx}) & +Re(D_{jj'}^{zy}) & Im(D_{jj'}^{zy}) & Re(D_{jj'}^{zz}) & Im(D_{jj'}^{zz}) \\ +\end{pmatrix}, +``` + +where _j_ and _j'_ are the atomic indices in the primitive cell. The phonon +frequencies may be recovered from `qpoints.yaml` by writing a simple python +script. For example, `qpoints.yaml` is obtained for NaCl at +{math}`q=(0, 0.5, 0.5)` by + +``` +phonopy --qpoints="0 1/2 1/2" --writedm +``` + +and the dynamical matrix may be used as + +```python +import yaml +import numpy as np + +data = yaml.load(open("qpoints.yaml")) +dynmat = [] +dynmat_data = data['phonon'][0]['dynamical_matrix'] +for row in dynmat_data: + vals = np.reshape(row, (-1, 2)) + dynmat.append(vals[:, 0] + vals[:, 1] * 1j) +dynmat = np.array(dynmat) + +eigvals, eigvecs, = np.linalg.eigh(dynmat) +frequencies = np.sqrt(np.abs(eigvals.real)) * np.sign(eigvals.real) +conversion_factor_to_THz = 15.633302 +print frequencies * conversion_factor_to_THz +``` + +(nac_tag)= + +## Non-analytical term correction + +### `NAC` + +Non-analytical term correction is applied to dynamical matrix. `BORN` file has +to be prepared in the current directory. See {ref}`born_file` and +{ref}`non_analytical_term_correction_theory`. The default method is +`NAC_METHOD = GONZE` after v1.13.0. + +``` +NAC = .TRUE. +``` + +(nac_method_tag)= + +### `NAC_METHOD` + +The method of non-analytical term correction is chosen by this tag between two, +`NAC_METHOD = GONZE` ({ref}`reference_dp_dp_NAC`) and `NAC_METHOD = WANG` +({ref}`reference_wang_NAC`), and the default is the former after v1.13.0. + +### `Q_DIRECTION` + +This tag is used to activate non-analytical term correction (NAC) at +{math}`\mathbf{q}\rightarrow\mathbf{0}`, i.e. practically {math}`\Gamma`-point, +because NAC is direction dependent. With this tag, {math}`\mathbf{q}` is +specified in the fractional coordinates of the reciprocal basis vectors. Only +the direction has the meaning. Therefore `Q_DIRECTION = 1 1 1` and +`Q_DIRECTION = 2 2 2` give the same result. This tag is valid for `QPOINTS`, +`IRREPS`, and `MODULATION` tags. + +Away from {math}`\Gamma`-point, this setting is ignored and the specified +**q**-point is used as the **q**-direction. + +``` +QPOINTS = 0 0 0 NAC = .TRUE. +Q_DIRECTION = 1 0 0 +``` + +(group_velocity_tag)= + +## Group velocity + +### `GROUP_VELOCITY` + +Group velocities at q-points are calculated by using this tag. The group +velocities are written into a yaml file corresponding to the run mode in +Cartesian coordinates. The physical unit depends on physical units of input +files and frequency conversion factor, but if VASP and the default settings +(e.g., THz for phonon frequency) are simply used, then the physical unit will be +Angstrom THz. + +``` +GROUP_VELOCITY = .TRUE. +``` + +Technical details are shown at {ref}`group_velocity`. + +### `GV_DELTA_Q` + +The reciprocal distance used for finite difference method is specified. The +default value is `1e-5` for the method of non-analytical term correction by +Gonze _et al._. In other case, unless this tag is specified, analytical +derivative is used instead of the finite difference method. + +``` +GV_DELTA_Q = 0.01 +``` + +## Symmetry + +(tolerance_tag)= + +### `SYMMETRY_TOLERANCE` + +This is used to set geometric tolerance to find symmetry of crystal structure. +The default value is `1e-5`. In general, it is not a good idea to loosen the +tolerance. It is recommended to symmetrize crystal structure before starting +phonon calculation, e.g., using {ref}`symmetry_option` option. + +``` +SYMMETRY_TOLERANCE = 1e-3 +``` + +(symmetry_tag)= + +### `SYMMETRY` + +P1 symmetry is enforced to the input unit cell by setting `SYMMETRY = .FALSE`. + +(nomeshsym_tag)= + +### `MESH_SYMMETRY` + +Symmetry search on the reciprocal sampling mesh is disabled by setting +`MESH_SYMMETRY = .FALSE.`. In some case such as hexagonal systems or primitive +cells of cubic systems having F and I-centrings, the results with and without +mesh symmetry give slightly different values for those properties that can +employ mesh symmetry. This happens when the uniform sampling mesh made along +basis vectors doesn't have the same crystallographic point group as the crystal +itself. This symmetry breaking may be also seen by the fact that `weight` +written in `mesh.yaml` can be different from possible order of product group of +site-symmetry group and time reversal symmetry. Generally the difference becomes +smaller when increasing the sampling mesh numbers. + +(fc_symmetry_tag)= + +### `FC_SYMMETRY` + +**Changed at v1.12.3** + +Previously this tag required a number for the iteration. From version 1.12.3, +the way of symmetrization for translation invariance is modified and this number +became unnecessary. + +This tag is used to symmetrize force constants by translational symmetry and +permutation symmetry with `.TRUE.` or `.FALSE.`. + +``` +FC_SYMMETRY = .TRUE. +``` + +From the translation invariance condition, + +```{math} +\sum_i \Phi_{ij}^{\alpha\beta} = 0, \;\;\text{for all $j$, $\alpha$, $\beta$}, +``` + +where _i_ and _j_ are the atom indices, and {math}`\alpha` and {math}`\beta` are +the Cartesian indices for atoms _i_ and _j_, respectively. When this condition +is broken, the sum gives non-zero value. This value is subtracted from the +diagonal blocks. Force constants are symmetric in each pair as + +```{math} +\Phi_{ij}^{\alpha\beta} = \frac{\partial^2 U}{\partial u_i^\alpha \partial +u_j^\beta} = \frac{\partial^2 U}{\partial u_j^\beta \partial u_i^\alpha} = +\Phi_{ji}^{\beta\alpha} +``` + +Mind that the other symmetries of force constants, i.e., the symmetry from +crystal symmetry or rotational symmetry, are broken to use `FC_SYMMETRY`. + +(force_constants_tag)= + +## Force constants + +### `FORCE_CONSTANTS` + +``` +FORCE_CONSTANTS = READ +``` + +There are three values to be set, which are `READ` and `WRITE`, and `.FALSE.`. +The default is `.FALSE.`. When `FORCE_CONSTANTS = READ`, force constants are +read from `FORCE_CONSTANTS` file. With `FORCE_CONSTANTS = WRITE`, force +constants calculated from `FORCE_SETS` are written to `FORCE_CONSTANTS` file. + +The file format of `FORCE_CONSTANTS` is shown +{ref}`here `. + +(full_force_constants_tag)= + +### `FULL_FORCE_CONSTANTS` + +`FULL_FORCE_CONSTANTS = .TRUE.` is used to compute full supercell constants +matrix. The default setting is `.FALSE.`. By `.TRUE.` or `.FALSE.`, the array +shape becomes `(n_patom, n_satom, 3, 3)` or `(n_satom, n_satom, 3, 3)`, +respectively. The detail is found at {ref}`file_force_constants`. + +### `READ_FORCE_CONSTANTS` + +`READ_FORCE_CONSTANTS = .TRUE.` is equivalent to `FORCE_CONSTANTS = READ`. + +### `WRITE_FORCE_CONSTANTS` + +`WRITE_FORCE_CONSTANTS = .TRUE.` is equivalent to `FORCE_CONSTANTS = WRITE`. + +(fc_calculator_tag)= + +### `FC_CALCULATOR` + +External force constants calculator can be used using this tag. Currently `ALM` +is supported. The phonopy's default force constants calculator is based on +finite difference method, for which atomic displacements are made +systematically. The following is the list of the force constants calculator +currently possible to be invoked from phonopy. + +(fc_calculator_alm_tag)= + +#### `ALM` + +**New in v2.3** ALM (https://github.com/ttadano/ALM) is based on fitting +approach and any displacements set of atoms in supercell can be handled. For +example, random displacements generated by {ref}`random_displacements_tag` can +be used to compute force constants. To use ALM, its python module has to be +installed via conda-forge or building it. The installation instruction is found +[here](https://alm.readthedocs.io/en/develop/compile-with-conda-packages.html). + +When ALM is used, please cite the paper: T. Tadano and S. Tsuneyuki, J. Phys. +Soc. Jpn. **87**, 041015 (2018). + +``` +FC_CALCULATOR = ALM +``` + +(animation_tag)= + +## Create animation file + +### `ANIME_TYPE` + +``` +ANIME_TYPE = JMOL +``` + +There are `V_SIM`, `ARC`, `XYZ`, `JMOL`, and `POSCAR` settings. Those may be +viewed by `v_sim`, `gdis`, `jmol` (animation), `jmol` (vibration), respectively. +For `POSCAR`, a set of `POSCAR` format structure files corresponding to +respective animation images are created such as `APOSCAR-000`, +`APOSCAR-001`,.... + +There are several parameters to be set in the `ANIME` tag. + +### `ANIME` + +**The format of `ANIME` tag was modified after ver. 0.9.3.3.** + +#### For v_sim + +``` +ANIME = 0.5 0.5 0 +``` + +The values are the _q_-point to be calculated. An animation file of +`anime.ascii` is generated. + +```{toctree} +animation +``` + +#### For the other animation formats + +Phonon is only calculated at {math}`\Gamma` point. So _q_-point is not necessary +to be set. + +`anime.arc`, `anime.xyz`, `anime.xyz_jmol`, or `APOSCAR-*` are generated +according to the `ANIME_TYPE` setting. + +``` +ANIME = 4 5 20 0.5 0.5 0 +``` + +The values are as follows from left: + +1. Band index given by ascending order in phonon frequency. + +2. Magnitude to be multiplied. In the harmonic phonon calculation, there is no + amplitude information obtained directly. The relative amplitude among atoms + in primitive cell can be obtained from eigenvectors with the constraint of + the norm or the eigenvectors equals one, i.e., number of atoms in the + primitive is large, the displacements become small. Therefore this has to be + adjusted to make the animation good looking. + +3. Number of images in one phonon period. + +4. (4-6) Shift of atomic points in reduced coordinate in real space. These + values can be omitted and the default values are `0 0 0`. + +For `anime.xyz_jmol`, the first and third values are not used, however dummy +values, e.g. 0, are required. + +(modulation_tag)= + +## Create modulated structure + +### `MODULATION` + +The `MODULATION` tag is used to create a crystal structure with displacements +along normal modes at q-point in the specified supercell dimension. + +Atomic displacement of the _j_-th atom is created from the real part of the +eigenvectors with amplitudes and phase factors as + +```{math} +\frac{A} { \sqrt{N_\mathrm{a}m_j} } \operatorname{Re} \left[ \exp(i\phi) +\mathbf{e}_j \exp( \mathbf{q} \cdot \mathbf{r}_{jl} ) \right], +``` + +where {math}`A` is the amplitude, {math}`\phi` is the phase, +{math}`N_\mathrm{a}` is the number of atoms in the supercell specified in this +tag and {math}`m_j` is the mass of the _j_-th atom, {math}`\mathbf{q}` is the +q-point specified, {math}`\mathbf{r}_{jl}` is the position of the _j_-th atom in +the _l_-th unit cell, and {math}`\mathbf{e}_j` is the _j_-th atom part of +eigenvector. Convention of eigenvector or dynamical matrix employed in phonopy +is shown in {ref}`dynacmial_matrix_theory`. + +If several modes are specified as shown in the example above, they are +overlapped on the structure. The output filenames are `MPOSCAR` and +`MPOSCAR-`. Each modulated structure of a normal mode is written in +`MPOSCAR-` where the numbers correspond to the order of specified sets +of modulations. `MPOSCAR` is the structure where all the modulations are summed. +`MPOSCAR-orig` is the structure without containing modulation, but the dimension +is the one that is specified. Some information is written into +`modulation.yaml`. + +#### Usage + +The first three (nine) values correspond to supercell dimension (supercell +matrix) like the {ref}`dimension_tag` tag. The following values are used to +describe how the atoms are modulated. Multiple sets of modulations can be +specified by separating by comma `,`. In each set, the first three values give a +Q-point in the reduced coordinates in reciprocal space. Then the next three +values are the band index from the bottom with ascending order, amplitude, and +phase factor in degrees. The phase factor is optional. If it is not specified, 0 +is used. + +Before multiplying user specified phase factor, the phase of the modulation +vector is adjusted as the largest absolute value, +{math}`\left|\mathbf{e}_j\right|/\sqrt{m_j}`, of element of 3N dimensional +modulation vector to be real. The complex modulation vector is shown in +`modulation.yaml`. + +``` +MODULATION = 3 3 1, 1/3 1/3 0 1 2, 1/3 1/3 0 2 3.5 +``` + +``` +MODULATION = 3 3 1, 1/3 1/3 0 1 2, 1/3 0 0 2 2 +``` + +``` +MODULATION = 3 3 1, 1/3 1/3 0 1 1 0, 1/3 1/3 0 1 1 90 +``` + +``` +MODULATION = -1 1 1 1 -1 1 1 1 -1, 1/2 1/2 0 1 2 +``` + +(irreducible_representation_related_tags)= + +## Characters of irreducible representations + +(irreps_tag)= + +### `IRREPS` + +Characters of irreducible representations (Irreps) of phonon modes are shown. +For this calculation, a primitive cell has to be used. If the input unit cell is +a non-primitive cell, it has to be transformed to a primitive cell using +`PRIMITIVE_AXES` tag. + +The first three values gives a _q_-point in reduced coordinates to be +calculated. The degenerated modes are searched only by the closeness of +frequencies. The frequency difference to be tolerated is specified by the fourth +value in the frequency unit that the user specified. + +``` +IRREPS = 0 0 0 1e-3 +``` + +Symbols of Irreps for the 32 point group types at the {math}`\Gamma` point are +shown but not at non-{math}`\Gamma` point. + +### `SHOW_IRREPS` + +Irreducible representations are shown along with character table. + +``` +IRREPS = 1/3 1/3 0 +SHOW_IRREPS = .TRUE. +``` + +### `LITTLE_COGROUP` + +Show irreps of little co-group (point-group of wavevector) instead of little +group. + +``` +IRREPS = 0 0 1/8 +LITTLE_COGROUP = .TRUE. +``` + +## Input/Output file control + +(fc_format_tag)= + +### `FC_FORMAT`, `READFC_FORMAT`, `WRITEFC_FORMAT` + +There are two file-formats to store force constants. Currently +{ref}`text style` (`TEXT`) and hdf5 (`HDF5`) formats are +supported. The default file format is the +{ref}`text style`. Reading and writing force constants are +invoked by {ref}`FORCE_CONSTANTS tag`. Using these tags, +the input/output formats are switched. + +`FC_FORMAT` affects to both input and output, e.g. + +``` +FORCE_CONSTANTS = WRITE +FC_FORMAT = HDF5 +``` + +`READFC_FORMAT` and `WRITEFC_FORMAT` can be used to control input and output +formats separately, i.e., the following setting to convert force constants +format is possible: + +``` +READ_FORCE_CONSTANTS = .TRUE. +WRITE_FORCE_CONSTANTS = .TRUE. +WRITEFC_FORMAT = HDF5 +``` + +(band_format_tag)= + +### `BAND_FORMAT`, `MESH_FORMAT`, `QPOINTS_FORMAT` + +There are two file-formats to write the results of band structure, mesh, and +q-points calculations. Currently YAML (`YAML`) and hdf5 (`HDF5`) formats are +supported. The default file format is the YAML format. The file format is +changed as follows: + +``` +BAND_FORMAT = HDF5 +``` + +``` +MESH_FORMAT = HDF5 +``` + +``` +QPOINTS_FORMAT = HDF5 +``` + +(hdf5_tag)= + +### `HDF5` + +The following output files are written in hdf5 format instead of their original +formats (in parenthesis) by `HDF5 = .TRUE.`. In addition, `force_constants.hdf5` +is read with this tag. + +- `force_constants.hdf5` (`FORCE_CONSTANTS`) +- `mesh.hdf5` (`mesh.yaml`) +- `band.hdf5` (`band.yaml`) +- `qpoints.hdf5` (`qpoints.yaml`) + +``` +HDF5 = .TRUE. +``` + +#### `force_constants.hdf5` + +With `--hdf5` option and `FORCE_CONSTANTS = WRITE` (`--writefc`), +`force_constants.hdf5` is written. With `--hdf5` option and +`FORCE_CONSTANTS = READ` (`--readfc`), `force_constants.hdf5` is read. + +#### `mesh.hdf5` + +In the mesh sampling calculations (see {ref}`mesh_sampling_tags`), calculation +results are written into `mesh.hdf5` but not into `mesh.yaml`. Using this option +may reduce the data output size and thus writing time when `mesh.yaml` is huge, +e.g., eigenvectors are written on a dense sampling mesh. + +#### `qpoints.hdf5` + +In the specific q-points calculations ({ref}`qpoints_tag`), calculation results +are written into `qpoints.hdf5` but not into `qpoints.yaml`. With +{ref}`writedm_tag`, dynamical matrices are also stored in `qpoints.hdf5`. Using +this option may be useful with large set of q-points with including eigenvector +or dynamical matrix output. + +#### `band.hdf5` + +In the band structure calculations ({ref}`band_structure_related_tags`), +calculation results are written into `band.hdf5` but not into `band.yaml`. + +(summary_tag)= + +### `summary` + +The following data may be optionally included in the summary yaml file called +`phonopy_disp.yaml`/`phonopy.yaml` in addition to other file output settings. +This happens at the end of the pre/post-process (after running the `phonopy` +script): + +- `force constants` +- `force sets` +- `dielectric constant` +- `born effective charge` +- `displacements` +- `[all]` + +Including all relevant data in a single output file allows for a human readable +convenient file format. + +#### `force constants` + +The `--include-fc` flag or setting `INCLUDE_FC = .TRUE.` will cause the force +constants (if available) to be written as an entry in the yaml summary file. The +written force constants will reflect the required/available format used during +processing. So if `--full-fc` is set the entire matrix will be written. + +#### `force sets` + +The `--include-fs` flag or setting `INCLUDE_FS = .TRUE.` will cause the force +sets (if available) to be written as an entry in the yaml summary file. + +#### `dielectric constant` and `born effective charge` + +The `--include-born` flag or setting `INCLUDE_BORN = .TRUE.` will cause the born +effective charges and dielectric tensor (if available) to be written as an entry +in the yaml summary file. The values will only be written if non-analytical term +correction is set with the `--nac` flag or by setting `NAC = .TRUE.`. + +This is more convenient than keeping track of the `BORN` file created by the +user. + +#### `displacements` + +The `--include-disp` flag or setting `INCLUDE_DISP = .TRUE.` will cause +displacements data (if available) to be written as an entry in the yaml summary +file. + +This is set by default when the `phonopy` script is run in `displacements` mode. + +#### `all` + +All available data covered by the other `include` flags can be written to the +yaml summary file using the `--include-all` flag or by setting +`INCLUDE_ALL = .TRUE.`. Force constants are not stored when force sets are +stored. diff -Nru phonopy-2.12.0/doc/setting-tags.rst phonopy-2.13.1/doc/setting-tags.rst --- phonopy-2.12.0/doc/setting-tags.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/setting-tags.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,1586 +0,0 @@ -.. _setting_tags: - -Setting tags -============ - -.. contents:: - :depth: 2 - :local: - -Most of the setting tags have respective command-line options -(:ref:`command_options`). -When both of equivalent command-line option and setting tag are set -simultaneously, the command-line option supersedes the setting tag. -The configuration file is recommended to place at the first position for -the mixed use of setting tags and command-line options, i.e., - -:: - - phonopy setting.conf [command-line-options] - - -For specifying real and reciprocal points, fractional values -(e.g. ``1/3``) are accepted. However fractional values must not -have space among characters (e.g. ``1 / 3``) are not allowed. - - -Basic tags ----------- - -.. _dimension_tag: - -``DIM`` -~~~~~~~~~~ - -The supercell is created from the input unit cell. When three integers -are specified, a supercell elongated along axes of unit cell is -created. - -:: - - DIM = 2 2 3 - -In this case, a 2x2x3 supercell is created. - - -When nine integers are specified, the supercell is created by -multiplying the supercell matrix :math:`M_\mathrm{s}` with the unit -cell. For example, - -:: - - DIM = 0 1 1 1 0 1 1 1 0 - -the supercell matrix is - -.. math:: - - M_\mathrm{s} = \begin{pmatrix} - 0 & 1 & 1 \\ - 1 & 0 & 1 \\ - 1 & 1 & 0 - \end{pmatrix} - -where the rows correspond to the first three, second three, and third -three sets of numbers, respectively. When lattice parameters of unit -cell are the column vectors of :math:`\mathbf{a}_\mathrm{u}`, -:math:`\mathbf{b}_\mathrm{u}`, and :math:`\mathbf{c}_\mathrm{u}`, -those of supercell, :math:`\mathbf{a}_\mathrm{s}`, -:math:`\mathbf{b}_\mathrm{s}`, :math:`\mathbf{c}_\mathrm{s}`, are -determined by, - -.. math:: - - ( \mathbf{a}_\mathrm{s} \; \mathbf{b}_\mathrm{s} \; \mathbf{c}_\mathrm{s} ) - = ( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; - \mathbf{c}_\mathrm{u} ) M_\mathrm{s} - -Be careful that the axes in ``POSCAR`` is defined by three row -vectors, i.e., :math:`( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} -\; \mathbf{c}_\mathrm{u} )^T`. - -.. _primitive_axis_tag: - -``PRIMITIVE_AXES`` or ``PRIMITIVE_AXIS`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When specified, transformation from the input unit cell to the -primitive cell is performed. With this, the primitive cell basis -vectors are used as the coordinate system for the phonon calculation. -The transformation matrix is specified by nine values. The first, -second, and third three values give the rows of the 3x3 matrix as follows:: - - PRIMITIVE_AXES = 0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0 - -Likewise, - -:: - - PRIMITIVE_AXES = 0 1/2 1/2 1/2 0 1/2 1/2 1/2 0 - -The primitive cell for building the dynamical matrix is created by -multiplying primitive-axis matrix :math:`\mathrm{M}_\mathrm{p}`. Let -the matrix as, - -.. math:: - - \mathrm{M}_\mathrm{p} = \begin{pmatrix} - 0.0 & 0.5 & 0.5 \\ - 0.5 & 0.0 & 0.5 \\ - 0.5 & 0.5 & 0.0 - \end{pmatrix} - -where the rows correspond to the first three, second three, and -third three sets of numbers, respectively. - -When lattice parameters of unit cell (set by ``POSCAR``) are the -column vectors of :math:`\mathbf{a}_\mathrm{u}`, -:math:`\mathbf{b}_\mathrm{u}`, and :math:`\mathbf{c}_\mathrm{u}`, -those of supercell, :math:`\mathbf{a}_\mathrm{p}`, -:math:`\mathbf{b}_\mathrm{p}`, :math:`\mathbf{c}_\mathrm{p}`, are -determined by, - -.. math:: - - ( \mathbf{a}_\mathrm{p} \; \mathbf{b}_\mathrm{p} \; \mathbf{c}_\mathrm{p} ) - = ( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; - \mathbf{c}_\mathrm{u} ) \mathrm{M}_\mathrm{p}. - -:math:`\mathrm{M}_\mathrm{p}` is a change of basis matrix and so -:math:`\mathrm{M}_\mathrm{p}^{-1}` must be an integer matrix. Be careful that -:math:the axes in ``POSCAR`` is defined by three row vectors, i.e., -:math:`( \mathbf{a}_\mathrm{u} \; \mathbf{b}_\mathrm{u} \; -\mathbf{c}_\mathrm{u} )^T`. - -**New in v1.14.0** ``PRIMITIVE_AXES = AUTO`` is supported. This -enables to choose the transformation matrix automatically. Since the choice -of the primitive cell is arbitrary, it is recommended to use -``PRIMITIVE_AXES = AUTO`` to check if a possible transformation matrix -exists or not. - - -``ATOM_NAME`` -~~~~~~~~~~~~~ - -Chemical symbols :: - - ATOM_NAME = Si O - -The number of chemical symbols have to be same as that of the numbers -in the sixth line of ``POSCAR``. - -Chemical symbols read by phonopy are overwritten by those written in -``POSCAR``. See ``POSCAR`` examples. In WIEN2k mode, -you don't need to set this tag, i.e., chemical symbols are read from -the structure file. - -``EIGENVECTORS`` -~~~~~~~~~~~~~~~~ - -When this tag is '.TRUE.', eigenvectors are calculated. With ``-p`` -option, partial density of states are calculated. - -.. _mass_tag: - -``MASS`` -~~~~~~~~ - -This tag is not necessary to use usually, because atomic masses are -automatically set from the chemical symbols. - -Atomic masses of a **primitive cell** are overwritten by the values -specified. The order of atoms in the primitive cell that is defined by -``PRIMITIVE_AXIS`` tag can be shown using ``-v`` option. It must be -noted that this tag does not affect to the symmetry search. - -For example, when there are six atoms in a primitive cell, ``MASS`` is -set as follows :: - - MASS = 28.085 28.085 16.000 16.000 16.000 16.000 - -.. _magmom_tag: - -``MAGMOM`` -~~~~~~~~~~~ - -Symmetry of spin such as collinear magnetic moments is considered -using this tag. The number of values has to be equal to the number of -atoms in the unit cell, not the primitive cell or supercell. If this -tag is used with ``-d`` option (``CREATE_DISPLACEMENTS`` tag), -``MAGMOM`` file is created. This file contains the ``MAGMOM`` -information of the supercell used for VASP. Unlike ``MAGMOM`` in VASP, -``*`` can not be used, i.e., all the values (the same number of times -to the number of atoms in unit cell) have to be explicitly written. - -:: - - MAGMOM = 1.0 1.0 -1.0 -1.0 - -.. _cell_filename_tag: - -``CELL_FILENAME`` -~~~~~~~~~~~~~~~~~~ - -:: - - CELL_FILENAME = POSCAR-unitcell - -See :ref:`cell_filename_option`. - -.. _frequency_conversion_factor_tag: - -``FREQUENCY_CONVERSION_FACTOR`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Unit conversion factor of frequency from input values to your favorite -unit can be specified, but the use should be limited and it is -recommended to use this tag to convert the frequency unit to THz in -some exceptional case, for example, a special force calculator whose -physical unit system is different from the default setting of phonopy -is used. If the frequency unit is different from THz, though it works -just for seeing results of frequencies, e.g., band structure or DOS, -it doesn't work for derived values like thermal properties and -mean square displacements. - -The default values for calculators are those to convert frequency -units to THz. The default conversion factors are shown at -:ref:`frequency_default_value_interfaces`. These are determined -following the physical unit systems of the calculators. How to -calcualte these conversion factors is explained at -:ref:`physical_unit_conversion`. - -Displacement creation tags --------------------------- - -``CREATE_DISPLACEMENTS`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Supercells with displacements are created. This tag is used as the -post process of phonon calculation. - -:: - - CREATE_DISPLACEMENTS = .TRUE. - DIM = 2 2 2 - -.. _displacement_distance_tag: - -``DISPLACEMENT_DISTANCE`` -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Finite atomic displacement distance is set as specified value when -creating supercells with displacements. The default displacement -amplitude is 0.01 Angstrom, but when the ``wien2k``, ``abinit``, -``Fleur`` or ``turbomole`` option is specified, the default value -is 0.02 Bohr. - -``DIAG`` -~~~~~~~~~ - -When this tag is set ``.FALSE.``, displacements in diagonal directions -are not searched, i.e. all the displacements are along the lattice -vectors. ``DIAG = .FALSE.`` is recommended if one of the lattice -parameter of your supercell is much longer or much shorter than the -other lattice parameters. - -.. _pm_displacement_tag: - -``PM`` -~~~~~~~ - -This tag specified how displacements are found. When ``PM = .FALSE.``, -least displacements that can calculate force constants are found. This -may cause less accurate result. When ``PM = .TRUE.``, all the -displacements that are opposite directions to the least displacements -are also found, which is called plus-minus displacements here. The -default setting is ``PM = AUTO``. Plus-minus displacements are -considered with this tag. If the plus and minus displacements are -symmetrically equivalent, only the plus displacement is found. This -may be in between ``.FALSE.`` and ``.TRUE.``. You can check how it -works to see the file ``DISP`` where displacement directions on atoms -are written. - -.. _random_displacements_tag: - -``RANDOM_DISPLACEMENTS`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -The number of random displacement supercells are created by the -specified positive integer values. In each supercell, all atoms are -displaced in random direction with a constant displacement distance -specified by :ref:`displacement_distance_tag` tag. The random seed can -be specified by :ref:`random_seed_tag` tag. - -To obtain force constants with random displacements and respective -forces, external force constants calculator is necessary. - -:: - - CREATE_DISPLACEMENTS = .TRUE. - DIM = 2 2 2 - RANDOM_DISPLACEMENTS = 20 - DISPLACEMENT_DISTANCE = 0.03 - -.. _random_seed_tag: - -``RANDOM_SEED`` -~~~~~~~~~~~~~~~~ - -The random seed used for creating random displacements by -:ref:`random_displacements_tag` tag. The value has to be 32bit -unsigned int. The random seed is useful for crating the same random -displacements with using the same number. - - -.. _band_structure_related_tags: - -Band structure tags ----------------------------- - -``BAND`` and ``BAND_POINTS`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``BAND`` gives sampling band paths. The reciprocal points are -specified in reduced coordinates. The given points are connected for -defining band paths. When comma ``,`` is inserted between the points, -the paths are disconnected. - -``BAND_POINTS`` gives the number of sampling points including the path -ends. The default value is ``BAND_POINTS = 51``. - - -An example of three paths, (0,0,0) to (1/2,0,1/2), (1/2,1/2,1) to -(0,0,0), and (0,0,0) to (1/2,1/2,1/2), with 101 sampling points of -each path are as follows: - -:: - - BAND = 0 0 0 1/2 0 1/2, 1/2 1/2 1 0 0 0 1/2 1/2 1/2 - BAND_POINTS = 101 - -.. _band_labels_tag: - -``BAND_LABELS`` -~~~~~~~~~~~~~~~~~~ - -Labels specified are depicted in band structure plot at the points of -band segments. The number of labels has to correspond to the number of -band paths specified by ``BAND`` plus one. When LaTeX math style -expression such as :math:`\Gamma` (``\Gamma``) is expected, it is -probably necessary to place it between two $ characters. - -:: - - BAND = 1/2 0 1/2 0 0 0 1/2 1/2 1/2 - BAND_LABELS = X $\Gamma$ L - -.. |bandlabels| image:: band-labels.png - :scale: 25 - -|bandlabels| - -The colors of curves are automatically determined by matplotlib. The -same color in a band segment shows the same kind of band. Between -different band segments, the correspondence of colors doesn't mean -anything. - -.. _band_connection_tag: - -``BAND_CONNECTION`` -~~~~~~~~~~~~~~~~~~~~ - -With this option, band connections are estimated from eigenvectors and -band structure is drawn considering band crossings. In sensitive -cases, to obtain better band connections, it requires to increase -number of points calculated in band segments by the ``BAND_POINTS`` tag. - -:: - - BAND = 1/2 0 1/2 0 0 0 1/2 1/2 1/2 - BAND_POINTS = 101 - BAND_CONNECTION = .TRUE. - -.. |bandconnection| image:: band-connection.png - :scale: 25 - -|bandconnection| - - -.. _mesh_sampling_tags: - -Mesh sampling tags -------------------- - -Mesh sampling tags are used commonly for calculations of thermal -properties and density of states. - -.. _mp_tag: - -``MESH``, ``MP``, or ``MESH_NUMBERS`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``MESH`` numbers give uniform meshes in each axis. As the default -behavior, the center of mesh is determined by the Monkhorst-Pack -scheme, i.e., for odd number, a point comes to the center, and for -even number, the center is shifted half in the distance between -neighboring mesh points. - -Examples of an even mesh with :math:`\Gamma` center in two ways, - -:: - - MESH = 8 8 8 - GAMMA_CENTER = .TRUE. - -:: - - MESH = 8 8 8 - MP_SHIFT = 1/2 1/2 1/2 - -If only one float value is given, e.g., ``MESH = 100.0``, -:math:`\Gamma` centred sampling mesh is generated with the mesh -numbers :math:`(N_{\mathbf{a}^*}, N_{\mathbf{b}^*}, N_{\mathbf{c}^*})` -computed following the convention of the VASP automatic -k-point generation, which is - -.. math:: - - N_{\mathbf{a}^*} = \max[1, \mathrm{nint}(l|\mathbf{a}^*|)], \; - N_{\mathbf{b}^*} = \max[1, \mathrm{nint}(l|\mathbf{b}^*|)], \; - N_{\mathbf{c}^*} = \max[1, \mathrm{nint}(l|\mathbf{c}^*|)], - -where :math:`l` is the value to be specified. With this, -``GAMMA_CENTER`` becomes simply ignored, but ``MP_SHIFT`` works on top -of the :math:`\Gamma` centred sampling mesh. - -:: - - MESh = 100 - - -``MP_SHIFT`` -~~~~~~~~~~~~~~~~~~ - -``MP_SHIFT`` gives the shifts in direction along the corresponding -reciprocal axes (:math:`a^*`, :math:`b^*`, :math:`c^*`). 0 or 1/2 -(0.5) can be used as these values. 1/2 means the half mesh shift with -respect to neighboring grid points in each direction. - -``GAMMA_CENTER`` -~~~~~~~~~~~~~~~~~~ - -Instead of employing the Monkhorst-Pack scheme for the mesh sampling, -:math:`\Gamma` center mesh is used. The default value is ``.FALSE.``. - -:: - - GAMMA_CENTER = .TRUE. - -.. _write_mesh_tag: - -``WRITE_MESH`` -~~~~~~~~~~~~~~~~~ - -With a dense mesh, with eigenvectors, without mesh symmetry, sometimes -its output file ``mesh.yaml`` or ``mesh.hdf5`` can be huge. However -when those files are not needed, e.g., in (P)DOS calculation, -``WRITE_MESH = .FALSE.`` can disable to write out those files. With -(P)DOS calculation, DOS output files are obtained even with -``WRITE_MESH = .FALSE.``. The default setting is ``.TRUE.``. - -:: - - WRITE_MESH = .FALSE. - - -.. _dos_related_tags: - -Phonon density of states (DOS) tags ------------------------------------- - -Phonon density of states (DOS) is calcualted either with a linear -tetrahedron method (default) or smearing method. Phonons are -calculated on a sampling mesh, therefore these tags must be used with -:ref:`mesh_sampling_tags`. The physical unit of horizontal axis is -that of frequency that the user employs, e.g., THz, and that of -vertical axis is {no. of states}/({unit cell} x {unit of the -horizontal axis}). If the DOS is integrated over the frequency range, -it will be :math:`3N_\mathrm{a}` states, where :math:`N_\mathrm{a}` is -the number of atoms in the unit cell. - -Phonon-DOS is formally defined as - -.. math:: - - g(\omega) = \frac{1}{N} \sum_\lambda \delta(\omega - \omega_\lambda) - -where :math:`N` is the number of unit cells and :math:`\lambda = (\nu, -\mathbf{q})` with :math:`\nu` as the band index and :math:`\mathbf{q}` -as the q-point. This is computed on a set of descritized sampling -frequency points for which :math:`\omega` is specified arbitrary using -:ref:`dos_range_tag`. The phonon frequencies :math:`\omega_\lambda` -are obtained on a sampling mesh whose the number of grid points being -:math:`N`. In the smearing method, the delta function is replaced by -normal distribution (Gaussian function) with the standard deviation -specified by :ref:`sigma_tag`. In the tetrahedron method, the -Brillouin integration is made analytically within tetrahedra in -reciprocal space. - -``DOS`` -~~~~~~~~ - -This tag enables to calculate DOS. This tag is automatically set when -``PDOS`` tag or ``-p`` option. - -:: - - DOS = .TRUE. - -.. _dos_range_tag: - -``DOS_RANGE`` -~~~~~~~~~~~~~ -:: - - DOS_RANGE = 0 40 0.1 - -Total and partial density of states are drawn with some -parameters. The example makes DOS be calculated from frequency=0 to 40 -with 0.1 pitch. - -:ref:`dos_fmin_fmax_tags` can be alternatively -used to specify the minimum and maximum frequencies (the first and -second values). - -.. _dos_fmin_fmax_tags: - -``FMIN``, ``FMAX``, and ``FPITCH`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The uniform frequency sampling points for phonon-DOS calculation are -specified. ``FMIN`` and ``FMAX`` give the minimum, maximum frequencies -of the range, respectively, and ``FPITCH`` gives the frequency pitch -to be sampled. These three values are the same as those that can be -specified by ``DOS_RANGE``. - -``PDOS`` -~~~~~~~~ - -Projected DOS is calculated using this tag. The formal definition is -written as - -.. math:: - - g^j(\omega, \hat{\mathbf{n}}) = \frac{1}{N} \sum_\lambda - \delta(\omega - \omega_\lambda) |\hat{\mathbf{n}} \cdot - \mathbf{e}^j_\lambda|^2, - -where :math:`j` is the atom indices and :math:`\hat{\mathbf{n}}` is -the unit projection direction vector. Without specifying -:ref:`projection_direction_tag` or :ref:`xyz_projection_tag`, PDOS is -computed as sum of :math:`g^j(\omega, \hat{\mathbf{n}})` projected -onto Cartesian axes :math:`x,y,z`, i.e., - -.. math:: - - g^j(\omega) = \sum_{\hat{\mathbf{n}} = \{x, y, z\}} g^j(\omega, - \hat{\mathbf{n}}). - -The atom indices :math:`j` are specified by - -:: - - PDOS = 1 2, 3 4 5 6 - - -These numbers are those in the primitive cell. ``,`` separates the -atom sets. In this example, atom 1 and 2 are summarized as one curve -and atom 3, 4, 5, and, 6 are summarized as another curve. - -``PDOS = AUTO`` is supported To group symmetrically equivalent atoms -automatically. - -:: - - PDOS = AUTO - - -``EIGENVECTORS = .TRUE.`` and ``MESH_SYMMETRY = .FALSE.`` are -automatically set, therefore the calculation takes much more time than -usual DOS calculation. With a very dense sampling mesh, writing data -into ``mesh.yaml`` or ``mesh.hdf5`` can be unexpectedly huge. If only -PDOS is necessary but these output files are unnecessary, then it is -good to consider using ``WRITE_MESH = .FALSE.`` -(:ref:`write_mesh_tag`). - -.. _projection_direction_tag: - -``PROJECTION_DIRECTION`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -Eigenvectors are projected along the direction specified by this tag. -Projection direction is specified in reduced coordinates, i.e., with -respect to *a*, *b*, *c* axes. - -:: - - PDOS = 1, 2 - PROJECTION_DIRECTION = -1 1 1 - -.. _xyz_projection_tag: - -``XYZ_PROJECTION`` -~~~~~~~~~~~~~~~~~~~ - -PDOS is calculated using eigenvectors projected along x, y, and z -Cartesian coordinates. The format of output file ``projected_dos.dat`` -becomes different when using this tag, where phonon-mode-frequency and -x, y, and z components of PDOS are written out in the order:: - - frequency atom1_x atom1_y atom1_z atom2_x atom2_y atom2_z ... - -With ``-p`` option, three curves are drawn. These correspond to -sums of all projections to x, sums of all projections to y, and sums -of all projections to z composents of eigenvectors, respectively. - -:: - - XYZ_PROJECTION = .TRUE. - - -.. _sigma_tag: - -``SIGMA`` -~~~~~~~~~ - -A smearing method is used instead of a linear tetrahedron method. -This tag also specifies the smearing width. The unit is same as that -used for phonon frequency. The default value is the value given by the -difference of maximum and minimum frequencies divided by 100. - -:: - - SIGMA = 0.1 - -.. _debye_model_tag: - -``DEBYE_MODEL`` -~~~~~~~~~~~~~~~~ - -By setting ``.TRUE.``, DOS at lower phonon frequencies are fit to a -Debye model. By default, the DOS from 0 to 1/4 of the maximum phonon -frequencies are used for the fitting. The function used to the fitting -is :math:`D(\omega)=a\omega^2` where :math:`a` is the parameter and -the Debye frequency is :math:`(9N/a)^{1/3}` where :math:`N` is the -number of atoms in unit cell. Users have to unserstand that this is -**not** a unique way to determine Debye frequency. Debye frequency is -dependent on how to parameterize it. - -:: - - DEBYE_MODEL = .TRUE. - -.. _dos_moment_tag: - -``MOMEMT`` and ``MOMENT_ORDER`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Phonon moments for DOS and PDOS defined below are calculated using -these tags up to arbitrary order. The order is specified with -``MOMENT_ORDER`` (:math:`n` in the formula). Unless ``MOMENT_ORDER`` -specified, the first and second moments are calculated. - -The moments for DOS are given as - -.. math:: - - M_n(\omega_\text{min}, \omega_\text{max}) - =\frac{\int_{\omega_\text{min}}^{\omega_\text{max}} \omega^n - g(\omega) d\omega} {\int_{\omega_\text{min}}^{\omega_\text{max}} - g(\omega) d\omega}. - -The moments for PDOS are given as - -.. math:: - - M_n^j(\omega_\text{min}, \omega_\text{max}) - =\frac{\int_{\omega_\text{min}}^{\omega_\text{max}} \omega^n - g^j(\omega) d\omega} {\int_{\omega_\text{min}}^{\omega_\text{max}} - g^j(\omega) d\omega}. - -:math:`\omega_\text{min}` and :math:`\omega_\text{max}` are specified -:using ref:`dos_fmin_fmax_tags` tags. When these are not specified, -the moments are computed with the range of :math:`\epsilon < \omega -< \infty`, where :math:`\epsilon` is a small positive -value. Imaginary frequencies are treated as negative real values in -this computation, therefore it is not a good idea to set negative -:math:`\omega_\text{min}`. - -:: - - MOMENT = .TRUE. - MOMENT_ORDER = 3 - -.. _thermal_properties_tag: - -Thermal properties related tags --------------------------------- - -See :ref:`cutoff_frequency_tags` on the treatment of the imaginary modes. - -``TPROP``, ``TMIN``, ``TMAX``, and ``TSTEP`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Thermal properties, free energy, heat capacity, and entropy, are -calculated from their statistical thermodynamic expressions (see -:ref:`thermal_properties_expressions`). Thermal properties are -calculated from phonon frequencies on a sampling mesh in the -reciprocal space. Therefore these tags must be used with -:ref:`mesh_sampling_tags` and their convergence with respect to the -sampling mesh has to be checked. Usually this calculation is not -computationally demanding, so the convergence is easily achieved with -increasing the density of the sampling mesh. ``-p`` option can be used -together to plot the thermal propreties. - -Phonon frequencies in THz, which is the default setting of phonopy, -are used to obtain the thermal properties, therefore physical units -have to be set properly for it (see :ref:`calculator_interfaces`.) - -The calculated values are -written into ``thermal_properties.yaml``. The unit systems of free -energy, heat capacity, and entropy are kJ/mol, J/K/mol, and J/K/mol, -respectively, where 1 mol means :math:`\mathrm{N_A}\times` your input -unit cell (not formula unit), i.e. you have to divide the value by -number of formula unit in your unit cell by yourself. For example, in -MgO (conventional) unit cell, if you want to compare with experimental -results in kJ/mol, you have to divide the phonopy output by four. - -``TMIN``, ``TMAX``, and ``TSTEP`` tags are used to specify the -temperature range to be calculated. The default values of them are 0, -1000, and 10, respectively. - -:: - - TPROP = .TRUE. - TMAX = 2000 - -.. _pretend_real_tags: - -``PRETEND_REAL`` -~~~~~~~~~~~~~~~~~ - -This enables to take imaginary frequencies as real for thermal -property calculation. This does give false thermal properties, -therefore for a testing purpose only, when a small amount of imaginary -branches obtained. - -:: - - TPROP = .TRUE. - PRETEND_REAL = .TRUE. - -.. _cutoff_frequency_tags: - -``CUTOFF_FREQUENCY`` -~~~~~~~~~~~~~~~~~~~~~ - -This is given by a real value and the default value is 0. This tag -works as follows. - -Phonon thermal properties are computed as sum over phonon modes. See -:ref:`thermal_properties_expressions`. When we treat imaginary -frequences as negative values by -:math:`\text{sgn}(\nu^2) |\nu| \rightarrow \nu_\text{phonopy}`, all -phonon modes with :math:`\nu_\text{phonopy}` smaller than -this ``CUTOFF_FREQUENCY`` are simply excluded in the summation. - -In the ``thermal_properties.yaml``, the total number of calculated -phonon modes and the number of phonon modes -included for the thermal property calculation are shown as -``num_modes:`` and ``num_integrated_modes:``, respectively. - -:: - - CUTOFF_FREQUENCY = 0.1 - -.. _thermal_atomic_displacements_tags: - -Thermal displacements ---------------------- - -.. _thermal_displacements_tag: - -``TDISP``, ``TMAX``, ``TMIN``, and ``TSTEP`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Mean square displacements projected to Cartesian axes as a function of -temperature are calculated from the number of phonon excitations. The -usages of ``TMAX``, ``TMIN``, ``TSTEP`` tags are same as those in -:ref:`thermal properties tags `. Phonon -frequencies in THz, which is the default setting of phonopy, are used to -obtain the mean square displacements, therefore physical units have to -be set properly for it (see :ref:`calculator_interfaces`.) The result -is given in :math:`\text{Angstrom}^2` and writen into -``thermal_displacements.yaml``. See the detail of the method, -:ref:`thermal_displacement`. These tags must be used with -:ref:`mesh_sampling_tags` - -Optionally, ``FMIN`` tag (``--fmin`` option) with a small value is -recommened to be set when q-points at :math:`\Gamma` point or near -:math:`\Gamma` point (e.g. using very dense sampling mesh) are sampled -to avoid divergence. ``FMAX`` tag (``--fmax`` option) can be used to -specify an upper bound of phonon frequencies where the phonons are -considered in the summation. The projection is applied along arbitrary -direction using ``PROJECTION_DIRECTION`` tag -(:ref:`projection_direction_tag`). - -``mesh.yaml`` or ``mesh.hdf5`` is not written out from phonopy-1.11.14. - -:: - - TDISP = .TRUE. - PROJECTION_DIRECTION = 1 1 0 - -.. _thermal_displacement_matrices_tag: - -``TDISPMAT``, ``TMAX``, ``TMIN``, and ``TSTEP`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Mean square displacement matricies are calculated. The definition is -shown at :ref:`thermal_displacement`. Phonon frequencies in THz, which -is the default setting of phonopy, are -used to obtain the mean square displacement matricies, therefore -physical units have to be set properly for it (see -:ref:`calculator_interfaces`.) The result is given in -:math:`\text{Angstrom}^2` and writen into -``thermal_displacement_matrices.yaml`` where six matrix elements are -given in the order of xx, yy, zz, yz, xz, xy. In this yaml file, -``displacement_matrices`` and ``displacement_matrices_cif`` correspond -to :math:`\mathrm{U}_\text{cart}` and :math:`\mathrm{U}_\text{cif}` -defined at :ref:`thermal_displacement_matrix`, respectively. - -Optionally, ``FMIN`` tag (``--fmin`` option) with a small value is -recommened to be set when q-points at :math:`\Gamma` point or near -:math:`\Gamma` point (e.g. using very dense sampling mesh) are sampled -to avoid divergence. ``FMAX`` tag (``--fmax`` option) can be used to -specify an upper bound of phonon frequencies where the phonons are -considered in the summation. - -The 3x3 matrix restricts distribution of each atom around the -equilibrium position to be ellipsoid. But the distribution is not -necessarily to be so. - -``mesh.yaml`` or ``mesh.hdf5`` is not written out from phonopy-1.11.14. - -:: - - TDISPMAT = .TRUE. - -.. _thermal_displacement_cif_tag: - -``TDISPMAT_CIF`` -~~~~~~~~~~~~~~~~~ - -This tag specifis a temperature (K) at which thermal displacement is -calculated and the mean square displacement matrix is written to the -cif file ``tdispmat.cif`` with the dictionary item ``aniso_U``. Phonon -frequencies in THz, which is the default setting of phonopy, are used -to obtain the mean square displacement matricies, therefore physical -units have to be set properly for it (see -:ref:`calculator_interfaces`.) The result is given in -:math:`\textrm{Angstrom}^2`. - -``mesh.yaml`` or ``mesh.hdf5`` is not written out from phonopy-1.11.14. - -:: - - TDISPMAT_CIF = 1273.0 - -Specific q-points ------------------ - -.. _qpoints_tag: - -``QPOINTS`` -~~~~~~~~~~~ - -When q-points are supplied, those phonons are calculated. Q-points are -specified successive values separated by spaces and collected by every -three values as vectors in reciprocal reduced coordinates. - -:: - - QPOINTS = 0 0 0 1/2 1/2 1/2 1/2 0 1/2 - -With ``QPOINTS = .TRUE.``, q-points are read from ``QPOITNS`` file -(see the file format at :ref:`QPOINTS`) in curret directory -phonons at the q-points are calculated. - -:: - - QPOINTS = .TRUE. - - -.. _writedm_tag: - -``WRITEDM`` -~~~~~~~~~~~~ - -:: - - WRITEDM = .TRUE. - -Dynamical matrices :math:`D` are written into ``qpoints.yaml`` -in the following :math:`6N\times3N` format, where *N* is the number of atoms in -the primitive cell. - -The physical unit of dynamical matrix is ``[unit of force] / ([unit of -displacement] * [unit of mass])``, i.e., square of the unit of phonon -frequency before multiplying the unit conversion factor -(see :ref:`frequency_conversion_factor_tag`). - -.. math:: - - D = - \begin{pmatrix} - D_{11} & D_{12} & D_{13} & \\ - D_{21} & D_{22} & D_{23} & \cdots \\ - D_{31} & D_{32} & D_{33} & \\ - & \vdots & & \\ - \end{pmatrix}, - -and :math:`D_{jj'}` is - -.. math:: - D_{jj'} = - \begin{pmatrix} - Re(D_{jj'}^{xx}) & Im(D_{jj'}^{xx}) & Re(D_{jj'}^{xy}) & - Im(D_{jj'}^{xy}) & Re(D_{jj'}^{xz}) & Im(D_{jj'}^{xz}) \\ - Re(D_{jj'}^{yx}) & Im(D_{jj'}^{yx}) & Re(D_{jj'}^{yy}) & - Im(D_{jj'}^{yy}) & Re(D_{jj'}^{yz}) & Im(D_{jj'}^{yz}) \\ - Re(D_{jj'}^{zx}) & Im(D_{jj'}^{zx}) & Re(D_{jj'}^{zy}) & - Im(D_{jj'}^{zy}) & Re(D_{jj'}^{zz}) & Im(D_{jj'}^{zz}) \\ - \end{pmatrix}, - -where *j* and *j'* are the atomic indices in the primitive cell. The -phonon frequencies may be recovered from ``qpoints.yaml`` by writing a -simple python script. For example, ``qpoints.yaml`` is obtained for -NaCl at :math:`q=(0, 0.5, 0.5)` by - -:: - - phonopy --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" --qpoints="0 1/2 1/2" --writedm - -and the dynamical matrix may be used as - -.. code-block:: python - - #!/usr/bin/env python - - import yaml - import numpy as np - - data = yaml.load(open("qpoints.yaml")) - dynmat = [] - dynmat_data = data['phonon'][0]['dynamical_matrix'] - for row in dynmat_data: - vals = np.reshape(row, (-1, 2)) - dynmat.append(vals[:, 0] + vals[:, 1] * 1j) - dynmat = np.array(dynmat) - - eigvals, eigvecs, = np.linalg.eigh(dynmat) - frequencies = np.sqrt(np.abs(eigvals.real)) * np.sign(eigvals.real) - conversion_factor_to_THz = 15.633302 - print frequencies * conversion_factor_to_THz - - -.. _nac_tag: - -Non-analytical term correction ----------------------------------- - -``NAC`` -~~~~~~~~~~ - -Non-analytical term correction is applied to dynamical -matrix. ``BORN`` file has to be prepared in the current directory. See -:ref:`born_file` and :ref:`non_analytical_term_correction_theory`. -The default method is ``NAC_METHOD = GONZE`` after v1.13.0. - -:: - - NAC = .TRUE. - -.. _nac_method_tag: - -``NAC_METHOD`` -~~~~~~~~~~~~~~~ - -The method of non-analytical term correction is chosen by this tag -between two, ``NAC_METHOD = GONZE`` (:ref:`reference_dp_dp_NAC`) and -``NAC_METHOD = WANG`` (:ref:`reference_wang_NAC`), and the default is -the former after v1.13.0. - -``Q_DIRECTION`` -~~~~~~~~~~~~~~~~ - -This tag is used to activate non-analytical term correction (NAC) at -:math:`\mathbf{q}\rightarrow\mathbf{0}`, i.e. practically -:math:`\Gamma`-point, because NAC is direction -dependent. With this tag, :math:`\mathbf{q}` is specified in the -fractional coordinates of the reciprocal basis vectors. Only the -direction has the meaning. Therefore ``Q_DIRECTION = 1 1 1`` and -``Q_DIRECTION = 2 2 2`` give the same result. This tag is valid for -``QPOINTS``, ``IRREPS``, and ``MODULATION`` tags. - -Away from :math:`\Gamma`-point, this setting is ignored and the -specified **q**-point is used as the **q**-direction. - -:: - - QPOINTS = 0 0 0 - NAC = .TRUE. - Q_DIRECTION = 1 0 0 - - -.. _group_velocity_tag: - -Group velocity ---------------- - -``GROUP_VELOCITY`` -~~~~~~~~~~~~~~~~~~~ - -Group velocities at q-points are calculated by using this tag. The -group velocities are written into a yaml file corresponding to the run -mode in Cartesian coordinates. The physical unit depends on physical -units of input files and frequency conversion factor, but if VASP and -the default settings (e.g., THz for phonon frequency) are simply used, -then the physical unit will be Angstrom THz. - -:: - - GROUP_VELOCITY = .TRUE. - -Technical details are shown at :ref:`group_velocity`. - -``GV_DELTA_Q`` -~~~~~~~~~~~~~~~ - -The reciprocal distance used for finite difference method is -specified. The default value is ``1e-5`` for the method of non-analytical -term correction by Gonze *et al.*. In other case, unless this tag is -specified, analytical derivative is used instead of the finite -difference method. - -:: - - GV_DELTA_Q = 0.01 - -Symmetry ---------- - -.. _tolerance_tag: - -``SYMMETRY_TOLERANCE`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -This is used to set geometric tolerance to find symmetry of -crystal structure. The default value is 1e-5. In general, it is not a -good idea to loosen the tolerance. It is recommended to symmetrize -crystal structure before starting phonon calculation, e.g., using -:ref:`symmetry_option` option. - -:: - - SYMMETRY_TOLERANCE = 1e-3 - -.. _symmetry_tag: - -``SYMMETRY`` -~~~~~~~~~~~~~ - -P1 symmetry is enforced to the input unit cell by setting ``SYMMETRY = .FALSE``. - -.. _nomeshsym_tag: - -``MESH_SYMMETRY`` -~~~~~~~~~~~~~~~~~~ - -Symmetry search on the reciprocal sampling mesh is disabled by setting -``MESH_SYMMETRY = .FALSE.``. In some case such as hexagonal systems or -primitive cells of cubic systems having F and I-centrings, the results -with and without mesh symmetry give slightly different values for -those proprerties that can employ mesh symmetry. This happens when the -uniform sampling mesh made along basis vectors desn't have the same -crystallographic point group as the crystal itself. This symmetry -breaking may be also seen by the fact that ``weight`` written in -``mesh.yaml`` can be different from possible order of product group of -site-symmetry group and time revesal symmetry. Generally the -difference becomes smaller when increasing the sampling mesh numbers. - - -.. _fc_symmetry_tag: - -``FC_SYMMETRY`` -~~~~~~~~~~~~~~~~ - -**Changed at v1.12.3** - -Previously this tag required a number for the iteration. From version -1.12.3, the way of symmetrization for translation invariance is -modified and this number became unnecessary. - -This tag is used to symmetrize force constants by translational -symmetry and permutation symmetry with ``.TRUE.`` or ``.FALSE.``. - -:: - - FC_SYMMETRY = .TRUE. - - -From the translation invariance condition, - -.. math:: - - \sum_i \Phi_{ij}^{\alpha\beta} = 0, \;\;\text{for all $j$, $\alpha$, $\beta$}, - -where *i* and *j* are the atom indices, and :math:`\alpha` and -:math:`\beta` are the Catesian indices for atoms *i* and *j*, -respectively. When this condition is broken, the sum gives non-zero -value. This value is subtracted from the diagonal blocks. Force -constants are symmetric in each pair as - -.. math:: - - \Phi_{ij}^{\alpha\beta} - = \frac{\partial^2 U}{\partial u_i^\alpha \partial u_j^\beta} - = \frac{\partial^2 U}{\partial u_j^\beta \partial u_i^\alpha} - = \Phi_{ji}^{\beta\alpha} - -Mind that the other symmetries of force constants, i.e., the -symmetry from crystal symmetry or rotational symmetry, are broken to -use ``FC_SYMMETRY``. - -.. _force_constants_tag: - -Force constants ---------------- - -``FORCE_CONSTANTS`` -~~~~~~~~~~~~~~~~~~~ - -:: - - FORCE_CONSTANTS = READ - -There are three values to be set, which are ``READ`` and ``WRITE``, -and ``.FALSE.``. The default is ``.FALSE.``. When ``FORCE_CONSTANTS = -READ``, force constants are read from ``FORCE_CONSTANTS`` file. With -``FORCE_CONSTANTS = WRITE``, force constants calculated from -``FORCE_SETS`` are written to ``FORCE_CONSTANTS`` file. - -The file format of ``FORCE_CONSTANTS`` is shown -:ref:`here `. - -.. _full_force_constants_tag: - -``FULL_FORCE_CONSTANTS`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -``FULL_FORCE_CONSTANTS = .TRUE.`` is used to compute full supercell -constants matrix. The default setting is ``.FALSE.``. By ``.TRUE.`` or -``.FALSE.``, the array shape becomes ``(n_patom, n_satom, 3, 3)`` or -``(n_satom, n_satom, 3, 3)``, respectively. The detail is found at -:ref:`file_force_constants`. - -``READ_FORCE_CONSTANTS`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -``READ_FORCE_CONSTANTS = .TRUE.`` is equivalent to ``FORCE_CONSTANTS = -READ``. - -``WRITE_FORCE_CONSTANTS`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -``WRITE_FORCE_CONSTANTS = .TRUE.`` is equivalent to ``FORCE_CONSTANTS = -WRITE``. - -.. _fc_calculator_tag: - -``FC_CALCULATOR`` -~~~~~~~~~~~~~~~~~~ - -External force constants calculator can be used using this -tag. Currently ``ALM`` is supported. The phonopy's default force -constants calculator is based on finite difference method, for which -atomic displacements are made systematically. The following is the -list of the force constants calculator currently possible to be -invoked from phonopy. - -.. _fc_calculator_alm_tag: - -``ALM`` -^^^^^^^^ - -**New in v2.3** ALM (https://github.com/ttadano/ALM) is based on -fitting approach and any displacements set of atoms in supercell can -be handled. For example, random displacements generated by -:ref:`random_displacements_tag` can be used to compute force -constants. To use ALM, its python module has to be installed. The -installation instruction is found `here -`_. - -When ALM is used, please cite the paper: T. Tadano -and S. Tsuneyuki, J. Phys. Soc. Jpn. **87**, 041015 (2018). - - -:: - - FC_CALCULATOR = ALM - - -.. _animation_tag: - -Create animation file ---------------------- - -``ANIME_TYPE`` -~~~~~~~~~~~~~~~~ - -:: - - ANIME_TYPE = JMOL - -There are ``V_SIM``, ``ARC``, ``XYZ``, ``JMOL``, and ``POSCAR`` -settings. Those may be viewed by ``v_sim``, ``gdis``, ``jmol`` -(animation), ``jmol`` (vibration), respectively. For ``POSCAR``, a set -of ``POSCAR`` format structure files corresponding to respective -animation images are created such as ``APOSCAR-000``, -``APOSCAR-001``,.... - -There are several parameters to be set in the ``ANIME`` tag. - -``ANIME`` -~~~~~~~~~ - -**The format of ``ANIME`` tag was modified after ver. 0.9.3.3.** - -For v_sim -^^^^^^^^^^ - -:: - - ANIME = 0.5 0.5 0 - -The values are the *q*-point to be calculated. An animation file of -``anime.ascii`` is generated. - -.. toctree:: - - animation - - -For the other animation formats -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Phonon is only calculated at :math:`\Gamma` point. So *q*-point is not -necessary to be set. - -``anime.arc``, ``anime.xyz``, ``anime.xyz_jmol``, or ``APOSCAR-*`` -are generated according to the ``ANIME_TYPE`` setting. - -:: - - ANIME = 4 5 20 0.5 0.5 0 - -The values are as follows from left: - -1. Band index given by ascending order in phonon frequency. - -2. Magnitude to be multiplied. In the harmonic phonon calculation, - there is no amplitude information obtained directly. The relative - amplitude among atoms in primitive cell can be obtained from - eigenvectors with the constraint of the norm or the eigenvectors - equals one, i.e., number of atoms in the primitive is large, the - displacements become small. Therefore this has to be adjusted to - make the animation good looking. - -3. Number of images in one phonon period. - -4. (4-6) Shift of atomic points in reduced coordinate in real space. These - values can be omitted and the default values are ``0 0 0``. - -For ``anime.xyz_jmol``, the first and third values are not used, -however dummy values, e.g. 0, are required. - -.. _modulation_tag: - -Create modulated structure ----------------------------- - -``MODULATION`` -~~~~~~~~~~~~~~ - -The ``MODULATION`` tag is used to create a crystal structure with -displacements along normal modes at q-point in the specified supercell -dimension. - -Atomic displacement of the *j*-th atom is created from the real part -of the eigenvectors with amplitudes and phase factors as - -.. math:: - - \frac{A} { \sqrt{N_\mathrm{a}m_j} } \operatorname{Re} \left[ \exp(i\phi) - \mathbf{e}_j \exp( \mathbf{q} \cdot \mathbf{r}_{jl} ) \right], - -where :math:`A` is the amplitude, :math:`\phi` is the phase, -:math:`N_\mathrm{a}` is the number of atoms in the supercell specified -in this tag and :math:`m_j` is the mass of the *j*-th atom, -:math:`\mathbf{q}` is the q-point specified, :math:`\mathbf{r}_{jl}` -is the position of the *j*-th atom in the *l*-th unit cell, and -:math:`\mathbf{e}_j` is the *j*-th atom part of eigenvector. Convention of -eigenvector or dynamical matrix employed in phonopy is shown in -:ref:`dynacmial_matrix_theory`. - -If several modes are specified as shown in the example above, they are -overlapped on the structure. The output filenames are -``MPOSCAR...``. Each modulated structure of a normal mode is written -in ``MPOSCAR-`` where the numbers correspond to the order of -specified sets of modulations. ``MPOSCAR`` is the structure where all -the modulations are summed. ``MPOSCAR-orig`` is the structure without -containing modulation, but the dimension is the one that is specified. -Some information is written into ``modulation.yaml``. - -Usage -^^^^^^^^^^^^^ - -The first three (nine) values correspond to supercell dimension -(supercell matrix) like the :ref:`dimension_tag` tag. The following -values are used to describe how the atoms are modulated. Multiple sets -of modulations can be specified by separating by comma ``,``. In each -set, the first three values give a Q-point in the reduced coordinates -in reciprocal space. Then the next three values are the band index -from the bottom with ascending order, amplitude, and phase factor in -degrees. The phase factor is optional. If it is not specified, 0 is -used. - -Before multiplying user specified phase factor, the phase of -the modulation vector is adjusted as the largest absolute value, -:math:`\left|\mathbf{e}_j\right|/\sqrt{m_j}`, of element of -3N dimensional modulation vector to be real. The complex modulation -vector is shown in ``modulation.yaml``. - -:: - - MODULATION = 3 3 1, 1/3 1/3 0 1 2, 1/3 1/3 0 2 3.5 - -:: - - MODULATION = 3 3 1, 1/3 1/3 0 1 2, 1/3 0 0 2 2 - -:: - - MODULATION = 3 3 1, 1/3 1/3 0 1 1 0, 1/3 1/3 0 1 1 90 - -:: - - MODULATION = -1 1 1 1 -1 1 1 1 -1, 1/2 1/2 0 1 2 - - -.. _irreducible_representation_related_tags: - -Characters of irreducible representations ------------------------------------------- - -.. _irreps_tag: - -``IRREPS`` -~~~~~~~~~~~~~~~~~~~~ - -Characters of irreducible representations (Irreps) of phonon modes are -shown. For this calculation, a primitive cell has to be used. If the -input unit cell is a non-primitive cell, it has to be transformed to a -primitive cell using ``PRIMITIVE_AXES`` tag. - -The first three values gives a *q*-point in reduced coordinates -to be calculated. The degenerated modes are searched only by the closeness of -frequencies. The frequency difference to be tolerated is specified by -the fourth value in the frequency unit that the user specified. - -:: - - IRREPS = 0 0 0 1e-3 - - -Symbols of Irreps for the 32 point group types at the :math:`\Gamma` -point are shown but not at non-:math:`\Gamma` point. - -``SHOW_IRREPS`` -~~~~~~~~~~~~~~~~ - -Irreducible representations are shown along with character table. - -:: - - IRREPS = 1/3 1/3 0 - SHOW_IRREPS = .TRUE. - -``LITTLE_COGROUP`` -~~~~~~~~~~~~~~~~~~~ -Show irreps of little co-group (point-group of wavevector) instead of -little group. - -:: - - IRREPS = 0 0 1/8 - LITTLE_COGROUP = .TRUE. - -Input/Output file control -------------------------- - -.. _fc_format_tag: - -``FC_FORMAT``, ``READFC_FORMAT``, ``WRITEFC_FORMAT`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There are two file-formats to store force constants. Currently -:ref:`text style` (``TEXT``) and hdf5 (``HDF5``) -formats are supported. The default file format is the :ref:`text -style`. Reading and writing force constants are -invoked by :ref:`FORCE_CONSTANTS tag`. Using -these tags, the input/output formats are switched. - -``FC_FORMAT`` affects to both input and output, e.g.:: - - FORCE_CONSTANTS = WRITE - FC_FORMAT = HDF5 - -``READFC_FORMAT`` and ``WRITEFC_FORMAT`` can be used to control -input and output formats separately, i.e., the following setting to -convert force constants format is possible:: - - READ_FORCE_CONSTANTS = .TRUE. - WRITE_FORCE_CONSTANTS = .TRUE. - WRITEFC_FORMAT = HDF5 - -.. _band_format_tag: - -``BAND_FORMAT``, ``MESH_FORMAT``, ``QPOINTS_FORMAT`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There are two file-formats to write the results of band structure, -mesh, and q-points calculations. Currently YAML (``YAML``) and hdf5 -(``HDF5``) formats are supported. The default file format is the YAML -format. The file format is changed as follows: - -:: - - BAND_FORMAT = HDF5 - -:: - - MESH_FORMAT = HDF5 - -:: - - QPOINTS_FORMAT = HDF5 - -.. _hdf5_tag: - -``HDF5`` -~~~~~~~~~~~ - -The following output files are written in hdf5 format instead of their -original formats (in parenthesis) by ``HDF5 = .TRUE.``. In addition, -``force_constants.hdf5`` is read with this tag. - -* ``force_constants.hdf5`` (``FORCE_CONSTANTS``) -* ``mesh.hdf5`` (``mesh.yaml``) -* ``band.hdf5`` (``band.yaml``) -* ``qpoints.hdf5`` (``qpoints.yaml``) - -:: - - HDF5 = .TRUE. - -``force_constants.hdf5`` -^^^^^^^^^^^^^^^^^^^^^^^^^ - -With ``--hdf5`` option and ``FORCE_CONSTANTS = WRITE`` -(``--writefc``), ``force_constants.hdf5`` is written. -With ``--hdf5`` option and ``FORCE_CONSTANTS = READ`` (``--readfc``), -``force_constants.hdf5`` is read. - -``mesh.hdf5`` -^^^^^^^^^^^^^^ - -In the mesh sampling calculations (see :ref:`mesh_sampling_tags`), -calculation results are written into ``mesh.hdf5`` but not into -``mesh.yaml``. Using this option may reduce the data output size and -thus writing time when ``mesh.yaml`` is huge, e.g., eigenvectors are -written on a dense sampling mesh. - -``qpoints.hdf5`` -^^^^^^^^^^^^^^^^^ - -In the specific q-points calculations (:ref:`qpoints_tag`), -calculation results are written into ``qpoints.hdf5`` but not into -``qpoints.yaml``. With :ref:`writedm_tag`, dynamical matrices are also -stored in ``qpoints.hdf5``. Using this option may be useful with large -set of q-points with including eigenvector or dynamical matrix output. - -``band.hdf5`` -^^^^^^^^^^^^^^^ - -In the band structure calculations (:ref:`band_structure_related_tags`), -calculation results are written into ``band.hdf5`` but not into -``band.yaml``. - - -.. _summary_tag: - -``summary`` -~~~~~~~~~~~ - -The following data may be optionally included in the summary yaml file -called ``phonopy_disp.yaml``/``phonopy.yaml`` in addition to other file -output settings. This happens at the end of the pre/post-process (after -running the ``phonopy`` script): - -* ``force constants`` -* ``force sets`` -* ``dielectric constant`` -* ``born effective charge`` -* ``displacements`` -* ``[all]`` - -Including all relevant data in a single output file allows for a human -readable convenient file format. - - -``force constants`` -^^^^^^^^^^^^^^^^^^^ - -The ``--include-fc`` flag or setting ``INCLUDE_FC = .TRUE.`` will cause -the force constants (if available) to be written as an entry in the -yaml summary file. The written force constants will reflect the -required/available format used during processing. So if ``--full-fc`` is -set the entire matrix will be written. - - -``force sets`` -^^^^^^^^^^^^^^ - -The ``--include-fs`` flag or setting ``INCLUDE_FS = .TRUE.`` will cause -the force sets (if available) to be written as an entry in the yaml summary -file. - - -``dielectric constant`` and ``born effective charge`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The ``--include-born`` flag or setting ``INCLUDE_BORN = .TRUE.`` will cause -the born effective charges and dielectric tensor (if available) to be -written as an entry in the yaml summary file. The values will only be written -if non-analytical term correction is set with the ``--nac`` flag or by -setting ``NAC = .TRUE.``. - -This is more convenient than keeping track of the ``BORN`` file created by the user. - - -``displacements`` -^^^^^^^^^^^^^^^^^ - -The ``--include-disp`` flag or setting ``INCLUDE_DISP = .TRUE.`` will cause -displacements data (if available) to be written as an entry in the yaml summary file. - -This is set by default when the ``phonopy`` script is run in ``displacements`` mode. - - -``all`` -^^^^^^^ - -All available data covered by the other ``include`` flags can be written to the yaml -summary file using the ``--include-all`` flag or by setting ``INCLUDE_ALL = .TRUE.``. -Force constants are not stored when force sets are stored. diff -Nru phonopy-2.12.0/doc/symmetry.md phonopy-2.13.1/doc/symmetry.md --- phonopy-2.12.0/doc/symmetry.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/symmetry.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,39 @@ +# Crystal symmetry + +## Tolerance used in crystal symmetry search + +Phonon calculation is based on the assumption that atoms have their own +equilibrium positions where forces on these atoms are zero. In addition, there +is a unit cell that contains these atoms and the unit cell are repeated in the +direct space, i.e., it forms a lattice. The lattice vectors (or basis vectors) +and points of atoms in this unit cell give the information of the crystal +structure. + +The crystal structure may have a specific symmetry. The categorization of the +crystal symmetrized is achieved by the group theory about symmetry operations, +and there are the 230 different space group types. In phonopy, the crystal +symmetry is automatically analyzed from the input unit cell structure file that +doesn't contain the symmetry information. Symmetries are searched by attempting +possible symmetry operations to the crystal structure and checking if the +crystal structure after the symmetry operation is overlapping to the original +crystal structures. In this analysis, a tolerance of distance is used to +tolerate small deviation of overlapping. This tolerance is the user's choice. +The default value is `1e-5`. + +Often we know the space group type of our crystal. Therefore it is recommended +to check whether the space group type of the input unit cell is the correct one +or not with very tight value such as `--tolerance=1e-8` ({ref}`tolerance_tag`). +If an input unit cell structure is naively distorted for which the distortion is +about the same order of the chosen tolerance, inconsistency in symmetry handling +may occur and it can result in a crash of the calculation or induce a strange +calculation result. This can be checked by changing the tolerance value +variously and watching the obtained space group type. If an input unit cell +structure is distorted, different space group types are found with respect to +the different tolerance values. + +The detailed space group information is obtained by {ref}`symmetry_option` +option. As a result of using this option and the chosen tolerance value, +`BPOSCAR` file is obtained. This is a standardized conventional unit cell (see +https://spglib.github.io/spglib/definition.html#conventions-of-standardized-unit-cell), +and its distortion against the crystal symmetry is very small. It is recommended +to used this structure as the starting point of phonopy calculation. diff -Nru phonopy-2.12.0/doc/symmetry.rst phonopy-2.13.1/doc/symmetry.rst --- phonopy-2.12.0/doc/symmetry.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/symmetry.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -Crystal symmetry -================= - -Tolerance used in crystal symmetry search ------------------------------------------- - -Phonon calculation is based on the assumption that atoms have thier -own equilibrium positions where forces on these atoms are zero. In -addition, there is a unit cell that contains these atoms and the unit -cell are repeated in the direct space, i.e., it forms a lattice. The -lattice vectors (or basis vectors) and points of atoms in this unit -cell give the information of the crystal structure. - -The crystal structure may have a specific symmetry. The categorization -of the crystal symmetried is achieved by the group theory about -symmetry operations, and there are the 230 different space group -types. In phonopy, the crystal symmetry is automatically analyzed from -the input unit cell structure file that doesn't contain the symmetry -information. Symmetries are searched by attemping possible symmetry -operations to the crystal structure and cheking if the crystal -structure after the symmetry operation is overlapping to the original -crystal structures. In this analysis, a tolerance of distance is -used to tolerate small deviation of overlapping. This tolerance is -the user's choice. The default value is ``1e-5``. - -Often we know the space group type of our crystal. Therefore it is -recommended to check whether the space group type of the input unit -cell is the correct one or not with very tight value such as -``--tolerance=1e-8`` (:ref:`tolerance_tag`). If an input -unit cell structure is naively distorted for which the distortion is -about the same order of the chosen tolerance, inconsistency in -symmetry handling may occur and it can result in a crash of the -calculation or induce a strange calculation result. This can be -checked by changing the tolerance value variously and watching the -obtained space group type. If an input unit cell structure is -distorted, different space group types are found with respect to the -different tolerance values. - -The detailed space group information is obtained by -:ref:`symmetry_option` option. As a result of using this option and -the chosen tolerance value, ``BPOSCAR`` file is obtained. This is a -standardized conventional unit cell (see -https://spglib.github.io/spglib/definition.html#conventions-of-standardized-unit-cell), -and its distortion against the crystal symmetry is very small. It is -recommended to used this structure as the starting point of phonopy -calculation. diff -Nru phonopy-2.12.0/doc/thermal-displacement.inc phonopy-2.13.1/doc/thermal-displacement.inc --- phonopy-2.12.0/doc/thermal-displacement.inc 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/thermal-displacement.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -.. _thermal_displacement: - -Thermal displacement ---------------------- - -Mean square displacement -~~~~~~~~~~~~~~~~~~~~~~~~~ - -From Eq. (10.71) in the book "Thermodynamics of Crystal", atomic -displacement, **u**, is written by - -.. math:: - - u^\alpha(jl,t) = \left(\frac{\hbar}{2Nm_j}\right)^{\frac{1}{2}} - \sum_{\mathbf{q},\nu}\left[\omega_\nu(\mathbf{q})\right]^{-\frac{1}{2}} - \left[\hat{a}_\nu(\mathbf{q})\exp(-i\omega_\nu(\mathbf{q})t)+ - \hat{a}^\dagger_\nu(\mathbf{-q})\exp({i\omega_\nu(\mathbf{q})}t)\right] - \exp({i\mathbf{q}\cdot\mathbf{r}(jl)}) - e^\alpha_\nu(j,\mathbf{q}) - -where *j* and *l* are the labels for the *j*-th atomic position in the -*l*-th unit cell, *t* is the time, :math:`\alpha` is an axis (a -Cartesian axis in the default behavior of phonopy), *m* is the atomic -mass, *N* is the number of the unit cells, :math:`\mathbf{q}` is the -wave vector, :math:`\nu` is the index of phonon mode. *e* is the -polarization vector of the atom *jl* and the band :math:`\nu` at -:math:`\mathbf{q}`. :math:`\mathbf{r}(jl)` is the atomic position and -:math:`\omega` is the phonon frequency. :math:`\hat{a}^\dagger` and -:math:`\hat{a}` are the creation and annihilation operators of -phonon. The expectation value of the squared atomic displacement is -calculated as, - -.. math:: - - \left\langle |u^\alpha(jl, t)|^2 \right\rangle = \frac{\hbar}{2Nm_j} - \sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} - (1+2n_\nu(\mathbf{q},T))|e^\alpha_\nu(j,\mathbf{q})|^2, - -where :math:`n_\nu(\mathbf{q},T)` is the phonon population, which is give by, - -.. math:: - - n_\nu(\mathbf{q},T) = - \frac{1}{\exp(\hbar\omega_\nu(\mathbf{q})/\mathrm{k_B}T)-1}, - -where *T* is the temperature, and :math:`\mathrm{k_B}` is the -Boltzmann constant. The equation is calculated using the commutation -relation of the creation and annihilation operators and the -expectation values of the combination of the operations, e.g., - -.. math:: - - [ \hat{a}_\nu(\mathbf{q}), \hat{a}^\dagger_{\nu'}(\mathbf{q'}) ] - &= \delta(\mathbf{q}-\mathbf{q}')\delta_{\nu\nu'},\\ - [ \hat{a}_\nu(\mathbf{q}), \hat{a}_{\nu'}(\mathbf{q'}) ] &= 0,\\ - [ \hat{a}^\dagger_\nu(\mathbf{q}), \hat{a}^\dagger_{\nu'}(\mathbf{q'}) ] &= 0,\\ - \langle|\hat{a}_\nu(\mathbf{q})\hat{a}_{\nu'}(\mathbf{q'})|\rangle &= 0,\\ - \langle|\hat{a}^\dagger_\nu(\mathbf{q})\hat{a}^\dagger_{\nu'}(\mathbf{q'})|\rangle - &= 0. - -.. _thermal_displacement_matrix: - -Mean square displacement matrix -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Mean square displacement matrix is defined as follows: - -.. math:: - - \mathrm{U}_\text{cart}(j, T) = \frac{\hbar}{2Nm_j} - \sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} - (1+2n_\nu(\mathbf{q},T)) - \mathbf{e}_\nu(j,\mathbf{q}) \otimes \mathbf{e}^*_\nu(j,\mathbf{q}). - -This is a symmetry matrix and diagonal elements are same as mean -square displacement calculated along Cartesian x, y, z directions. - -Projection to an arbitrary axis -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In phonopy, eigenvectors are calculated in the Cartesian axes that are -defined in the input structure file. Mean square displacement along an -arbitrary axis is obtained projecting eigenvectors in the Cartesian -axes as follows: - -.. math:: - - \left\langle |u(jl, t)|^2 \right\rangle = \frac{\hbar}{2Nm_j} - \sum_{\mathbf{q},\nu}\omega_\nu(\mathbf{q})^{-1} - (1+2n_\nu(\mathbf{q},T))| - \hat{\mathbf{n}}\cdot\mathbf{e}_\nu(j,\mathbf{q})|^2 - -where :math:`\hat{\mathbf{n}}` is an arbitrary unit direction. - -Mean square displacement matrix in cif format -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -According to the paper by Grosse-Kunstleve and Adams [J. Appl. Cryst., -35, 477-480 (2002)], mean square displacement matrix in the cif -definition (``aniso_U``), -:math:`\mathrm{U}_\text{cif}`, is obtained by - -.. math:: - - \mathrm{U}_\text{cif} = (\mathrm{AN})^{-1}\mathrm{U}_\text{cart} - (\mathrm{AN})^{-\mathrm{T}}, - -where :math:`\mathrm{A}` is the matrix to transform a point in fractional -coordinates to the Cartesian coordinates and :math:`\mathrm{N}` is the -diagonal matrix made of reciprocal basis vector lengths as follows: - -.. math:: - - \mathrm{A} = \begin{pmatrix} - a_x & b_x & c_x \\ - a_y & b_y & c_y \\ - a_z & b_z & c_z - \end{pmatrix} - -and - -.. math:: - - \mathrm{N} = \begin{pmatrix} - a^* & 0 & 0 \\ - 0 & b^* & 0 \\ - 0 & 0 & c^* - \end{pmatrix}. - -:math:`a^*`, :math:`b^*`, :math:`c^*` are defined without :math:`2\pi`. diff -Nru phonopy-2.12.0/doc/workflow.md phonopy-2.13.1/doc/workflow.md --- phonopy-2.12.0/doc/workflow.md 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/doc/workflow.md 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,29 @@ +(workflow)= + +# Work flow + +## Phonon calculations at constant volume + +Work flow of phonopy is shown schematically. There are two ways to calculate, +(1) atomic forces from finite displacements and (2) given force constants. You +can choose one of them. Forces on atoms or force constants are calculated by +your favorite calculator (shown by the octagons in the work flow). The boxes are +jobs being done by phonopy, and the circles are input and intermediate output +data structures. + +```{figure} procedure.png +:scale: 80 +:align: center + +Work flow of phonon calculation +``` + +## Combinations of phonon calculations at different volumes + +Mode Grüneisen parameters can be calculated from two or three phonon calculation +results obtained at slightly different volume points. See the details at +{ref}`phonopy_gruneisen`. + +With more volume points and fitting the thermal properties, thermal properties +at constant pressure are obtained under the (so-called) quasi-harmonic +approximation. See more details at {ref}`phonopy_qha`. diff -Nru phonopy-2.12.0/doc/workflow.rst phonopy-2.13.1/doc/workflow.rst --- phonopy-2.12.0/doc/workflow.rst 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/doc/workflow.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -.. _workflow: - -Work flow -========== - -Phonon calculations at constant volume --------------------------------------- - -Work flow of phonopy is shown schematically. There are two ways to -calculate, (1) atomic forces from finite displacements and (2) given -force constants. You can choose one of them. Forces on atoms or force -constants are calculated by your favorite calculator (shown by the -octagons in the work flow). The boxes are jobs being done by phonopy, -and the circles are input and intermediate output data structures. - -.. figure:: procedure.png - :scale: 80 - :align: center - - Work flow of phonon calculation - -Combinations of phonon calculations at different volumes ---------------------------------------------------------- - -Mode Grüneisen parameters can be calculated from two or three phonon -calculation results obtained at slightly different volume points. See -the details at :ref:`phonopy_gruneisen`. - -With more volume points and fitting the thermal properties, thermal -properties at constant pressure are obtained under the (so-called) -quasi-harmonic approximation. See more details at :ref:`phonopy_qha`. diff -Nru phonopy-2.12.0/.gitignore phonopy-2.13.1/.gitignore --- phonopy-2.12.0/.gitignore 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/.gitignore 2022-02-13 03:47:08.000000000 +0000 @@ -43,3 +43,9 @@ .buildinfo .doctrees _build + +# VSCode +.vscode + +# sphinx +_sources diff -Nru phonopy-2.12.0/phonopy/api_phonopy.py phonopy-2.13.1/phonopy/api_phonopy.py --- phonopy-2.12.0/phonopy/api_phonopy.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/api_phonopy.py 2022-02-13 03:47:08.000000000 +0000 @@ -181,7 +181,7 @@ self._search_primitive_symmetry() # displacements - self._displacement_dataset = {"natom": self._supercell.get_number_of_atoms()} + self._displacement_dataset = {"natom": len(self._supercell)} self._supercells_with_displacements = None # set_force_constants or set_forces @@ -1590,7 +1590,7 @@ _is_gamma_center = is_gamma_center else: if self._primitive_symmetry is not None: - rots = self._primitive_symmetry.get_pointgroup_operations() + rots = self._primitive_symmetry.pointgroup_operations mesh_nums = length2mesh(mesh, self._primitive.cell, rotations=rots) else: mesh_nums = length2mesh(mesh, self._primitive.cell) @@ -2381,7 +2381,7 @@ """ return { "frequency_points": self._pdos.frequency_points, - "projected_dos": self._pdos.partial_dos, + "projected_dos": self._pdos.projected_dos, } def get_partial_DOS(self): @@ -3465,7 +3465,7 @@ if len(self._symmetry.pointgroup_operations) != len( self._primitive_symmetry.pointgroup_operations - ): # noqa: E129 E501 + ): print( "Warning: Point group symmetries of supercell and primitive" "cell are different." @@ -3480,7 +3480,7 @@ all_positions = [] if "first_atoms" in self._displacement_dataset: # type-1 for disp in self._displacement_dataset["first_atoms"]: - positions = self._supercell.get_positions() + positions = self._supercell.positions positions[disp["number"]] += disp["displacement"] all_positions.append(positions) elif "displacements" in self._displacement_dataset: @@ -3495,10 +3495,9 @@ PhonopyAtoms( numbers=self._supercell.numbers, masses=self._supercell.masses, - magmoms=self._supercell.magnetic_moments, + magnetic_moments=self._supercell.magnetic_moments, positions=positions, cell=self._supercell.cell, - pbc=True, ) ) self._supercells_with_displacements = supercells diff -Nru phonopy-2.12.0/phonopy/cui/collect_cell_info.py phonopy-2.13.1/phonopy/cui/collect_cell_info.py --- phonopy-2.12.0/phonopy/cui/collect_cell_info.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/collect_cell_info.py 2022-02-13 03:47:08.000000000 +0000 @@ -51,10 +51,54 @@ chemical_symbols=None, enforce_primitive_matrix_auto=False, phonopy_yaml_cls=None, - symprec=1e-5, - return_dict=False, ): - """Collect crystal structure information from inputs.""" + """Collect crystal structure information from inputs. + + Note + ---- + When the crystal structure is read from phonopy.yaml like file, + ``supercell_matrix`` and ``primitive_matrix`` are ignored. + + Parameters + ---------- + supercell_matrix : array_like or None + 3x3 transformation matrix or when it is a diagonal matrix, + three diagonal elements. Default is None. + See also shape_supercell_matrix. + primitive_matrix : array_like, str, or None + 3x3 transformation matrix or a character representing centring + or None. Default is None. See also get_primitive_matrix. + interface_mode : str or None + Force calculator or crystal structure format name. + cell_filename : str or None + Input cell filename. + chemical_symbols : list of str + List of chemical symbols or unit cell. + enforce_primitive_matrix_auto : bool + Enforce primitive_matrix='auto' when True. Default is False. + phonopy_yaml_cls : Class object + PhonopyYaml like class name. This is used to return its instance + when needed. + + Returns + ------- + dict : + "unitcell": PhonopyAtoms + Unit cell. + "supercell_matrix": ndarray + "primitive_matrix": ndarray + "optional_structure_info": list + See read_crystal_structure. + "interface_mode": str + Force calculator or crystal structure format name. + "phonopy_yaml": None or instance of the class given by phonopy_yaml_cls + Not None when crystal structure was read phonopy.yaml like file. + "error_message" : str + Unless error exists, this entry should not be in this dict. + Otherwise, some error exists. The error message is storedin the + string. + + """ # In some cases, interface mode falls back to phonopy_yaml mode. fallback_reason = _fallback_to_phonopy_yaml( supercell_matrix, interface_mode, cell_filename @@ -67,23 +111,27 @@ else: _interface_mode = interface_mode.lower() + if phonopy_yaml_cls is None: + _phonopy_yaml_cls = PhonopyYaml + else: + _phonopy_yaml_cls = phonopy_yaml_cls + unitcell, optional_structure_info = read_crystal_structure( filename=cell_filename, interface_mode=_interface_mode, chemical_symbols=chemical_symbols, - phonopy_yaml_cls=phonopy_yaml_cls, + phonopy_yaml_cls=_phonopy_yaml_cls, ) # Error check if unitcell is None: err_msg = _get_error_message( optional_structure_info, - interface_mode, fallback_reason, cell_filename, - phonopy_yaml_cls, + _phonopy_yaml_cls, ) - return err_msg + return {"error_message": err_msg} # Retrieve more information on cells ( @@ -96,45 +144,61 @@ interface_mode, supercell_matrix, primitive_matrix, - enforce_primitive_matrix_auto, ) - # Another error check - msg_list = [ - 'Crystal structure was read from "%s".' % optional_structure_info[0], - ] + err_msg = [] + unitcell_filename = optional_structure_info[0] if supercell_matrix_out is None: - msg_list.append("Supercell matrix (DIM or --dim) information was not found.") - return "\n".join(msg_list) + err_msg.append("Supercell matrix (DIM or --dim) information was not found.") + if cell_filename is None and ( + unitcell_filename == get_default_cell_filename(interface_mode_out) + ): + err_msg += [ + "", + "Phonopy read the crystal structure from the file having the default " + "filename ", + "of each calculator. In this case, supercell matrix has to be " + "specified.", + "Because this is the old style way of using %s," + % _phonopy_yaml_cls.command_name, + ] + filenames = [ + '"%s"' % name for name in _phonopy_yaml_cls.default_filenames[:-1] + ] + err_msg += [ + '"%s" was read being prefered to files such as ' % unitcell_filename, + '%s, or "%s".' + % (", ".join(filenames), _phonopy_yaml_cls.default_filenames[-1]), + ] + err_msg += [ + "", + 'If crystal structure is expected to be read from some "*.yaml" file,', + 'Please rename "%s" to something else.' % unitcell_filename, + ] + if np.linalg.det(unitcell.cell) < 0.0: + err_msg.append("Lattice vectors have to follow the right-hand rule.") + if len(err_msg) > 0: + err_msg = [ + 'Crystal structure was read from "%s".' % unitcell_filename + ] + err_msg + return {"error_message": "\n".join(err_msg)} - if np.linalg.det(unitcell.get_cell()) < 0.0: - msg_list.append("Lattice vectors have to follow the right-hand rule.") - return "\n".join(msg_list) + if enforce_primitive_matrix_auto: + primitive_matrix_out = "auto" - # Succeeded! if _interface_mode == "phonopy_yaml": phpy_yaml: PhonopyYaml = optional_structure_info[1] else: phpy_yaml = None - if return_dict: - return { - "unitcell": unitcell, - "supercell_matrix": supercell_matrix_out, - "primitive_matrix": primitive_matrix_out, - "optional_structure_info": optional_structure_info, - "interface_mode": interface_mode_out, - "phonopy_yaml": phpy_yaml, - } - else: - return ( - unitcell, - supercell_matrix_out, - primitive_matrix_out, - optional_structure_info, - interface_mode_out, - phpy_yaml, - ) + return { + "unitcell": unitcell, + "supercell_matrix": supercell_matrix_out, + "primitive_matrix": primitive_matrix_out, + "optional_structure_info": optional_structure_info, + "interface_mode": interface_mode_out, + "phonopy_yaml": phpy_yaml, + } def _fallback_to_phonopy_yaml(supercell_matrix, interface_mode, cell_filename): @@ -223,7 +287,6 @@ interface_mode, supercell_matrix, primitive_matrix, - enforce_primitive_matrix_auto, ): if _interface_mode == "phonopy_yaml" and optional_structure_info[1] is not None: phpy: PhonopyYaml = optional_structure_info[1] @@ -240,20 +303,13 @@ elif phpy.primitive_matrix is not None: _primitive_matrix = phpy.primitive_matrix else: - _primitive_matrix = "auto" + _primitive_matrix = None else: interface_mode_out = _interface_mode _supercell_matrix = supercell_matrix _primitive_matrix = primitive_matrix - if enforce_primitive_matrix_auto: - _primitive_matrix = "auto" - - if _supercell_matrix is None and _primitive_matrix == "auto": - supercell_matrix_out = np.eye(3, dtype="intc") - else: - supercell_matrix_out = _supercell_matrix - + supercell_matrix_out = _supercell_matrix primitive_matrix_out = _primitive_matrix return interface_mode_out, supercell_matrix_out, primitive_matrix_out @@ -261,16 +317,11 @@ def _get_error_message( optional_structure_info, - interface_mode, fallback_reason, cell_filename, phonopy_yaml_cls, ): final_cell_filename = optional_structure_info[0] - if phonopy_yaml_cls is None: - _phonopy_yaml_cls = PhonopyYaml - else: - _phonopy_yaml_cls = phonopy_yaml_cls if fallback_reason is None: msg_list = [] @@ -309,11 +360,11 @@ ) msg_list.append( - "By this reason, %s_yaml mode was invoked." % _phonopy_yaml_cls.command_name + "By this reason, %s_yaml mode was invoked." % phonopy_yaml_cls.command_name ) if final_cell_filename is None: # No phonopy*.yaml file was found. - filenames = ['"%s"' % name for name in _phonopy_yaml_cls.default_filenames] + filenames = ['"%s"' % name for name in phonopy_yaml_cls.default_filenames] if len(filenames) == 1: text = filenames[0] elif len(filenames) == 2: diff -Nru phonopy-2.12.0/phonopy/cui/load.py phonopy-2.13.1/phonopy/cui/load.py --- phonopy-2.12.0/phonopy/cui/load.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/load.py 2022-02-13 03:47:08.000000000 +0000 @@ -207,10 +207,14 @@ or supercell_filename is not None or unitcell is not None or unitcell_filename is not None - ): # noqa E129 + ): + if primitive_matrix is None: + _primitive_matrix = "auto" + else: + _primitive_matrix = primitive_matrix cell, smat, pmat = load_helper.get_cell_settings( supercell_matrix=supercell_matrix, - primitive_matrix=primitive_matrix, + primitive_matrix=_primitive_matrix, unitcell=unitcell, supercell=supercell, unitcell_filename=unitcell_filename, diff -Nru phonopy-2.12.0/phonopy/cui/phonopy_argparse.py phonopy-2.13.1/phonopy/cui/phonopy_argparse.py --- phonopy-2.12.0/phonopy/cui/phonopy_argparse.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/phonopy_argparse.py 2022-02-13 03:47:08.000000000 +0000 @@ -187,14 +187,15 @@ default=None, help="Out of cutoff radius, force constants are set zero.", ) - parser.add_argument( - "-d", - "--displacement", - dest="is_displacement", - action="store_true", - default=None, - help="Create supercells with displacements", - ) + if not load_phonopy_yaml: + parser.add_argument( + "-d", + "--displacement", + dest="is_displacement", + action="store_true", + default=None, + help="Create supercells with displacements", + ) parser.add_argument( "--dense-svecs", dest="store_dense_svecs", @@ -202,13 +203,14 @@ default=None, help="Pair shortest vectors in supercell are stored in dense format.", ) - parser.add_argument( - "--dim", - nargs="+", - dest="supercell_dimension", - default=None, - help="Same behavior as DIM tag", - ) + if not load_phonopy_yaml: + parser.add_argument( + "--dim", + nargs="+", + dest="supercell_dimension", + default=None, + help="Same behavior as DIM tag", + ) parser.add_argument( "--dm-decimals", dest="dynamical_matrix_decimals", diff -Nru phonopy-2.12.0/phonopy/cui/phonopy_script.py phonopy-2.13.1/phonopy/cui/phonopy_script.py --- phonopy-2.12.0/phonopy/cui/phonopy_script.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/phonopy_script.py 2022-02-13 03:47:08.000000000 +0000 @@ -236,22 +236,20 @@ sys.exit(0) -def print_cells(phonon, unitcell_filename): +def print_cells(phonon: Phonopy): """Show cells.""" - supercell = phonon.get_supercell() - unitcell = phonon.get_unitcell() - primitive = phonon.get_primitive() - p2p_map = primitive.get_primitive_to_primitive_map() - mapping = np.array( - [p2p_map[x] for x in primitive.get_supercell_to_primitive_map()], dtype="intc" - ) - s_indep_atoms = phonon.get_symmetry().get_independent_atoms() + supercell = phonon.supercell + unitcell = phonon.unitcell + primitive = phonon.primitive + p2p_map = primitive.p2p_map + mapping = np.array([p2p_map[x] for x in primitive.s2p_map], dtype="intc") + s_indep_atoms = phonon.symmetry.get_independent_atoms() p_indep_atoms = mapping[s_indep_atoms] - u2s_map = supercell.get_unitcell_to_supercell_map() + u2s_map = supercell.u2s_map print("-" * 30 + " primitive cell " + "-" * 30) print_cell(primitive, stars=p_indep_atoms) print("-" * 32 + " unit cell " + "-" * 33) # 32 + 11 + 33 = 76 - u2u_map = supercell.get_unitcell_to_unitcell_map() + u2u_map = supercell.u2u_map u_indep_atoms = [u2u_map[x] for x in s_indep_atoms] print_cell(unitcell, mapping=mapping[u2s_map], stars=u_indep_atoms) print("-" * 32 + " super cell " + "-" * 32) @@ -1511,7 +1509,7 @@ return fc_calculator, fc_calculator_options -def get_cell_info(settings, cell_filename, symprec, log_level): +def get_cell_info(settings, cell_filename, log_level): """Return calculator interface and crystal structure information.""" cell_info = collect_cell_info( supercell_matrix=settings.supercell_matrix, @@ -1520,20 +1518,21 @@ cell_filename=cell_filename, chemical_symbols=settings.chemical_symbols, enforce_primitive_matrix_auto=is_band_auto(settings), - symprec=symprec, - return_dict=True, ) - if type(cell_info) is str: - print_error_message(cell_info) + + if "error_message" in cell_info: + print_error_message(cell_info["error_message"]) if log_level: print_error() sys.exit(1) - # (unitcell, supercell_matrix, primitive_matrix, - # optional_structure_info, interface_mode, - # phpy_yaml) = cell_info - # unitcell_filename = optional_structure_info[0] + set_magnetic_moments(cell_info, settings, log_level) + + return cell_info + +def set_magnetic_moments(cell_info, settings, log_level): + """Set magnetic moments to unitcell in cell_info.""" # Set magnetic moments magmoms = settings.magnetic_moments if magmoms is not None: @@ -1547,20 +1546,6 @@ print_error() sys.exit(1) - if auto_primitive_axes(cell_info["primitive_matrix"]): - error_text = ( - "'PRIMITIVE_AXES = auto', 'BAND = auto', or no DIM " - "setting is not allowed with MAGMOM." - ) - print_error_message(error_text) - if log_level: - print_error() - sys.exit(1) - - cell_info["magmoms"] = magmoms - - return cell_info - def show_symmetry_info_then_exit(cell_info, symprec): """Show crystal structure information in yaml style.""" @@ -1657,6 +1642,10 @@ def main(**argparse_control): """Start phonopy.""" + # import warnings + + # warnings.simplefilter("error") + ############################################ # Parse phonopy conf and crystal structure # ############################################ @@ -1707,9 +1696,30 @@ ################################################################# # Parse crystal structure and optionally phonopy.yaml-like file # ################################################################# - cell_info = get_cell_info(settings, cell_filename, symprec, log_level) + cell_info = get_cell_info(settings, cell_filename, log_level) unitcell_filename = cell_info["optional_structure_info"][0] + if cell_info["unitcell"].magnetic_moments is not None and auto_primitive_axes( + cell_info["primitive_matrix"] + ): + print_error_message('Unit cell was read from "%s".' % unitcell_filename) + + if cell_info["phonopy_yaml"] is None: + print_error_message( + "'PRIMITIVE_AXES = auto' and 'BAND = auto' " + "are not allowed using with MAGMOM." + ) + else: + print_error_message(str(cell_info["phonopy_yaml"].unitcell)) + print_error_message("") + print_error_message( + "'PRIMITIVE_AXES = auto' and 'BAND = auto' " + "are not allowed using with magnetic_moments." + ) + if log_level: + print_error() + sys.exit(1) + ########################################################### # Show crystal symmetry information and exit (--symmetry) # ########################################################### @@ -1732,10 +1742,15 @@ unitcell_filename, load_phonopy_yaml, ) - if cell_info["magmoms"] is None: + if phonon.unitcell.magnetic_moments is None: print("Spacegroup: %s" % phonon.symmetry.get_international_table()) + else: + print( + "Number of symmetry operations in supercell: %d" + % len(phonon.symmetry.symmetry_operations["rotations"]) + ) if log_level > 1: - print_cells(phonon, unitcell_filename) + print_cells(phonon) else: print( "Use -v option to watch primitive cell, unit cell, " diff -Nru phonopy-2.12.0/phonopy/cui/settings.py phonopy-2.13.1/phonopy/cui/settings.py --- phonopy-2.12.0/phonopy/cui/settings.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/settings.py 2022-02-13 03:47:08.000000000 +0000 @@ -360,30 +360,30 @@ def read_file(self): """Read conf file.""" - file = open(self._filename, "r") - is_continue = False - left = None - - for line in file: - if line.strip() == "": - is_continue = False - continue - - if line.strip()[0] == "#": - is_continue = False - continue - - if is_continue and left is not None: - self._confs[left] += line.strip() - self._confs[left] = self._confs[left].replace("+++", " ") - is_continue = False - - if line.find("=") != -1: - left, right = [x.strip() for x in line.split("=")] - self._confs[left.lower()] = right + with open(self._filename, "r") as file: + is_continue = False + left = None + + for line in file: + if line.strip() == "": + is_continue = False + continue + + if line.strip()[0] == "#": + is_continue = False + continue + + if is_continue and left is not None: + self._confs[left] += line.strip() + self._confs[left] = self._confs[left].replace("+++", " ") + is_continue = False + + if line.find("=") != -1: + left, right = [x.strip() for x in line.split("=")] + self._confs[left.lower()] = right - if line.find("+++") != -1: - is_continue = True + if line.find("+++") != -1: + is_continue = True def read_options(self): """Read options from ArgumentParser class instance. @@ -1405,7 +1405,7 @@ """Set thermal_atom_pairs.""" self._v["thermal_atom_pairs"] = val - def set_thermal_displacement_matrix_temperatue(self, val): + def set_thermal_displacement_matrix_temperature(self, val): """Set thermal_displacement_matrix_temperatue.""" self._v["thermal_displacement_matrix_temperatue"] = val diff -Nru phonopy-2.12.0/phonopy/cui/show_symmetry.py phonopy-2.13.1/phonopy/cui/show_symmetry.py --- phonopy-2.12.0/phonopy/cui/show_symmetry.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/cui/show_symmetry.py 2022-02-13 03:47:08.000000000 +0000 @@ -44,6 +44,7 @@ ) from phonopy.structure.atoms import PhonopyAtoms from phonopy.structure.cells import get_primitive, guess_primitive_matrix +from phonopy.structure.symmetry import Symmetry def check_symmetry(phonon: Phonopy, optional_structure_info): @@ -83,9 +84,9 @@ ) -def _get_symmetry_yaml(cell, symmetry, phonopy_version=None): - rotations = symmetry.get_symmetry_operations()["rotations"] - translations = symmetry.get_symmetry_operations()["translations"] +def _get_symmetry_yaml(cell: PhonopyAtoms, symmetry: Symmetry, phonopy_version=None): + rotations = symmetry.symmetry_operations["rotations"] + translations = symmetry.symmetry_operations["translations"] atom_sets = symmetry.get_map_atoms() independent_atoms = symmetry.get_independent_atoms() @@ -96,7 +97,7 @@ if phonopy_version is not None: lines.append("phonopy_version: '%s'" % phonopy_version) - if cell.get_magnetic_moments() is None: + if cell.magnetic_moments is None: spg_symbol, spg_number = symmetry.get_international_table().split() spg_number = int(spg_number.replace("(", "").replace(")", "")) lines.append("space_group_type: '%s'" % spg_symbol) @@ -126,7 +127,7 @@ sitesym = symmetry.get_site_symmetry(i) lines.append("- atom: %d" % (i + 1)) - if cell.get_magnetic_moments() is None: + if cell.magnetic_moments is None: lines.append(" Wyckoff: '%s'" % wyckoffs[i]) site_pointgroup = get_pointgroup(sitesym) lines.append(" site_point_group: '%s'" % site_pointgroup[0].strip()) diff -Nru phonopy-2.12.0/phonopy/harmonic/displacement.py phonopy-2.13.1/phonopy/harmonic/displacement.py --- phonopy-2.12.0/phonopy/harmonic/displacement.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/harmonic/displacement.py 2022-02-13 03:47:08.000000000 +0000 @@ -58,7 +58,7 @@ def directions_to_displacement_dataset(displacement_directions, distance, supercell): """Transform displacement directions to displacements in Cartesian coordinates.""" - lattice = supercell.get_cell() + lattice = supercell.cell first_atoms = [] for disp in displacement_directions: direction = disp[1:] @@ -68,7 +68,7 @@ {"number": int(disp[0]), "displacement": disp_cartesian.tolist()} ) displacement_dataset = { - "natom": supercell.get_number_of_atoms(), + "natom": len(supercell), "first_atoms": first_atoms, } diff -Nru phonopy-2.12.0/phonopy/harmonic/force_constants.py phonopy-2.13.1/phonopy/harmonic/force_constants.py --- phonopy-2.12.0/phonopy/harmonic/force_constants.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/harmonic/force_constants.py 2022-02-13 03:47:08.000000000 +0000 @@ -33,8 +33,6 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -import textwrap - import numpy as np from phonopy.structure.atoms import PhonopyAtoms @@ -841,8 +839,7 @@ "or something wrong (e.g. crystal structure does not " "match)." ) - print(textwrap.fill(text)) - raise ValueError + raise ValueError(text) assert set(map_atoms) & set(atom_list_done) == set(map_atoms) assert -1 not in map_atoms diff -Nru phonopy-2.12.0/phonopy/interface/phonopy_yaml.py phonopy-2.13.1/phonopy/interface/phonopy_yaml.py --- phonopy-2.12.0/phonopy/interface/phonopy_yaml.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/interface/phonopy_yaml.py 2022-02-13 03:47:08.000000000 +0000 @@ -39,6 +39,8 @@ import numpy as np import yaml +from phonopy.structure.cells import Primitive + try: from yaml import CLoader as Loader except ImportError: @@ -50,42 +52,6 @@ from phonopy.structure.atoms import PhonopyAtoms -def read_cell_yaml(filename, cell_type="unitcell"): - """Read crystal structure from a phonopy.yaml or PhonopyAtoms.__str__ like file. - - phonopy.yaml like file can contain several different cells, e.g., unit cell, - primitive cell, or supercell. In this case, the default preference order of - the returned cell is unit cell > primitive cell > supercell. ``cell_type`` - is used to specify to choose one of them. - - When output of PhonopyAtoms.__str__ is given (like below), this file is - parsed and its cell is returned. - - lattice: - - [ 0.000000000000000, 2.845150738087836, 2.845150738087836 ] # a - - [ 2.845150738087836, 0.000000000000000, 2.845150738087836 ] # b - - [ 2.845150738087836, 2.845150738087836, 0.000000000000000 ] # c - points: - - symbol: Na # 1 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 22.989769 - - symbol: Cl # 2 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 35.453000 - - """ - ph_yaml = PhonopyYaml() - ph_yaml.read(filename) - if ph_yaml.unitcell and cell_type == "unitcell": - return ph_yaml.unitcell - elif ph_yaml.primitive and cell_type == "primitive": - return ph_yaml.primitive - elif ph_yaml.supercell and cell_type == "supercell": - return ph_yaml.supercell - else: - return None - - class PhonopyYaml: """PhonopyYaml is a container of phonopy setting. @@ -338,7 +304,7 @@ lines.append("") return lines - def _primitive_yaml_lines(self, primitive, name): + def _primitive_yaml_lines(self, primitive: Primitive, name): lines = [] if primitive is not None: lines += self._cell_yaml_lines(self.primitive, name, None) @@ -366,7 +332,7 @@ lines.append("") return lines - def _cell_yaml_lines(self, cell, name, map_to_primitive): + def _cell_yaml_lines(self, cell: PhonopyAtoms, name, map_to_primitive): lines = [] lines.append("%s:" % name) count = 0 @@ -418,23 +384,37 @@ self.dataset, with_forces=with_forces ) - def _displacements_yaml_lines_2types(self, dataset, with_forces=False): + def _displacements_yaml_lines_2types( + self, dataset, with_forces=False, key="displacements" + ): + """Choose yaml writer depending on the dataset type. + + See type1 and type2 at Phonopy.dataset. + + """ if dataset is not None: if "first_atoms" in dataset: return self._displacements_yaml_lines_type1( - dataset, with_forces=with_forces + dataset, with_forces=with_forces, key=key ) elif "displacements" in dataset: return self._displacements_yaml_lines_type2( - dataset, with_forces=with_forces + dataset, with_forces=with_forces, key=key ) return [] - def _displacements_yaml_lines_type1(self, dataset, with_forces=False): + def _displacements_yaml_lines_type1( + self, dataset, with_forces=False, key="displacements" + ): + """Return type1 dataset in yaml. + + See data structure at Phonopy.dataset. + + """ lines = [ - "displacements:", + "%s:" % key, ] - for i, d in enumerate(dataset["first_atoms"]): + for d in dataset["first_atoms"]: lines.append("- atom: %4d" % (d["number"] + 1)) lines.append(" displacement:") lines.append(" [ %20.16f,%20.16f,%20.16f ]" % tuple(d["displacement"])) @@ -445,12 +425,19 @@ lines.append("") return lines - def _displacements_yaml_lines_type2(self, dataset, with_forces=False): + def _displacements_yaml_lines_type2( + self, dataset, with_forces=False, key="displacements" + ): + """Return type2 dataset in yaml. + + See data structure at Phonopy.dataset. + + """ if "random_seed" in dataset: lines = ["random_seed: %d" % dataset["random_seed"], "displacements:"] else: lines = [ - "displacements:", + "%s:" % key, ] for i, dset in enumerate(dataset["displacements"]): lines.append("- # %4d" % (i + 1)) @@ -484,30 +471,10 @@ return lines def _load(self, filename): - _, ext = os.path.splitext(filename) - if ext == ".xz" or ext == ".lzma": - try: - import lzma - except ImportError: - raise ( - "Reading a lzma compressed file is not supported " - "by this python version." - ) - with lzma.open(filename) as f: - self._yaml = yaml.load(f, Loader=Loader) - elif ext == ".gz": - import gzip - - with gzip.open(filename) as f: - self._yaml = yaml.load(f, Loader=Loader) - else: - with open(filename, "r") as f: - self._yaml = yaml.load(f, Loader=Loader) - + self._yaml = load_yaml(filename) if type(self._yaml) is str: msg = "Could not open %s's yaml file." % self.command_name raise TypeError(msg) - self.parse() def _parse_command_header(self): @@ -545,6 +512,7 @@ points = [] symbols = [] masses = [] + magnetic_moments = [] if "points" in cell_yaml: for x in cell_yaml["points"]: if "coordinates" in x: @@ -553,6 +521,8 @@ symbols.append(x["symbol"]) if "mass" in x: masses.append(x["mass"]) + if "magnetic_moment" in x: + magnetic_moments.append(x["magnetic_moment"]) # For version < 1.10.9 elif "atoms" in cell_yaml: for x in cell_yaml["atoms"]: @@ -562,9 +532,11 @@ symbols.append(x["symbol"]) if "mass" in x: masses.append(x["mass"]) - return self._get_cell(lattice, points, symbols, masses=masses) + return self._get_cell( + lattice, points, symbols, masses=masses, magnetic_moments=magnetic_moments + ) - def _get_cell(self, lattice, points, symbols, masses=None): + def _get_cell(self, lattice, points, symbols, masses=None, magnetic_moments=None): if lattice: _lattice = lattice else: @@ -581,6 +553,10 @@ _masses = masses else: _masses = None + if magnetic_moments: + _magnetic_moments = magnetic_moments + else: + _magnetic_moments = None if _lattice and _points and _symbols: return PhonopyAtoms( @@ -588,6 +564,7 @@ cell=_lattice, masses=_masses, scaled_positions=_points, + magnetic_moments=_magnetic_moments, ) else: return None @@ -601,26 +578,26 @@ def _parse_dataset(self): self.dataset = self._get_dataset(self.supercell) - def _get_dataset(self, supercell): + def _get_dataset(self, supercell, key="displacements"): dataset = None - if "displacements" in self._yaml: + if key in self._yaml: if supercell is not None: natom = len(supercell) else: natom = None - disp = self._yaml["displacements"][0] + disp = self._yaml[key][0] if type(disp) is dict: # type1 - dataset = self._parse_force_sets_type1(natom=natom) + dataset = self._parse_force_sets_type1(natom=natom, key=key) elif type(disp) is list: # type2 if "displacement" in disp[0]: - dataset = self._parse_force_sets_type2() + dataset = self._parse_force_sets_type2(key=key) return dataset - def _parse_force_sets_type1(self, natom=None): + def _parse_force_sets_type1(self, natom=None, key="displacements"): with_forces = False - if "forces" in self._yaml["displacements"][0]: + if "forces" in self._yaml[key][0]: with_forces = True - dataset = {"natom": len(self._yaml["displacements"][0]["forces"])} + dataset = {"natom": len(self._yaml[key][0]["forces"])} elif natom is not None: dataset = {"natom": natom} elif "natom" in self._yaml: @@ -629,7 +606,7 @@ raise RuntimeError("Number of atoms in supercell could not be found.") first_atoms = [] - for d in self._yaml["displacements"]: + for d in self._yaml[key]: data = { "number": d["atom"] - 1, "displacement": np.array(d["displacement"], dtype="double"), @@ -641,16 +618,16 @@ return dataset - def _parse_force_sets_type2(self): - nsets = len(self._yaml["displacements"]) - natom = len(self._yaml["displacements"][0]) - if "force" in self._yaml["displacements"][0][0]: + def _parse_force_sets_type2(self, key="displacements"): + nsets = len(self._yaml[key]) + natom = len(self._yaml[key][0]) + if "force" in self._yaml[key][0][0]: with_forces = True forces = np.zeros((nsets, natom, 3), dtype="double", order="C") else: with_forces = False displacements = np.zeros((nsets, natom, 3), dtype="double", order="C") - for i, dfset in enumerate(self._yaml["displacements"]): + for i, dfset in enumerate(self._yaml[key]): for j, df in enumerate(dfset): if with_forces: forces[i, j] = df["force"] @@ -686,3 +663,68 @@ and "calculator" in self._yaml[self.command_name] ): self.calculator = self._yaml[self.command_name]["calculator"] + + +def read_cell_yaml(filename, cell_type="unitcell"): + """Read crystal structure from a phonopy.yaml or PhonopyAtoms.__str__ like file. + + phonopy.yaml like file can contain several different cells, e.g., unit cell, + primitive cell, or supercell. In this case, the default preference order of + the returned cell is unit cell > primitive cell > supercell. ``cell_type`` + is used to specify to choose one of them. + + When output of PhonopyAtoms.__str__ is given (like below), this file is + parsed and its cell is returned. + + lattice: + - [ 0.000000000000000, 2.845150738087836, 2.845150738087836 ] # a + - [ 2.845150738087836, 0.000000000000000, 2.845150738087836 ] # b + - [ 2.845150738087836, 2.845150738087836, 0.000000000000000 ] # c + points: + - symbol: Na # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 + - symbol: Cl # 2 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + + """ + ph_yaml = PhonopyYaml() + ph_yaml.read(filename) + if ph_yaml.unitcell and cell_type == "unitcell": + return ph_yaml.unitcell + elif ph_yaml.primitive and cell_type == "primitive": + return ph_yaml.primitive + elif ph_yaml.supercell and cell_type == "supercell": + return ph_yaml.supercell + else: + return None + + +def load_yaml(filename): + """Load yaml file. + + lzma and gzip comppressed files can be loaded. + + """ + _, ext = os.path.splitext(filename) + if ext == ".xz" or ext == ".lzma": + try: + import lzma + except ImportError: + raise ( + "Reading a lzma compressed file is not supported " + "by this python version." + ) + with lzma.open(filename) as f: + yaml_data = yaml.load(f, Loader=Loader) + elif ext == ".gz": + import gzip + + with gzip.open(filename) as f: + yaml_data = yaml.load(f, Loader=Loader) + else: + with open(filename, "r") as f: + yaml_data = yaml.load(f, Loader=Loader) + + return yaml_data diff -Nru phonopy-2.12.0/phonopy/interface/vasp.py phonopy-2.13.1/phonopy/interface/vasp.py --- phonopy-2.12.0/phonopy/interface/vasp.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/interface/vasp.py 2022-02-13 03:47:08.000000000 +0000 @@ -568,7 +568,7 @@ """ fc_tmp = None - major_version = None + version_nums = None num_atom = 0 for event, element in vasprun_etree: # VASP version @@ -576,7 +576,7 @@ for element_i in element.findall("./i"): if element_i.attrib["name"] == "version": version_str = element_i.text.strip() - major_version = int(version_str.split(".")[0]) + version_nums = [int(v) for v in version_str.split(".")] if num_atom == 0: atomtypes = self._get_atomtypes(element) @@ -614,8 +614,9 @@ force_constants[i, j] *= -np.sqrt(masses[i] * masses[j]) # Recover the unit of eV/Angstrom^2 for VASP-6. - if major_version == 6: - force_constants /= VaspToTHz ** 2 + if version_nums is not None and len(version_nums) > 1: + if version_nums[0] == 6 and version_nums[1] > 1: + force_constants /= VaspToTHz ** 2 return force_constants, elements diff -Nru phonopy-2.12.0/phonopy/phonon/band_structure.py phonopy-2.13.1/phonopy/phonon/band_structure.py --- phonopy-2.12.0/phonopy/phonon/band_structure.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/phonon/band_structure.py 2022-02-13 03:47:08.000000000 +0000 @@ -872,7 +872,7 @@ point_coords = band_path["point_coords"] qpoints_of_paths = [] if is_const_interval: - reclat = np.linalg.inv(primitive.get_cell()) + reclat = np.linalg.inv(primitive.cell) else: reclat = None band_paths = [ diff -Nru phonopy-2.12.0/phonopy/phonon/group_velocity.py phonopy-2.13.1/phonopy/phonon/group_velocity.py --- phonopy-2.12.0/phonopy/phonon/group_velocity.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/phonon/group_velocity.py 2022-02-13 03:47:08.000000000 +0000 @@ -256,7 +256,7 @@ def _get_dD_analytical(self, q): """Compute derivative of dynamcial matrices.""" self._ddm.run(q) - ddm = self._ddm.get_derivative_of_dynamical_matrix() + ddm = self._ddm.d_dynamical_matrix dtype = "c%d" % (np.dtype("double").itemsize * 2) ddm_dirs = np.zeros((len(self._directions),) + ddm.shape[1:], dtype=dtype) for i, dq in enumerate(self._directions): diff -Nru phonopy-2.12.0/phonopy/phonon/irreps.py phonopy-2.13.1/phonopy/phonon/irreps.py --- phonopy-2.12.0/phonopy/phonon/irreps.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/phonon/irreps.py 2022-02-13 03:47:08.000000000 +0000 @@ -42,6 +42,7 @@ from phonopy.harmonic.force_constants import similarity_transformation from phonopy.phonon.character_table import character_table from phonopy.phonon.degeneracy import degenerate_sets as get_degenerate_sets +from phonopy.structure.cells import is_primitive_cell from phonopy.structure.symmetry import Symmetry from phonopy.units import VaspToTHz @@ -84,21 +85,19 @@ self._ddm = DerivativeOfDynamicalMatrix(dynamical_matrix) self._character_table = None - def run(self): - """Calculate irreps.""" - self._set_eigenvectors(self._dynamical_matrix) self._symmetry_dataset = Symmetry( self._primitive, symprec=self._symprec ).dataset - if not self._is_primitive_cell(): - print("") - print("Non-primitve cell is used.") - print( - "Your unit cell may be transformed to a primitive cell " - "by PRIMITIVE_AXIS tag." + if not is_primitive_cell(self._symmetry_dataset["rotations"]): + raise RuntimeError( + "Non-primitve cell is used. Your unit cell may be transformed to " + "a primitive cell by PRIMITIVE_AXIS tag." ) - return False + + def run(self): + """Calculate irreps.""" + self._set_eigenvectors(self._dynamical_matrix) (self._rotations_at_q, self._translations_at_q) = self._get_rotations_at_q() @@ -396,16 +395,6 @@ return ir_labels - def _is_primitive_cell(self): - num_identity = 0 - for r in self._symmetry_dataset["rotations"]: - if (r - np.eye(3, dtype="intc") == 0).all(): - num_identity += 1 - if num_identity > 1: - return False - else: - return True - def _show(self, show_irreps): print("") print("-------------------------------") diff -Nru phonopy-2.12.0/phonopy/structure/atoms.py phonopy-2.13.1/phonopy/structure/atoms.py --- phonopy-2.12.0/phonopy/structure/atoms.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/structure/atoms.py 2022-02-13 03:47:08.000000000 +0000 @@ -66,20 +66,26 @@ symbols=None, numbers=None, masses=None, - magmoms=None, + magnetic_moments=None, scaled_positions=None, positions=None, cell=None, atoms: Optional["PhonopyAtoms"] = None, + magmoms=None, pbc=True, ): # pbc is dummy argument, and never used. """Init method.""" + if magmoms is not None: + warnings.warn( + "PhonopyAtoms.__init__ parameter of magmoms is deprecated. " + "Use magnetic_moments instead.", + DeprecationWarning, + ) if atoms: - magmoms = None self._set_parameters( numbers=atoms.numbers, masses=atoms.masses, - magmoms=magmoms, + magnetic_moments=atoms.magnetic_moments, scaled_positions=atoms.scaled_positions, cell=atoms.cell, pbc=True, @@ -89,7 +95,7 @@ symbols=symbols, numbers=numbers, masses=masses, - magmoms=magmoms, + magnetic_moments=magnetic_moments, scaled_positions=scaled_positions, positions=positions, cell=cell, @@ -101,7 +107,7 @@ symbols=None, numbers=None, masses=None, - magmoms=None, + magnetic_moments=None, scaled_positions=None, positions=None, cell=None, @@ -122,7 +128,7 @@ # (initial) magnetic moments self._magmoms = None - self._set_magnetic_moments(magmoms) + self._set_magnetic_moments(magnetic_moments) # numbers and symbols if self._numbers is not None: # number --> symbol @@ -430,9 +436,8 @@ cell=self._cell, scaled_positions=self._scaled_positions, masses=self._masses, - magmoms=self._magmoms, + magnetic_moments=self._magmoms, symbols=self._symbols, - pbc=True, ) def totuple(self): @@ -468,13 +473,19 @@ masses = [None] * len(self._symbols) else: masses = self._masses - for i, (s, v, m) in enumerate( - zip(self._symbols, self._scaled_positions, masses) + if self._magmoms is None: + magmoms = [None] * len(self._symbols) + else: + magmoms = self._magmoms + for i, (s, v, m, mag) in enumerate( + zip(self._symbols, self._scaled_positions, masses, magmoms) ): lines.append("- symbol: %-2s # %d" % (s, i + 1)) lines.append(" coordinates: [ %18.15f, %18.15f, %18.15f ]" % tuple(v)) if m is not None: lines.append(" mass: %f" % m) + if mag is not None: + lines.append(" magnetic_moment: %.8f" % mag) return lines def __str__(self): diff -Nru phonopy-2.12.0/phonopy/structure/cells.py phonopy-2.13.1/phonopy/structure/cells.py --- phonopy-2.12.0/phonopy/structure/cells.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/structure/cells.py 2022-02-13 03:47:08.000000000 +0000 @@ -67,18 +67,25 @@ ) -def print_cell(cell, mapping=None, stars=None): +def print_cell(cell: PhonopyAtoms, mapping=None, stars=None): """Show cell information.""" + lines = get_cell_lines(cell, mapping=mapping, stars=stars) + print("\n".join(lines)) + + +def get_cell_lines(cell: PhonopyAtoms, mapping=None, stars=None): + """Return cell information text lines.""" symbols = cell.symbols masses = cell.masses magmoms = cell.magnetic_moments lattice = cell.cell - print("Lattice vectors:") - print(" a %20.15f %20.15f %20.15f" % tuple(lattice[0])) - print(" b %20.15f %20.15f %20.15f" % tuple(lattice[1])) - print(" c %20.15f %20.15f %20.15f" % tuple(lattice[2])) - print("Atomic positions (fractional):") - for i, v in enumerate(cell.get_scaled_positions()): + lines = [] + lines.append("Lattice vectors:") + lines.append(" a %20.15f %20.15f %20.15f" % tuple(lattice[0])) + lines.append(" b %20.15f %20.15f %20.15f" % tuple(lattice[1])) + lines.append(" c %20.15f %20.15f %20.15f" % tuple(lattice[2])) + lines.append("Atomic positions (fractional):") + for i, v in enumerate(cell.scaled_positions): num = " " if stars is not None: if i in stars: @@ -93,9 +100,10 @@ else: line += " %s" % magmoms[i].ravel() if mapping is None: - print(line) + lines.append(line) else: - print(line + " > %d" % (mapping[i] + 1)) + lines.append(line + " > %d" % (mapping[i] + 1)) + return lines def isclose(a, b, rtol=1e-5, atol=1e-8): @@ -118,6 +126,23 @@ return True +def is_primitive_cell(rotations): + """Check if single identity operation exists in rotations or not. + + This is used for checking a cell is a primitive cell or not. + + """ + num_identity = 0 + identity = np.eye(3, dtype="intc") + for r in rotations: + if (r == identity).all(): + num_identity += 1 + if num_identity > 1: + return False + else: + return True + + class Supercell(PhonopyAtoms): """Build supercell from supercell matrix and unit cell. @@ -269,9 +294,8 @@ ) return self.u2u_map - def _create_supercell(self, unitcell, symprec): + def _create_supercell(self, unitcell: PhonopyAtoms, symprec): mat = self._supercell_matrix - if self._is_old_style: P = None multi = self._get_surrounding_frame(mat) @@ -315,7 +339,7 @@ super().__init__( numbers=supercell.numbers, masses=supercell.masses, - magmoms=supercell.magnetic_moments, + magnetic_moments=supercell.magnetic_moments, scaled_positions=supercell.scaled_positions, cell=supercell.cell, pbc=True, @@ -324,7 +348,7 @@ self._u2u_map = {j: i for i, j in enumerate(self._u2s_map)} self._s2u_map = np.array(u2sur_map[sur2s_map] * N, dtype="int_") - def _get_simple_supercell(self, unitcell, multi, P): + def _get_simple_supercell(self, unitcell: PhonopyAtoms, multi, P): if self._is_old_style: mat = np.diag(multi) else: @@ -375,7 +399,7 @@ simple_supercell = PhonopyAtoms( numbers=numbers_multi, masses=masses_multi, - magmoms=magmoms_multi, + magnetic_moments=magmoms_multi, scaled_positions=positions_multi, cell=np.dot(mat, lattice), pbc=True, @@ -618,7 +642,7 @@ super().__init__( numbers=trimmed_cell.numbers, masses=trimmed_cell.masses, - magmoms=trimmed_cell.magnetic_moments, + magnetic_moments=trimmed_cell.magnetic_moments, scaled_positions=trimmed_cell.scaled_positions, cell=trimmed_cell.cell, pbc=True, @@ -709,7 +733,9 @@ """ - def __init__(self, relative_axes, cell, positions_to_reorder=None, symprec=1e-5): + def __init__( + self, relative_axes, cell: PhonopyAtoms, positions_to_reorder=None, symprec=1e-5 + ): """Init method. Parameters @@ -758,7 +784,7 @@ """ return self._extracted_atoms - def _run(self, cell, relative_axes, positions_to_reorder, symprec): + def _run(self, cell: PhonopyAtoms, relative_axes, positions_to_reorder, symprec): trimmed_lattice = np.dot(relative_axes.T, cell.cell) positions_in_new_lattice = np.dot( cell.scaled_positions, np.linalg.inv(relative_axes).T @@ -799,7 +825,7 @@ super().__init__( numbers=trimmed_numbers, masses=trimmed_masses, - magmoms=trimmed_magmoms, + magnetic_moments=trimmed_magmoms, scaled_positions=trimmed_positions, cell=trimmed_lattice, pbc=True, diff -Nru phonopy-2.12.0/phonopy/structure/grid_points.py phonopy-2.13.1/phonopy/structure/grid_points.py --- phonopy-2.12.0/phonopy/structure/grid_points.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/structure/grid_points.py 2022-02-13 03:47:08.000000000 +0000 @@ -153,7 +153,7 @@ Mesh numbers along a, b, c axes. dtype='intc' shape=(3,) - reciprocal_lattice: array_like + reciprocal_lattice: ndarray Basis vectors in reciprocal space. a*, b*, c* are given in column vectors. dtype='double' @@ -164,7 +164,7 @@ shape=(ir-grid points, 3) weights: ndarray Geometric q-point weights. Its sum is the number of grid points. - dtype='intc' + dtype='int_' shape=(ir-grid points,) grid_address: ndarray Addresses of all grid points represented by integers. @@ -172,10 +172,10 @@ shape=(prod(mesh_numbers), 3) ir_grid_points: ndarray Indices of irreducible grid points in grid_address. - dtype='intc', shape=(ir-grid points,) + dtype='int_', shape=(ir-grid points,) grid_mapping_table: ndarray Index mapping table from all grid points to ir-grid points. - dtype='intc', shape=(prod(mesh_numbers),) + dtype='int_', shape=(prod(mesh_numbers),) """ @@ -233,7 +233,7 @@ """ self._mesh = np.array(mesh_numbers, dtype="intc") - self._rec_lat = reciprocal_lattice + self._rec_lat = np.array(reciprocal_lattice, dtype="double", order="C") self._is_shift = self._shift2boolean( q_mesh_shift, is_gamma_center=is_gamma_center ) @@ -399,6 +399,8 @@ is_time_reversal=is_time_reversal, is_dense=True, ) + # uintp to int_ + grid_mapping_table = np.array(grid_mapping_table, dtype="int_") # Currently 'intc', but will be 'int_' in next major version. if int(__version__.split(".")[0]) < 3: diff -Nru phonopy-2.12.0/phonopy/structure/symmetry.py phonopy-2.13.1/phonopy/structure/symmetry.py --- phonopy-2.12.0/phonopy/structure/symmetry.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/structure/symmetry.py 2022-02-13 03:47:08.000000000 +0000 @@ -67,7 +67,7 @@ self._map_operations = None magmom = cell.magnetic_moments - if type(magmom) is np.ndarray: + if isinstance(magmom, np.ndarray): if (magmom < symprec).all(): magmom = None diff -Nru phonopy-2.12.0/phonopy/version.py phonopy-2.13.1/phonopy/version.py --- phonopy-2.12.0/phonopy/version.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/phonopy/version.py 2022-02-13 03:47:08.000000000 +0000 @@ -33,4 +33,4 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -__version__ = "2.12.0" +__version__ = "2.13.1" diff -Nru phonopy-2.12.0/.pre-commit-config.yaml phonopy-2.13.1/.pre-commit-config.yaml --- phonopy-2.12.0/.pre-commit-config.yaml 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/.pre-commit-config.yaml 2022-02-13 03:47:08.000000000 +0000 @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -35,7 +35,7 @@ - "--ignore=E203,W503,E501" - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 21.12b0 hooks: - id: black args: @@ -47,7 +47,7 @@ - id: pydocstyle - repo: https://github.com/pycqa/isort - rev: 5.9.3 + rev: 5.10.1 hooks: - id: isort name: isort (python) diff -Nru phonopy-2.12.0/requirements.txt phonopy-2.13.1/requirements.txt --- phonopy-2.12.0/requirements.txt 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/requirements.txt 2022-02-13 03:47:08.000000000 +0000 @@ -1,5 +1,5 @@ -numpy >= 1.11.0 +numpy >= 1.15.0 PyYAML -matplotlib >= 2.0.0 +matplotlib >= 2.2.2 h5py spglib diff -Nru phonopy-2.12.0/setup.py phonopy-2.13.1/setup.py --- phonopy-2.12.0/setup.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/setup.py 2022-02-13 03:47:08.000000000 +0000 @@ -144,11 +144,11 @@ author_email="atz.togo@gmail.com", url="https://phonopy.github.io/phonopy/", packages=packages_phonopy, - python_requires=">=3.6", + python_requires=">=3.7", install_requires=[ - "numpy>=1.11.0", + "numpy>=1.15.0", "PyYAML", - "matplotlib>2.0.0", + "matplotlib>=2.2.2", "h5py", "spglib", ], diff -Nru phonopy-2.12.0/test/conftest.py phonopy-2.13.1/test/conftest.py --- phonopy-2.12.0/test/conftest.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/conftest.py 2022-02-13 03:47:08.000000000 +0000 @@ -13,6 +13,18 @@ @pytest.fixture(scope="session") +def ph_si() -> Phonopy: + """Return Phonopy class instance of Si-prim 2x2x2.""" + yaml_filename = os.path.join(current_dir, "phonopy_params_Si.yaml") + return phonopy.load( + yaml_filename, + is_compact_fc=False, + log_level=1, + produce_fc=True, + ) + + +@pytest.fixture(scope="session") def ph_nacl() -> Phonopy: """Return Phonopy class instance of NaCl 2x2x2.""" yaml_filename = os.path.join(current_dir, "phonopy_disp_NaCl.yaml") @@ -257,6 +269,12 @@ ) np.testing.assert_array_equal(cell.numbers, cell_ref.numbers) np.testing.assert_allclose(cell.masses, cell_ref.masses, atol=symprec) + if cell.magnetic_moments is None: + assert cell_ref.magnetic_moments is None + else: + np.testing.assert_allclose( + cell.magnetic_moments, cell_ref.magnetic_moments, atol=symprec + ) @classmethod def compare_positions_with_order(cls, pos, pos_ref, lattice, symprec=1e-5): @@ -285,6 +303,14 @@ np.testing.assert_allclose( cell.masses, cell_ref.masses[indices], atol=symprec ) + if cell.magnetic_moments is None: + assert cell_ref.magnetic_moments is None + else: + np.testing.assert_allclose( + cell.magnetic_moments, + cell_ref.magnetic_moments[indices], + atol=symprec, + ) @classmethod def compare_positions_in_arbitrary_order( diff -Nru phonopy-2.12.0/test/harmonic/comm_points.dat phonopy-2.13.1/test/harmonic/comm_points.dat --- phonopy-2.12.0/test/harmonic/comm_points.dat 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/harmonic/comm_points.dat 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -1 0.00 0.00 0.00 -2 0.00 0.25 0.25 -3 0.00 0.50 0.50 -4 0.00 0.75 0.75 -5 0.25 0.00 0.25 -6 0.25 0.25 0.50 -7 0.25 0.50 0.75 -8 0.25 0.75 0.00 -9 0.50 0.00 0.50 -10 0.50 0.25 0.75 -11 0.50 0.50 0.00 -12 0.50 0.75 0.25 -13 0.75 0.00 0.75 -14 0.75 0.25 0.00 -15 0.75 0.50 0.25 -16 0.75 0.75 0.50 -17 0.25 0.25 0.00 -18 0.25 0.50 0.25 -19 0.25 0.75 0.50 -20 0.25 0.00 0.75 -21 0.50 0.25 0.25 -22 0.50 0.50 0.50 -23 0.50 0.75 0.75 -24 0.50 0.00 0.00 -25 0.75 0.25 0.50 -26 0.75 0.50 0.75 -27 0.75 0.75 0.00 -28 0.75 0.00 0.25 -29 0.00 0.25 0.75 -30 0.00 0.50 0.00 -31 0.00 0.75 0.25 -32 0.00 0.00 0.50 diff -Nru phonopy-2.12.0/test/harmonic/test_displacements.py phonopy-2.13.1/test/harmonic/test_displacements.py --- phonopy-2.12.0/test/harmonic/test_displacements.py 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/test/harmonic/test_displacements.py 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,131 @@ +"""Tests for displacements.""" +from copy import deepcopy + +import numpy as np + +from phonopy import Phonopy + + +def test_nacl(ph_nacl: Phonopy): + """Test displacements of NaCl 2x2x2.""" + dataset = deepcopy(ph_nacl.dataset) + disp_ref = [[0, 0.01, 0.0, 0.0], [32, 0.01, 0.0, 0.0]] + np.testing.assert_allclose(ph_nacl.displacements, disp_ref, atol=1e-8) + ph_nacl.generate_displacements() + np.testing.assert_allclose(ph_nacl.displacements, disp_ref, atol=1e-8) + ph_nacl.dataset = dataset + + +def test_si(ph_si: Phonopy): + """Test displacements of Si.""" + dataset = deepcopy(ph_si.dataset) + disp_ref = [[0, 0.0, 0.0070710678118655, 0.0070710678118655]] + np.testing.assert_allclose(ph_si.displacements, disp_ref, atol=1e-8) + ph_si.generate_displacements() + np.testing.assert_allclose(ph_si.displacements, disp_ref, atol=1e-8) + ph_si.dataset = dataset + + +def test_sno2(ph_sno2: Phonopy): + """Test displacements of SnO2.""" + dataset = deepcopy(ph_sno2.dataset) + disp_ref = [ + [0, 0.01, 0.0, 0.0], + [0, -0.01, 0.0, 0.0], + [0, 0.0, 0.0, 0.01], + [48, 0.01, 0.0, 0.0], + [48, 0.0, 0.0, 0.01], + ] + np.testing.assert_allclose(ph_sno2.displacements, disp_ref, atol=1e-8) + ph_sno2.generate_displacements() + disp_gen = [ + [0, 0.007032660602415084, 0.0, 0.007109267532681459], + [0, -0.007032660602415084, 0.0, -0.007109267532681459], + [48, 0.007032660602415084, 0.0, 0.007109267532681459], + ] + np.testing.assert_allclose(ph_sno2.displacements, disp_gen, atol=1e-8) + ph_sno2.dataset = dataset + + +def test_tio2(ph_tio2: Phonopy): + """Test displacements of TiO2.""" + dataset = deepcopy(ph_tio2.dataset) + disp_ref = [ + [0, 0.01, 0.0, 0.0], + [0, 0.0, 0.01, 0.0], + [0, 0.0, 0.0, 0.01], + [0, 0.0, 0.0, -0.01], + [72, 0.01, 0.0, 0.0], + [72, 0.0, 0.0, 0.01], + ] + np.testing.assert_allclose(ph_tio2.displacements, disp_ref, atol=1e-8) + ph_tio2.generate_displacements() + disp_gen = [ + [0, 0.0060687317141537135, 0.0060687317141537135, 0.0051323474905008], + [0, -0.0060687317141537135, -0.0060687317141537135, -0.0051323474905008], + [72, 0.007635558297727332, 0.0, 0.006457418174627326], + [72, -0.007635558297727332, 0.0, -0.006457418174627326], + ] + np.testing.assert_allclose(ph_tio2.displacements, disp_gen, atol=1e-8) + ph_tio2.dataset = dataset + + +def test_zr3n4(ph_zr3n4: Phonopy): + """Test displacements of Zr3N4.""" + dataset = deepcopy(ph_zr3n4.dataset) + disp_ref = [ + [0, 0.01, 0.0, 0.0], + [0, -0.01, 0.0, 0.0], + [16, 0.01, 0.0, 0.0], + [16, 0.0, 0.01, 0.0], + ] + np.testing.assert_allclose(ph_zr3n4.displacements, disp_ref, atol=1e-8) + ph_zr3n4.generate_displacements() + disp_gen = [ + [0, 0.01, 0.0, 0.0], + [0, -0.01, 0.0, 0.0], + [16, 0.007071067811865475, 0.007071067811865475, 0.0], + [16, -0.007071067811865475, -0.007071067811865475, 0.0], + ] + np.testing.assert_allclose(ph_zr3n4.displacements, disp_gen, atol=1e-8) + ph_zr3n4.dataset = dataset + + +def test_tipn3(ph_tipn3: Phonopy): + """Test displacements of Zr3N4.""" + dataset = deepcopy(ph_tipn3.dataset) + disp_ref = [ + [0, 0.01, 0.0, 0.0], + [0, 0.0, 0.01, 0.0], + [0, 0.0, 0.0, 0.01], + [0, 0.0, 0.0, -0.01], + [16, 0.01, 0.0, 0.0], + [16, 0.0, 0.01, 0.0], + [16, 0.0, 0.0, 0.01], + [16, 0.0, 0.0, -0.01], + [32, 0.01, 0.0, 0.0], + [32, 0.0, 0.01, 0.0], + [32, 0.0, -0.01, 0.0], + [32, 0.0, 0.0, 0.01], + [32, 0.0, 0.0, -0.01], + [40, 0.01, 0.0, 0.0], + [40, 0.0, 0.01, 0.0], + [40, 0.0, 0.0, 0.01], + [40, 0.0, 0.0, -0.01], + ] + np.testing.assert_allclose(ph_tipn3.displacements, disp_ref, atol=1e-8) + ph_tipn3.generate_displacements() + disp_gen = [ + [0, 0.006370194270018462, 0.006021020526083804, 0.00481330829956917], + [0, -0.006370194270018462, -0.006021020526083804, -0.00481330829956917], + [16, 0.006370194270018462, 0.006021020526083804, 0.00481330829956917], + [16, -0.006370194270018462, -0.006021020526083804, -0.00481330829956917], + [32, 0.007267439570389398, 0.0068690845162028965, 0.0], + [32, -0.007267439570389398, -0.0068690845162028965, 0.0], + [32, 0.0, 0.0, 0.01], + [32, 0.0, 0.0, -0.01], + [40, 0.006370194270018462, 0.006021020526083804, 0.00481330829956917], + [40, -0.006370194270018462, -0.006021020526083804, -0.00481330829956917], + ] + np.testing.assert_allclose(ph_tipn3.displacements, disp_gen, atol=1e-8) + ph_tipn3.dataset = dataset diff -Nru phonopy-2.12.0/test/harmonic/test_dynmat_to_fc.py phonopy-2.13.1/test/harmonic/test_dynmat_to_fc.py --- phonopy-2.12.0/test/harmonic/test_dynmat_to_fc.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/harmonic/test_dynmat_to_fc.py 2022-02-13 03:47:08.000000000 +0000 @@ -1,5 +1,6 @@ """Tests for dynmat_to_fc, inverse phonon transformation.""" import os +from io import StringIO import numpy as np import pytest @@ -16,6 +17,40 @@ data_dir = os.path.dirname(os.path.abspath(__file__)) +comm_points_str = """1 0.00 0.00 0.00 +2 0.00 0.25 0.25 +3 0.00 0.50 0.50 +4 0.00 0.75 0.75 +5 0.25 0.00 0.25 +6 0.25 0.25 0.50 +7 0.25 0.50 0.75 +8 0.25 0.75 0.00 +9 0.50 0.00 0.50 +10 0.50 0.25 0.75 +11 0.50 0.50 0.00 +12 0.50 0.75 0.25 +13 0.75 0.00 0.75 +14 0.75 0.25 0.00 +15 0.75 0.50 0.25 +16 0.75 0.75 0.50 +17 0.25 0.25 0.00 +18 0.25 0.50 0.25 +19 0.25 0.75 0.50 +20 0.25 0.00 0.75 +21 0.50 0.25 0.25 +22 0.50 0.50 0.50 +23 0.50 0.75 0.75 +24 0.50 0.00 0.00 +25 0.75 0.25 0.50 +26 0.75 0.50 0.75 +27 0.75 0.75 0.00 +28 0.75 0.00 0.25 +29 0.00 0.25 0.75 +30 0.00 0.50 0.00 +31 0.00 0.75 0.25 +32 0.00 0.00 0.50""" + + def test_get_commensurate_points(): """Test for getting commensurate points.""" comm_points, _ = _get_commensurate_points() @@ -46,11 +81,10 @@ return get_commensurate_points(smat), smat -def _compare(comm_points, filename="comm_points.dat"): - with open(os.path.join(data_dir, filename)) as f: - comm_points_in_file = np.loadtxt(f) - diff = comm_points_in_file[:, 1:] - comm_points - np.testing.assert_allclose(diff, np.rint(diff), atol=1e-3) +def _compare(comm_points): + comm_points_ref = np.loadtxt(StringIO(comm_points_str), dtype="double") + diff = comm_points_ref[:, 1:] - comm_points + np.testing.assert_allclose(diff, np.rint(diff), atol=1e-3) def _write(comm_points, filename="comm_points.dat"): diff -Nru phonopy-2.12.0/test/phonon/test_group_velocity.py phonopy-2.13.1/test/phonon/test_group_velocity.py --- phonopy-2.12.0/test/phonon/test_group_velocity.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/phonon/test_group_velocity.py 2022-02-13 03:47:08.000000000 +0000 @@ -6,7 +6,11 @@ def test_gv_nacl(ph_nacl: Phonopy): - """Test of GroupVelocity.""" + """Test of GroupVelocity by NaCl. + + This test should pass _get_dD_FD. + + """ gv_ref = [ 14.90162220, 14.90162220, @@ -32,3 +36,34 @@ np.testing.assert_allclose(gv.group_velocities[0].ravel(), gv_ref, atol=1e-5) # for line in gv.group_velocities[0]: # print("".join(["%.8f, " % v for v in line])) + + +def test_gv_si(ph_si: Phonopy): + """Test of GroupVelocity by Si. + + This test should pass _get_dD_analytical. + + """ + gv_ref = [ + 17.06443768, + 17.06443768, + 17.06443768, + 17.06443768, + 17.06443768, + 17.06443768, + 46.95145125, + 46.95145125, + 46.95145125, + -3.59278449, + -3.59278449, + -3.59278449, + -2.39847202, + -2.39847202, + -2.39847202, + -2.39847202, + -2.39847202, + -2.39847202, + ] + gv = GroupVelocity(ph_si.dynamical_matrix, symmetry=ph_si.primitive_symmetry) + gv.run([[0.1, 0.1, 0.1]]) + np.testing.assert_allclose(gv.group_velocities[0].ravel(), gv_ref, atol=1e-5) diff -Nru phonopy-2.12.0/test/phonopy_params_Si.yaml phonopy-2.13.1/test/phonopy_params_Si.yaml --- phonopy-2.12.0/test/phonopy_params_Si.yaml 1970-01-01 00:00:00.000000000 +0000 +++ phonopy-2.13.1/test/phonopy_params_Si.yaml 2022-02-13 03:47:08.000000000 +0000 @@ -0,0 +1,147 @@ +phonopy: + version: 2.12.0 + frequency_unit_conversion_factor: 15.633302 + symmetry_tolerance: 1.00000e-05 + +physical_unit: + atomic_mass: "AMU" + +space_group: + type: "Fd-3m" + number: 227 + Hall_symbol: "F 4d 2 3 -1d" + +primitive_matrix: +- [ 1.000000000000000, 0.000000000000000, 0.000000000000000 ] +- [ 0.000000000000000, 1.000000000000000, 0.000000000000000 ] +- [ 0.000000000000000, 0.000000000000000, 1.000000000000000 ] + +supercell_matrix: +- [ 2, 0, 0 ] +- [ 0, 2, 0 ] +- [ 0, 0, 2 ] + +primitive_cell: + lattice: + - [ 0.000000000000000, 2.733099421887393, 2.733099421887393 ] # a + - [ 2.733099421887393, 0.000000000000000, 2.733099421887393 ] # b + - [ 2.733099421887393, 2.733099421887393, 0.000000000000000 ] # c + points: + - symbol: Si # 1 + coordinates: [ 0.875000000000000, 0.875000000000000, 0.875000000000000 ] + mass: 28.085500 + - symbol: Si # 2 + coordinates: [ 0.125000000000000, 0.125000000000000, 0.125000000000000 ] + mass: 28.085500 + reciprocal_lattice: # without 2pi + - [ -0.182942485002875, 0.182942485002875, 0.182942485002875 ] # a* + - [ 0.182942485002875, -0.182942485002875, 0.182942485002875 ] # b* + - [ 0.182942485002875, 0.182942485002875, -0.182942485002875 ] # c* + +unit_cell: + lattice: + - [ 0.000000000000000, 2.733099421887393, 2.733099421887393 ] # a + - [ 2.733099421887393, 0.000000000000000, 2.733099421887393 ] # b + - [ 2.733099421887393, 2.733099421887393, 0.000000000000000 ] # c + points: + - symbol: Si # 1 + coordinates: [ 0.875000000000000, 0.875000000000000, 0.875000000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 2 + coordinates: [ 0.125000000000000, 0.125000000000000, 0.125000000000000 ] + mass: 28.085500 + reduced_to: 2 + +supercell: + lattice: + - [ 0.000000000000000, 5.466198843774786, 5.466198843774786 ] # a + - [ 5.466198843774786, 0.000000000000000, 5.466198843774786 ] # b + - [ 5.466198843774786, 5.466198843774786, 0.000000000000000 ] # c + points: + - symbol: Si # 1 + coordinates: [ 0.437500000000000, 0.437500000000000, 0.437500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 2 + coordinates: [ 0.937500000000000, 0.437500000000000, 0.437500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 3 + coordinates: [ 0.437500000000000, 0.937500000000000, 0.437500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 4 + coordinates: [ 0.937500000000000, 0.937500000000000, 0.437500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 5 + coordinates: [ 0.437500000000000, 0.437500000000000, 0.937500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 6 + coordinates: [ 0.937500000000000, 0.437500000000000, 0.937500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 7 + coordinates: [ 0.437500000000000, 0.937500000000000, 0.937500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 8 + coordinates: [ 0.937500000000000, 0.937500000000000, 0.937500000000000 ] + mass: 28.085500 + reduced_to: 1 + - symbol: Si # 9 + coordinates: [ 0.062500000000000, 0.062500000000000, 0.062500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 10 + coordinates: [ 0.562500000000000, 0.062500000000000, 0.062500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 11 + coordinates: [ 0.062500000000000, 0.562500000000000, 0.062500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 12 + coordinates: [ 0.562500000000000, 0.562500000000000, 0.062500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 13 + coordinates: [ 0.062500000000000, 0.062500000000000, 0.562500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 14 + coordinates: [ 0.562500000000000, 0.062500000000000, 0.562500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 15 + coordinates: [ 0.062500000000000, 0.562500000000000, 0.562500000000000 ] + mass: 28.085500 + reduced_to: 9 + - symbol: Si # 16 + coordinates: [ 0.562500000000000, 0.562500000000000, 0.562500000000000 ] + mass: 28.085500 + reduced_to: 9 + +displacements: +- atom: 1 + displacement: + [ 0.0000000000000000, 0.0070710678118655, 0.0070710678118655 ] + forces: + - [ -0.0015555800000000, -0.0941483300000000, -0.0941483300000000 ] + - [ 0.0000158000000000, 0.0066924700000000, 0.0066924700000000 ] + - [ 0.0035175900000000, -0.0060909500000000, 0.0031715000000000 ] + - [ -0.0035398400000000, 0.0031556300000000, -0.0060935500000000 ] + - [ 0.0035175900000000, 0.0031715000000000, -0.0060909500000000 ] + - [ -0.0035398400000000, -0.0060935500000000, 0.0031556300000000 ] + - [ -0.0000084700000000, -0.0003651600000000, -0.0003651600000000 ] + - [ 0.0000042200000000, 0.0009028700000000, 0.0009028700000000 ] + - [ 0.0018083600000000, 0.0000339900000000, 0.0000339900000000 ] + - [ -0.0018089900000000, 0.0000287500000000, 0.0000287500000000 ] + - [ -0.0000036600000000, -0.0017820900000000, -0.0017727000000000 ] + - [ 0.0001161600000000, 0.0086877900000000, 0.0085529800000000 ] + - [ -0.0000036600000000, -0.0017727000000000, -0.0017820900000000 ] + - [ 0.0001161600000000, 0.0085529800000000, 0.0086877900000000 ] + - [ -0.0302155900000000, 0.0390068200000000, 0.0390068200000000 ] + - [ 0.0315797500000000, 0.0400199900000000, 0.0400199900000000 ] diff -Nru phonopy-2.12.0/test/structure/test_atoms.py phonopy-2.13.1/test/structure/test_atoms.py --- phonopy-2.12.0/test/structure/test_atoms.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/structure/test_atoms.py 2022-02-13 03:47:08.000000000 +0000 @@ -26,12 +26,24 @@ _test_cell(cell_SiO2, _lattice, _points, symbols_SiO2) -def test_AcO2(): +def test_SiO2_copy(helper_methods): + """Test of PhonopyAtoms.copy() by SiO2.""" + helper_methods.compare_cells(cell_SiO2, cell_SiO2.copy()) + helper_methods.compare_cells_with_order(cell_SiO2, cell_SiO2.copy()) + + +def test_AcO2(helper_methods): """Test of attributes by AcO2.""" _test_cell(cell_AcO2, _lattice, _points, symbols_AcO2) + helper_methods.compare_cells(cell_AcO2, cell_AcO2.copy()) + helper_methods.compare_cells_with_order(cell_AcO2, cell_AcO2.copy()) + + +def test_AcO2_copy(): + """Test of PhonopyAtoms.copy() by AcO2.""" -def _test_cell(cell, lattice, points, symbols): +def _test_cell(cell: PhonopyAtoms, lattice, points, symbols): np.testing.assert_allclose(cell.cell, lattice, atol=1e-8) for s1, s2 in zip(cell.symbols, symbols): assert s1 == s2 @@ -51,15 +63,37 @@ _test_phonopy_atoms(cell_AcO2) -def _test_phonopy_atoms(cell): +def test_Cr_magnetic_moments(convcell_cr: PhonopyAtoms): + """Test by Cr with [1, -1] magnetic moments.""" + convcell_cr.magnetic_moments = [1, -1] + _test_phonopy_atoms(convcell_cr) + convcell_cr.magnetic_moments = None + + +def test_Cr_copy_magnetic_moments(convcell_cr: PhonopyAtoms, helper_methods): + """Test by Cr with [1, -1] magnetic moments.""" + convcell_cr.magnetic_moments = [1, -1] + helper_methods.compare_cells(convcell_cr, convcell_cr.copy()) + helper_methods.compare_cells_with_order(convcell_cr, convcell_cr.copy()) + convcell_cr.magnetic_moments = None + + +def _test_phonopy_atoms(cell: PhonopyAtoms): with StringIO(str(PhonopyAtoms(atoms=cell))) as f: data = yaml.safe_load(f) np.testing.assert_allclose(cell.cell, data["lattice"], atol=1e-8) positions = [] + magmoms = [] for atom, symbol in zip(data["points"], cell.symbols): positions.append(atom["coordinates"]) + if "magnetic_moment" in atom: + magmoms.append(atom["magnetic_moment"]) assert atom["symbol"] == symbol + diff = cell.scaled_positions - positions diff -= np.rint(diff) dist = np.linalg.norm(np.dot(diff, cell.cell), axis=1) np.testing.assert_allclose(dist, np.zeros(len(dist)), atol=1e-8) + + if magmoms: + np.testing.assert_allclose(cell.magnetic_moments, magmoms, atol=1e-8) diff -Nru phonopy-2.12.0/test/structure/test_cells.py phonopy-2.13.1/test/structure/test_cells.py --- phonopy-2.12.0/test/structure/test_cells.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/structure/test_cells.py 2022-02-13 03:47:08.000000000 +0000 @@ -214,6 +214,21 @@ helper_methods.compare_cells(scell, scell_snf) +def test_get_supercell_Cr(convcell_cr: PhonopyAtoms, helper_methods): + """Test of get_supercell using SNF by Cr with magnetic moments.""" + convcell_cr.magnetic_moments = [1, -1] + smat = [[-1, 1, 1], [1, -1, 1], [1, 1, -1]] + scell = get_supercell(convcell_cr, smat, is_old_style=True) + np.testing.assert_allclose( + scell.magnetic_moments, + [1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0], + atol=1e-8, + ) + scell_snf = get_supercell(convcell_cr, smat, is_old_style=False) + helper_methods.compare_cells(scell, scell_snf) + convcell_cr.magnetic_moments = None + + def _test_get_supercell_convcell_sio2( convcell_sio2: PhonopyAtoms, helper_methods, is_old_style=True ): @@ -248,6 +263,17 @@ helper_methods.compare_cells_with_order(pcell, primcell_nacl) +def test_get_primitive_convcell_Cr(convcell_cr: PhonopyAtoms, helper_methods): + """Test get_primitive by NaCl.""" + convcell_cr.magnetic_moments = [1, -1] + smat = [[2, 0, 0], [0, 2, 0], [0, 0, 2]] + scell = get_supercell(convcell_cr, smat, is_old_style=True) + pmat = np.linalg.inv(smat) + pcell = get_primitive(scell, pmat) + helper_methods.compare_cells(convcell_cr, pcell) + convcell_cr.magnetic_moments = None + + @pytest.mark.parametrize("store_dense_svecs", [True, False]) def test_get_primitive_convcell_nacl_svecs( convcell_nacl: PhonopyAtoms, store_dense_svecs diff -Nru phonopy-2.12.0/test/structure/test_grid_points.py phonopy-2.13.1/test/structure/test_grid_points.py --- phonopy-2.12.0/test/structure/test_grid_points.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/structure/test_grid_points.py 2022-02-13 03:47:08.000000000 +0000 @@ -42,6 +42,15 @@ def test_GridPoints(): """Test of GridPoints.""" gp = GridPoints([2, 3, 4], [[-1, 1, 1], [1, -1, 1], [1, 1, -1]]) + + assert gp.ir_grid_points.dtype == np.dtype("int_") + assert gp.weights.dtype == np.dtype("int_") + assert gp.grid_mapping_table.dtype == np.dtype("int_") + assert gp.grid_address.dtype == np.dtype("intc") + assert gp.mesh_numbers.dtype == np.dtype("intc") + assert gp.reciprocal_lattice.dtype == np.dtype("double") + assert gp.qpoints.dtype == np.dtype("double") + np.testing.assert_array_equal(gp.grid_address, ga234) diff -Nru phonopy-2.12.0/test/structure/test_symmetry.py phonopy-2.13.1/test/structure/test_symmetry.py --- phonopy-2.12.0/test/structure/test_symmetry.py 2021-10-27 22:56:11.000000000 +0000 +++ phonopy-2.13.1/test/structure/test_symmetry.py 2022-02-13 03:47:08.000000000 +0000 @@ -1,6 +1,7 @@ """Tests for symmetry tools.""" import numpy as np +from phonopy.structure.atoms import PhonopyAtoms from phonopy.structure.cells import get_supercell from phonopy.structure.symmetry import ( Symmetry, @@ -34,24 +35,23 @@ assert (diff < symprec).all() -def test_magmom(convcell_cr): +def test_magmom(convcell_cr: PhonopyAtoms): """Test symmetry search with hmagnetic moments.""" symprec = 1e-5 - cell = convcell_cr - symmetry_nonspin = Symmetry(cell, symprec=symprec) + symmetry_nonspin = Symmetry(convcell_cr, symprec=symprec) atom_map_nonspin = symmetry_nonspin.get_map_atoms() len_sym_nonspin = len(symmetry_nonspin.symmetry_operations["rotations"]) spin = [1, -1] - cell_withspin = cell.copy() + cell_withspin = convcell_cr.copy() cell_withspin.magnetic_moments = spin symmetry_withspin = Symmetry(cell_withspin, symprec=symprec) atom_map_withspin = symmetry_withspin.get_map_atoms() len_sym_withspin = len(symmetry_withspin.symmetry_operations["rotations"]) broken_spin = [1, -2] - cell_brokenspin = cell.copy() - cell_brokenspin = cell.copy() + cell_brokenspin = convcell_cr.copy() + cell_brokenspin = convcell_cr.copy() cell_brokenspin.magnetic_moments = broken_spin symmetry_brokenspin = Symmetry(cell_brokenspin, symprec=symprec) atom_map_brokenspin = symmetry_brokenspin.get_map_atoms()