pySIMSalabim 1__tar.gz → 1.1__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 → pysimsalabim-1.1}/PKG-INFO +4 -4
- {pysimsalabim-1 → pysimsalabim-1.1}/README.md +1 -1
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/hysteresis.py +187 -19
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/impedance.py +213 -110
- {pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/PKG-INFO +4 -4
- {pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/SOURCES.txt +5 -5
- {pysimsalabim-1 → pysimsalabim-1.1}/setup.py +3 -3
- {pysimsalabim-1 → pysimsalabim-1.1}/LICENSE +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/aux_funcs/SCLC_funcs.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/aux_funcs/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/aux_funcs/addons.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/CV.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/EQE.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/JV_steady_state.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/experiments/imps.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/install/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/install/compile_simsalabim.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/install/get_SIMsalabim.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/install/get_gnu_parallel.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/plots/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/plots/band_diagram.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/plots/plot_def.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/plots/plot_functions.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_CV.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_EQE.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_IMPS.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_JV.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_hyst.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/tests/test_impedance.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/__init__.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/clean_up.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/device_parameters.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/general.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/parallel_sim.py +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/pySIMsalabim/utils/utils.py +0 -0
- {pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/dependency_links.txt +0 -0
- {pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/requires.txt +0 -0
- {pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/top_level.txt +0 -0
- {pysimsalabim-1 → pysimsalabim-1.1}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 1
|
|
2
|
+
Name: pySIMsalabim
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Home-page: https://github.com/kostergroup/pySIMsalabim
|
|
5
|
-
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.tar.gz
|
|
5
|
+
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.01.tar.gz
|
|
6
6
|
Author: Vincent M. Le Corre, Sander Heester, L. Jan Anton Koster
|
|
7
7
|
Author-email:
|
|
8
8
|
License: GPLv3
|
|
@@ -26,7 +26,7 @@ Provides-Extra: dev
|
|
|
26
26
|
Requires-Dist: pytest; extra == "dev"
|
|
27
27
|
Requires-Dist: twine; extra == "dev"
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# pySIMsalabim
|
|
30
30
|
|
|
31
31
|
## Description
|
|
32
32
|
**pySIMsalabim** is a Python package used to interface drift-diffusion simulator [SIMsalabim](https://github.com/kostergroup/SIMsalabim) with Python. It provides many useful tools to set up and run simulations, as well as to analyze and visualize the results.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pySIMsalabim
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
**pySIMsalabim** is a Python package used to interface drift-diffusion simulator [SIMsalabim](https://github.com/kostergroup/SIMsalabim) with Python. It provides many useful tools to set up and run simulations, as well as to analyze and visualize the results.
|
|
@@ -239,11 +239,13 @@ def create_tVG_hysteresis(session_path, Vmin, Vmax, scan_speed, direction, steps
|
|
|
239
239
|
|
|
240
240
|
return retval, msg
|
|
241
241
|
|
|
242
|
-
def plot_hysteresis_JV(path2file = 'tj.dat'):
|
|
242
|
+
def plot_hysteresis_JV(session_path, path2file = 'tj.dat'):
|
|
243
243
|
"""Plot the hysteresis JV curve
|
|
244
244
|
|
|
245
245
|
Parameters
|
|
246
246
|
----------
|
|
247
|
+
session_path : string
|
|
248
|
+
working directory for zimt
|
|
247
249
|
path2file : string
|
|
248
250
|
Path to the tj file
|
|
249
251
|
|
|
@@ -254,7 +256,7 @@ def plot_hysteresis_JV(path2file = 'tj.dat'):
|
|
|
254
256
|
|
|
255
257
|
"""
|
|
256
258
|
# Read the data from tj-file
|
|
257
|
-
data_tj = pd.read_csv(path2file, sep=r'\s+')
|
|
259
|
+
data_tj = pd.read_csv(os.path.join(session_path,path2file), sep=r'\s+')
|
|
258
260
|
|
|
259
261
|
fig, ax = plt.subplots()
|
|
260
262
|
pars = {'Jext' : 'Simulation'} #'$J_{ext}$'}
|
|
@@ -267,6 +269,7 @@ def plot_hysteresis_JV(path2file = 'tj.dat'):
|
|
|
267
269
|
plot_type = plt.plot
|
|
268
270
|
|
|
269
271
|
ax = utils_plot.plot_result(data_tj, pars, list(pars.keys()), par_x, xlabel, ylabel, xscale, yscale, title, ax, plot_type)
|
|
272
|
+
plt.tight_layout() # make it fit in the window
|
|
270
273
|
|
|
271
274
|
return ax
|
|
272
275
|
|
|
@@ -509,6 +512,156 @@ def Compare_Exp_Sim_JV(session_path, expJV_Vmin_Vmax, expJV_Vmax_Vmin, rms_mode,
|
|
|
509
512
|
|
|
510
513
|
return rms
|
|
511
514
|
|
|
515
|
+
def calc_hysteresis_index(session_path, tj_file_name = 'tj.dat', tVG_file_ame='tVG.txt', plot_hyst_index = False):
|
|
516
|
+
"""
|
|
517
|
+
Calculate the hysteresis index from the simulated JV curve using the difference area between the forward and backward scan
|
|
518
|
+
|
|
519
|
+
Parameters
|
|
520
|
+
----------
|
|
521
|
+
session_path : string
|
|
522
|
+
working directory for zimt
|
|
523
|
+
tj_file_name : string
|
|
524
|
+
Name of the tj file
|
|
525
|
+
tVG_file_ame : string
|
|
526
|
+
Name of the tVG file
|
|
527
|
+
plot_hyst_index : bool
|
|
528
|
+
If True, plot the JV curves with the normalisation and difference area
|
|
529
|
+
|
|
530
|
+
Returns
|
|
531
|
+
-------
|
|
532
|
+
float
|
|
533
|
+
Hysteresis index
|
|
534
|
+
"""
|
|
535
|
+
|
|
536
|
+
sign_dum = 0 # dummy value for sign change in voltage array
|
|
537
|
+
|
|
538
|
+
# Read data from files. tj file for the JV curve and tVG file to get all possible voltage steps.
|
|
539
|
+
# This is needed as not all voltages might be present in the tj file.
|
|
540
|
+
data_tj = pd.read_csv(os.path.join(session_path,tj_file_name), sep=r'\s+')
|
|
541
|
+
data_tVG = pd.read_csv(os.path.join(session_path,tVG_file_ame), sep=r'\s+')
|
|
542
|
+
|
|
543
|
+
# Store Vinput, Vext and Jext in arrays
|
|
544
|
+
Vinput = np.array(data_tVG['Vext'])
|
|
545
|
+
Vext = np.array(data_tj['Vext'])
|
|
546
|
+
Jext = np.array(data_tj['Jext'])
|
|
547
|
+
|
|
548
|
+
# Find the min and max values of Vext and Jext to span the normalisation area
|
|
549
|
+
Jmin = min(Jext)
|
|
550
|
+
Jmax = max(Jext)
|
|
551
|
+
Vmin = min(Vext)
|
|
552
|
+
Vmax = max(Vext)
|
|
553
|
+
|
|
554
|
+
# As the forward and backward scan are in the same array,
|
|
555
|
+
# we need to find the point where the JV curve changes direction, i.e. the turning point and split into two seperate arrays
|
|
556
|
+
# Vext,Jext array
|
|
557
|
+
diff = np.diff(Vext)
|
|
558
|
+
sign_change = np.where(np.diff(np.sign(diff)))
|
|
559
|
+
|
|
560
|
+
if len(sign_change[0]) == 0:
|
|
561
|
+
print('Hysteresis index could not be calculated. No sign change in the voltage array')
|
|
562
|
+
return 0
|
|
563
|
+
elif len(sign_change[0]) ==2:
|
|
564
|
+
# Check if they are consecutive. If so, we might just be missing the 'flip'' point, as it could have not converged, so we need to correct for this.
|
|
565
|
+
if sign_change[0][1] - sign_change[0][0] == 1:
|
|
566
|
+
idx_change = sign_change[0][0] + 2
|
|
567
|
+
sign_dum = 1
|
|
568
|
+
else:
|
|
569
|
+
print('Hysteresis index could not be calculated. Multiple sign changes in the voltage array')
|
|
570
|
+
return 0
|
|
571
|
+
elif len(sign_change[0]) > 2:
|
|
572
|
+
print('Hysteresis index could not be calculated. Multiple sign changes in the voltage array')
|
|
573
|
+
return 0
|
|
574
|
+
else:
|
|
575
|
+
# Need to correct for the index change between Vinput and the sign_change array
|
|
576
|
+
idx_change = sign_change[0][0] + 2
|
|
577
|
+
|
|
578
|
+
# split the Vext and Jext arrays into two arrays
|
|
579
|
+
Vext_1 = Vext[:idx_change]
|
|
580
|
+
Jext_1 = Jext[:idx_change]
|
|
581
|
+
Vext_2 = Vext[idx_change:]
|
|
582
|
+
Jext_2 = Jext[idx_change:]
|
|
583
|
+
|
|
584
|
+
if sign_dum != 1:
|
|
585
|
+
# append the last value of the first array to the first position of the second array to be able to include the turning point
|
|
586
|
+
Vext_2 = np.insert(Vext_2,0,Vext_1[-1])
|
|
587
|
+
Jext_2 = np.insert(Jext_2,0,Jext_1[-1])
|
|
588
|
+
|
|
589
|
+
# Vinput array
|
|
590
|
+
diff = np.diff(Vinput)
|
|
591
|
+
sign_change = np.where(np.diff(np.sign(diff)))
|
|
592
|
+
|
|
593
|
+
if len(sign_change[0]) == 0:
|
|
594
|
+
print('Hysteresis index could not be calculated. No sign change in the voltage array')
|
|
595
|
+
return 0
|
|
596
|
+
elif len(sign_change[0]) > 1:
|
|
597
|
+
print('Hysteresis index could not be calculated.. Multiple sign changes in the voltage array')
|
|
598
|
+
return 0
|
|
599
|
+
else:
|
|
600
|
+
# Need to correct for the index change between Vinput and the sign_change array
|
|
601
|
+
sign_change_Vinput = sign_change[0][0] + 2
|
|
602
|
+
|
|
603
|
+
# We only need one of the arrays, as we will only use this as a reference
|
|
604
|
+
Vinput_1 = Vinput[:sign_change_Vinput]
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
# To calculate the difference area between the two curves, we need to reverse the order of the second arrays to match the order of the applied voltage
|
|
608
|
+
# reverse the second array
|
|
609
|
+
Vext_2 = Vext_2[::-1]
|
|
610
|
+
Jext_2 = Jext_2[::-1]
|
|
611
|
+
|
|
612
|
+
# Create empty arrays to store the final V,J values
|
|
613
|
+
Vfinal = []
|
|
614
|
+
Jfinal_1 = []
|
|
615
|
+
Jfinal_2 = []
|
|
616
|
+
|
|
617
|
+
# Loop over Vinput and check if the voltage exist in both V arrays
|
|
618
|
+
# If it does, add the current to the corresponding J array, else we cannot use it so we discard it
|
|
619
|
+
for i in range(len(Vinput_1)):
|
|
620
|
+
if (Vinput_1[i] in Vext_1) and (Vinput_1[i] in Vext_2):
|
|
621
|
+
# Get the index of the voltage in the corresponding V arrays
|
|
622
|
+
idx1 = np.where(Vext_1 == Vinput_1[i])[0][0]
|
|
623
|
+
idx2 = np.where(Vext_2 == Vinput_1[i])[0][0]
|
|
624
|
+
|
|
625
|
+
# Append the values to the final arrays
|
|
626
|
+
Vfinal.append(Vext_1[idx1])
|
|
627
|
+
Jfinal_1.append(Jext_1[idx1])
|
|
628
|
+
Jfinal_2.append(Jext_2[idx2])
|
|
629
|
+
|
|
630
|
+
# Calculate the hysteresis index
|
|
631
|
+
hysteresis_index_num = abs(np.trapezoid(np.abs(np.array(Jfinal_1) - np.array(Jfinal_2)),Vfinal)) # Use abs around trapezoid to avoid negative values when Vfinal is flipped
|
|
632
|
+
hysteresis_index_denom = (Jmax - Jmin) * (Vmax - Vmin)
|
|
633
|
+
hysteresis_index = hysteresis_index_num / hysteresis_index_denom
|
|
634
|
+
|
|
635
|
+
if plot_hyst_index == True:
|
|
636
|
+
|
|
637
|
+
# Plot JV traces together with normalisation and difference area
|
|
638
|
+
fig, ax = plt.subplots()
|
|
639
|
+
|
|
640
|
+
# Normalisation area
|
|
641
|
+
ax.vlines(x = Vmin,ymin = Jmin, ymax = Jmax, color='#919191',linestyles='dashed',label='Normalisation area')
|
|
642
|
+
ax.vlines(x = Vmax,ymin = Jmin, ymax = Jmax, color='#919191',linestyles='dashed')
|
|
643
|
+
ax.hlines(y = Jmin,xmin = Vmin, xmax = Vmax, color='#919191',linestyles='dashed')
|
|
644
|
+
ax.hlines(y = Jmax,xmin = Vmin, xmax = Vmax, color='#919191',linestyles='dashed')
|
|
645
|
+
|
|
646
|
+
# Difference area
|
|
647
|
+
ax.fill_between(Vfinal,Jfinal_1,Jfinal_2, color='#b1f997',label='Difference area')
|
|
648
|
+
|
|
649
|
+
# JV traces
|
|
650
|
+
ax.plot(Vfinal,Jfinal_2,label='Backward', color='r', linewidth=4)
|
|
651
|
+
ax.plot(Vfinal,Jfinal_1,label='Forward', color = 'b', linewidth=4)
|
|
652
|
+
|
|
653
|
+
ax.set_xlabel('$V_{ext}$ [V]')
|
|
654
|
+
ax.set_ylabel('$J_{ext}$ [Am$^{-2}$]')
|
|
655
|
+
|
|
656
|
+
# Reverse the legend order. Curves should be listed first, then norm/diff area.
|
|
657
|
+
handles, labels = ax.get_legend_handles_labels()
|
|
658
|
+
ax.legend(handles[::-1], labels[::-1],framealpha=1, loc='center left', bbox_to_anchor=(0.07, 0.75))
|
|
659
|
+
plt.tight_layout()
|
|
660
|
+
|
|
661
|
+
plt.show()
|
|
662
|
+
|
|
663
|
+
return hysteresis_index
|
|
664
|
+
|
|
512
665
|
def Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed, direction, G_frac, tVG_name='tVG.txt', tj_name = 'tj.dat',varFile='none',
|
|
513
666
|
run_mode=False, Vmin=0.0, Vmax=0.0, steps =0, expJV_Vmin_Vmax='', expJV_Vmax_Vmin='',rms_mode='lin', **kwargs ):
|
|
514
667
|
"""Create a tVG file and perform a JV hysteresis experiment.
|
|
@@ -556,8 +709,8 @@ def Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed,
|
|
|
556
709
|
Output object of with returncode and console output of the simulation
|
|
557
710
|
string
|
|
558
711
|
Return message to display on the UI, for both success and failed
|
|
559
|
-
|
|
560
|
-
|
|
712
|
+
dict
|
|
713
|
+
Dictionary containing the special output values of the simulation. In this case, the rms error ('rms') and the hysteresis index ('hyst_index')
|
|
561
714
|
"""
|
|
562
715
|
|
|
563
716
|
UUID = kwargs.get('UUID', '') # Check if the user wants to add a UUID to the tj file name
|
|
@@ -599,7 +752,10 @@ def Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed,
|
|
|
599
752
|
varFile = os.path.join(session_path, varFile)
|
|
600
753
|
# varFile = 'none' # we don't use a var file for the hysteresis JV simulation
|
|
601
754
|
|
|
755
|
+
# Init output_vals rms & hyst_index
|
|
602
756
|
rms = 0.0
|
|
757
|
+
hyst_index = 0.0
|
|
758
|
+
|
|
603
759
|
if UseExpData == 1:
|
|
604
760
|
# When fitting to experimental data, create a tVG file where Vext is the same as the voltages in the experimental JV file
|
|
605
761
|
if os.path.exists(os.path.join(session_path, expJV_Vmin_Vmax)) and os.path.exists(os.path.join(session_path, expJV_Vmax_Vmin)):
|
|
@@ -633,9 +789,17 @@ def Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed,
|
|
|
633
789
|
if result.returncode == 0 or result.returncode == 95:
|
|
634
790
|
if UseExpData == 1:
|
|
635
791
|
rms = Compare_Exp_Sim_JV(session_path, expJV_Vmin_Vmax, expJV_Vmax_Vmin, rms_mode, direction, tj_name)
|
|
792
|
+
hyst_index = calc_hysteresis_index(session_path, tj_name, tVG_name)
|
|
793
|
+
else:
|
|
794
|
+
message = result.stdout
|
|
795
|
+
|
|
636
796
|
result = result.returncode
|
|
797
|
+
|
|
798
|
+
# Put all the output values in a dictionary to be returned.
|
|
799
|
+
# By putting it in a dictionary we can add any number of values without breaking return arguments
|
|
800
|
+
output_vals = {'rms': rms, 'hyst_index': hyst_index}
|
|
637
801
|
|
|
638
|
-
return result, message,
|
|
802
|
+
return result, message, output_vals
|
|
639
803
|
|
|
640
804
|
## Running the function as a standalone script
|
|
641
805
|
if __name__ == "__main__":
|
|
@@ -646,7 +810,7 @@ if __name__ == "__main__":
|
|
|
646
810
|
UseExpData = 0 # integer, if 1 read experimental data
|
|
647
811
|
Vmin = 0 # lower voltage boundary
|
|
648
812
|
Vmax = 1.15 # upper voltage boundary
|
|
649
|
-
steps =
|
|
813
|
+
steps = 200 # Number of voltage steps
|
|
650
814
|
expJV_Vmin_Vmax = 'od05_f.txt' # Forward (direction=1)/Backward (direction=-1) JV scan file
|
|
651
815
|
expJV_Vmax_Vmin = 'od05_b.txt' # Backward (direction=1)/Forward (direction=-1) JV scan file
|
|
652
816
|
|
|
@@ -655,9 +819,10 @@ if __name__ == "__main__":
|
|
|
655
819
|
|
|
656
820
|
zimt_device_parameters = 'simulation_setup.txt'
|
|
657
821
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
822
|
+
tVGFile = 'tVG.txt'
|
|
823
|
+
tJFile = 'tj.dat'
|
|
824
|
+
varFile = 'none'
|
|
825
|
+
|
|
661
826
|
# UUID = str(uuid.uuid4()) # Add a UUID to the simulation
|
|
662
827
|
UUID = ''
|
|
663
828
|
|
|
@@ -706,7 +871,7 @@ if __name__ == "__main__":
|
|
|
706
871
|
|
|
707
872
|
# Define mappings for keys and variables
|
|
708
873
|
key_action_map = {
|
|
709
|
-
'
|
|
874
|
+
'zimt_device_parameters': lambda val: {'zimt_device_parameters': val},
|
|
710
875
|
'scan_speed': lambda val: {'scan_speed': float(val)},
|
|
711
876
|
'direction': lambda val: {'direction': int(val)},
|
|
712
877
|
'G_frac': lambda val: {'G_frac': float(val)},
|
|
@@ -716,8 +881,9 @@ if __name__ == "__main__":
|
|
|
716
881
|
'steps': lambda val: {'steps': int(val)},
|
|
717
882
|
'expJV_Vmin_Vmax': lambda val: {'expJV_Vmin_Vmax': val},
|
|
718
883
|
'expJV_Vmax_Vmin': lambda val: {'expJV_Vmax_Vmin': val},
|
|
719
|
-
'
|
|
720
|
-
'
|
|
884
|
+
'tVGFile': lambda val: {'tVGFile': val},
|
|
885
|
+
'tJFile': lambda val: {'tJFile': val},
|
|
886
|
+
'varFile': lambda val: {'varFile': val},
|
|
721
887
|
'UUID': lambda val: {'UUID': val},
|
|
722
888
|
}
|
|
723
889
|
|
|
@@ -732,17 +898,19 @@ if __name__ == "__main__":
|
|
|
732
898
|
cmd_pars.extend({'par': key, 'val': value} for key, value in cmd_pars_dict.items())
|
|
733
899
|
|
|
734
900
|
if UseExpData == 1:
|
|
735
|
-
result, message,
|
|
901
|
+
result, message, output_vals = Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed, direction, G_frac, tVG_name = tVGFile, tj_name = tJFile,
|
|
736
902
|
run_mode = False, expJV_Vmin_Vmax = expJV_Vmin_Vmax, expJV_Vmax_Vmin = expJV_Vmax_Vmin, rms_mode = rms_mode, cmd_pars = cmd_pars, UUID=UUID)
|
|
737
903
|
else:
|
|
738
|
-
result, message,
|
|
904
|
+
result, message, output_vals = Hysteresis_JV(zimt_device_parameters, session_path, UseExpData, scan_speed, direction, G_frac, tVG_name = tVGFile, tj_name = tJFile,
|
|
739
905
|
run_mode = False, Vmin=Vmin, Vmax=Vmax, steps =steps, rms_mode = rms_mode, cmd_pars = cmd_pars, UUID=UUID)
|
|
740
|
-
|
|
906
|
+
|
|
741
907
|
if result == 0 or result == 95:
|
|
742
908
|
if UseExpData == 1:
|
|
743
|
-
print('Rms-value: ', "{:.5f}".format(round(rms, 5)))
|
|
744
|
-
|
|
745
|
-
|
|
909
|
+
print('Rms-value: ', "{:.5f}".format(round(output_vals['rms'], 5)))
|
|
910
|
+
|
|
911
|
+
print(f'hyst-index: {output_vals["hyst_index"]:.3f}')
|
|
912
|
+
|
|
913
|
+
ax = plot_hysteresis_JV(session_path, tJFile)
|
|
746
914
|
if UseExpData == 1:
|
|
747
915
|
JVExp = concatJVs(session_path, expJV_Vmin_Vmax, expJV_Vmax_Vmin, direction)
|
|
748
916
|
ax.scatter(JVExp.Vext, JVExp.Jext, label='Experimental', color='r')
|
|
@@ -750,4 +918,4 @@ if __name__ == "__main__":
|
|
|
750
918
|
ax.legend()
|
|
751
919
|
plt.show()
|
|
752
920
|
else:
|
|
753
|
-
print('Convergence issues, no plot is printed')
|
|
921
|
+
print(message) #'Convergence issues, no plot is printed')
|
|
@@ -113,87 +113,44 @@ def create_tVG_SS(V_0, G_frac, tVG_name, session_path):
|
|
|
113
113
|
|
|
114
114
|
return retval, msg
|
|
115
115
|
|
|
116
|
+
def create_tVG_tolDens(V_0, del_V, ini_timeFactor, f_min, f_max, G, tVG_name, session_path):
|
|
117
|
+
""" Creates the tVG file for the steady state simulation with only t 0 and V_0
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# DataFrame
|
|
130
|
-
# Pandas dataFrame containing the time, voltage, current density and numerical error in the current density of the tj_file
|
|
131
|
-
# """
|
|
132
|
-
|
|
133
|
-
# data = pd.read_csv(os.path.join(session_path,tj_file_name), sep=r'\s+')
|
|
134
|
-
|
|
135
|
-
# return data
|
|
136
|
-
|
|
137
|
-
# def get_integral_bounds(data, f_min=1e-2, f_max=1e6, f_steps=20):
|
|
138
|
-
# """ Determine integral bounds in the time domain, used to compute the conductance and capacitance
|
|
139
|
-
|
|
140
|
-
# Parameters
|
|
141
|
-
# ----------
|
|
142
|
-
# data : dataFrame
|
|
143
|
-
# Pandas dataFrame containing the time, voltage, current density and numerical error in the current density of the tj_file
|
|
144
|
-
# f_min : float
|
|
145
|
-
# Minimum frequency
|
|
146
|
-
# f_max : float
|
|
147
|
-
# Maximum frequency
|
|
148
|
-
# f_steps : float
|
|
149
|
-
# Frequency steps
|
|
150
|
-
|
|
151
|
-
# Returns
|
|
152
|
-
# -------
|
|
153
|
-
# list
|
|
154
|
-
# List of array indices that will be used in the plotting
|
|
155
|
-
# """
|
|
156
|
-
|
|
157
|
-
# # Total number of time points
|
|
158
|
-
# numTimePoints = len(data['t'])
|
|
159
|
-
|
|
160
|
-
# # Check which time index corresponds to 1/fmax. We call this istart:
|
|
161
|
-
# istart = -1
|
|
162
|
-
# for i in range(numTimePoints):
|
|
163
|
-
# if math.isclose(data['t'][i], 1/f_max, rel_tol = 2/f_steps): #note: don't use == to compare 2 floating points!
|
|
164
|
-
# istart = i
|
|
165
|
-
|
|
166
|
-
# # Starting time point could not be found.
|
|
167
|
-
# if istart == -1:
|
|
168
|
-
# msg = 'Could not find a time that corresponds to the highest frequency.'
|
|
169
|
-
# return -1, msg
|
|
170
|
-
|
|
171
|
-
# # print('Found istart: ', istart)
|
|
172
|
-
|
|
173
|
-
# # ifin: last index we should plot, corresponds to time = 1/f_min:
|
|
174
|
-
# ifin = numTimePoints - 1
|
|
119
|
+
Parameters
|
|
120
|
+
----------
|
|
121
|
+
V_0 : float
|
|
122
|
+
Voltage at t=0
|
|
123
|
+
del_V : float
|
|
124
|
+
Voltage step that is applied after t=0
|
|
125
|
+
G_frac : float
|
|
126
|
+
Fractional light intensity
|
|
127
|
+
tVG_name : string
|
|
128
|
+
Name of the tVG file
|
|
129
|
+
session_path : string
|
|
130
|
+
Path of the simulation folder for this session
|
|
175
131
|
|
|
176
|
-
|
|
177
|
-
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
134
|
+
string
|
|
135
|
+
A message to indicate the result of the process
|
|
136
|
+
"""
|
|
178
137
|
|
|
179
|
-
#
|
|
138
|
+
del_t = ini_timeFactor/f_max # t_1 = 0 s + del_t
|
|
180
139
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
140
|
+
tVG_lines = ('t\tVext\tG_frac\n'
|
|
141
|
+
f'0\t{V_0+del_V}\t{G:.3e}\n'
|
|
142
|
+
f'0\t{V_0}\t{G:.3e}\n'
|
|
143
|
+
f'{del_t}\t{V_0+del_V}\t{G:.3e}\n')
|
|
185
144
|
|
|
186
|
-
#
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
# isToPlot.append(i) # add the index to our array
|
|
145
|
+
# Write the tVG lines to the tVG file
|
|
146
|
+
with open(os.path.join(session_path,tVG_name), 'w') as file:
|
|
147
|
+
file.write(tVG_lines)
|
|
190
148
|
|
|
191
|
-
#
|
|
192
|
-
|
|
149
|
+
# tVG file is created, message a success
|
|
150
|
+
msg = 'Success'
|
|
151
|
+
retval = 0
|
|
193
152
|
|
|
194
|
-
|
|
195
|
-
# msg = 'Success'
|
|
196
|
-
# return isToPlot, msg
|
|
153
|
+
return retval, msg
|
|
197
154
|
|
|
198
155
|
def calc_impedance_limit_time(I, errI, time, VStep, imax):
|
|
199
156
|
"""Fourier Decomposition formula which computes the impedance at frequency freq (Hz) and its complex error
|
|
@@ -304,20 +261,6 @@ def calc_impedance(data, del_V, isToPlot,session_path,zimt_device_parameters,Rse
|
|
|
304
261
|
errC = np.empty(numFreqPoints)
|
|
305
262
|
errG = np.empty(numFreqPoints)
|
|
306
263
|
|
|
307
|
-
|
|
308
|
-
# We need to know the series and shunt resistance to calculate the impedance correctly later on
|
|
309
|
-
# dev_val,lyrs_dum = load_device_parameters(session_path, zimt_device_parameters)
|
|
310
|
-
# for i in dev_val[zimt_device_parameters]:
|
|
311
|
-
# if i[0] == 'Contacts':
|
|
312
|
-
# contacts = i
|
|
313
|
-
# break
|
|
314
|
-
|
|
315
|
-
# for i in contacts[1:]:
|
|
316
|
-
# if i[1] == 'R_series':
|
|
317
|
-
# Rseries = float(i[2])
|
|
318
|
-
# elif i[1] == 'R_shunt':
|
|
319
|
-
# Rshunt = float(i[2])
|
|
320
|
-
|
|
321
264
|
for i in range(numFreqPoints):
|
|
322
265
|
imax=isToPlot[i]
|
|
323
266
|
freq[i], Z[i], errZ[i] = calc_impedance_limit_time(data['Jext'], data['errJ'], data['t'], del_V, imax)
|
|
@@ -534,6 +477,110 @@ def plot_impedance(session_path, output_file='freqZ.dat'):
|
|
|
534
477
|
# Capacitance plot
|
|
535
478
|
Capacitance_plot(session_path,output_file)
|
|
536
479
|
|
|
480
|
+
|
|
481
|
+
def get_tolDens(zimt_device_parameters, session_path, f_min, f_max, V_0, G_frac, del_V, run_mode, tVG_name, tj_name, varFile, ini_timeFactor, dum_str, cmd_pars):
|
|
482
|
+
"""
|
|
483
|
+
Calculate the tolerance of the density solver, to ensure a reliable impedance spectrum
|
|
484
|
+
|
|
485
|
+
Parameters
|
|
486
|
+
----------
|
|
487
|
+
zimt_device_parameters : string
|
|
488
|
+
Name of the zimt device parameters file
|
|
489
|
+
session_path : string
|
|
490
|
+
Working directory for zimt
|
|
491
|
+
f_min : float
|
|
492
|
+
Minimum frequency
|
|
493
|
+
f_max : float
|
|
494
|
+
Maximum frequency
|
|
495
|
+
V_0 : float
|
|
496
|
+
Voltage at t=0
|
|
497
|
+
G_frac : float
|
|
498
|
+
Fractional light intensity
|
|
499
|
+
del_V : float
|
|
500
|
+
Voltage step
|
|
501
|
+
run_mode : bool
|
|
502
|
+
Indicate whether the script is in 'web' mode (True) or standalone mode (False). Used to control the console output
|
|
503
|
+
tVG_name : string
|
|
504
|
+
Name of the tVG file
|
|
505
|
+
tj_name : string
|
|
506
|
+
Name of the tj file
|
|
507
|
+
varFile : string
|
|
508
|
+
Name of the var file
|
|
509
|
+
ini_timeFactor : float
|
|
510
|
+
Constant defining the size of the initial timestep
|
|
511
|
+
dum_str : string
|
|
512
|
+
dummy string with UUID string to append to the file names
|
|
513
|
+
cmd_pars : list
|
|
514
|
+
List of dictionaries with the command line parameters
|
|
515
|
+
|
|
516
|
+
Returns
|
|
517
|
+
-------
|
|
518
|
+
integer
|
|
519
|
+
Return code of the simulation, 0 if successful, -1 if one of the steps failed else the return code of the simulation
|
|
520
|
+
string
|
|
521
|
+
Return message to display on the UI in case of failure
|
|
522
|
+
float
|
|
523
|
+
Tolerance of the density solver. If failed, returns None
|
|
524
|
+
"""
|
|
525
|
+
|
|
526
|
+
# Determine J(t=0), J(t=∞), and J_dis to get the maximum allowed tolerance of the density solver to retrieve a
|
|
527
|
+
# reliable impedance spectrum, where tolDens = J(t=∞) - J(t=0) / J_displacement
|
|
528
|
+
result, message = create_tVG_tolDens(V_0, del_V, ini_timeFactor, f_min, f_max, G_frac, tVG_name, session_path)
|
|
529
|
+
|
|
530
|
+
if result == 0:
|
|
531
|
+
# In order for zimt to converge, set absolute tolerance of Poisson solver small enough
|
|
532
|
+
tolPois = 10**(math.floor(math.log10(abs(del_V)))-5)
|
|
533
|
+
|
|
534
|
+
tolDens_test = str(1e-10)
|
|
535
|
+
# Define mandatory options for ZimT to run well with impedance:
|
|
536
|
+
tolDens_args = [{'par':'dev_par_file','val':zimt_device_parameters},
|
|
537
|
+
{'par':'tVGFile','val':tVG_name},
|
|
538
|
+
{'par':'tolPois','val':str(tolPois)},
|
|
539
|
+
{'par':'tolDens','val':tolDens_test},
|
|
540
|
+
{'par':'limitDigits','val':'0'},
|
|
541
|
+
{'par':'currDiffInt','val':'2'},
|
|
542
|
+
{'par':'tJFile','val':tj_name},
|
|
543
|
+
{'par':'varFile','val':varFile},
|
|
544
|
+
{'par':'logFile','val':'log'+dum_str+'.txt'}]
|
|
545
|
+
|
|
546
|
+
if cmd_pars is not None:
|
|
547
|
+
tolDens_args = update_cmd_pars(tolDens_args, cmd_pars)
|
|
548
|
+
|
|
549
|
+
result, message = utils_gen.run_simulation('zimt', tolDens_args, session_path, run_mode)
|
|
550
|
+
|
|
551
|
+
if result.returncode == 0 or result.returncode == 95:
|
|
552
|
+
data = read_tj_file(session_path, tj_file_name=tj_name)
|
|
553
|
+
try:
|
|
554
|
+
J_0 = data['Jext'][1]
|
|
555
|
+
J_inf = data['Jext'][0]
|
|
556
|
+
J_dis = abs(data['Jext'][2] - J_0)
|
|
557
|
+
except KeyError as key:
|
|
558
|
+
if key == 0:
|
|
559
|
+
message = f"J_inf does not exist in the tolDens tJ-file"
|
|
560
|
+
elif key == 1:
|
|
561
|
+
message = f"J_0 does not exist in the tolDens tJ-file"
|
|
562
|
+
elif key == 2:
|
|
563
|
+
message = f"J_spike does not exist in the tolDens tJ-file"
|
|
564
|
+
return -1, message, None
|
|
565
|
+
|
|
566
|
+
# tolDens cannot be larger than 1E-6
|
|
567
|
+
tolDens = min(abs(J_inf - J_0) / J_dis * 1e-4, 1e-6)
|
|
568
|
+
|
|
569
|
+
# tolDens cannot be smaller than 1E-12
|
|
570
|
+
tolDens = max(tolDens, 1e-12)
|
|
571
|
+
else:
|
|
572
|
+
return result.returncode, message, None
|
|
573
|
+
|
|
574
|
+
# Remove the tVG and tJ files as they are not needed anymore
|
|
575
|
+
os.remove(os.path.join(session_path,tVG_name))
|
|
576
|
+
os.remove(os.path.join(session_path,tj_name))
|
|
577
|
+
|
|
578
|
+
else:
|
|
579
|
+
message = "Computing tolDens was unsuccesful"
|
|
580
|
+
return -1, message, None
|
|
581
|
+
|
|
582
|
+
return 0, '', tolDens
|
|
583
|
+
|
|
537
584
|
def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_steps, V_0, G_frac = 1, del_V = 0.01, run_mode = False, tVG_name='tVG.txt', output_file = 'freqZ.dat', tj_name = 'tj.dat', varFile ='none', ini_timeFactor=1e-3, timeFactor=1.02, **kwargs):
|
|
538
585
|
"""Create a tVG file and run ZimT with impedance device parameters
|
|
539
586
|
|
|
@@ -615,10 +662,54 @@ def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_ste
|
|
|
615
662
|
varFile = os.path.join(session_path,varFile)
|
|
616
663
|
# varFile = 'none' # we don't use a var file for the hysteresis JV simulation
|
|
617
664
|
|
|
665
|
+
##############################################################################
|
|
666
|
+
# If the voltage is set to Voc, firstly compute its value
|
|
667
|
+
if V_0 == 'oc':
|
|
668
|
+
# Create tVG
|
|
669
|
+
result, message = create_tVG_SS(V_0, G_frac, tVG_name, session_path)
|
|
670
|
+
|
|
671
|
+
# Check if tVG file is created
|
|
672
|
+
if result == 0:
|
|
673
|
+
# In order for zimt to converge, set absolute tolerance of Poisson solver small enough
|
|
674
|
+
tolPois = 10**(math.floor(math.log10(abs(del_V)))-4)
|
|
675
|
+
|
|
676
|
+
# Define mandatory options for ZimT to run well with impedance:
|
|
677
|
+
Impedance_SS_args = [{'par':'dev_par_file','val':zimt_device_parameters},
|
|
678
|
+
{'par':'tVGFile','val':tVG_name},
|
|
679
|
+
{'par':'tolPois','val':str(tolPois)},
|
|
680
|
+
{'par':'limitDigits','val':'0'},
|
|
681
|
+
{'par':'currDiffInt','val':'2'},
|
|
682
|
+
{'par':'tJFile','val':tj_name},
|
|
683
|
+
{'par':'varFile','val':varFile},
|
|
684
|
+
{'par':'logFile','val':'log'+dum_str+'.txt'}
|
|
685
|
+
]
|
|
686
|
+
|
|
687
|
+
if turnoff_autoTidy:
|
|
688
|
+
Impedance_SS_args.append({'par':'autoTidy','val':'0'})
|
|
689
|
+
|
|
690
|
+
if cmd_pars is not None:
|
|
691
|
+
Impedance_SS_args = update_cmd_pars(Impedance_SS_args, cmd_pars)
|
|
692
|
+
|
|
693
|
+
if threadsafe:
|
|
694
|
+
result, message = utils_gen.run_simulation_filesafe('zimt', Impedance_SS_args, session_path, run_mode)
|
|
695
|
+
else:
|
|
696
|
+
result, message = utils_gen.run_simulation('zimt', Impedance_SS_args, session_path, run_mode)
|
|
697
|
+
|
|
698
|
+
if result.returncode == 0 or result.returncode == 95:
|
|
699
|
+
data = read_tj_file(session_path, tj_file_name=tj_name)
|
|
700
|
+
|
|
701
|
+
V_0 = data['Vext'][0]
|
|
702
|
+
else:
|
|
703
|
+
message = "Computing the value of Voc led to the following error: " + message
|
|
704
|
+
return result.returncode, message
|
|
705
|
+
else:
|
|
706
|
+
V_0 = float(V_0)
|
|
707
|
+
|
|
708
|
+
##############################################################################
|
|
618
709
|
# The simulations with Rseries and Rshunt often do not converge, so we first run a steady state simulation to get the internal voltage and then run the impedance simulation with Rseries = 0 and Rshunt = -Rshunt. We will correct the impedance afterwards. This is a workaround to improve the convergence of the impedance simulation that should remain accurate to estimate the impedance.
|
|
619
|
-
#
|
|
710
|
+
# Default values for Rseries and Rshunt
|
|
620
711
|
Rseries = 0
|
|
621
|
-
Rshunt = -
|
|
712
|
+
Rshunt = -1 # Negative values are used for Rshunt in SIMsalabim to indicate infinite Rshunt
|
|
622
713
|
|
|
623
714
|
# Do the steady state simulation to calculate the internal voltage in case of series resistance
|
|
624
715
|
# Create tVG
|
|
@@ -691,10 +782,15 @@ def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_ste
|
|
|
691
782
|
return result, message
|
|
692
783
|
|
|
693
784
|
# remove the Rseries and Rshunt from cmd_pars
|
|
694
|
-
if
|
|
695
|
-
cmd_pars
|
|
696
|
-
|
|
697
|
-
|
|
785
|
+
if cmd_pars is not None:
|
|
786
|
+
cmd_pars = [dictionary for dictionary in cmd_pars if dictionary['par'] not in ('R_series', 'R_shunt')]
|
|
787
|
+
|
|
788
|
+
# Calculate the tolerance of the density solver
|
|
789
|
+
result, message, tolDens = get_tolDens(zimt_device_parameters, session_path, f_min, f_max, V_0, G_frac, del_V, run_mode, tVG_name, tj_name, varFile, ini_timeFactor, dum_str, cmd_pars)
|
|
790
|
+
|
|
791
|
+
if result != 0:
|
|
792
|
+
# Failed to calculate the tolerance of the density solver, return the error message
|
|
793
|
+
return result, message
|
|
698
794
|
|
|
699
795
|
# Do the impedance simulation
|
|
700
796
|
# Create tVG
|
|
@@ -709,6 +805,7 @@ def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_ste
|
|
|
709
805
|
Impedance_args = [{'par':'dev_par_file','val':zimt_device_parameters},
|
|
710
806
|
{'par':'tVGFile','val':tVG_name},
|
|
711
807
|
{'par':'tolPois','val':str(tolPois)},
|
|
808
|
+
{'par':'tolDens','val':str(tolDens)},
|
|
712
809
|
{'par':'limitDigits','val':'0'},
|
|
713
810
|
{'par':'currDiffInt','val':'2'},
|
|
714
811
|
{'par':'tJFile','val':tj_name},
|
|
@@ -716,7 +813,7 @@ def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_ste
|
|
|
716
813
|
{'par':'logFile','val':'log'+dum_str+'.txt'},
|
|
717
814
|
# We remove Rseries and Rshunt as the simulation is either to converge that way, we will correct the impedance afterwards
|
|
718
815
|
{'par':'R_series','val':str(0)},
|
|
719
|
-
{'par':'R_shunt','val':str(-
|
|
816
|
+
{'par':'R_shunt','val':str(-1)}]
|
|
720
817
|
|
|
721
818
|
if turnoff_autoTidy:
|
|
722
819
|
Impedance_args.append({'par':'autoTidy','val':'0'})
|
|
@@ -743,9 +840,9 @@ def run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_ste
|
|
|
743
840
|
if __name__ == "__main__":
|
|
744
841
|
## Manual Impedance input parameters. These are overwritten by command line arguments if provided
|
|
745
842
|
f_min = 1e-2 # org 1e-2
|
|
746
|
-
f_max =
|
|
843
|
+
f_max = 1e6 # org 1e6
|
|
747
844
|
f_steps = 20 # org 20
|
|
748
|
-
V_0 =
|
|
845
|
+
V_0 = 0.6 # Float or 'oc' for the open-circuit voltage
|
|
749
846
|
del_V = 1e-2 # org 1e-2
|
|
750
847
|
G_frac = 1
|
|
751
848
|
|
|
@@ -754,9 +851,10 @@ if __name__ == "__main__":
|
|
|
754
851
|
|
|
755
852
|
zimt_device_parameters = 'simulation_setup.txt'
|
|
756
853
|
|
|
757
|
-
|
|
758
|
-
|
|
854
|
+
tVGFile = 'tVG.txt'
|
|
855
|
+
tJFile = 'tj.dat'
|
|
759
856
|
output_name = 'freqZ.dat'
|
|
857
|
+
varFile = 'none'
|
|
760
858
|
|
|
761
859
|
# UUID = str(uuid.uuid4()) # Add a UUID to the simulation
|
|
762
860
|
UUID = ''
|
|
@@ -764,7 +862,7 @@ if __name__ == "__main__":
|
|
|
764
862
|
# Not user input
|
|
765
863
|
ini_timeFactor = 1e-3 # Initial timestep factor, org 1e-3
|
|
766
864
|
timeFactor = 1.02 # Increase in timestep every step to reduce the amount of datapoints necessary, use value close to 1 as this is best! Org 1.02
|
|
767
|
-
run_mode =
|
|
865
|
+
run_mode = False # Show verbose output in console
|
|
768
866
|
|
|
769
867
|
############## Command line arguments ##############
|
|
770
868
|
## Notes
|
|
@@ -774,7 +872,7 @@ if __name__ == "__main__":
|
|
|
774
872
|
## - Special arguments
|
|
775
873
|
## - sp : string
|
|
776
874
|
## - The session path, i.e. the working directory for the simulation
|
|
777
|
-
## -
|
|
875
|
+
## - zimt_device_parameters : string
|
|
778
876
|
## - The name of the zimt simulation setup parameters file
|
|
779
877
|
## - UUID : string
|
|
780
878
|
## - An UUID to add to the simulation (output)
|
|
@@ -811,18 +909,24 @@ if __name__ == "__main__":
|
|
|
811
909
|
|
|
812
910
|
# Define mappings for keys and variables
|
|
813
911
|
key_action_map = {
|
|
814
|
-
'
|
|
912
|
+
'zimt_device_parameters': lambda val: {'zimt_device_parameters': val},
|
|
815
913
|
'f_min': lambda val: {'f_min': float(val)},
|
|
816
914
|
'f_max': lambda val: {'f_max': float(val)},
|
|
817
915
|
'f_steps': lambda val: {'f_steps': int(val)},
|
|
818
|
-
'V_0': lambda val: {'V_0':
|
|
916
|
+
'V_0': lambda val: {'V_0': val},
|
|
819
917
|
'del_V': lambda val: {'del_V': float(val)},
|
|
820
918
|
'G_frac': lambda val: {'G_frac': float(val)},
|
|
821
|
-
'
|
|
822
|
-
'
|
|
823
|
-
'
|
|
919
|
+
'tVGFile': lambda val: {'tVGFile': val},
|
|
920
|
+
'tJFile': lambda val: {'tJFile': val},
|
|
921
|
+
'varFile': lambda val: {'varFile': val},
|
|
922
|
+
'output_name': lambda val: {'output_name': val},
|
|
824
923
|
'UUID': lambda val: {'UUID': val},
|
|
825
|
-
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
# Use exactly the same names as in SIMsalabim and as the Manual input parameters,
|
|
927
|
+
# if not than the tVG file name is not updated if putting e.g. "-tVGFile tVG_1.txt" in the command line in the terminal.
|
|
928
|
+
# Instead two tVG files names are defined one from the manual input parameters and one from the command line wherefore
|
|
929
|
+
# SIMsalabim gives the error "invalid input"
|
|
826
930
|
|
|
827
931
|
for key in list(cmd_pars_dict.keys()): # Use list to avoid modifying the dictionary while iterating
|
|
828
932
|
if key in key_action_map:
|
|
@@ -835,9 +939,8 @@ if __name__ == "__main__":
|
|
|
835
939
|
cmd_pars.extend({'par': key, 'val': value} for key, value in cmd_pars_dict.items())
|
|
836
940
|
|
|
837
941
|
## Run impedance spectroscopy
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
output_file = output_name, tj_name = tj_name,ini_timeFactor=ini_timeFactor, timeFactor=timeFactor, cmd_pars=cmd_pars, UUID=UUID)
|
|
942
|
+
result, message = run_impedance_simu(zimt_device_parameters, session_path, f_min, f_max, f_steps, V_0, G_frac, del_V, run_mode=run_mode, tVG_name=tVGFile,
|
|
943
|
+
output_file=output_name, tj_name=tJFile, varFile=varFile, ini_timeFactor=ini_timeFactor, timeFactor=timeFactor, cmd_pars=cmd_pars, UUID=UUID)
|
|
841
944
|
|
|
842
945
|
# Make the impedance plots
|
|
843
946
|
if result == 0 or result == 95:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 1
|
|
2
|
+
Name: pySIMsalabim
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Home-page: https://github.com/kostergroup/pySIMsalabim
|
|
5
|
-
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.tar.gz
|
|
5
|
+
Download-URL: https://github.com/kostergroup/pySIMsalabim/v1.01.tar.gz
|
|
6
6
|
Author: Vincent M. Le Corre, Sander Heester, L. Jan Anton Koster
|
|
7
7
|
Author-email:
|
|
8
8
|
License: GPLv3
|
|
@@ -26,7 +26,7 @@ Provides-Extra: dev
|
|
|
26
26
|
Requires-Dist: pytest; extra == "dev"
|
|
27
27
|
Requires-Dist: twine; extra == "dev"
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# pySIMsalabim
|
|
30
30
|
|
|
31
31
|
## Description
|
|
32
32
|
**pySIMsalabim** is a Python package used to interface drift-diffusion simulator [SIMsalabim](https://github.com/kostergroup/SIMsalabim) with Python. It provides many useful tools to set up and run simulations, as well as to analyze and visualize the results.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
|
-
pySIMSalabim.egg-info/PKG-INFO
|
|
5
|
-
pySIMSalabim.egg-info/SOURCES.txt
|
|
6
|
-
pySIMSalabim.egg-info/dependency_links.txt
|
|
7
|
-
pySIMSalabim.egg-info/requires.txt
|
|
8
|
-
pySIMSalabim.egg-info/top_level.txt
|
|
9
4
|
pySIMsalabim/__init__.py
|
|
5
|
+
pySIMsalabim.egg-info/PKG-INFO
|
|
6
|
+
pySIMsalabim.egg-info/SOURCES.txt
|
|
7
|
+
pySIMsalabim.egg-info/dependency_links.txt
|
|
8
|
+
pySIMsalabim.egg-info/requires.txt
|
|
9
|
+
pySIMsalabim.egg-info/top_level.txt
|
|
10
10
|
pySIMsalabim/aux_funcs/SCLC_funcs.py
|
|
11
11
|
pySIMsalabim/aux_funcs/__init__.py
|
|
12
12
|
pySIMsalabim/aux_funcs/addons.py
|
|
@@ -4,8 +4,8 @@ with open("README.md", "r") as fh:
|
|
|
4
4
|
long_description = fh.read()
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
|
-
name="
|
|
8
|
-
version="v1",
|
|
7
|
+
name="pySIMsalabim", # Replace with your own username
|
|
8
|
+
version="v1.01",
|
|
9
9
|
author="Vincent M. Le Corre, Sander Heester, L. Jan Anton Koster",
|
|
10
10
|
author_email="",
|
|
11
11
|
description="",
|
|
@@ -13,7 +13,7 @@ setuptools.setup(
|
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
14
|
license='GPLv3',
|
|
15
15
|
url="https://github.com/kostergroup/pySIMsalabim",
|
|
16
|
-
download_url="https://github.com/kostergroup/pySIMsalabim/v1.tar.gz",
|
|
16
|
+
download_url="https://github.com/kostergroup/pySIMsalabim/v1.01.tar.gz",
|
|
17
17
|
packages=setuptools.find_packages(),
|
|
18
18
|
readme = "README.md",
|
|
19
19
|
keywords=['Drift-diffusion', 'semiconductor', 'solar cells'],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/dependency_links.txt
RENAMED
|
File without changes
|
{pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/requires.txt
RENAMED
|
File without changes
|
{pysimsalabim-1/pySIMSalabim.egg-info → pysimsalabim-1.1/pySIMsalabim.egg-info}/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|