@@ -1715,7 +1715,8 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17151715
17161716 # Exclude translations
17171717 if not self .ignore_small_w :
1718- trans_original = CC .Methods .get_translations (pols_original , super_struct0 .get_masses_array ())
1718+ trans_original = super_struct0 .get_asr_modes (pols_original )
1719+ # trans_original = CC.Methods.get_translations(pols_original, super_struct0.get_masses_array())
17191720 else :
17201721 trans_original = np .abs (w_original ) < CC .Phonons .__EPSILON_W__
17211722
@@ -1732,15 +1733,14 @@ def update_weights_fourier(self, new_dynamical_matrix, newT, timer=None):
17321733
17331734
17341735 if not self .ignore_small_w :
1735- trans_mask = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
1736+ trans_mask = super_structure .get_asr_modes (pols )
1737+ # trans_mask = CC.Methods.get_translations(pols, super_structure.get_masses_array())
17361738 else :
17371739 trans_mask = np .abs (w_new ) < CC .Phonons .__EPSILON_W__
17381740
17391741
17401742 # Check if the new dynamical matrix satisfies the sum rule
1741- violating_sum_rule = (np .sum (trans_mask .astype (int )) != 3 ) or (np .sum (trans_original .astype (int )) != 3 )
1742- if self .ignore_small_w :
1743- violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
1743+ violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
17441744
17451745
17461746 if violating_sum_rule :
@@ -1937,7 +1937,8 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19371937
19381938 # Exclude translations
19391939 if not self .ignore_small_w :
1940- trans_original = CC .Methods .get_translations (pols_original , super_struct0 .get_masses_array ())
1940+ trans_original = super_struct0 .get_asr_modes (pols_original )
1941+ # trans_original = CC.Methods.get_translations(pols_original, super_struct0.get_masses_array())
19411942 else :
19421943 trans_original = np .abs (w_original ) < CC .Phonons .__EPSILON_W__
19431944
@@ -1954,15 +1955,15 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19541955
19551956
19561957 if not self .ignore_small_w :
1957- trans_mask = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
1958+ trans_mask = super_structure .get_asr_modes (pols )
1959+ # trans_mask = CC.Methods.get_translations(pols, super_structure.get_masses_array())
19581960 else :
19591961 trans_mask = np .abs (w_new ) < CC .Phonons .__EPSILON_W__
19601962
19611963
19621964 # Check if the new dynamical matrix satisfies the sum rule
1963- violating_sum_rule = (np .sum (trans_mask .astype (int )) != 3 ) or (np .sum (trans_original .astype (int )) != 3 )
1964- if self .ignore_small_w :
1965- violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
1965+ # violating_sum_rule = (np.sum(trans_mask.astype(int)) != 3) or (np.sum(trans_original.astype(int)) != 3)
1966+ violating_sum_rule = np .sum (trans_mask .astype (int )) != np .sum (trans_original .astype (int ))
19661967
19671968
19681969 if violating_sum_rule :
@@ -1977,7 +1978,7 @@ def update_weights(self, new_dynamical_matrix, newT, update_q = False, timer=Non
19771978DETAILS OF ERROR:
19781979 Number of translatinal modes in the original dyn = {}
19791980 Number of translational modes in the target dyn = {}
1980- (They should be both 3 )
1981+ (They should be both be the same - 3 in bulk )
19811982""" .format (np .sum (trans_original .astype (int )), np .sum (trans_mask .astype (int )))
19821983
19831984 print (ERR_MSG )
@@ -2699,7 +2700,8 @@ def get_preconditioned_gradient(self, subtract_sscha = True, return_error = Fals
26992700 w , pols = self .current_dyn .DiagonalizeSupercell ()#supercell_dyn.DyagDinQ(0)
27002701
27012702 if not self .ignore_small_w :
2702- trans = CC .Methods .get_translations (pols , super_struct .get_masses_array ())
2703+ trans = super_struct .get_asr_modes (pols )
2704+ # trans = CC.Methods.get_translations(pols, super_struct.get_masses_array())
27032705 else :
27042706 trans = np .abs (w ) < CC .Phonons .__EPSILON_W__
27052707
@@ -2939,7 +2941,8 @@ def get_stress_tensor(self, offset_stress = None, use_spglib = False):
29392941 wr , pols = self .current_dyn .DiagonalizeSupercell ()
29402942
29412943 if not self .ignore_small_w :
2942- trans = ~ CC .Methods .get_translations (pols , super_structure .get_masses_array ())
2944+ trans = ~ super_structure .get_asr_modes (pols )
2945+ # trans = ~ CC.Methods.get_translations(pols, super_structure.get_masses_array())
29432946 else :
29442947 trans = np .abs (wr ) > CC .Phonons .__EPSILON_W__
29452948
@@ -3367,7 +3370,8 @@ def get_odd_realspace(self):
33673370 w_sc , pols_sc = super_dyn .DyagDinQ (0 )
33683371
33693372 # Remove translations
3370- no_trans_mask = ~ CC .Methods .get_translations (pols_sc , super_dyn .structure .get_masses_array ())
3373+ no_trans_mask = ~ super_dyn .structure .get_asr_modes (pols_sc )
3374+ # no_trans_mask = ~CC.Methods.get_translations(pols_sc, super_dyn.structure.get_masses_array())
33713375 w_sc = w_sc [no_trans_mask ]
33723376 pols_sc = pols_sc [:, no_trans_mask ]
33733377
@@ -3662,7 +3666,8 @@ def get_free_energy_hessian(self, include_v4 = False, get_full_hessian = True, v
36623666
36633667 # Get the translational modes
36643668 if not self .ignore_small_w :
3665- trans = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
3669+ trans = super_structure .get_asr_modes (pols )
3670+ # trans = CC.Methods.get_translations(pols, super_structure.get_masses_array())
36663671 else :
36673672 trans = np .abs (w ) < CC .Phonons .__EPSILON_W__
36683673
0 commit comments