pySIMSalabim 1.2__tar.gz → 1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pysimsalabim-1.2 → pysimsalabim-1.3}/PKG-INFO +23 -3
- {pysimsalabim-1.2 → pysimsalabim-1.3}/README.md +8 -0
- pysimsalabim-1.3/pySIMsalabim/aux_funcs/PathChecksWin.py +36 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/CV.py +9 -8
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/EQE.py +12 -15
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/JV_steady_state.py +46 -11
- pysimsalabim-1.3/pySIMsalabim/experiments/JV_sweep.py +625 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/hysteresis.py +59 -77
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/impedance.py +17 -16
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/imps.py +5 -4
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_EQE.py +41 -41
- pysimsalabim-1.3/pySIMsalabim/tests/test_JV_sweep.py +123 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_hyst.py +30 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/general.py +105 -65
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/parallel_sim.py +170 -22
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim.egg-info/PKG-INFO +23 -3
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim.egg-info/SOURCES.txt +4 -0
- pysimsalabim-1.3/pyproject.toml +5 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/setup.py +2 -2
- {pysimsalabim-1.2 → pysimsalabim-1.3}/LICENSE +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/aux_funcs/SCLC_funcs.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/aux_funcs/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/aux_funcs/addons.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/experiments/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/install/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/install/compile_simsalabim.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/install/get_SIMsalabim.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/install/get_gnu_parallel.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/plots/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/plots/band_diagram.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/plots/plot_def.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/plots/plot_functions.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_CV.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_IMPS.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_JV.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/tests/test_impedance.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/__init__.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/clean_up.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/device_parameters.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim/utils/utils.py +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim.egg-info/dependency_links.txt +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim.egg-info/requires.txt +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/pySIMsalabim.egg-info/top_level.txt +0 -0
- {pysimsalabim-1.2 → pysimsalabim-1.3}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pySIMsalabim
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3
|
|
4
4
|
Home-page: https://github.com/kostergroup/pySIMsalabim
|
|
5
|
-
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.
|
|
5
|
+
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.03.tar.gz
|
|
6
6
|
Author: Vincent M. Le Corre, Sander Heester, L. Jan Anton Koster
|
|
7
7
|
Author-email:
|
|
8
8
|
License: GPLv3
|
|
@@ -25,6 +25,18 @@ Requires-Dist: openpyxl>=3.0
|
|
|
25
25
|
Provides-Extra: dev
|
|
26
26
|
Requires-Dist: pytest; extra == "dev"
|
|
27
27
|
Requires-Dist: twine; extra == "dev"
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: download-url
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: provides-extra
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: requires-python
|
|
28
40
|
|
|
29
41
|
<img src="./docs/logo/pySIMsalabim_logo.png" alt="pySIMsalabim logo" width="100px">
|
|
30
42
|
|
|
@@ -144,6 +156,14 @@ install_GNU_parallel_Linux()
|
|
|
144
156
|
|
|
145
157
|
If you are on Windows, pySIMsalabim will use the default threading or multiprocessing from Python.
|
|
146
158
|
|
|
159
|
+
## Warning for Windows users
|
|
160
|
+
If you are using Windows, please be aware that Windows typically has a maximum path length of 260 characters. This can cause issues when running simulations with long file paths. To avoid this, you can try to shorten the paths used in your simulations or enable long path support in Windows.
|
|
161
|
+
|
|
162
|
+
We also recommend that you do not run the simulations on synced folders (e.g. OneDrive, Google Drive, Dropbox, etc.) as this can cause issues with file access.
|
|
163
|
+
All these issues are not related to pySIMsalabim or SIMsalabim, but to the Windows operating system itself.
|
|
164
|
+
|
|
165
|
+
If this annoys you, we recommend using Linux or WSL2 (Windows Subsystem for Linux) instead of Windows.
|
|
166
|
+
|
|
147
167
|
## Testing
|
|
148
168
|
The physics and implementation of the drift-diffusion simulator are tested in the main SIMsalabim repository. The tests in pySIMsalabim are mainly focused on the interface between SIMsalabim and Python. The tests can be run using the following command:
|
|
149
169
|
|
|
@@ -116,6 +116,14 @@ install_GNU_parallel_Linux()
|
|
|
116
116
|
|
|
117
117
|
If you are on Windows, pySIMsalabim will use the default threading or multiprocessing from Python.
|
|
118
118
|
|
|
119
|
+
## Warning for Windows users
|
|
120
|
+
If you are using Windows, please be aware that Windows typically has a maximum path length of 260 characters. This can cause issues when running simulations with long file paths. To avoid this, you can try to shorten the paths used in your simulations or enable long path support in Windows.
|
|
121
|
+
|
|
122
|
+
We also recommend that you do not run the simulations on synced folders (e.g. OneDrive, Google Drive, Dropbox, etc.) as this can cause issues with file access.
|
|
123
|
+
All these issues are not related to pySIMsalabim or SIMsalabim, but to the Windows operating system itself.
|
|
124
|
+
|
|
125
|
+
If this annoys you, we recommend using Linux or WSL2 (Windows Subsystem for Linux) instead of Windows.
|
|
126
|
+
|
|
119
127
|
## Testing
|
|
120
128
|
The physics and implementation of the drift-diffusion simulator are tested in the main SIMsalabim repository. The tests in pySIMsalabim are mainly focused on the interface between SIMsalabim and Python. The tests can be run using the following command:
|
|
121
129
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Check and convert Windows paths to long path format if necessary."""
|
|
2
|
+
# Description:
|
|
3
|
+
# ------------
|
|
4
|
+
# This script checks if a given Windows path exceeds the traditional MAX_PATH limit
|
|
5
|
+
# and converts it to a long path format if necessary.
|
|
6
|
+
|
|
7
|
+
######### Package Imports ###################################################################
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
######### Function Definitions ##############################################################
|
|
12
|
+
|
|
13
|
+
def convert_to_long_path(tempPath):
|
|
14
|
+
""" Convert a path to a Windows long path by adding the \\\\?\\ prefix
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
tempPath : string
|
|
19
|
+
Path to be converted
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
Path
|
|
24
|
+
Converted Path object with long path prefix
|
|
25
|
+
"""
|
|
26
|
+
resolved_path = Path(tempPath).resolve()
|
|
27
|
+
if len(str(resolved_path)) < 260: # Windows path length limit
|
|
28
|
+
return resolved_path
|
|
29
|
+
|
|
30
|
+
else:
|
|
31
|
+
print(f"\n Warning: Path is too long ({len(resolved_path)} characters), if the process fails try to shorten the path (i.e. by moving the folder to a location with a shorter path). \n If it stills fails try changing the Windows registry to enable long paths: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enabling-long-paths-in-windows-10-version-1607-and-later \n Current Path: {tempPath}")
|
|
32
|
+
|
|
33
|
+
# Add \\?\ prefix manually for long paths
|
|
34
|
+
win_path = Path("\\\\?\\" + str(resolved_path))
|
|
35
|
+
return win_path
|
|
36
|
+
|
|
@@ -642,6 +642,7 @@ def run_CV_simu(zimt_device_parameters, session_path, freq, V_min, V_max, V_step
|
|
|
642
642
|
string
|
|
643
643
|
Return message to display on the UI, for both success and failed
|
|
644
644
|
"""
|
|
645
|
+
verbose = kwargs.get('verbose', False) # Check if the user wants to see the console output
|
|
645
646
|
UUID = kwargs.get('UUID', '') # Check if the user wants to add a UUID to the tj file name
|
|
646
647
|
cmd_pars = kwargs.get('cmd_pars', None) # Check if the user wants to add additional command line parameters
|
|
647
648
|
# Check if the user wants to force the use of thread safe mode, necessary for Windows with parallel simulations
|
|
@@ -736,18 +737,18 @@ def run_CV_simu(zimt_device_parameters, session_path, freq, V_min, V_max, V_step
|
|
|
736
737
|
CV_SS_args = update_cmd_pars(CV_SS_args, cmd_pars)
|
|
737
738
|
|
|
738
739
|
if threadsafe:
|
|
739
|
-
result, message = utils_gen.run_simulation_filesafe('zimt', CV_SS_args, session_path, run_mode)
|
|
740
|
+
result, message = utils_gen.run_simulation_filesafe('zimt', CV_SS_args, session_path, run_mode, verbose=verbose)
|
|
740
741
|
else:
|
|
741
|
-
result, message = utils_gen.run_simulation('zimt', CV_SS_args, session_path, run_mode)
|
|
742
|
+
result, message = utils_gen.run_simulation('zimt', CV_SS_args, session_path, run_mode, verbose=verbose)
|
|
742
743
|
|
|
743
|
-
if result
|
|
744
|
+
if result == 0 or result == 95:
|
|
744
745
|
data = read_tj_file(session_path, tj_file_name=tj_name)
|
|
745
746
|
|
|
746
747
|
Vext = np.asarray(data['Vext'])
|
|
747
748
|
Jext = np.asarray(data['Jext'])
|
|
748
749
|
Vint = Vext - Jext*Rseries
|
|
749
750
|
else:
|
|
750
|
-
return result
|
|
751
|
+
return result, message
|
|
751
752
|
else:
|
|
752
753
|
return result, message
|
|
753
754
|
|
|
@@ -796,18 +797,18 @@ def run_CV_simu(zimt_device_parameters, session_path, freq, V_min, V_max, V_step
|
|
|
796
797
|
CV_args = update_cmd_pars(CV_args, cmd_pars)
|
|
797
798
|
|
|
798
799
|
if threadsafe:
|
|
799
|
-
result, message = utils_gen.run_simulation_filesafe('zimt', CV_args, session_path, run_mode)
|
|
800
|
+
result, message = utils_gen.run_simulation_filesafe('zimt', CV_args, session_path, run_mode, verbose=verbose)
|
|
800
801
|
else:
|
|
801
|
-
result, message = utils_gen.run_simulation('zimt', CV_args, session_path, run_mode)
|
|
802
|
+
result, message = utils_gen.run_simulation('zimt', CV_args, session_path, run_mode, verbose=verbose)
|
|
802
803
|
|
|
803
|
-
if result
|
|
804
|
+
if result == 0 or result == 95:
|
|
804
805
|
data = read_tj_file(session_path, tj_file_name=tj_name)
|
|
805
806
|
|
|
806
807
|
result, message = get_capacitance(data, freq, V_min, V_max, del_V, V_step, session_path, zimt_device_parameters, output_file)
|
|
807
808
|
return result, message
|
|
808
809
|
|
|
809
810
|
else:
|
|
810
|
-
return result
|
|
811
|
+
return result, message
|
|
811
812
|
|
|
812
813
|
return result, message
|
|
813
814
|
|
|
@@ -159,7 +159,7 @@ def run_EQE(simss_device_parameters, session_path, spectrum, lambda_min, lambda_
|
|
|
159
159
|
int
|
|
160
160
|
0 if the function runs successfully.
|
|
161
161
|
"""
|
|
162
|
-
|
|
162
|
+
verbose = kwargs.get('verbose', False) # Check if the user wants to print messages to the console
|
|
163
163
|
UUID = kwargs.get('UUID', '') # Check if the user wants to add a UUID to the JV file name
|
|
164
164
|
cmd_pars = kwargs.get('cmd_pars', None) # Check if the user wants to add additional command line parameters to the simulation
|
|
165
165
|
force_multithreading = kwargs.get('force_multithreading', False) # Check if the user wants to force multithreading instead of using GNU parallel
|
|
@@ -236,17 +236,17 @@ def run_EQE(simss_device_parameters, session_path, spectrum, lambda_min, lambda_
|
|
|
236
236
|
EQE_args = update_cmd_pars(EQE_args, cmd_pars)
|
|
237
237
|
|
|
238
238
|
if threadsafe:
|
|
239
|
-
result, message = utils_gen.run_simulation_filesafe('simss', EQE_args, session_path, run_mode)
|
|
239
|
+
result, message = utils_gen.run_simulation_filesafe('simss', EQE_args, session_path, run_mode,verbose=verbose)
|
|
240
240
|
else:
|
|
241
|
-
result, message = utils_gen.run_simulation('simss', EQE_args, session_path, run_mode)
|
|
241
|
+
result, message = utils_gen.run_simulation('simss', EQE_args, session_path, run_mode,verbose=verbose)
|
|
242
242
|
# result, message = run_sim_EQE(simss_device_parameters, session_path, spectrum, Vext, JV_file_name, run_mode)
|
|
243
243
|
|
|
244
244
|
# If the simulation fails, stop running the script and exit
|
|
245
|
-
if not result
|
|
246
|
-
if result
|
|
247
|
-
message = f'SIMsalabim raised an error with errorcode {result
|
|
245
|
+
if not result == 0:
|
|
246
|
+
if result== 95:
|
|
247
|
+
message = f'SIMsalabim raised an error with errorcode {result}, simulation did not converge.'
|
|
248
248
|
msg_list.append(message)
|
|
249
|
-
return result
|
|
249
|
+
return result, msg_list
|
|
250
250
|
|
|
251
251
|
# Get the current density Jext and its error
|
|
252
252
|
J0_single, J0_err_single = get_CurrDens(JV_file_name, session_path)
|
|
@@ -285,7 +285,7 @@ def run_EQE(simss_device_parameters, session_path, spectrum, lambda_min, lambda_
|
|
|
285
285
|
dum_args = update_cmd_pars(dum_args, cmd_pars)
|
|
286
286
|
EQE_args_list.append(dum_args)
|
|
287
287
|
|
|
288
|
-
results = run_simulation_parallel('simss', EQE_args_list, session_path, max_jobs, force_multithreading=force_multithreading)
|
|
288
|
+
results = run_simulation_parallel('simss', EQE_args_list, session_path, max_jobs, force_multithreading=force_multithreading,verbose=verbose)
|
|
289
289
|
|
|
290
290
|
for i in lambda_array:
|
|
291
291
|
JV_file_name_single = f'{JV_file_name_base}{dum_str}_{int(i*1e9)}nm{JV_file_name_ext}'
|
|
@@ -293,8 +293,6 @@ def run_EQE(simss_device_parameters, session_path, spectrum, lambda_min, lambda_
|
|
|
293
293
|
Jext.append(J_single)
|
|
294
294
|
Jext_err.append(Jerr_single)
|
|
295
295
|
|
|
296
|
-
|
|
297
|
-
|
|
298
296
|
else:
|
|
299
297
|
for i in lambda_array:
|
|
300
298
|
JV_file_name_base, JV_file_name_ext = os.path.splitext(JV_file_name)
|
|
@@ -325,12 +323,11 @@ def run_EQE(simss_device_parameters, session_path, spectrum, lambda_min, lambda_
|
|
|
325
323
|
EQE_args = update_cmd_pars(EQE_args, cmd_pars)
|
|
326
324
|
|
|
327
325
|
if threadsafe:
|
|
328
|
-
result, message = utils_gen.run_simulation_filesafe('simss', EQE_args, session_path, run_mode)
|
|
326
|
+
result, message = utils_gen.run_simulation_filesafe('simss', EQE_args, session_path, run_mode,verbose=verbose)
|
|
329
327
|
else:
|
|
330
|
-
result, message = utils_gen.run_simulation('simss', EQE_args, session_path, run_mode)
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
if not result.returncode == 0:
|
|
328
|
+
result, message = utils_gen.run_simulation('simss', EQE_args, session_path, run_mode,verbose=verbose)
|
|
329
|
+
|
|
330
|
+
if not result == 0:
|
|
334
331
|
msg_list.append(message)
|
|
335
332
|
|
|
336
333
|
J_single, Jerr_single = get_CurrDens(JV_file_name_single,session_path)
|
|
@@ -53,7 +53,7 @@ def run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', va
|
|
|
53
53
|
Message from the simulation.
|
|
54
54
|
|
|
55
55
|
"""
|
|
56
|
-
|
|
56
|
+
verbose = kwargs.get('verbose', False) # Check if the user wants to show verbose output in the console
|
|
57
57
|
UUID = kwargs.get('UUID', '') # Check if the user wants to add a UUID to the JV file name
|
|
58
58
|
cmd_pars = kwargs.get('cmd_pars', None) # Check if the user wants to add additional command line parameters to the
|
|
59
59
|
force_multithreading = kwargs.get('force_multithreading', False) # Check if the user wants to force multithreading instead of using GNU parallel
|
|
@@ -107,12 +107,18 @@ def run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', va
|
|
|
107
107
|
|
|
108
108
|
if varFile != 'none':
|
|
109
109
|
SS_JV_args.append({'par':'varFile','val':varFile})
|
|
110
|
+
else:
|
|
111
|
+
SS_JV_args.append({'par':'outputRatio','val':'0'})
|
|
110
112
|
|
|
111
113
|
# Update the cmd_pars with the SS_JV_args
|
|
112
114
|
if cmd_pars is not None:
|
|
113
115
|
SS_JV_args = update_cmd_pars(SS_JV_args, cmd_pars)
|
|
114
116
|
|
|
115
|
-
|
|
117
|
+
if threadsafe:
|
|
118
|
+
# Run the simulation in thread safe mode
|
|
119
|
+
result, message = utils_gen.run_simulation_filesafe('simss', SS_JV_args, session_path, run_mode = run_mode,verbose=verbose)
|
|
120
|
+
else:
|
|
121
|
+
result, message = utils_gen.run_simulation('simss',SS_JV_args,session_path,run_mode = run_mode,verbose=verbose)
|
|
116
122
|
|
|
117
123
|
return result, message
|
|
118
124
|
|
|
@@ -133,9 +139,11 @@ def run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', va
|
|
|
133
139
|
{'par':'JVFile','val':JV_file_name_base + f'_Gfrac_{G_frac}' + dum_str + JV_file_name_ext},
|
|
134
140
|
{'par':'logFile','val':os.path.join(session_path,'log'+f'_Gfrac_{G_frac}'+dum_str+'.txt')},
|
|
135
141
|
{'par':'scParsFile','val':os.path.join(session_path,'scPars'+f'_Gfrac_{G_frac}'+dum_str+'.txt')},
|
|
136
|
-
{'par':'varFile','val':os.path.join(session_path,var_file_base + f'_Gfrac_{G_frac}' + dum_str +var_file_ext)} if varFile != 'none' else {'par':'varFile','val':'none'}
|
|
142
|
+
{'par':'varFile','val':os.path.join(session_path,var_file_base + f'_Gfrac_{G_frac}' + dum_str +var_file_ext)} if varFile != 'none' else {'par':'varFile','val':'none'},
|
|
137
143
|
]
|
|
138
|
-
|
|
144
|
+
if varFile == 'none':
|
|
145
|
+
dum_args.append({'par':'outputRatio','val':'0'})
|
|
146
|
+
|
|
139
147
|
if turnoff_autoTidy:
|
|
140
148
|
dum_args.append({'par':'autoTidy','val':'0'})
|
|
141
149
|
|
|
@@ -145,22 +153,21 @@ def run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', va
|
|
|
145
153
|
SS_JV_args_list.append(dum_args)
|
|
146
154
|
|
|
147
155
|
if parallel and len(G_fracs) > 1:
|
|
148
|
-
results = run_simulation_parallel('simss', SS_JV_args_list, session_path, max_jobs, force_multithreading=force_multithreading)
|
|
156
|
+
results = run_simulation_parallel('simss', SS_JV_args_list, session_path, max_jobs, force_multithreading=force_multithreading,verbose=verbose)
|
|
149
157
|
msg_list = ['' for i in range(len(results))]
|
|
150
158
|
else:
|
|
151
159
|
results, msg_list = [], []
|
|
152
160
|
for dum_args in SS_JV_args_list:
|
|
153
161
|
|
|
154
162
|
if threadsafe:
|
|
155
|
-
result, message = utils_gen.run_simulation_filesafe('simss', dum_args, session_path, run_mode)
|
|
163
|
+
result, message = utils_gen.run_simulation_filesafe('simss', dum_args, session_path, run_mode,verbose=verbose)
|
|
156
164
|
else:
|
|
157
|
-
result, message = utils_gen.run_simulation('simss', dum_args, session_path, run_mode)
|
|
165
|
+
result, message = utils_gen.run_simulation('simss', dum_args, session_path, run_mode,verbose=verbose)
|
|
158
166
|
|
|
159
|
-
results.append(result
|
|
167
|
+
results.append(result)
|
|
160
168
|
msg_list.append(message)
|
|
161
169
|
|
|
162
170
|
# check if results is a list of CompletedProcess objects
|
|
163
|
-
|
|
164
171
|
if isinstance(results, list) :
|
|
165
172
|
if len(results) > 0 and not isinstance(results[0], subprocess.CompletedProcess):
|
|
166
173
|
pass
|
|
@@ -168,14 +175,42 @@ def run_SS_JV(simss_device_parameters, session_path, JV_file_name = 'JV.dat', va
|
|
|
168
175
|
if len(results) > 0 and isinstance(results[0], tuple) and all(isinstance(res[0], subprocess.CompletedProcess) for res in results):
|
|
169
176
|
# Extract the return codes from the CompletedProcess objects
|
|
170
177
|
results = [res[0].returncode for res in results]
|
|
178
|
+
|
|
171
179
|
# Check if all simulations were successful
|
|
172
180
|
if all([res == 0 for res in results]):
|
|
181
|
+
if verbose and not run_mode:
|
|
182
|
+
print('All JV simulations completed successfully\n')
|
|
183
|
+
# for mess in msg_list:
|
|
184
|
+
# print(mess)
|
|
173
185
|
return 0, 'All JV simulations completed successfully'
|
|
174
186
|
elif all([(res == 0 or res == 95) for res in results]):
|
|
187
|
+
if verbose and not run_mode:
|
|
188
|
+
print('All JV simulations completed successfully, but some had some points that did not converge\n')
|
|
189
|
+
for mess in msg_list:
|
|
190
|
+
print(mess)
|
|
175
191
|
return 0, 'All JV simulations completed successfully, but some had some points that did not converge'
|
|
176
192
|
else:
|
|
177
|
-
|
|
178
|
-
|
|
193
|
+
if verbose and not run_mode:
|
|
194
|
+
print('Some JV simulations failed\n')
|
|
195
|
+
for i, res in enumerate(results):
|
|
196
|
+
print(f'Simulation {i+1} failed with return code {res}')
|
|
197
|
+
|
|
198
|
+
# get all results that are not 0
|
|
199
|
+
failed_results = [res for i, res in enumerate(results) if res != 0 and res != 95]
|
|
200
|
+
# If there is only one failed result, return it with the error message
|
|
201
|
+
# get only unique values in failed_results
|
|
202
|
+
failed_results = list(set(failed_results))
|
|
203
|
+
if len(failed_results) == 1:
|
|
204
|
+
return failed_results[0], utils_gen.error_message(failed_results[0])
|
|
205
|
+
else:
|
|
206
|
+
print(failed_results)
|
|
207
|
+
# if len(failed_results) > 1:
|
|
208
|
+
print(f"Multiple different errors occurred during the parallel simulations: {set([val for val in failed_results if val not in [0, 95, 3]])}. Returning error code 666.")
|
|
209
|
+
return 666, utils_gen.error_message(666)
|
|
210
|
+
# else:
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
179
214
|
## Running the function as a standalone script
|
|
180
215
|
if __name__ == "__main__":
|
|
181
216
|
## Manual Steady State input parameters. These are overwritten by command line arguments if provided
|