Révision 7d37379d
b/modules/dos_input.py | ||
---|---|---|
159 | 159 |
return True |
160 | 160 |
|
161 | 161 |
|
162 |
def check_inp_files(inp_files, code, potcar_dir): |
|
162 |
def check_inp_files(inp_files, code, potcar_dir=None):
|
|
163 | 163 |
if code == 'cp2k': |
164 | 164 |
from pycp2k import CP2K |
165 | 165 |
if not isinstance(inp_files, str): |
... | ... | |
403 | 403 |
|
404 | 404 |
# Isolated |
405 | 405 |
|
406 |
def get_isol_inp_file(code, potcar_dir): # TODO allow spaces in path names |
|
406 |
def get_isol_inp_file(code, potcar_dir=None): # TODO allow spaces in path names
|
|
407 | 407 |
inp_file_lst = dos_inp.get('Isolated', 'isol_inp_file').split() |
408 | 408 |
check_inp_files(inp_file_lst[0] if len(inp_file_lst) == 1 else inp_file_lst, |
409 | 409 |
code, potcar_dir) |
... | ... | |
440 | 440 |
|
441 | 441 |
# Screening |
442 | 442 |
|
443 |
def get_screen_inp_file(code, potcar_dir): # TODO allow spaces in path names |
|
443 |
def get_screen_inp_file(code, |
|
444 |
potcar_dir=None): # TODO allow spaces in path names |
|
444 | 445 |
inp_file_lst = dos_inp.get('Screening', 'screen_inp_file').split() |
445 | 446 |
check_inp_files(inp_file_lst[0] if len(inp_file_lst) == 1 else inp_file_lst, |
446 | 447 |
code, potcar_dir) |
... | ... | |
731 | 732 |
|
732 | 733 |
def get_H_donor(spec_atoms): |
733 | 734 |
from ase.data import chemical_symbols |
734 |
err_msg = "The value of 'h_donor' must be either False, a chemical symbol "\ |
|
735 |
err_msg = "The value of 'h_donor' must be either False, a chemical symbol " \
|
|
735 | 736 |
"or an atom index" |
736 | 737 |
h_donor_str = dos_inp.get('Screening', 'h_donor', fallback="False") |
737 | 738 |
h_donor = [] |
... | ... | |
793 | 794 |
|
794 | 795 |
# Refinement |
795 | 796 |
|
796 |
def get_refine_inp_file(code, potcar_dir): |
|
797 |
def get_refine_inp_file(code, potcar_dir=None):
|
|
797 | 798 |
inp_file_lst = dos_inp.get('Refinement', 'refine_inp_file').split() |
798 | 799 |
check_inp_files(inp_file_lst[0] if len(inp_file_lst) == 1 else inp_file_lst, |
799 | 800 |
code, potcar_dir) |
... | ... | |
887 | 888 |
if not dos_inp.has_option('Isolated', opt): |
888 | 889 |
logger.error(no_opt_err % (opt, 'Isolated')) |
889 | 890 |
raise NoOptionError(opt, 'Isolated') |
890 |
inp_vars['isol_inp_file'] = get_isol_inp_file(inp_vars['code'], |
|
891 |
inp_vars['potcar_dir']) |
|
891 |
if 'potcar_dir' in inp_vars: |
|
892 |
inp_vars['isol_inp_file'] = get_isol_inp_file(inp_vars['code'], |
|
893 |
inp_vars[ |
|
894 |
'potcar_dir']) |
|
895 |
else: |
|
896 |
inp_vars['isol_inp_file'] = get_isol_inp_file(inp_vars['code']) |
|
892 | 897 |
inp_vars['molec_file'] = get_molec_file() |
893 | 898 |
|
894 | 899 |
# Checks for PBC |
... | ... | |
930 | 935 |
if not dos_inp.has_option('Screening', opt): |
931 | 936 |
logger.error(no_opt_err % (opt, 'Screening')) |
932 | 937 |
raise NoOptionError(opt, 'Screening') |
933 |
inp_vars['screen_inp_file'] = get_screen_inp_file(inp_vars['code'], |
|
934 |
inp_vars[ |
|
935 |
'potcar_dir']) |
|
938 |
if 'potcar_dir' in inp_vars: |
|
939 |
inp_vars['screen_inp_file'] = get_screen_inp_file(inp_vars['code'], |
|
940 |
inp_vars[ |
|
941 |
'potcar_dir']) |
|
942 |
else: |
|
943 |
inp_vars['screen_inp_file'] = get_screen_inp_file(inp_vars['code']) |
|
936 | 944 |
inp_vars['surf_file'] = get_surf_file() |
937 | 945 |
inp_vars['sites'] = get_sites() |
938 | 946 |
inp_vars['molec_ctrs'] = get_molec_ctrs() |
... | ... | |
1017 | 1025 |
if not dos_inp.has_option('Refinement', opt): |
1018 | 1026 |
logger.error(no_opt_err % (opt, 'Refinement')) |
1019 | 1027 |
raise NoOptionError(opt, 'Refinement') |
1020 |
inp_vars['refine_inp_file'] = get_refine_inp_file(inp_vars['code'], |
|
1021 |
inp_vars[ |
|
1022 |
'potcar_dir']) |
|
1028 |
if 'potcar_dir' in inp_vars: |
|
1029 |
inp_vars['refine_inp_file'] = get_refine_inp_file(inp_vars['code'], |
|
1030 |
inp_vars[ |
|
1031 |
'potcar_dir']) |
|
1032 |
else: |
|
1033 |
inp_vars['refine_inp_file'] = get_refine_inp_file(inp_vars['code']) |
|
1023 | 1034 |
|
1024 | 1035 |
# Facultative options (Default value present) |
1025 | 1036 |
inp_vars['energy_cutoff'] = get_energy_cutoff() |
Formats disponibles : Unified diff