Skip to content

Commit e1864d0

Browse files
committed
Merge branch 'hotfix/v.1.4.2'
2 parents 914fdd9 + e5962f4 commit e1864d0

File tree

10 files changed

+79
-39
lines changed

10 files changed

+79
-39
lines changed

ChangeLog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Ver. 1.4.2 (2022-09-28)
2+
3+
## Fixes
4+
5+
- Fix a bug in group velocity when NONANALYTIC=3
6+
7+
8+
# Ver. 1.4.1 (2022-06-22)
9+
10+
## Fixes
11+
12+
- Fix a bug in xml writer in the previous version
13+
14+
115
# Ver. 1.4.0 (2022-06-21)
216

317
## New

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![License][license-image]][license-url]
44
[![Doc status][docs-image]][docs-url]
55

6-
### Version 1.4.0
6+
### Version 1.4.2
77
![alt ALAMODE](./docs/img/alamode.png)
88

99

anphon/conductivity.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ void Conductivity::setup_kappa()
124124

125125
phonon_velocity->get_phonon_group_velocity_mesh_mpi(*dos->kmesh_dos,
126126
system->lavec_p,
127-
fcs_phonon->fc2_ext,
128127
vel);
129128
if (mympi->my_rank == 0) {
130129
for (i = 0; i < nk; ++i) {

anphon/phonon_velocity.cpp

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ or http://opensource.org/licenses/mit-license.php for information.
1313
#include "constants.h"
1414
#include "dynamical.h"
1515
#include "error.h"
16+
#include "ewald.h"
1617
#include "fcs_phonon.h"
1718
#include "kpoint.h"
1819
#include "mathfunctions.h"
@@ -77,6 +78,7 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr
7778
const double lavec_p[3][3],
7879
const double rlavec_p[3][3],
7980
const std::vector<FcsClassExtent> &fc2_ext_in,
81+
const std::vector<FcsClassExtent> &fc2_without_dipole,
8082
double **phvel_out) const
8183
{
8284
unsigned int i;
@@ -130,12 +132,19 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr
130132
rotvec(xk_shift[idiff], xk_shift[idiff], lavec_p, 'T');
131133
for (i = 0; i < 3; ++i) xk_shift[idiff][i] /= 2.0 * pi;
132134

133-
dynamical->eval_k(xk_shift[idiff],
134-
kpoint_bs_in->kvec_na[ik],
135-
fc2_ext_in,
136-
omega_shift[idiff],
137-
evec_tmp, false);
138-
135+
if (dynamical->nonanalytic == 3) {
136+
dynamical->eval_k_ewald(xk_shift[idiff],
137+
kpoint_bs_in->kvec_na[ik],
138+
fc2_without_dipole,
139+
omega_shift[idiff],
140+
evec_tmp, false);
141+
} else {
142+
dynamical->eval_k(xk_shift[idiff],
143+
kpoint_bs_in->kvec_na[ik],
144+
fc2_ext_in,
145+
omega_shift[idiff],
146+
evec_tmp, false);
147+
}
139148
}
140149

141150
for (i = 0; i < n; ++i) {
@@ -159,7 +168,6 @@ void PhononVelocity::get_phonon_group_velocity_bandstructure(const KpointBandStr
159168

160169
void PhononVelocity::get_phonon_group_velocity_mesh(const KpointMeshUniform &kmesh_in,
161170
const double lavec_p[3][3],
162-
const std::vector<FcsClassExtent> &fc2_ext_in,
163171
const bool irreducible_only,
164172
double ***phvel3_out) const
165173
{
@@ -202,7 +210,6 @@ void PhononVelocity::get_phonon_group_velocity_mesh(const KpointMeshUniform &kme
202210

203211
void PhononVelocity::get_phonon_group_velocity_mesh_mpi(const KpointMeshUniform &kmesh_in,
204212
const double lavec_p[3][3],
205-
const std::vector<FcsClassExtent> &fc2_ext_in,
206213
double ***phvel3_out) const
207214
{
208215
// 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,
469476

470477
for (idiff = 0; idiff < ndiff; ++idiff) {
471478

472-
dynamical->eval_k(xk_shift[idiff],
473-
kvec_na_tmp[0],
474-
fcs_phonon->fc2_ext,
475-
omega_shift[idiff],
476-
evec_tmp,
477-
false);
478-
479+
if (dynamical->nonanalytic == 3) {
480+
dynamical->eval_k_ewald(xk_shift[idiff],
481+
kvec_na_tmp[idiff],
482+
ewald->fc2_without_dipole,
483+
omega_shift[idiff],
484+
evec_tmp,
485+
false);
486+
} else {
487+
dynamical->eval_k(xk_shift[idiff],
488+
kvec_na_tmp[idiff],
489+
fcs_phonon->fc2_ext,
490+
omega_shift[idiff],
491+
evec_tmp,
492+
false);
493+
}
479494
}
480495

481496
for (j = 0; j < n; ++j) {

anphon/phonon_velocity.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ class PhononVelocity : protected Pointers {
3535

3636
void get_phonon_group_velocity_mesh(const KpointMeshUniform &kmesh_in,
3737
const double lavec_p[3][3],
38-
const std::vector<FcsClassExtent> &fc2_ext_in,
3938
const bool irreducible_only,
4039
double ***phvel3_out) const;
4140

4241
void get_phonon_group_velocity_mesh_mpi(const KpointMeshUniform &kmesh_in,
4342
const double lavec_p[3][3],
44-
const std::vector<FcsClassExtent> &fc2_ext_in,
4543
double ***phvel3_out) const;
4644

4745
void calc_phonon_velmat_mesh(std::complex<double> ****velmat_out) const;
@@ -50,6 +48,7 @@ class PhononVelocity : protected Pointers {
5048
const double lavec_p[3][3],
5149
const double rlavec_p[3][3],
5250
const std::vector<FcsClassExtent> &fc2_ext_in,
51+
const std::vector<FcsClassExtent> &fc2_without_dipole,
5352
double **phvel_out) const;
5453

5554
void velocity_matrix_analytic(const double *xk_in,

anphon/write_phonons.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ or http://opensource.org/licenses/mit-license.php for information.
1515
#include "dielec.h"
1616
#include "dynamical.h"
1717
#include "error.h"
18+
#include "ewald.h"
1819
#include "fcs_phonon.h"
1920
#include "gruneisen.h"
2021
#include "kpoint.h"
@@ -779,6 +780,7 @@ void Writes::write_phonon_vel() const
779780
system->lavec_p,
780781
system->rlavec_p,
781782
fcs_phonon->fc2_ext,
783+
ewald->fc2_without_dipole,
782784
phvel_bs);
783785

784786
ofs_vel << "# k-axis, |Velocity| [m / sec]" << std::endl;
@@ -834,7 +836,6 @@ void Writes::write_phonon_vel_all() const
834836

835837
phonon_velocity->get_phonon_group_velocity_mesh(*dos->kmesh_dos,
836838
system->lavec_p,
837-
fcs_phonon->fc2_ext,
838839
false,
839840
phvel_xyz);
840841
unsigned int ik, is;

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
# The short X.Y version.
6060
version = '1.4'
6161
# The full version, including alpha/beta/rc tags.
62-
release = '1.4.0'
62+
release = '1.4.2'
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.

include/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
#include <string>
1414

15-
static const std::string ALAMODE_VERSION = "1.4.0";
15+
static const std::string ALAMODE_VERSION = "1.4.2";

tools/interface/LAMMPS.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,24 +380,36 @@ def x_fractional(self):
380380
@staticmethod
381381
def _get_coordinate_and_force_lammps(lammps_dump_file):
382382

383-
add_flag = False
383+
add_flag = None
384384
ret = []
385385

386386
with open(lammps_dump_file) as f:
387387
for line in f:
388-
if "ITEM:" in line and "ITEM: ATOMS id xu yu zu fx fy fz" not in line:
389-
add_flag = False
388+
#if "ITEM:" in line and "ITEM: ATOMS id xu yu zu fx fy fz" not in line:
389+
# add_flag = False
390+
# continue
391+
if "ITEM: ATOMS id xu yu zu fx fy fz" in line:
392+
add_flag = "id.xu"
390393
continue
391-
elif "ITEM: ATOMS id xu yu zu fx fy fz" in line:
392-
add_flag = True
394+
elif "ITEM: ATOMS element xu yu zu fx fy fz" in line:
395+
add_flag = "element.xu"
396+
id_ = 0
393397
continue
394398

395-
if add_flag:
396-
if line.strip():
397-
entries = line.strip().split()
398-
data_atom = [int(entries[0]),
399-
[float(t) for t in entries[1:4]],
400-
[float(t) for t in entries[4:]]]
399+
if add_flag is not None:
400+
if add_flag == "id.xu":
401+
if line.strip():
402+
entries = line.strip().split()
403+
data_atom = [int(entries[0]),
404+
[float(t) for t in entries[1:4]],
405+
[float(t) for t in entries[4:]]]
406+
elif add_flag == "element.xu":
407+
if line.strip():
408+
entries = line.strip().split()
409+
id_ += 1
410+
data_atom = [int(id_),
411+
[float(t) for t in entries[1:4]],
412+
[float(t) for t in entries[4:]]]
401413

402414
ret.append(data_atom)
403415

tools/interface/QE.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,13 +1024,13 @@ def _get_borninfo_phout(phout_file):
10241024
borncharge = []
10251025

10261026
search_tag1 = "Dielectric constant in cartesian axis"
1027-
1027+
search_tags = ["Px", "Py", "Pz", "Ex", "Ey", "Ez"]
10281028
f = open(phout_file, 'r')
10291029
line = f.readline()
10301030

10311031
found_tag1 = False
10321032
found_tag2 = False
1033-
1033+
10341034
while line:
10351035
if search_tag1 in line:
10361036
found_tag1 = True
@@ -1039,7 +1039,7 @@ def _get_borninfo_phout(phout_file):
10391039
line = f.readline()
10401040
dielec.extend([float(t) for t in line.strip().split()[1:4]])
10411041

1042-
if "Px" in line or "Py" in line or "Pz" in line:
1042+
if any(s in line for s in search_tags):
10431043
found_tag2 = True
10441044
borncharge.extend(float(t) for t in line.strip().split()[2:5])
10451045

@@ -1051,9 +1051,9 @@ def _get_borninfo_phout(phout_file):
10511051
"in %s" % phout_file, file=sys.stderr)
10521052
return None
10531053

1054-
nat = len(borncharge) // 9
1054+
nat2 = len(borncharge) // 9
10551055
dielec = np.reshape(np.array(dielec[9:]), (3, 3))
1056-
borncharge = np.reshape(np.array(borncharge), (nat, 3, 3))
1057-
return dielec, borncharge
1056+
borncharge = np.reshape(np.array(borncharge), (nat2, 3, 3))
1057+
return dielec, borncharge[:nat2 // 2, :, :]
10581058

10591059

0 commit comments

Comments
 (0)