@@ -1733,7 +1733,8 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17331733
17341734 # Exclude translations
17351735 if not self .ignore_small_w :
1736- trans_original = CC .Methods .get_translations (pols_original , super_struct0 .get_masses_array ())
1736+ trans_original = super_struct0 .get_asr_modes (pols_original )
1737+ # trans_original = CC.Methods.get_translations(pols_original, super_struct0.get_masses_array())
17371738 else :
17381739 trans_original = np .abs (w_original ) < CC .Phonons .__EPSILON_W__
17391740
@@ -1750,15 +1751,14 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17501751
17511752
17521753 if not self .ignore_small_w :
1753- trans_mask = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
1754+ trans_mask = super_structure .get_asr_modes (pols )
1755+ # trans_mask = CC.Methods.get_translations(pols, super_structure.get_masses_array())
17541756 else :
17551757 trans_mask = np .abs (w_new ) < CC .Phonons .__EPSILON_W__
17561758
17571759
17581760 # Check if the new dynamical matrix satisfies the sum rule
1759- violating_sum_rule = (np .sum (trans_mask .astype (int )) != 3 ) or (np .sum (trans_original .astype (int )) != 3 )
1760- if self .ignore_small_w :
1761- violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
1761+ violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
17621762
17631763
17641764 if violating_sum_rule :
@@ -1955,7 +1955,8 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19551955
19561956 # Exclude translations
19571957 if not self .ignore_small_w :
1958- trans_original = CC .Methods .get_translations (pols_original , super_struct0 .get_masses_array ())
1958+ trans_original = super_struct0 .get_asr_modes (pols_original )
1959+ # trans_original = CC.Methods.get_translations(pols_original, super_struct0.get_masses_array())
19591960 else :
19601961 trans_original = np .abs (w_original ) < CC .Phonons .__EPSILON_W__
19611962
@@ -1972,15 +1973,15 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19721973
19731974
19741975 if not self .ignore_small_w :
1975- trans_mask = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
1976+ trans_mask = super_structure .get_asr_modes (pols )
1977+ # trans_mask = CC.Methods.get_translations(pols, super_structure.get_masses_array())
19761978 else :
19771979 trans_mask = np .abs (w_new ) < CC .Phonons .__EPSILON_W__
19781980
19791981
19801982 # Check if the new dynamical matrix satisfies the sum rule
1981- violating_sum_rule = (np .sum (trans_mask .astype (int )) != 3 ) or (np .sum (trans_original .astype (int )) != 3 )
1982- if self .ignore_small_w :
1983- violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
1983+ # violating_sum_rule = (np.sum(trans_mask.astype(int)) != 3) or (np.sum(trans_original.astype(int)) != 3)
1984+ violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
19841985
19851986
19861987 if violating_sum_rule :
@@ -1995,7 +1996,7 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19951996DETAILS OF ERROR:
19961997 Number of translatinal modes in the original dyn = {}
19971998 Number of translational modes in the target dyn = {}
1998- (They should be both 3 )
1999+ (They should be both be the same - 3 in bulk )
19992000""" .format (np .sum (trans_original .astype (int )), np .sum (trans_mask .astype (int )))
20002001
20012002 print (ERR_MSG )
@@ -2718,7 +2719,8 @@ def get_preconditioned_gradient(self, subtract_sscha = True, return_error = Fals
27182719 w , pols = self .current_dyn .DiagonalizeSupercell ()#supercell_dyn.DyagDinQ(0)
27192720
27202721 if not self .ignore_small_w :
2721- trans = CC .Methods .get_translations (pols , super_struct .get_masses_array ())
2722+ trans = super_struct .get_asr_modes (pols )
2723+ # trans = CC.Methods.get_translations(pols, super_struct.get_masses_array())
27222724 else :
27232725 trans = np .abs (w ) < CC .Phonons .__EPSILON_W__
27242726
@@ -2958,7 +2960,8 @@ def get_stress_tensor(self, offset_stress = None, use_spglib = False):
29582960 wr , pols = self .current_dyn .DiagonalizeSupercell ()
29592961
29602962 if not self .ignore_small_w :
2961- trans = ~ CC .Methods .get_translations (pols , super_structure .get_masses_array ())
2963+ trans = ~ super_structure .get_asr_modes (pols )
2964+ # trans = ~ CC.Methods.get_translations(pols, super_structure.get_masses_array())
29622965 else :
29632966 trans = np .abs (wr ) > CC .Phonons .__EPSILON_W__
29642967
@@ -3386,7 +3389,8 @@ def get_odd_realspace(self):
33863389 w_sc , pols_sc = super_dyn .DyagDinQ (0 )
33873390
33883391 # Remove translations
3389- no_trans_mask = ~ CC .Methods .get_translations (pols_sc , super_dyn .structure .get_masses_array ())
3392+ no_trans_mask = ~ super_dyn .structure .get_asr_modes (pols_sc )
3393+ # no_trans_mask = ~CC.Methods.get_translations(pols_sc, super_dyn.structure.get_masses_array())
33903394 w_sc = w_sc [no_trans_mask ]
33913395 pols_sc = pols_sc [:, no_trans_mask ]
33923396
@@ -3681,7 +3685,8 @@ def get_free_energy_hessian(self, include_v4 = False, get_full_hessian = True, v
36813685
36823686 # Get the translational modes
36833687 if not self .ignore_small_w :
3684- trans = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
3688+ trans = super_structure .get_asr_modes (pols )
3689+ # trans = CC.Methods.get_translations(pols, super_structure.get_masses_array())
36853690 else :
36863691 trans = np .abs (w ) < CC .Phonons .__EPSILON_W__
36873692
0 commit comments