Skip to content

Commit 8cf3d2a

Browse files
committed
Speedup of the spglib symmetrization
1 parent 1df534c commit 8cf3d2a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Modules/SchaMinimizer.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def minimization_step(self, custom_function_gradient = None):
353353
#CC.symmetries.CustomASR(err)
354354
else:
355355
# We have a supercell, we must generate the dynamical matrix in the supercell
356+
t_5 = time.time()
356357
super_structure = self.dyn.structure.generate_supercell(supercell)
357358
fc_supercell = CC.Phonons.GetSupercellFCFromDyn(dyn_grad, np.array(self.dyn.q_tot), \
358359
self.dyn.structure, super_structure)
@@ -361,12 +362,21 @@ def minimization_step(self, custom_function_gradient = None):
361362
qe_sym_supcell = CC.symmetries.QE_Symmetry(super_structure)
362363
qe_sym_supcell.SetupFromSPGLIB()
363364

365+
t_6 = time.time()
366+
364367
# Apply the symmetries to the fc_supercell matrix
365368
qe_sym_supcell.ApplySymmetriesToV2(fc_supercell)
366369

370+
t_7 = time.time()
367371
# Convert back to Q space
368-
dyn_grad = CC.Phonons.GetDynQFromFCSupercell(fc_supercell, np.array(self.dyn.q_tot), \
372+
dyn_grad = CC.Phonons.GetDynQFromFCSupercell_parallel(fc_supercell, np.array(self.dyn.q_tot), \
369373
self.dyn.structure, super_structure)
374+
375+
t_8 = time.time()
376+
377+
print(' [symmetrization] Time to prepare the suprecell dyn : {:.6f} s'.format(t_6 - t_5))
378+
print(' [symmetrization] Time to symmetrize in the supercell : {:.6f} s'.format(t_7 - t_6))
379+
print(' [symmetrization] Time to return in fourier space : {:.6f} s'.format(t_8 - t_7))
370380

371381
# Apply the sum rule at gamma
372382
CC.symmetries.CustomASR(dyn_grad[0,:,:])

0 commit comments

Comments
 (0)