13
13
from dptb .nn .sktb .builtin_skbasisDB import skbasisDB
14
14
from dptb .nn .sktb .builtin_skbasisDB import onsite_e_builtin_basis , occupations_builtin_basis , Hubbard_U_builtin_basis
15
15
import logging
16
+ import os
16
17
log = logging .getLogger (__name__ )
17
18
18
19
19
20
class DFT2SKTable (object ):
20
- def __init__ (self , xc : str , superposition : str = 'density' , scalarrel = True , ** kwargs ):
21
+ def __init__ (self , xc : str , superposition : str = 'density' , scalarrel : bool = True , output : str = './' , ** kwargs ):
21
22
'''This Python function initializes parameters for XC functional calculations, allowing for
22
23
customization of the functional, superposition scheme, and scalar relativistic corrections.
23
24
@@ -43,7 +44,10 @@ def __init__(self, xc: str, superposition: str = 'density', scalarrel=True, **kw
43
44
self .scalarrel = scalarrel
44
45
self .kwargs = kwargs
45
46
self .atomic_objs = {}
46
-
47
+ if not os .path .exists (output ):
48
+ os .makedirs (output )
49
+ self .output = output
50
+ self .out_filename_template = output + '/{el1}-{el2}.skf'
47
51
def update_config (self , basis :Dict [str , List ], rw : dict , pw :dict , rd :dict = None , pd :dict = None ):
48
52
atomic_symbols = list (basis .keys ())
49
53
# check basis
@@ -133,15 +137,16 @@ def get_skf_pair(self, atom_a:str, atom_b:str=None, rmin=0.4, dr=0.02, N = 800,
133
137
# Write the SK tables without repulsion (only electronic part)
134
138
# for homo-case, the atomic eigenvalues, Hubbardvalues, occupations are also saved
135
139
# but the spe as well as the (spin-polarization error) is set to 0.0.
136
-
140
+
137
141
if atom_a == atom_b :
138
142
self .off2c .write (eigenvalues = self .atomic_objs [atom_a ]['eigenvalues' ],
139
143
hubbardvalues = self .atomic_objs [atom_a ]['hubbardvalues' ],
140
144
occupations = self .atomic_objs [atom_a ]['occupations' ],
141
- spe = 0.
145
+ spe = 0. ,
146
+ filename_template = self .out_filename_template
142
147
)
143
148
else :
144
- self .off2c .write ()
149
+ self .off2c .write (filename_template = self . out_filename_template )
145
150
log .info (f'finished writing sk tables....' )
146
151
147
152
def get_full_pair (self , atom_a :str , atom_b :str = None , rmin = 0.4 , dr = 0.02 , N = 800 , stride = 1 ):
0 commit comments