We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e070094 + 27c8853 commit ae48d6eCopy full SHA for ae48d6e
5 files changed
Modules/Minimizer.py
@@ -224,6 +224,9 @@ def run_step(self, gradient, kl_new):
224
# Enlarge the step
225
if not self.fixed_step:
226
self.step *= self.increment_step
227
+
228
+ # Perform the minimization step for new direction
229
+ self.current_x = self.old_x - self.step * self.direction
230
else:
231
# Proceed with the line minimization
232
@@ -243,14 +246,16 @@ def run_step(self, gradient, kl_new):
243
246
print("Step too large (scalar = {} | kl_ratio = {}), reducing to {}".format(scalar, kl_ratio, self.step))
244
247
#print("Direction: ", self.direction)
245
248
#print("Gradient: ", gradient)
249
250
+ # Try again with reduced step
251
252
253
# The step is good, therefore next step perform a new direction
254
self.new_direction = True
255
if self.verbose:
256
print("Good step found with {}, try increment".format(self.step))
-
- # Perform the minimiziation step
- self.current_x = self.old_x - self.step * self.direction
257
+ # DO NOT update current_x - we accept the current position
258
+ # (current_x was already updated in the previous step)
259
260
261
def update_dyn(self, new_kl_ratio, dyn_gradient, structure_gradient = None):
Modules/SchaMinimizer.py
@@ -964,11 +964,11 @@ def print_info(self):
964
print (" supercell size = ", " ".join([str(x) for x in self.ensemble.supercell]))
965
966
# Get the current frequencies
967
- w, pols = self.dyn.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
+ w, pols = self.dyn.DiagonalizeSupercell()#self.dyn.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
968
w *= __RyToCm__
969
970
# Get the starting frequencies
971
- w0, p0 = self.ensemble.dyn_0.GenerateSupercellDyn(self.ensemble.supercell).DyagDinQ(0)
+ w0, p0 = self.ensemble.dyn_0.DiagonalizeSupercell()
972
w0 *= __RyToCm__
973
974
print ()
Modules/fourier_gradient.jl
@@ -78,7 +78,7 @@ function get_gradient_fourier!(Φ_grad :: Array{Complex{T}, 3},
78
for i in 1:n_random
79
tmp = v_tilde[i, j, jq] * conj(δf_tilde[i, k, jq])
80
Φ_grad[j, k, jq] += tmp * weights[i]
81
- Φ_grad_err[j, k, jq] += tmp * conj(tmp) * weights[i]
+ Φ_grad_err[j, k, jq] += abs2(tmp) * weights[i]
82
83
# @views mul!(tmp, v_tilde[:, jq, i], δf_tilde[:, jq, i]')
84
# @. tmp2 = tmp * conj(tmp)
@@ -103,9 +103,10 @@ function get_gradient_fourier!(Φ_grad :: Array{Complex{T}, 3},
103
begin
104
tmp_grad = zeros(Complex{T}, (3*nat, 3*nat, nq))
105
for iq in 1:nq
106
- @views Φ_grad[:, :, iq] .+= Φ_grad[:, :, iq]'
107
@views tmp_grad[:, :, iq] .= Φ_grad[:, :, iq]
+ @views tmp_grad[:, :, iq] .+= Φ_grad[:, :, iq]'
108
end
109
+ Φ_grad .= tmp_grad
110
111
@views tmp_grad[:, :, iq] .+= conj.(Φ_grad[:, :, minus_q_index[iq]]')
112
meson.build
@@ -1,6 +1,6 @@
1
project('python-sscha',
2
['c','fortran'],
3
- version : '1.5.0',
+ version : '1.6.0',
4
license: 'GPL',
5
meson_version: '>= 1.1.0', # <- set min version of meson.
6
default_options : [
pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "mesonpy"
[project]
name = "python-sscha"
7
-version = "1.5.1"
+version = "1.6.0"
8
description = "Python implementation of the sscha code"
9
authors = [{name = "Lorenzo Monacelli"}] # Put here email
10
readme = "README.md"
0 commit comments