@@ -296,10 +296,10 @@ def __init__(
296
296
self ,
297
297
mol ,
298
298
correlation_grid : dict [str , str ] | None = None ,
299
- Exc_DFT_option : dict [str , str ] | None = None ,
300
- COHSEX_options : dict [str , str ] | None = None ,
301
- GW_options : dict [str , str ] | None = None ,
302
- BSE_TDDFT_options : dict [str , str ] | None = None ,
299
+ exc_dft_option : dict [str , str ] | None = None ,
300
+ cohsex_options : dict [str , str ] | None = None ,
301
+ gw_options : dict [str , str ] | None = None ,
302
+ bse_tddft_options : dict [str , str ] | None = None ,
303
303
):
304
304
"""
305
305
:param mol: pymatgen mol
@@ -311,8 +311,8 @@ def __init__(
311
311
"""
312
312
self ._mol = mol
313
313
self .correlation_grid = correlation_grid or {"dE_grid" : "0.500" , "n_grid" : "14" }
314
- self .Exc_DFT_option = Exc_DFT_option or {"rdVxcpsi" : "1" }
315
- self .COHSEX_options = COHSEX_options or {
314
+ self .Exc_DFT_option = exc_dft_option or {"rdVxcpsi" : "1" }
315
+ self .cohsex_options = cohsex_options or {
316
316
"eigMethod" : "C" ,
317
317
"mix_cohsex" : "0.500" ,
318
318
"nc_cohsex" : "0" ,
@@ -321,8 +321,8 @@ def __init__(
321
321
"resMethod" : "V" ,
322
322
"scf_cohsex_wf" : "0" ,
323
323
}
324
- self .GW_options = GW_options or {"nc_corr" : "10" , "nit_gw" : "3" , "nv_corr" : "10" }
325
- self .BSE_TDDFT_options = BSE_TDDFT_options or {
324
+ self .GW_options = gw_options or {"nc_corr" : "10" , "nit_gw" : "3" , "nv_corr" : "10" }
325
+ self .bse_tddft_options = bse_tddft_options or {
326
326
"do_bse" : "1" ,
327
327
"do_tddft" : "0" ,
328
328
"nc_bse" : "382" ,
@@ -343,7 +343,7 @@ def set_auxiliary_basis_set(self, folder, auxiliary_folder, auxiliary_basis_set_
343
343
for specie in self ._mol .symbol_set :
344
344
for file in list_files :
345
345
if file .upper ().find (specie .upper () + "2" ) != - 1 and file .lower ().find (auxiliary_basis_set_type ) != - 1 :
346
- shutil .copyfile (auxiliary_folder + "/" + file , folder + "/" + specie + " 2.ion" )
346
+ shutil .copyfile (f" { auxiliary_folder } / { file } " , f" { folder } / { specie } 2.ion" )
347
347
348
348
def set_gw_options (self , nv_band = 10 , nc_band = 10 , n_iteration = 5 , n_grid = 6 , dE_grid = 0.5 ):
349
349
"""
@@ -359,10 +359,10 @@ def set_gw_options(self, nv_band=10, nc_band=10, n_iteration=5, n_grid=6, dE_gri
359
359
@staticmethod
360
360
def make_full_bse_densities_folder (folder ):
361
361
"""Mkdir "FULL_BSE_Densities" folder (needed for bse run) in the desired folder."""
362
- if os .path .exists (folder + " /FULL_BSE_Densities" ):
362
+ if os .path .exists (f" { folder } /FULL_BSE_Densities" ):
363
363
return "FULL_BSE_Densities folder already exists"
364
364
365
- os .makedirs (folder + " /FULL_BSE_Densities" )
365
+ os .makedirs (f" { folder } /FULL_BSE_Densities" )
366
366
return "makedirs FULL_BSE_Densities folder"
367
367
368
368
def set_bse_options (self , n_excitations = 10 , nit_bse = 200 ):
@@ -373,7 +373,7 @@ def set_bse_options(self, n_excitations=10, nit_bse=200):
373
373
:param n_excitations: number of excitations
374
374
:param nit_bse: number of iterations.
375
375
"""
376
- self .BSE_TDDFT_options .update (npsi_bse = n_excitations , nit_bse = nit_bse )
376
+ self .bse_tddft_options .update (npsi_bse = n_excitations , nit_bse = nit_bse )
377
377
378
378
def dump_bse_data_in_gw_run (self , BSE_dump = True ):
379
379
"""
@@ -383,77 +383,70 @@ def dump_bse_data_in_gw_run(self, BSE_dump=True):
383
383
set the "do_bse" variable to one in cell.in
384
384
"""
385
385
if BSE_dump :
386
- self .BSE_TDDFT_options .update (do_bse = 1 , do_tddft = 0 )
386
+ self .bse_tddft_options .update (do_bse = 1 , do_tddft = 0 )
387
387
else :
388
- self .BSE_TDDFT_options .update (do_bse = 0 , do_tddft = 0 )
388
+ self .bse_tddft_options .update (do_bse = 0 , do_tddft = 0 )
389
389
390
- def dump_TDDFT_data_in_GW_run (self , TDDFT_dump = True ):
390
+ def dump_tddft_data_in_gw_run (self , tddft_dump = True ):
391
391
"""
392
392
:param TDDFT_dump: boolean
393
393
394
394
Returns:
395
395
set the do_tddft variable to one in cell.in
396
396
"""
397
- if TDDFT_dump :
398
- self .BSE_TDDFT_options .update (do_bse = 0 , do_tddft = 1 )
399
- else :
400
- self .BSE_TDDFT_options .update (do_bse = 0 , do_tddft = 0 )
397
+ self .bse_tddft_options .update (do_bse = 0 , do_tddft = 1 if tddft_dump else 0 )
401
398
402
399
@property
403
400
def infos_on_system (self ):
404
401
"""Returns infos on initial parameters as in the log file of Fiesta."""
405
- o = []
406
- o .append ("=========================================" )
407
- o .append ("Reading infos on system:" )
408
- o .append ("" )
409
- o .append (
410
- f" Number of atoms = { self ._mol .composition .num_atoms } ; number of species = { len (self ._mol .symbol_set )} "
411
- )
412
- o .append (f" Number of valence bands = { int (self ._mol .nelectrons / 2 )} " )
413
- o .append (
402
+ lst = [
403
+ "=========================================" ,
404
+ "Reading infos on system:" ,
405
+ "" ,
406
+ f" Number of atoms = { self ._mol .composition .num_atoms } ; number of species = { len (self ._mol .symbol_set )} " ,
407
+ f" Number of valence bands = { int (self ._mol .nelectrons / 2 )} " ,
414
408
f" Sigma grid specs: n_grid = { self .correlation_grid ['n_grid' ]} ; "
415
- f"dE_grid = { self .correlation_grid ['dE_grid' ]} (eV)"
416
- )
409
+ f"dE_grid = { self .correlation_grid ['dE_grid' ]} (eV)" ,
410
+ ]
417
411
if int (self .Exc_DFT_option ["rdVxcpsi" ]) == 1 :
418
- o .append (" Exchange and correlation energy read from Vxcpsi.mat" )
412
+ lst .append (" Exchange and correlation energy read from Vxcpsi.mat" )
419
413
elif int (self .Exc_DFT_option ["rdVxcpsi" ]) == 0 :
420
- o .append (" Exchange and correlation energy re-computed" )
421
-
422
- if self .COHSEX_options ["eigMethod" ] == "C" :
423
- o . append (
424
- f" Correcting { self .COHSEX_options ['nv_cohsex' ]} valence bands and "
425
- f"{ self .COHSEX_options ['nc_cohsex' ]} conduction bands at COHSEX level"
426
- )
427
- o . append ( f" Performing { self . COHSEX_options [ 'nit_cohsex' ] } diagonal COHSEX iterations" )
428
- elif self .COHSEX_options ["eigMethod" ] == "HF" :
429
- o . append (
430
- f" Correcting { self .COHSEX_options ['nv_cohsex' ]} valence bands and "
431
- f"{ self .COHSEX_options ['nc_cohsex' ]} conduction bands at HF level"
432
- )
433
- o . append ( f" Performing { self . COHSEX_options [ 'nit_cohsex' ] } diagonal HF iterations" )
434
-
435
- o . append ( f" Using resolution of identity : { self . COHSEX_options [ 'resMethod' ] } " )
436
- o . append (
414
+ lst .append (" Exchange and correlation energy re-computed" )
415
+
416
+ if self .cohsex_options ["eigMethod" ] == "C" :
417
+ lst += [
418
+ f" Correcting { self .cohsex_options ['nv_cohsex' ]} valence bands and "
419
+ f"{ self .cohsex_options ['nc_cohsex' ]} conduction bands at COHSEX level" ,
420
+ f" Performing { self . cohsex_options [ 'nit_cohsex' ] } diagonal COHSEX iterations" ,
421
+ ]
422
+ elif self .cohsex_options ["eigMethod" ] == "HF" :
423
+ lst += [
424
+ f" Correcting { self .cohsex_options ['nv_cohsex' ]} valence bands and "
425
+ f"{ self .cohsex_options ['nc_cohsex' ]} conduction bands at HF level" ,
426
+ f" Performing { self . cohsex_options [ 'nit_cohsex' ] } diagonal HF iterations" ,
427
+ ]
428
+
429
+ lst += [
430
+ f" Using resolution of identity : { self . cohsex_options [ 'resMethod' ] } " ,
437
431
f" Correcting { self .GW_options ['nv_corr' ]} valence bands and "
438
- f"{ self .GW_options ['nc_corr' ]} conduction bands at GW level"
439
- )
440
- o . append ( f" Performing { self . GW_options [ 'nit_gw' ] } GW iterations" )
432
+ f"{ self .GW_options ['nc_corr' ]} conduction bands at GW level" ,
433
+ f" Performing { self . GW_options [ 'nit_gw' ] } GW iterations" ,
434
+ ]
441
435
442
- if int (self .BSE_TDDFT_options ["do_bse" ]) == 1 :
443
- o .append (" Dumping data for BSE treatment" )
436
+ if int (self .bse_tddft_options ["do_bse" ]) == 1 :
437
+ lst .append (" Dumping data for BSE treatment" )
444
438
445
- if int (self .BSE_TDDFT_options ["do_tddft" ]) == 1 :
446
- o .append (" Dumping data for TD-DFT treatment" )
447
- o .append ("" )
448
- o .append (" Atoms in cell cartesian A:" )
439
+ if int (self .bse_tddft_options ["do_tddft" ]) == 1 :
440
+ lst .append (" Dumping data for TD-DFT treatment" )
441
+ lst .extend (("" , " Atoms in cell cartesian A:" ))
449
442
symbols = list (self ._mol .symbol_set )
450
443
451
444
for site in self ._mol :
452
- o .append (f" { site .x } { site .y } { site .z } { int (symbols .index (site .specie .symbol )) + 1 } " )
445
+ lst .append (f" { site .x } { site .y } { site .z } { int (symbols .index (site .specie .symbol )) + 1 } " )
453
446
454
- o .append ("=========================================" )
447
+ lst .append ("=========================================" )
455
448
456
- return str (o )
449
+ return str (lst )
457
450
458
451
@property
459
452
def molecule (self ):
@@ -506,22 +499,22 @@ def __str__(self):
506
499
n_grid = self .correlation_grid ["n_grid" ],
507
500
dE_grid = self .correlation_grid ["dE_grid" ],
508
501
rdVxcpsi = self .Exc_DFT_option ["rdVxcpsi" ],
509
- nv_cohsex = self .COHSEX_options ["nv_cohsex" ],
510
- nc_cohsex = self .COHSEX_options ["nc_cohsex" ],
511
- eigMethod = self .COHSEX_options ["eigMethod" ],
512
- nit_cohsex = self .COHSEX_options ["nit_cohsex" ],
513
- resMethod = self .COHSEX_options ["resMethod" ],
514
- scf_cohsex_wf = self .COHSEX_options ["scf_cohsex_wf" ],
515
- mix_cohsex = self .COHSEX_options ["mix_cohsex" ],
502
+ nv_cohsex = self .cohsex_options ["nv_cohsex" ],
503
+ nc_cohsex = self .cohsex_options ["nc_cohsex" ],
504
+ eigMethod = self .cohsex_options ["eigMethod" ],
505
+ nit_cohsex = self .cohsex_options ["nit_cohsex" ],
506
+ resMethod = self .cohsex_options ["resMethod" ],
507
+ scf_cohsex_wf = self .cohsex_options ["scf_cohsex_wf" ],
508
+ mix_cohsex = self .cohsex_options ["mix_cohsex" ],
516
509
nv_corr = self .GW_options ["nv_corr" ],
517
510
nc_corr = self .GW_options ["nc_corr" ],
518
511
nit_gw = self .GW_options ["nit_gw" ],
519
- do_bse = self .BSE_TDDFT_options ["do_bse" ],
520
- do_tddft = self .BSE_TDDFT_options ["do_tddft" ],
521
- nv_bse = self .BSE_TDDFT_options ["nv_bse" ],
522
- nc_bse = self .BSE_TDDFT_options ["nc_bse" ],
523
- npsi_bse = self .BSE_TDDFT_options ["npsi_bse" ],
524
- nit_bse = self .BSE_TDDFT_options ["nit_bse" ],
512
+ do_bse = self .bse_tddft_options ["do_bse" ],
513
+ do_tddft = self .bse_tddft_options ["do_tddft" ],
514
+ nv_bse = self .bse_tddft_options ["nv_bse" ],
515
+ nc_bse = self .bse_tddft_options ["nc_bse" ],
516
+ npsi_bse = self .bse_tddft_options ["npsi_bse" ],
517
+ nit_bse = self .bse_tddft_options ["nit_bse" ],
525
518
symbols = "\n " .join (symbols ),
526
519
geometry = "\n " .join (geometry ),
527
520
)
@@ -540,9 +533,9 @@ def as_dict(self):
540
533
"mol" : self ._mol .as_dict (),
541
534
"correlation_grid" : self .correlation_grid ,
542
535
"Exc_DFT_option" : self .Exc_DFT_option ,
543
- "COHSEX_options" : self .COHSEX_options ,
536
+ "COHSEX_options" : self .cohsex_options ,
544
537
"GW_options" : self .GW_options ,
545
- "BSE_TDDFT_options" : self .BSE_TDDFT_options ,
538
+ "BSE_TDDFT_options" : self .bse_tddft_options ,
546
539
}
547
540
548
541
@classmethod
@@ -696,10 +689,10 @@ def from_str(cls, string_input):
696
689
return FiestaInput (
697
690
mol = mol ,
698
691
correlation_grid = correlation_grid ,
699
- Exc_DFT_option = Exc_DFT_option ,
700
- COHSEX_options = COHSEX_options ,
701
- GW_options = GW_options ,
702
- BSE_TDDFT_options = BSE_TDDFT_options ,
692
+ exc_dft_option = Exc_DFT_option ,
693
+ cohsex_options = COHSEX_options ,
694
+ gw_options = GW_options ,
695
+ bse_tddft_options = BSE_TDDFT_options ,
703
696
)
704
697
705
698
@classmethod
0 commit comments