From e9c275fc55678f9d26f9ef61c26a687cea86dd3d Mon Sep 17 00:00:00 2001 From: Terumasa TADANO Date: Wed, 22 Jun 2022 23:31:25 +0900 Subject: [PATCH 1/5] Change version number --- ChangeLog.md | 7 +++++++ README.md | 2 +- docs/source/conf.py | 2 +- include/version.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f5e0c4e1..84e5736b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,10 @@ +# Ver. 1.4.1 (2022-06-22) + +## Fixes + +- Fix a bug in xml writer in the previous version + + # Ver. 1.4.0 (2022-06-21) ## New diff --git a/README.md b/README.md index 946fc1a3..e95a08dd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![License][license-image]][license-url] [![Doc status][docs-image]][docs-url] -### Version 1.4.0 +### Version 1.4.1 ![alt ALAMODE](./docs/img/alamode.png) diff --git a/docs/source/conf.py b/docs/source/conf.py index e9b8dd82..73dc63e1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -59,7 +59,7 @@ # The short X.Y version. version = '1.4' # The full version, including alpha/beta/rc tags. -release = '1.4.0' +release = '1.4.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/include/version.h b/include/version.h index 0fee59d3..8bdc0d39 100644 --- a/include/version.h +++ b/include/version.h @@ -12,4 +12,4 @@ #include -static const std::string ALAMODE_VERSION = "1.4.0"; +static const std::string ALAMODE_VERSION = "1.4.1"; From 4f5f135772d8a3119fd439703f45919a3f222d85 Mon Sep 17 00:00:00 2001 From: Terumasa TADANO Date: Thu, 30 Jun 2022 03:20:46 +0900 Subject: [PATCH 2/5] Fix a bug in QE.py for loading Born effective charges --- tools/interface/QE.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/interface/QE.py b/tools/interface/QE.py index 6a10eaf2..7c8e6709 100644 --- a/tools/interface/QE.py +++ b/tools/interface/QE.py @@ -1024,13 +1024,13 @@ def _get_borninfo_phout(phout_file): borncharge = [] search_tag1 = "Dielectric constant in cartesian axis" - + search_tags = ["Px", "Py", "Pz", "Ex", "Ey", "Ez"] f = open(phout_file, 'r') line = f.readline() found_tag1 = False found_tag2 = False - + while line: if search_tag1 in line: found_tag1 = True @@ -1039,7 +1039,7 @@ def _get_borninfo_phout(phout_file): line = f.readline() dielec.extend([float(t) for t in line.strip().split()[1:4]]) - if "Px" in line or "Py" in line or "Pz" in line: + if any(s in line for s in search_tags): found_tag2 = True borncharge.extend(float(t) for t in line.strip().split()[2:5]) @@ -1051,9 +1051,9 @@ def _get_borninfo_phout(phout_file): "in %s" % phout_file, file=sys.stderr) return None - nat = len(borncharge) // 9 + nat2 = len(borncharge) // 9 dielec = np.reshape(np.array(dielec[9:]), (3, 3)) - borncharge = np.reshape(np.array(borncharge), (nat, 3, 3)) - return dielec, borncharge + borncharge = np.reshape(np.array(borncharge), (nat2, 3, 3)) + return dielec, borncharge[:nat2 // 2, :, :] From 021bbdd8ad4a07a6d6f2c7be5305c6e5ae5f4f8d Mon Sep 17 00:00:00 2001 From: Hiori Kino Date: Fri, 12 Aug 2022 10:08:30 +0200 Subject: [PATCH 3/5] accept element xu yu yz for aiida-lammps --- tools/interface/LAMMPS.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/tools/interface/LAMMPS.py b/tools/interface/LAMMPS.py index bab294f7..b9f39f1f 100644 --- a/tools/interface/LAMMPS.py +++ b/tools/interface/LAMMPS.py @@ -380,24 +380,36 @@ def x_fractional(self): @staticmethod def _get_coordinate_and_force_lammps(lammps_dump_file): - add_flag = False + add_flag = None ret = [] with open(lammps_dump_file) as f: for line in f: - if "ITEM:" in line and "ITEM: ATOMS id xu yu zu fx fy fz" not in line: - add_flag = False + #if "ITEM:" in line and "ITEM: ATOMS id xu yu zu fx fy fz" not in line: + # add_flag = False + # continue + if "ITEM: ATOMS id xu yu zu fx fy fz" in line: + add_flag = "id.xu" continue - elif "ITEM: ATOMS id xu yu zu fx fy fz" in line: - add_flag = True + elif "ITEM: ATOMS element xu yu zu fx fy fz" in line: + add_flag = "element.xu" + id_ = 0 continue - if add_flag: - if line.strip(): - entries = line.strip().split() - data_atom = [int(entries[0]), - [float(t) for t in entries[1:4]], - [float(t) for t in entries[4:]]] + if add_flag is not None: + if add_flag == "id.xu": + if line.strip(): + entries = line.strip().split() + data_atom = [int(entries[0]), + [float(t) for t in entries[1:4]], + [float(t) for t in entries[4:]]] + elif add_flag == "element.xu": + if line.strip(): + entries = line.strip().split() + id_ += 1 + data_atom = [int(id_), + [float(t) for t in entries[1:4]], + [float(t) for t in entries[4:]]] ret.append(data_atom) From 190c4a54525c77614b4ff1de837215528060fe1f Mon Sep 17 00:00:00 2001 From: Terumasa TADANO Date: Wed, 28 Sep 2022 14:47:22 +0900 Subject: [PATCH 4/5] Fix a bug in phonon velocity when NONANALYTIC=3. The nonanalytic correction was missing for group velocity when NONANALYTIC=3. This bug has been fixed. --- anphon/conductivity.cpp | 1 - anphon/phonon_velocity.cpp | 45 +++++++++++++++++++++++++------------- anphon/phonon_velocity.h | 3 +-- anphon/write_phonons.cpp | 3 ++- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/anphon/conductivity.cpp b/anphon/conductivity.cpp index e46a460d..efa90d4d 100644 --- a/anphon/conductivity.cpp +++ b/anphon/conductivity.cpp @@ -124,7 +124,6 @@ void Conductivity::setup_kappa() phonon_velocity->get_phonon_group_velocity_mesh_mpi(*dos->kmesh_dos, system->lavec_p, - fcs_phonon->fc2_ext, vel); if (mympi->my_rank == 0) { for (i = 0; i < nk; ++i) { diff --git a/anphon/phonon_velocity.cpp b/anphon/phonon_velocity.cpp index 3da46cf8..da98ebbb 100644 --- a/anphon/phonon_velocity.cpp +++ b/anphon/phonon_velocity.cpp @@ -13,6 +13,7 @@ or http://opensource.org/licenses/mit-license.php for information. #include "constants.h" #include "dynamical.h" #include "error.h" +#include "ewald.h" #include "fcs_phonon.h" #include "kpoint.h" #include "mathfunctions.h" @@ -77,6 +78,7 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr const double lavec_p[3][3], const double rlavec_p[3][3], const std::vector &fc2_ext_in, + const std::vector &fc2_without_dipole, double **phvel_out) const { unsigned int i; @@ -130,12 +132,19 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr rotvec(xk_shift[idiff], xk_shift[idiff], lavec_p, 'T'); for (i = 0; i < 3; ++i) xk_shift[idiff][i] /= 2.0 * pi; - dynamical->eval_k(xk_shift[idiff], - kpoint_bs_in->kvec_na[ik], - fc2_ext_in, - omega_shift[idiff], - evec_tmp, false); - + if (dynamical->nonanalytic == 3) { + dynamical->eval_k_ewald(xk_shift[idiff], + kpoint_bs_in->kvec_na[ik], + fc2_without_dipole, + omega_shift[idiff], + evec_tmp, false); + } else { + dynamical->eval_k(xk_shift[idiff], + kpoint_bs_in->kvec_na[ik], + fc2_ext_in, + omega_shift[idiff], + evec_tmp, false); + } } for (i = 0; i < n; ++i) { @@ -159,7 +168,6 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr void PhononVelocity::get_phonon_group_velocity_mesh(const KpointMeshUniform &kmesh_in, const double lavec_p[3][3], - const std::vector &fc2_ext_in, const bool irreducible_only, double ***phvel3_out) const { @@ -202,7 +210,6 @@ void PhononVelocity::get_phonon_group_velocity_mesh(const KpointMeshUniform &kme void PhononVelocity::get_phonon_group_velocity_mesh_mpi(const KpointMeshUniform &kmesh_in, const double lavec_p[3][3], - const std::vector &fc2_ext_in, double ***phvel3_out) const { // This routine computes the group velocities for the given uniform k mesh @@ -469,13 +476,21 @@ void PhononVelocity::phonon_vel_k(const double *xk_in, for (idiff = 0; idiff < ndiff; ++idiff) { - dynamical->eval_k(xk_shift[idiff], - kvec_na_tmp[0], - fcs_phonon->fc2_ext, - omega_shift[idiff], - evec_tmp, - false); - + if (dynamical->nonanalytic == 3) { + dynamical->eval_k_ewald(xk_shift[idiff], + kvec_na_tmp[idiff], + ewald->fc2_without_dipole, + omega_shift[idiff], + evec_tmp, + false); + } else { + dynamical->eval_k(xk_shift[idiff], + kvec_na_tmp[idiff], + fcs_phonon->fc2_ext, + omega_shift[idiff], + evec_tmp, + false); + } } for (j = 0; j < n; ++j) { diff --git a/anphon/phonon_velocity.h b/anphon/phonon_velocity.h index bdde590b..bed30d5e 100644 --- a/anphon/phonon_velocity.h +++ b/anphon/phonon_velocity.h @@ -35,13 +35,11 @@ class PhononVelocity : protected Pointers { void get_phonon_group_velocity_mesh(const KpointMeshUniform &kmesh_in, const double lavec_p[3][3], - const std::vector &fc2_ext_in, const bool irreducible_only, double ***phvel3_out) const; void get_phonon_group_velocity_mesh_mpi(const KpointMeshUniform &kmesh_in, const double lavec_p[3][3], - const std::vector &fc2_ext_in, double ***phvel3_out) const; void calc_phonon_velmat_mesh(std::complex ****velmat_out) const; @@ -50,6 +48,7 @@ class PhononVelocity : protected Pointers { const double lavec_p[3][3], const double rlavec_p[3][3], const std::vector &fc2_ext_in, + const std::vector &fc2_without_dipole, double **phvel_out) const; void velocity_matrix_analytic(const double *xk_in, diff --git a/anphon/write_phonons.cpp b/anphon/write_phonons.cpp index 1861c045..0bff6833 100644 --- a/anphon/write_phonons.cpp +++ b/anphon/write_phonons.cpp @@ -15,6 +15,7 @@ or http://opensource.org/licenses/mit-license.php for information. #include "dielec.h" #include "dynamical.h" #include "error.h" +#include "ewald.h" #include "fcs_phonon.h" #include "gruneisen.h" #include "kpoint.h" @@ -779,6 +780,7 @@ void Writes::write_phonon_vel() const system->lavec_p, system->rlavec_p, fcs_phonon->fc2_ext, + ewald->fc2_without_dipole, phvel_bs); ofs_vel << "# k-axis, |Velocity| [m / sec]" << std::endl; @@ -834,7 +836,6 @@ void Writes::write_phonon_vel_all() const phonon_velocity->get_phonon_group_velocity_mesh(*dos->kmesh_dos, system->lavec_p, - fcs_phonon->fc2_ext, false, phvel_xyz); unsigned int ik, is; From e5962f4b95608f746b9bcdae81cd8ca8f013fe2c Mon Sep 17 00:00:00 2001 From: Terumasa TADANO Date: Wed, 28 Sep 2022 14:52:51 +0900 Subject: [PATCH 5/5] Change version number to 1.4.2 --- ChangeLog.md | 7 +++++++ README.md | 2 +- docs/source/conf.py | 2 +- include/version.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 84e5736b..b87826be 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,10 @@ +# Ver. 1.4.2 (2022-09-28) + +## Fixes + +- Fix a bug in group velocity when NONANALYTIC=3 + + # Ver. 1.4.1 (2022-06-22) ## Fixes diff --git a/README.md b/README.md index e95a08dd..488e8df9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![License][license-image]][license-url] [![Doc status][docs-image]][docs-url] -### Version 1.4.1 +### Version 1.4.2 ![alt ALAMODE](./docs/img/alamode.png) diff --git a/docs/source/conf.py b/docs/source/conf.py index 73dc63e1..81badae2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -59,7 +59,7 @@ # The short X.Y version. version = '1.4' # The full version, including alpha/beta/rc tags. -release = '1.4.1' +release = '1.4.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/include/version.h b/include/version.h index 8bdc0d39..aa239435 100644 --- a/include/version.h +++ b/include/version.h @@ -12,4 +12,4 @@ #include -static const std::string ALAMODE_VERSION = "1.4.1"; +static const std::string ALAMODE_VERSION = "1.4.2";