@@ -64,54 +64,6 @@ def _download_extract_pseudo_archive(func):
6464 tarfil .extractall (target_dir )
6565
6666
67- url = f"{ base_url } "
68- for func in functionals :
69- target_dir = f"{ head_path } /{ dir_header } /{ func } "
70- os .makedirs (target_dir , exist_ok = True )
71- archive_filename = f"{ func } _ch_pseudos.tgz"
72- archive_found = False
73- for entry in os .listdir (target_dir ):
74- if entry == archive_filename :
75- archive_found = True
76- if not archive_found :
77- _download_extract_pseudo_archive (func )
78-
79-
80- # Check all the pseudos/core-wfc data files in the TOC dictionary
81- # and load/check all of them before proceeding. Note that this
82- # approach relies on there not being multiple instances of nodes
83- # with the same label.
84- for func in functionals :
85- gipaw_pseudo_dict = pseudo_data_dict [func ]["gipaw_pseudos" ]
86- core_wfc_dict = pseudo_data_dict [func ]["core_wavefunction_data" ]
87- core_hole_pseudo_dict = pseudo_data_dict [func ]["core_hole_pseudos" ]
88- main_path = f"{ head_path } /{ dir_header } /{ func } "
89- core_wfc_dir = f"{ main_path } /core_wfc_data"
90- gipaw_dir = f"{ main_path } /gipaw_pseudos"
91- ch_pseudo_dir = f"{ main_path } /ch_pseudos/star1s"
92- # First, check that the local directories contain what's in the pseudo_toc
93- for pseudo_dir , pseudo_dict in zip (
94- [gipaw_dir , core_wfc_dir , ch_pseudo_dir ],
95- [gipaw_pseudo_dict , core_wfc_dict , core_hole_pseudo_dict ],
96- ):
97- pseudo_toc_mismatch = os .listdir (pseudo_dir ) != pseudo_dict .values ()
98-
99- # Re-download the relevant archive if there is a mismatch
100- if pseudo_toc_mismatch :
101- _download_extract_pseudo_archive (func )
102-
103- _load_or_import_nodes_from_filenames (
104- in_dict = gipaw_pseudo_dict ,
105- path = gipaw_dir ,
106- )
107- _load_or_import_nodes_from_filenames (
108- in_dict = core_wfc_dict , path = core_wfc_dir , core_wfc_data = True
109- )
110- _load_or_import_nodes_from_filenames (
111- in_dict = core_hole_pseudo_dict ["1s" ], path = ch_pseudo_dir
112- )
113-
114-
11567class Setting (Panel ):
11668 title = "XAS Settings"
11769 identifier = "xas"
@@ -260,6 +212,51 @@ def set_panel_value(self, input_dict):
260212 def _update_structure (self , _ = None ):
261213 self ._update_element_select_panel ()
262214
215+ for func in functionals :
216+ target_dir = f"{ head_path } /{ dir_header } /{ func } "
217+ os .makedirs (target_dir , exist_ok = True )
218+ archive_filename = f"{ func } _ch_pseudos.tgz"
219+ archive_found = False
220+ for entry in os .listdir (target_dir ):
221+ if entry == archive_filename :
222+ archive_found = True
223+ if not archive_found :
224+ _download_extract_pseudo_archive (func )
225+
226+ # Check all the pseudos/core-wfc data files in the TOC dictionary
227+ # and load/check all of them before proceeding. Note that this
228+ # approach relies on there not being multiple instances of nodes
229+ # with the same label.
230+ for func in functionals :
231+ gipaw_pseudo_dict = pseudo_data_dict [func ]["gipaw_pseudos" ]
232+ core_wfc_dict = pseudo_data_dict [func ]["core_wavefunction_data" ]
233+ core_hole_pseudo_dict = pseudo_data_dict [func ]["core_hole_pseudos" ]
234+ main_path = f"{ head_path } /{ dir_header } /{ func } "
235+ core_wfc_dir = f"{ main_path } /core_wfc_data"
236+ gipaw_dir = f"{ main_path } /gipaw_pseudos"
237+ ch_pseudo_dir = f"{ main_path } /ch_pseudos/star1s"
238+ # First, check that the local directories contain what's in the pseudo_toc
239+ for pseudo_dir , pseudo_dict in zip (
240+ [gipaw_dir , core_wfc_dir , ch_pseudo_dir ],
241+ [gipaw_pseudo_dict , core_wfc_dict , core_hole_pseudo_dict ],
242+ ):
243+ pseudo_toc_mismatch = os .listdir (pseudo_dir ) != pseudo_dict .values ()
244+
245+ # Re-download the relevant archive if there is a mismatch
246+ if pseudo_toc_mismatch :
247+ _download_extract_pseudo_archive (func )
248+
249+ _load_or_import_nodes_from_filenames (
250+ in_dict = gipaw_pseudo_dict ,
251+ path = gipaw_dir ,
252+ )
253+ _load_or_import_nodes_from_filenames (
254+ in_dict = core_wfc_dict , path = core_wfc_dir , core_wfc_data = True
255+ )
256+ _load_or_import_nodes_from_filenames (
257+ in_dict = core_hole_pseudo_dict ["1s" ], path = ch_pseudo_dir
258+ )
259+
263260 def _update_element_select_panel (self ):
264261 if self .input_structure is None :
265262 return
0 commit comments