-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
…empty list
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,15 +31,17 @@ def _G(e, HC, elec_idx, SE, mode='DOS'): | |
GF = np.zeros([len(e), no], dtype=np.complex128) | ||
elif mode == 'Full': | ||
GF = np.zeros([len(e), no, no], dtype=np.complex128) | ||
|
||
# This if statement overcomes cases where there are no electrodes | ||
if np.array(SE).shape == (0,): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zerothi
Collaborator
|
||
SE = [SE] | ||
for ie, e_i in enumerate(e): | ||
inv_GF = e_i * np.identity(no) - HC | ||
for idx, se in zip(elec_idx, SE[ie]): | ||
inv_GF[idx, idx.T] -= se | ||
if mode == 'DOS': | ||
GF[ie] = np.linalg.inv(inv_GF)[np.arange(no), np.arange(no)] | ||
elif mode == 'Full': | ||
GF[ie] = np.linalg.inv(inv_GF) | ||
if mode == 'DOS': | ||
GF[ie] = np.linalg.inv(inv_GF)[np.arange(no), np.arange(no)] | ||
elif mode == 'Full': | ||
GF[ie] = np.linalg.inv(inv_GF) | ||
return GF | ||
|
||
|
||
|
This will fail if you have multiple electrodes with different sizes, also it is quite costly since it doubles SE memory consumption. Instead, wouldn't just checking for Se length be enough?