Skip to content

Commit

Permalink
Remove loop over oeprators for faster RIXS
Browse files Browse the repository at this point in the history
  • Loading branch information
mretegan committed Jun 8, 2018
1 parent 9130875 commit d4d3192
Show file tree
Hide file tree
Showing 21 changed files with 420 additions and 243 deletions.
3 changes: 0 additions & 3 deletions crispy/gui/quanty.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,8 +1334,6 @@ def plot(self):
data = np.zeros_like(data)

if 'RIXS' in self.calculation.experiment:
# Keep the aspect ratio for RIXS plots.
# self.getPlotWidget().setKeepDataAspectRatio(flag=True)
self.getPlotWidget().setGraphXLabel('Incident Energy (eV)')
self.getPlotWidget().setGraphYLabel('Energy Transfer (eV)')

Expand Down Expand Up @@ -1375,7 +1373,6 @@ def plot(self):
z, origin=origin, scale=scale, reset=False)

else:
# self.getPlotWidget().setKeepDataAspectRatio(flag=False)
self.getPlotWidget().setGraphXLabel('Absorption Energy (eV)')
self.getPlotWidget().setGraphYLabel(
'Absorption Cross Section (a.u.)')
Expand Down
33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s2p_C3v.lua
Original file line number Diff line number Diff line change
Expand Up @@ -445,22 +445,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s2p_D4h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -597,22 +597,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s2p_Oh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -551,22 +551,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s2p_Td.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,22 +432,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_2p_1s, Ty_2p_1s, Tz_2p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s3p_C3v.lua
Original file line number Diff line number Diff line change
Expand Up @@ -445,22 +445,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s3p_D4h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -597,22 +597,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s3p_Oh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -551,22 +551,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

33 changes: 21 additions & 12 deletions crispy/resources/modules/quanty/templates/3d_1s3p_Td.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,22 +432,31 @@ NE2 = $NE2

G = 0

totalCalculations = 5 * 3 * #Psis_i
totalCalculations = #Psis_i
calculation = 1

for i, Psi in ipairs(Psis_i) do
for j, T_in in ipairs({Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}) do
for k, T_out in ipairs({Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}) do
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, T_in, T_out, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end
io.write(string.format('Running calculation %d of %d.\n', calculation, totalCalculations))
if CalculationRestrictions == nil then
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}}) * dZ[i]
else
G = G + CreateResonantSpectra(H_m, H_f, {Txy_1s_3d, Txz_1s_3d, Tyz_1s_3d, Tx2y2_1s_3d, Tz2_1s_3d}, {Tx_3p_1s, Ty_3p_1s, Tz_3p_1s}, Psi, {{'Emin1', Emin1}, {'Emax1', Emax1}, {'NE1', NE1}, {'Gamma1', Gamma1}, {'Emin2', Emin2}, {'Emax2', Emax2}, {'NE2', NE2}, {'Gamma2', Gamma2}, {'restrictions1', CalculationRestrictions}}) * dZ[i]
end
calculation = calculation + 1
end

Gtot = 0
ishift = 0

-- The number of operators in times the number of operators out.
for i = 1, 5 * 3 do
Indices = {}
for i = 1, NE1 + 1 do
table.insert(Indices, i + ishift)
end
Gtot = Gtot + Spectra.Element(G, Indices)
ishift = ishift + NE1 + 1
end

G.Print({{'file', '$BaseName.spec'}})
Gtot.Print({{'file', '$BaseName.spec'}})

Loading

0 comments on commit d4d3192

Please sign in to comment.