@@ -31,6 +31,7 @@ def __init__(
31
31
supercell_matrix : np .ndarray = None ,
32
32
qpoints_mesh : np .ndarray = None ,
33
33
max_atoms : int = None ,
34
+ calc_spec : bool = True ,
34
35
):
35
36
"""_summary
36
37
@@ -51,6 +52,8 @@ def __init__(
51
52
max_atoms (int, optional): Maximum atoms number limitation for the
52
53
supercell generation. If not set, will automatic generate super
53
54
-cell based on symmetry. Defaults to None.
55
+ calc_spec (bool, optional): If calculate the spectrum and check
56
+ imaginary frequencies. Default to True.
54
57
"""
55
58
assert (
56
59
atoms .calc is not None
@@ -88,6 +91,7 @@ def __init__(
88
91
self .qpoints_mesh = qpoints_mesh
89
92
90
93
self .max_atoms = max_atoms
94
+ self .calc_spec = calc_spec
91
95
92
96
def compute_force_constants (self , atoms : Atoms , nrep_second : np .ndarray ):
93
97
"""
@@ -209,14 +213,18 @@ def run(self):
209
213
print ("Error while computing force constants:" , e )
210
214
raise
211
215
212
- try :
213
- # Calculate phonon spectrum
214
- self .compute_phonon_spectrum_dos (self .atoms , phonon , k_point_mesh )
215
- # check whether has imaginary frequency
216
- has_imaginary = self .check_imaginary_freq (phonon )
217
- except Exception as e :
218
- print ("Error while computing phonon spectrum and dos:" , e )
219
- raise
216
+ if self .calc_spec :
217
+ try :
218
+ # Calculate phonon spectrum
219
+ self .compute_phonon_spectrum_dos (self .atoms , phonon , k_point_mesh )
220
+ # check whether has imaginary frequency
221
+ has_imaginary = self .check_imaginary_freq (phonon )
222
+ except Exception as e :
223
+ print ("Error while computing phonon spectrum and dos:" , e )
224
+ raise
225
+ else :
226
+ has_imaginary = 'Not calculated, set calc_spec True'
227
+ phonon .save (settings = {"force_constants" : True })
220
228
221
229
except Exception as e :
222
230
print ("An error occurred during the Phonon workflow:" , e )
0 commit comments