@@ -252,19 +252,6 @@ def __init__(self, dyn0, T0, supercell = None, **kwargs):
252252 # A flag that memorize if the ensemble has also the stresses
253253 self .has_stress = True
254254
255- # Store data for calculations of 3FC elements:
256- self .a = np .zeros ( (Nsc * 3 ), dtype = np .double )
257- self .new_pol = np .zeros ( (Nsc , Nsc * 3 , 3 ), dtype = np .double )
258- # If the element is sym:
259- self .ur = np .zeros ( (self .N , Nsc * 3 ))
260- self .upsilon = np .zeros ( (Nsc * 3 , Nsc * 3 ))
261- # Symmetry data for sym 3FC:
262- self .nsym = 0
263- self .s_cart = np .zeros ( (3 , 3 , 48 ) , dtype = np .float64 , order = "F" )
264- self .s_inv_cart = np .zeros ( (3 , 3 , 48 ) , dtype = np .float64 , order = "F" )
265- self .irt = np .zeros ( (48 , Nsc ), dtype = np .intc , order = "F" )
266- self .translations_irt = np .zeros ( (Nsc , np .prod (self .supercell )), dtype = np .intc , order = "F" )
267-
268255 # A flag for each configuration that check if it possess a force and a stress
269256 self .force_computed = None
270257 self .stress_computed = None
@@ -3911,6 +3898,17 @@ def get_free_energy_hessian_dev(self, include_v4 = False, do_scf = True, eps = 1
39113898 nat_sc = int (np .shape (pols )[0 ] / 3 )
39123899 nat = self .dyn_0 .structure .N_atoms
39133900
3901+ a = np .zeros ( (nat_sc * 3 ), dtype = np .double )
3902+ new_pol = np .zeros ( (nat_sc , nat_sc * 3 , 3 ), dtype = np .double )
3903+ # If the element is sym:
3904+ ur = np .zeros ( (self .N , nat_sc * 3 ))
3905+ upsilon = np .zeros ( (nat_sc * 3 , nat_sc * 3 ))
3906+ # Symmetry data for sym 3FC:
3907+ s_cart = np .zeros ( (3 , 3 , 48 ) , dtype = np .float64 , order = "F" )
3908+ s_inv_cart = np .zeros ( (3 , 3 , 48 ) , dtype = np .float64 , order = "F" )
3909+ irt = np .zeros ( (48 , nat_sc ), dtype = np .intc , order = "F" )
3910+ translations_irt = np .zeros ( (nat_sc , np .prod (self .supercell )), dtype = np .intc , order = "F" )
3911+
39143912 # Get the translational modes
39153913 if not self .ignore_small_w :
39163914 trans = CC .Methods .get_translations (pols , super_structure .get_masses_array ())
@@ -3933,25 +3931,25 @@ def get_free_energy_hessian_dev(self, include_v4 = False, do_scf = True, eps = 1
39333931 u = self .u_disps .reshape ((self .N , nat_sc , 3 ), order = "C" ) #/ Bohr
39343932
39353933 log_err = "err_yesrho"
3936- self . a = SCHAModules .thermodynamic .w_to_a (w , self .current_T )
3934+ a = SCHAModules .thermodynamic .w_to_a (w , self .current_T )
39373935 # Get the polarization vectors in the correct format
39383936 for i in range (nat_sc ):
39393937 for j in range (n_modes ):
3940- self . new_pol [i , j , :] = pols [3 * i : 3 * (i + 1 ), j ]
3938+ new_pol [i , j , :] = pols [3 * i : 3 * (i + 1 ), j ]
39413939
39423940 #Calculating rotated displacements and upsilon matrix"
3943- self . ur , self . upsilon = SCHAModules .get_ur_upsilon_matrices (self . a , self . new_pol , trans , amass , ityp , u )
3941+ ur , upsilon = SCHAModules .get_ur_upsilon_matrices (a , new_pol , trans , amass , ityp , u )
39443942 #Obtaining symmetry data
39453943 qe_sym = CC .symmetries .QE_Symmetry (super_structure )
39463944 qe_sym .SetupFromSPGLIB ()
39473945
39483946 # SpaceGroup symmetries data
3949- self . nsym , self . s_cart , self . s_inv_cart , self . irt = qe_sym . QE_nsym , qe_sym .QE_s_cart , qe_sym .QE_s_inv_cart , qe_sym .QE_irt
3950- self . s_cart = np .asfortranarray (self . s_cart )
3951- self . s_inv_cart = np .asfortranarray (self . s_inv_cart )
3947+ s_cart , s_inv_cart , irt = qe_sym .QE_s_cart , qe_sym .QE_s_inv_cart , qe_sym .QE_irt
3948+ s_cart = np .asfortranarray (s_cart )
3949+ s_inv_cart = np .asfortranarray (s_inv_cart )
39523950
39533951 #Translations
3954- self . translations_irt = qe_sym .QE_translations_irt
3952+ translations_irt = qe_sym .QE_translations_irt
39553953 #self.prepare_sym_third_fc = False
39563954
39573955 wq = np .empty (nat * 3 , dtype = np .float64 )
@@ -4048,7 +4046,7 @@ def get_free_energy_hessian_dev(self, include_v4 = False, do_scf = True, eps = 1
40484046 nat = self .current_dyn .structure .N_atoms
40494047 n_modes = self .current_dyn .structure .N_atoms * mod [0 ]* mod [1 ]* mod [2 ]* 3
40504048
4051- ref_3fc = SCHAModules .module_hess .get_ref3fc (nat , orbit3a , indep_3fc_elem , n_indep_3fc_elem , kernel_3fc , rot_3fc , self . ur , self . upsilon , f , self .rho , log_err , self . s_inv_cart , self . irt , self . translations_irt , True )
4049+ ref_3fc = SCHAModules .module_hess .get_ref3fc (nat , orbit3a , indep_3fc_elem , n_indep_3fc_elem , kernel_3fc , rot_3fc , ur , upsilon , f , self .rho , log_err , s_inv_cart , irt , translations_irt , True )
40524050
40534051 vs_red = np .empty ([nrefq2 ,nat * 3 ,nat * 3 ,nat * 3 ], dtype = np .complex128 )
40544052 vs_red = SCHAModules .module_hess .get_ref_vsq (refq2 ,trs_l ,rot_3fc ,ref_3fc ,mapping_triplet ,True )
@@ -4060,15 +4058,15 @@ def get_free_energy_hessian_dev(self, include_v4 = False, do_scf = True, eps = 1
40604058
40614059 orbit4t , orbit4o , norbit_4 , indep_4fc_elem , n_indep_4fc_elem , kernel_4fc , rot_4fc , mapping_quadruplet = Classify .recognize_quadruplet (self .current_dyn , mapping , map_uc , verbose )
40624060
4063- ref_4fc = SCHAModules .module_hess .get_ref4fc (orbit4t , indep_4fc_elem , n_indep_4fc_elem , kernel_4fc , rot_4fc , self . ur , self . upsilon , f , self .rho , log_err , self . s_inv_cart , self . irt , self . translations_irt , True )
4061+ ref_4fc = SCHAModules .module_hess .get_ref4fc (orbit4t , indep_4fc_elem , n_indep_4fc_elem , kernel_4fc , rot_4fc , ur , upsilon , f , self .rho , log_err , s_inv_cart , irt , translations_irt , True )
40644062
40654063 ws_red = np .zeros ([nrefq4 ,nat * 3 ,nat * 3 ,nat * 3 ,nat * 3 ], dtype = np .complex128 )
40664064 ws_red = SCHAModules .module_hess .get_ref_wsq (refq4 ,trs_l ,rot_4fc ,ref_4fc ,mapping_quadruplet ,True )
40674065
40684066 degs = qClassify .find_degeneracies (trs_wq )
40694067 Pmn = qClassify .construct_Pmn (mapping , orbitq1a , orbitq1s , trs_polvecs , rot_cart )
40704068
4071- v_red , ref_3fc = SCHAModules .module_hess .get_v3_red (nat , norbit3 , orbit3a , orbit3s , indep_3fc_elem , n_indep_3fc_elem , kernel_3fc , rot_3fc , self . ur , self . upsilon , f , self .rho , log_err , self . s_inv_cart , self . irt , self . translations_irt )
4069+ v_red , ref_3fc = SCHAModules .module_hess .get_v3_red (nat , norbit3 , orbit3a , orbit3s , indep_3fc_elem , n_indep_3fc_elem , kernel_3fc , rot_3fc , ur , upsilon , f , self .rho , log_err , s_inv_cart , irt , translations_irt )
40724070 vs = SCHAModules .module_hess .get_all_vsq (trs_l , v_red , map_uc )
40734071
40744072 if do_scf :
@@ -4089,7 +4087,7 @@ def get_free_energy_hessian_dev(self, include_v4 = False, do_scf = True, eps = 1
40894087 for r in range (nr ):
40904088 # Translated Single atomic-cartesian index
40914089 # Fortran to Py: -1
4092- phi_sc_odd [3 * (self . translations_irt [nat1 ,r ]- 1 )+ alpha , 3 * (self . translations_irt [nat2 ,r ]- 1 )+ beta ] = fc9 [index ]
4090+ phi_sc_odd [3 * (translations_irt [nat1 ,r ]- 1 )+ alpha , 3 * (translations_irt [nat2 ,r ]- 1 )+ beta ] = fc9 [index ]
40934091 dynq_odd = CC .Phonons .GetDynQFromFCSupercell (phi_sc_odd , np .array (self .current_dyn .q_tot ),
40944092 self .current_dyn .structure , super_structure )
40954093 self .convert_units (UNITS_DEFAULT )
0 commit comments