Skip to content

Commit a5f846a

Browse files
Fix for the Thermodymamic
1 parent 94a351f commit a5f846a

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

Modules/Ensemble.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17321732
w = np.array(w/2, dtype = np.float64)
17331733

17341734
# Get the a_0
1735-
old_a = SCHAModules.thermodynamic.w_to_a(w, self.T0)
1735+
old_a = self.w_to_a(w, self.T0)
17361736

17371737
# Now do the same for the new dynamical matrix
17381738
#new_super_dyn = new_dynamical_matrix.GenerateSupercellDyn(self.supercell)
@@ -1770,7 +1770,7 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17701770

17711771
w= w_new[~trans_mask]
17721772
w = np.array(w/2, dtype = np.float64)
1773-
new_a = SCHAModules.thermodynamic.w_to_a(w, newT)
1773+
new_a = self.w_to_a(w, newT)
17741774

17751775

17761776
# Get the new displacements in the supercell
@@ -1954,7 +1954,7 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19541954
w = np.array(w/2, dtype = np.float64)
19551955

19561956
# Get the a_0
1957-
old_a = SCHAModules.thermodynamic.w_to_a(w, self.T0)
1957+
old_a = self.w_to_a(w, self.T0)
19581958

19591959
# Now do the same for the new dynamical matrix
19601960
#new_super_dyn = new_dynamical_matrix.GenerateSupercellDyn(self.supercell)
@@ -1992,7 +1992,7 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19921992

19931993
w= w_new[~trans_mask]
19941994
w = np.array(w/2, dtype = np.float64)
1995-
new_a = SCHAModules.thermodynamic.w_to_a(w, newT)
1995+
new_a = self.w_to_a(w, newT)
19961996

19971997

19981998
# Get the new displacements in the supercell
@@ -3654,7 +3654,7 @@ def get_free_energy_hessian(self, include_v4 = False, get_full_hessian = True, v
36543654
else:
36553655
w, pols = w_pols
36563656

3657-
a = SCHAModules.thermodynamic.w_to_a(w, self.current_T)
3657+
a = self.w_to_a(w, self.current_T)
36583658

36593659

36603660
n_modes = len(w)
@@ -4195,8 +4195,16 @@ def get_energy_forces(self, ase_calculator, compute_stress = True, stress_numeri
41954195
timer.execute_timed_function(self.init)
41964196
else:
41974197
self.init()
4198+
def w_to_a(w, T):
4199+
n = len(w)
4200+
a = np.zeros(n)
4201+
if T == 0.0:
4202+
a[:] = np.sqrt(1.0 / (2.0 * w))
4203+
else:
4204+
a[:] = np.sqrt((1.0 / tanh(0.5 * w * 315774.65221921849 / T)) / (2.0 * w))
4205+
return a
41984206

4199-
4207+
#-------------------------------------------------------------------------------
42004208
def _wrapper_julia_get_upsilon_q(*args, **kwargs):
42014209
"""Worker function, just for testing"""
42024210
return julia.Main.get_upsilon_fourier(*args, **kwargs)

0 commit comments

Comments
 (0)