Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify M loading and support loading a smaller eph region than device #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions Inelastica/iets.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,30 @@ def IntegrityCheck(options, GF, NCfile):
sys.exit('Inelastica: Error - inconsistency detected for device region.\n')


def get_coupling(ncfile, ihw, ispin):
ihw = int(ihw)
dims = ncfile.dimensions
vars = ncfile.variables
norb = len(dims["norb"])
eph = N.arange(norb).reshape(-1, 1)
if "norb_eph" in dims:
eph = vars["eph_orbs_in_dev"][:].data.reshape(-1, 1)

dtype = complex if "ImHe_ph" in vars else float
M = N.zeros((norb, norb), dtype=dtype)
M.real[eph, eph.T] = vars['He_ph'][ihw, ispin, :, :]
if "ImHe_ph" not in vars:
print('Warning: Variable ImHe_ph not found')
else:
M.imag[eph, eph.T] = vars['ImHe_ph'][ihw, ispin, :, :]
return M


def calcTraces(options, GF1, GF2, basis, NCfile, ihw):
# Calculate various traces over the electronic structure
# Electron-phonon couplings
ihw = int(ihw)
M = N.array(NCfile.variables['He_ph'][ihw, options.iSpin, :, :], N.complex)
try:
M += 1.j*N.array(NCfile.variables['ImHe_ph'][ihw, options.iSpin, :, :], N.complex)
except:
print('Warning: Variable ImHe_ph not found')
M = get_coupling(NCfile, ihw, options.iSpin)
# Calculation of intermediate quantity
MARGLGM = MM.mm(M, GF1.ARGLG, M)
MARGLGM2 = MM.mm(M, GF2.ARGLG, M)
Expand Down Expand Up @@ -652,11 +667,7 @@ def writeFGRrates(options, GF, hw, NCfile):

for ihw in range(len(hw)):
SIO.printDone(ihw, len(hw), 'Golden Rate')
M = N.array(NCfile.variables['He_ph'][ihw, options.iSpin, :, :], N.complex)
try:
M += 1.j*N.array(NCfile.variables['ImHe_ph'][ihw, options.iSpin, :, :], N.complex)
except:
print('Warning: Variable ImHe_ph not found')
M = get_coupling(NCfile, ihw, options.iSpin)
rate = N.zeros((len(GF.ECleft), len(GF.ECright)), N.float)
totrate = 0.0
inter, intra = 0.0, 0.0 # splitting total rate in two
Expand Down