Skip to content

Commit 1226275

Browse files
committed
Improved minimizer: use DiagonalizeSupercell, fix hermitian symmetry, version bump to 1.6.0
1 parent db22c63 commit 1226275

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

Modules/SchaMinimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,11 +964,11 @@ def print_info(self):
964964
print (" supercell size = ", " ".join([str(x) for x in self.ensemble.supercell]))
965965

966966
# Get the current frequencies
967-
w, pols = self.dyn.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
967+
w, pols = self.dyn.DiagonalizeSupercell()#self.dyn.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
968968
w *= __RyToCm__
969969

970970
# Get the starting frequencies
971-
w0, p0 = self.ensemble.dyn_0.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
971+
w0, p0 = self.ensemble.dyn_0.DiagonalizeSupercell()
972972
w0 *= __RyToCm__
973973

974974
print ()

Modules/fourier_gradient.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function get_gradient_fourier!(Φ_grad :: Array{Complex{T}, 3},
7878
for i in 1:n_random
7979
tmp = v_tilde[i, j, jq] * conj(δf_tilde[i, k, jq])
8080
Φ_grad[j, k, jq] += tmp * weights[i]
81-
Φ_grad_err[j, k, jq] += tmp * conj(tmp) * weights[i]
81+
Φ_grad_err[j, k, jq] += abs2(tmp) * weights[i]
8282

8383
# @views mul!(tmp, v_tilde[:, jq, i], δf_tilde[:, jq, i]')
8484
# @. tmp2 = tmp * conj(tmp)
@@ -103,9 +103,10 @@ function get_gradient_fourier!(Φ_grad :: Array{Complex{T}, 3},
103103
begin
104104
tmp_grad = zeros(Complex{T}, (3*nat, 3*nat, nq))
105105
for iq in 1:nq
106-
@views Φ_grad[:, :, iq] .+= Φ_grad[:, :, iq]'
107106
@views tmp_grad[:, :, iq] .= Φ_grad[:, :, iq]
107+
@views tmp_grad[:, :, iq] .+= Φ_grad[:, :, iq]'
108108
end
109+
Φ_grad .= tmp_grad
109110
for iq in 1:nq
110111
@views tmp_grad[:, :, iq] .+= conj.(Φ_grad[:, :, minus_q_index[iq]]')
111112
end

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('python-sscha',
22
['c','fortran'],
3-
version : '1.5.0',
3+
version : '1.6.0',
44
license: 'GPL',
55
meson_version: '>= 1.1.0', # <- set min version of meson.
66
default_options : [

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "mesonpy"
44

55
[project]
66
name = "python-sscha"
7-
version = "1.5.0"
7+
version = "1.6.0"
88
description = "Python implementation of the sscha code"
99
authors = [{name = "Lorenzo Monacelli"}] # Put here email
1010
readme = "README.md"

0 commit comments

Comments
 (0)