iDEA package

Submodules

Module contents

iDEA.utilities module

Contains many utilities useful for efficient iDEA usage.

class iDEA.utilities.ArrayPlaceholder[source]

Bases: object

Array Placeholder.

class iDEA.utilities.Container[source]

Bases: object

Empty container.

class iDEA.utilities.Experiment[source]

Bases: Container

Container to hold all results, quantities and definitions for an experiment.

iDEA.utilities.load_experiment(file_name: str) Experiment[source]

Load an experiment from an experiment file.

Args:
file_name: str, file name.
Returns
experiment: iDEA.utilities.Experiment, Loaded Experiment object.
iDEA.utilities.save_experiment(experiment: Experiment, file_name: str) None[source]

Save an experiment to an experiment file.

Args:
experiment: iDEA.utilities.Experiment, Experiment object to save.
file_name: str, file name.

iDEA.interactions module

Contains some pre-defined electron-electron interations

iDEA.interactions.softened_interaction(x: ndarray, strength: float = 1.0, softening: float = 1.0) ndarray[source]

Constructs the softened interaction potential.

\[v_\mathrm{int}(x,x') = \frac{s}{|x-x'| + a}\]
Args:
x: np.ndarray, x grid.
strength: float, Strength of the interaction .. math:: s. (default = 1.0)
softening: float, Softening parameter of the interaction .. math:: a. (default = 1.0)
Returns:
v_int: np.ndarray, Softened interaction potential on x grid of the System.
iDEA.interactions.softened_interaction_alternative(x: ndarray, strength: float = 1.0, softening: float = 1.0) ndarray[source]

Constructs the alternative softened interaction potential.

\[v_\mathrm{int}(x,x') = \frac{s}{{(\sqrt{x-x'} + a)}^{2}}\]
Args:
x: np.ndarray, x grid.
strength: float, Strength of the interaction .. math:: s. (default = 1.0)
softening: float, Softening parameter of the interaction .. math:: a. (default = 1.0)
Returns:
v_int: np.ndarray, Softened interaction potential on x grid of the System.

iDEA.system module

Contains all functionality to define and manage definitions of model systems.

class iDEA.system.System(x: ndarray, v_ext: ndarray, v_int: ndarray, electrons: str, stencil: int = 13)[source]

Bases: object

Model system, containing all defining properties.

check()[source]

Performs checks on system properties. Raises AssertionError if any check fails.

property dx
property electrons
property x
iDEA.system.load_system(file_name: str) System[source]

Load a system from an system file.

Args:
file_name: str, file name.
Returns
system: iDEA.system.System, Loaded System object.
iDEA.system.save_system(s: System, file_name: str) None[source]

Save a system to an system file.

Args:
system: iDEA.system.System, System object to save.
file_name: str, file name.

iDEA.state module

Defines the structures to describe the system states

class iDEA.state.Evolution[source]

Bases: ABC

Interface class representing a time-dependent evolution of a state.

class iDEA.state.ManyBodyEvolution(initial_state: ManyBodyState)[source]

Bases: Evolution

Time-dependent evolution of particles in a many-body state.

In addition to the arrays defined within the initial ManyBodyState, this state is described by three additional arrays:

td_space: np.ndarray, Spatial part of the wavefunction on the spatial grid psi(t,x_1,x_2,dots,x_N).
v_ptrb: np.ndarray, Perturbation potential that this time-dependence was driven by. indexed as v_ptrb[space] if static, and v_ptrb[time,space] if dynamic.
t: np.ndarray, Time grid used during evolution.
class iDEA.state.ManyBodyState(space: ndarray | None = None, spin: ndarray | None = None, full=None, energy=None)[source]

Bases: State

State of interacting particles.

class iDEA.state.SingleBodyEvolution(initial_state: SingleBodyState)[source]

Bases: Evolution

Time-dependent evolution of particles in a single-body state.

In addition to the arrays defined within the initial SingleBodyState, this state is described by four additional arrays:

up.td_orbitals: np.ndarray, Array of single-body time-dependend orbitals, indexed as orbitals[time,space,orbital_number].
down.td_orbital: np.ndarray, Array of single-body time-dependend orbitals, indexed as orbitals[time,space,orbital_number].
v_ptrb: np.ndarray, Perturbation potential that this time-dependence was driven by. indexed as v_ptrb[space] if static, and v_ptrb[time,space] if dynamic.
t: np.ndarray, Time grid used during evolution.

In this case, only the occupied time-dependent orbitals are stored, as only these are propigated.

class iDEA.state.SingleBodyState[source]

Bases: State

State of particles in a single-body state.

This is described by three arrays for each spin channel:

up.energies: np.ndarray, Array of single-body energies, indexed as energies[orbital_number].
up.orbitals: np.ndarray, Array of single-body orbitals, indexed as orbitals[space,orbital_number].
up.occupations: np.ndarray, Array of single-body occupations, indexed as occupations[orbital_number].
up.occupied: np.ndarray, Indices of up.occupations that are non-zero, to indicate occupied orbitals.
down.energies: np.ndarray, Array of single-body energies, indexed as energies[orbital_number].
down.orbitals: np.ndarray, Array of single-body orbitals, indexed as orbitals[space,orbital_number].
down.occupations: np.ndarray, Array of single-body occupations, indexed as occupations[orbital_number].
down.occupied: np.ndarray, Indices of down.occupations that are non-zero, to indicate occupied orbitals.
class iDEA.state.State[source]

Bases: ABC

Interface class representing a static state.

iDEA.observables module

iDEA.observables.density(s: System, state: SingleBodyState | ManyBodyState | None = None, evolution: SingleBodyEvolution | ManyBodyEvolution | None = None, time_indices: ndarray | None = None, return_spins: bool = False) ndarray[source]

Compute the charge density of a non_interacting state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState or iDEA.state.ManyBodyState, State. (default = None)
evolution: iDEA.state.SingleBodyEvolution or iDEA.state.ManyBodyEvolution, Evolution. (default = None)
time_indices: np.ndarray, Time indices to compute observable if given evolution. If None will perform for all time indices. (default = None)
return_spins: bool, True to also return the spin densities: total, up, down. (default = False)
Returns:
n: np.ndarray, Charge density, or evolution of charge density.
iDEA.observables.density_matrix(s: System, state: SingleBodyState | ManyBodyState | None = None, evolution: SingleBodyEvolution | ManyBodyEvolution | None = None, time_indices: ndarray | None = None, return_spins: bool = False) ndarray[source]

Compute the charge density matrix of a non_interacting state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState or iDEA.state.ManyBodyState, State. (default = None)
evolution: iDEA.state.SingleBodyEvolution or iDEA.state.ManyBodyEvolution, Evolution. (default = None)
time_indices: np.ndarray, Time indices to compute observable if given evolution. If None will perform for all time indices. (default = None)
return_spins: bool, True to also return the spin density matrices: total, up, down. (default = False)
Returns:
p: np.ndarray, Charge density matrix, or evolution of charge density matrix.
iDEA.observables.exchange_energy(s: System, p: ndarray, v_x: ndarray) float | ndarray[source]

Compute the exchange energy from a density matrix and exchange potential.

Args:
s: iDEA.system.System, System object.
p: np.ndarray, Density matrix of the system.
v_x: np.ndarray, Exchange potential of the system.
Returns:
E_x: float or np.ndarray, Exchange energy, or evolution of exchange energy.
iDEA.observables.exchange_potential(s: System, p: ndarray) ndarray[source]

Compute the exchange potential from a density matrix.

Args:
s: iDEA.system.System, System object.
p: np.ndarray, Density matrix of the system.
Returns:
v_x: np.ndarray, Exchange potential, or evolution of exchange potential.
iDEA.observables.external_energy(s: System, n: ndarray, v_ext: ndarray) float | ndarray[source]

Compute the external energy from a density and external potential.

Args: | s: iDEA.system.System, System object. | n: np.ndarray, Charge density of the system. | v_ext: np.ndarray, External potential of the system.

Returns: | E_ext: float or np.ndarray, External energy, or evolution of external energy.

iDEA.observables.external_potential(s: System) ndarray[source]

Compute the external potential.

Args:
s: iDEA.system.System, System object.
Returns:
v_ext: np.ndarray, External potential of the system.
iDEA.observables.hartree_energy(s: System, n: ndarray, v_h: ndarray) float | ndarray[source]

Compute the Hartree energy from a density and Hartree potential.

Args:
s: iDEA.system.System, System object.
n: np.ndarray, Charge density of the system.
v_h: np.ndarray, Hartree potential of the system.
Returns:
E_h: float or np.ndarray, Hartree energy, or evolution of Hartree energy.
iDEA.observables.hartree_potential(s: System, n: ndarray) ndarray[source]

Compute the Hartree potential from a density.

Args:
s: iDEA.system.System, System object.
n: np.ndarray, Charge density of the system.
Returns:
v_h: np.ndarray, Hartree potential, or evolution of Hartree potential.
iDEA.observables.kinetic_energy(s: System, state: SingleBodyState | None = None, evolution: SingleBodyEvolution | None = None) float | ndarray[source]

Compute the kinetic energy of a non_interacting state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
evolution: iDEA.state.SingleBodyEvolution, Evolution. (default = None)
Returns:
E_k: float or np.ndarray, Kinetic energy, or evolution of kinetic energy.
iDEA.observables.observable(s: System, observable_operator: ndarray, state: SingleBodyState | ManyBodyState | None = None, evolution: SingleBodyEvolution | ManyBodyEvolution | None = None, return_spins: bool = False) float | ndarray[source]

Compute an observable based on a given operator and state or evolution.

Args:
s: iDEA.system.System, System object.
observable_operator: np.ndarray, Obserbable operator.
state: iDEA.state.SingleBodyState or iDEA.state.ManyBodyState, State. (default = None)
evolution: iDEA.state.SingleBodyEvolution or iDEA.state.ManyBodyEvolution, Evolution. (default = None)
return_spins: bool, True to also return the spin observables: total, up, down. (default = False)
Returns:
observable: float or np.ndarray, Observable.
iDEA.observables.single_particle_energy(s: System, state: SingleBodyState) float[source]

Compute the single particle energy of a single particle state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State.
Returns:
E: float, Single particle energy.

iDEA.methods module

class iDEA.methods.Methods(value)[source]

Bases: Enum

An enumeration.

HARTREE = 3
HARTREE_FOCK = 4
HYBRID = 6
INTERACTING = 1
KSSCE = 7
LDA = 5
NON_INTERACTING = 2

iDEA.methods.interacting module

Contains all interacting functionality and solvers.

iDEA.methods.interacting.antisymmetrize(s, spaces, spins, energies)[source]

Antisymmetrize the solution to the Schrodinger equation.

Args:
s: iDEA.system.System, System object.
spaces: np.ndarray, Spatial parts of the wavefunction.
spins: np.ndarray, Spin parts of the wavefunction.
energies: np.ndarray, Energies.
Returns:
fulls: np.ndarray, Full anantisymmetrized wavefunction.
spaces: np.ndarray, Spatial parts of the wavefunction.
spins: np.ndarray, Spin parts of the wavefunction.
energies: np.ndarray, Energies.
iDEA.methods.interacting.external_potential_operator(s: System) dia_matrix[source]

Compute many-particle external potential energy operator as a matrix.

Args:
s: iDEA.system.System, System object.
Returns:
Vext: sps.dia_matrix, External potential operator.
iDEA.methods.interacting.hamiltonian(s: System) dia_matrix[source]

Compute the many-body Hamiltonian.

Args:
s: iDEA.system.System, System object.
Returns:
H: sps.dia_matrix, Hamiltonian.
iDEA.methods.interacting.kinetic_energy_operator(s: System) dia_matrix[source]

Compute many-particle kinetic energy operator as a matrix.

This is built using a given number of finite differences to represent the second derivative. The number of differences taken is defined in s.stencil.

Args:
s: iDEA.system.System, System object.
Returns:
K: sps.dia_matrix, Kintetic energy operator.
iDEA.methods.interacting.propagate(s: System, state: ManyBodyState, v_ptrb: ndarray, t: ndarray, H: dia_matrix | None = None) ManyBodyEvolution[source]

Propagate a many body state forward in time due to a local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.ManyBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
H: np.ndarray, Static Hamiltonian [If None this will be computed from s]. (default = None)
Returns:
evolution: iDEA.state.ManyBodyEvolution, Solved time-dependent evolution.
iDEA.methods.interacting.propagate_step(s: System, evolution: ManyBodyEvolution, H: dia_matrix, v_ptrb: ndarray, j: int, dt: float, objs: tuple) ManyBodyEvolution[source]

Propagate a many body state forward in time, one time-step, due to a local pertubation.

Args:
s: iDEA.system.System, System object.
evolution: iDEA.state.ManyBodyEvolution, time-dependent evolution.
H: np.ndarray, Static Hamiltonian [If None this will be computed from s]. (default = None)
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
j: int, Time index.
dt: float, Time-step.
objs: tuple. Tuple of objects needed to construct many-body operator (I, generate_terms).
Returns:
evolution: iDEA.state.ManyBodyEvolution, time-dependent evolution one time-step evolved.
iDEA.methods.interacting.solve(s: System, H: ndarray | None = None, k: int = 0, level=None) ManyBodyState[source]

Solves the interacting Schrodinger equation of the given system.

Args:
s: iDEA.system.System, System object.
H: np.ndarray, Hamiltonian [If None this will be computed from s]. (default = None)
k: int, Energy state to solve for. (default = 0, the ground-state)
level: int. Max level of excitation to use when solving the Schrodinger equation.
Returns:
state: iDEA.state.ManyBodyState, Solved state.
iDEA.methods.interacting.total_energy(s: System, state: ManyBodyState) float[source]

Compute the total energy of an interacting state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.ManyBodyState, State.
Returns:
E: float, Total energy.

iDEA.methods.non_interacting module

Contains all non-interacting functionality and solvers.

iDEA.methods.non_interacting.add_occupations(s: System, state: SingleBodyState, k: int) SingleBodyState[source]

Calculate the occpuations of a state in a given energy excitation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State.
k: int, Excitation state [k = 0 is the ground-state].
Returns:
state: iDEA.state.SingleBodyState, State with occupations added.
iDEA.methods.non_interacting.external_potential_operator(s: System) ndarray[source]

Compute the external potential operator.

Args:
s: iDEA.system.System, System object.
Returns:
Vext: np.ndarray, External potential energy operator.
iDEA.methods.non_interacting.hamiltonian(s: System, up_n: ndarray | None = None, down_n: ndarray | None = None, up_p: ndarray | None = None, down_p: ndarray | None = None, K: ndarray | None = None, Vext: ndarray | None = None) ndarray[source]

Compute the Hamiltonian from the kinetic and potential terms.

Args:
s: iDEA.system.System, System object.
up_n: np.ndarray, Charge density of up electrons.
down_n: np.ndarray, Charge density of down electrons.
up_p: np.ndarray, Charge density matrix of up electrons.
down_p: np.ndarray, Charge density matrix of down electrons.
K: np.ndarray, Single-particle kinetic energy operator [If None this will be computed from s]. (default = None)
Vext: np.ndarray, Potential energy operator [If None this will be computed from s]. (default = None)
Returns:
H: np.ndarray, Hamiltonian, up Hamiltonian, down Hamiltonian.
iDEA.methods.non_interacting.kinetic_energy_operator(s: System) ndarray[source]

Compute single-particle kinetic energy operator as a matrix.

This is built using a given number of finite differences to represent the second derivative. The number of differences taken is defined in s.stencil.

Args:
s: iDEA.system.System, System object.
Returns:
K: np.ndarray, Kintetic energy operator.
iDEA.methods.non_interacting.propagate(s: System, state: SingleBodyState, v_ptrb: ndarray, t: ndarray, hamiltonian_function: Callable | None = None, restricted: bool = False, name: str = 'non_interacting', **kwargs) SingleBodyEvolution[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values. n
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
name: str, Name of method. (default = “non_interacting”)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
iDEA.methods.non_interacting.propagate_step(s: System, evolution: SingleBodyEvolution, j: int, hamiltonian_function: Callable, v_ptrb: ndarray, dt: float, restricted: bool, **kwargs)[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
evolution: iDEA.state.SingleBodyEvolution, Time-dependent evolution.
j: int, Time index to step to.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
dt: float, Timestep.
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Time-dependent evolution solved at time index j from j-1.
iDEA.methods.non_interacting.sc_step(s: System, state: SingleBodyState, up_H: ndarray, down_H: ndarray)[source]

Performs a single step of the self-consistent cycle.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, Previous state.
up_H: np.ndarray, Hamiltonian for up electrons.
down_H: np.ndarray, Hamiltonian for down electrons.
Returns:
state: iDEA.state.SingleBodyState, New state.
iDEA.methods.non_interacting.solve(s: System, hamiltonian_function: Callable | None = None, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple | None = None, name: str = 'non_interacting', silent: bool = False, **kwargs) SingleBodyState[source]

Solves the Schrodinger equation for the given system.

Args:
s: iDEA.system.System, System object.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
k: int, Energy state to solve for. (default = 0, the ground-state)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
mixing: float, Mixing parameter. (default = 0.5)
tol: float, Tollerance of convergence. (default = 1e-10)
initial: tuple. Tuple of initial values used to begin the self-consistency (n, up_n, down_n, p, up_p, down_p). (default = None)
name: str, Name of method. (default = “non_interacting”)
silent: bool, Set to true to prevent printing. (default = False)
Returns:
state: iDEA.state.SingleBodyState, Solved state.
iDEA.methods.non_interacting.total_energy(s: System, state: SingleBodyState) float[source]

Compute the total energy of a non_interacting state.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
Returns:
E: float, Total energy.

iDEA.methods.hartree

Contains all Hartree functionality and solvers.

iDEA.methods.hartree.hamiltonian(s: System, up_n: ndarray, down_n: ndarray, up_p: ndarray, down_p: ndarray, K: ndarray | None = None, Vext: ndarray | None = None) ndarray[source]

Compute the Hamiltonian from the kinetic and potential terms.

Args:
s: iDEA.system.System, System object.
up_n: np.ndarray, Charge density of up electrons.
down_n: np.ndarray, Charge density of down electrons.
up_p: np.ndarray, Charge density matrix of up electrons.
down_p: np.ndarray, Charge density matrix of down electrons.
K: np.ndarray, Single-particle kinetic energy operator [If None this will be computed from s]. (default = None)
Vext: np.ndarray, Potential energy operator [If None this will be computed from s]. (default = None)
Returns:
H: np.ndarray, Hamiltonian, up Hamiltonian, down Hamiltonian.
iDEA.methods.hartree.hartree_potential_operator(s: System, n: ndarray) ndarray[source]

Compute the Hartree potential operator.

Args:
s: iDEA.system.System, System object.
n: np.ndarray, Charge density.
Returns:
Vh: np.ndarray, Hartree potential energy operator.
iDEA.methods.hartree.propagate(s: System, state: SingleBodyState, v_ptrb: ndarray, t: ndarray, hamiltonian_function: Callable | None = None, restricted: bool = False) SingleBodyEvolution[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
iDEA.methods.hartree.solve(s: System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple | None = None, silent: bool = False) SingleBodyState[source]

Solves the Schrodinger equation for the given system.

Args:
s: iDEA.system.System, System object.
k: int, Energy state to solve for. (default = 0, the ground-state)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
mixing: float, Mixing parameter. (default = 0.5)
tol: float, Tollerance of convergence. (default = 1e-10)
initial: tuple. Tuple of initial values used to begin the self-consistency (n, up_n, down_n, p, up_p, down_p). (default = None)
silent: bool, Set to true to prevent printing. (default = False)
Returns:
state: iDEA.state.SingleBodyState, Solved state.
iDEA.methods.hartree.total_energy(s: System, state: SingleBodyState) float[source]

Compute the total energy.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
Returns:
E: float, Total energy.

iDEA.methods.hartree_fock module

Contains all Hartree Fock functionality and solvers.

iDEA.methods.hartree_fock.exchange_potential_operator(s: System, p: ndarray) ndarray[source]

Compute the exchange potential operator.

Args:
s: iDEA.system.System, System object.
p: np.ndarray, Charge density matrix.
Returns:
Vx: np.ndarray, Exchange potential energy operator.
iDEA.methods.hartree_fock.hamiltonian(s: System, up_n: ndarray, down_n: ndarray, up_p: ndarray, down_p: ndarray, K: ndarray | None = None, Vext: ndarray | None = None) ndarray[source]

Compute the Hamiltonian from the kinetic and potential terms.

Args:
s: iDEA.system.System, System object.
up_n: np.ndarray, Charge density of up electrons.
down_n: np.ndarray, Charge density of down electrons.
up_p: np.ndarray, Charge density matrix of up electrons.
down_p: np.ndarray, Charge density matrix of down electrons.
K: np.ndarray, Single-particle kinetic energy operator [If None this will be computed from s]. (default = None)
Vext: np.ndarray, Potential energy operator [If None this will be computed from s]. (default = None)
Returns:
H: np.ndarray, Hamiltonian, up Hamiltonian, down Hamiltonian.
iDEA.methods.hartree_fock.propagate(s: System, state: SingleBodyState, v_ptrb: ndarray, t: ndarray, hamiltonian_function: Callable | None = None, restricted: bool = False) SingleBodyEvolution[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
iDEA.methods.hartree_fock.solve(s: System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple | None = None, silent: bool = False) SingleBodyState[source]

Solves the Schrodinger equation for the given system.

Args:
s: iDEA.system.System, System object.
k: int, Energy state to solve for. (default = 0, the ground-state)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
mixing: float, Mixing parameter. (default = 0.5)
tol: float, Tollerance of convergence. (default = 1e-10)
initial: tuple. Tuple of initial values used to begin the self-consistency (n, up_n, down_n, p, up_p, down_p). (default = None)
silent: bool, Set to true to prevent printing. (default = False)
Returns:
state: iDEA.state.SingleBodyState, Solved state.
iDEA.methods.hartree_fock.total_energy(s: System, state: SingleBodyState) float[source]

Compute the total energy.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
Returns:
E: float, Total energy.

iDEA.methods.lda module

Contains all LDA functionality and solvers.

class iDEA.methods.lda.HEG[source]

Bases: object

Class to hold parameters fitted from 1D HEG.

a = -1.1511
b = 3.344
c = -9.7079
d = 19.088
e = -20.896
ec_lda = {'spin_polerised': {'a': 0.0009415195, 'b': 0.2601, 'c': 0.06404, 'd': 0.000248, 'e': 2.61e-06, 'f': 1.254, 'g': 28.8}}
eps = {'a': -1.1511, 'b': 3.344, 'c': -9.7079, 'd': 19.088, 'e': -20.896, 'f': 9.4861, 'g': 0.73586}
ex_lda = {'spin_polerised': {'a': -1.1511, 'b': 3.344, 'c': -9.7079, 'd': 19.088, 'e': -20.896, 'f': 9.4861, 'g': 0.73586}}
f = 9.4861
g = 0.73586
vx_lda = {'spin_polerised': {'a': -1.998148446, 'b': 9.14871584, 'c': -36.267355294, 'd': 90.39809568, 'e': -119.85653056, 'f': 63.897041546, 'g': 0.73586}}
iDEA.methods.lda.exchange_correlation_energy(s: System, n: ndarray, separate: bool = False) ndarray[source]

Compute the LDA exchange-correlation energy from a density.

Args:
s: iDEA.system.System, System object.
n: np.ndarray, Charge density of the system.
seperate: bool, Set to True to return E_xc, E_x, E_c.
Returns:
E_xc: np.ndarray, Exchange correlation energy, or evolution of exchange correlation energy.
iDEA.methods.lda.exchange_correlation_potential(s: System, n: ndarray, separate: bool = False) ndarray[source]

Compute the LDA exchange-correlation potential from a density.

Args:
s: iDEA.system.System, System object.
n: np.ndarray, Charge density of the system.
seperate: bool, Set to True to return v_xc, v_x, v_c.
Returns:
v_xc: np.ndarray, Exchange correlation potential, or evolution of exchange correlation potential.
iDEA.methods.lda.exchange_correlation_potential_operator(s: System, n: ndarray) ndarray[source]

Compute the exchange potential operator.

Args;
s: iDEA.system.System, System object.
n: np.ndarray, Charge density of the system.
Returns:
Vxc: np.ndarray, Exchange correlation potential energy operator.
iDEA.methods.lda.hamiltonian(s: System, up_n: ndarray, down_n: ndarray, up_p: ndarray, down_p: ndarray, K: ndarray | None = None, Vext: ndarray | None = None) ndarray[source]

Compute the Hamiltonian from the kinetic and potential terms.

Args:
s: iDEA.system.System, System object.
up_n: np.ndarray, Charge density of up electrons.
down_n: np.ndarray, Charge density of down electrons.
up_p: np.ndarray, Charge density matrix of up electrons.
down_p: np.ndarray, Charge density matrix of down electrons.
K: np.ndarray, Single-particle kinetic energy operator [If None this will be computed from s]. (default = None)
Vext: np.ndarray, Potential energy operator [If None this will be computed from s]. (default = None)
Returns:
H: np.ndarray, Hamiltonian, up Hamiltonian, down Hamiltonian.
iDEA.methods.lda.propagate(s: System, state: SingleBodyState, v_ptrb: ndarray, t: ndarray, hamiltonian_function: Callable | None = None, restricted: bool = False) SingleBodyEvolution[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
iDEA.methods.lda.solve(s: System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple | None = None, silent: bool = False) SingleBodyState[source]

Solves the Schrodinger equation for the given system.

Args:
s: iDEA.system.System, System object.
k: int, Energy state to solve for. (default = 0, the ground-state)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
mixing: float, Mixing parameter. (default = 0.5)
tol: float, Tollerance of convergence. (default = 1e-10)
initial: tuple. Tuple of initial values used to begin the self-consistency (n, up_n, down_n, p, up_p, down_p). (default = None)
silent: bool, Set to true to prevent printing. (default = False)
Returns:
state: iDEA.state.SingleBodyState, Solved state.
iDEA.methods.lda.total_energy(s: System, state: SingleBodyState) float[source]

Compute the total energy.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
Returns:
E: float, Total energy.

iDEA.methods.hybrid

Contains all Hartree Fock functionality and solvers.

iDEA.methods.hybrid.hamiltonian(s: System, up_n: ndarray, down_n: ndarray, up_p: ndarray, down_p: ndarray, K: ndarray | None = None, Vext: ndarray | None = None, **kwargs) ndarray[source]

Compute the Hamiltonian from the kinetic and potential terms.

Args:
s: iDEA.system.System, System object.
up_n: np.ndarray, Charge density of up electrons.
down_n: np.ndarray, Charge density of down electrons.
up_p: np.ndarray, Charge density matrix of up electrons.
down_p: np.ndarray, Charge density matrix of down electrons.
K: np.ndarray, Single-particle kinetic energy operator [If None this will be computed from s]. (default = None)
Vext: np.ndarray, Potential energy operator [If None this will be computed from s]. (default = None)
alpha: float, Value used to mix the Hartree and LDA potentials.
Returns:
H: np.ndarray, Hamiltonian, up Hamiltonian, down Hamiltonian.
iDEA.methods.hybrid.propagate(s: System, state: SingleBodyState, v_ptrb: ndarray, t: ndarray, hamiltonian_function: Callable | None = None, restricted: bool = False, alpha: float = 0.8) SingleBodyEvolution[source]

Propagate a set of orbitals forward in time due to a dynamic local pertubation.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State to be propigated.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
alpha: float, Value used to mix the Hartree and LDA potentials. (default = 0.8)
Returns:
evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
iDEA.methods.hybrid.solve(s: System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple | None = None, silent: bool = False, alpha: float = 0.8) SingleBodyState[source]

Solves the Schrodinger equation for the given system.

Args:
s: iDEA.system.System, System object.
k: int, Energy state to solve for. (default = 0, the ground-state)
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
mixing: float, Mixing parameter. (default = 0.5)
tol: float, Tollerance of convergence. (default = 1e-10)
initial: tuple. Tuple of initial values used to begin the self-consistency (n, up_n, down_n, p, up_p, down_p). (default = None)
silent: bool, Set to true to prevent printing. (default = False)
alpha: float, Value used to mix the Hartree and LDA potentials. (default = 0.8)
Returns:
state: iDEA.state.SingleBodyState, Solved state.
iDEA.methods.hybrid.total_energy(s: System, state: SingleBodyState, alpha: float = 0.8) float[source]

Compute the total energy.

Args:
s: iDEA.system.System, System object.
state: iDEA.state.SingleBodyState, State. (default = None)
alpha: float, Value used to mix the Hartree and LDA potentials. (default = 0.8)
Returns:
E: float, Total energy.

iDEA.reverse_engineering module

Contains all reverse-engineering functionality.

iDEA.reverse_engineering.reverse(s: System, target_n: ndarray, method: Container, v_guess: ndarray | None = None, mu: float = 1.0, pe: float = 0.1, tol: float = 1e-12, silent: bool = False, **kwargs) State[source]

Determines what ficticious system is needed for a given method, when solving the system, to produce a given target density. If the given target density is from solving the interacting electron problem (iDEA.methods.interacting), and the method is the non-interacting electron solver (iDEA.methods.non_interacting) the output is the Kohn-Sham system.

The iterative method used is defined by the following formula: .. math:: mathrm{V}_mathrm{ext} rightarrow mu * (mathrm{n}^p - mathrm{target_n}^p)

Args:
s: iDEA.system.System, System object.
target_n: np.ndarray, Target density to reverse engineer.
method: Container, The method used to solve the system.
v_guess: np.ndarray, The initial guess of the fictitious potential. (default = None)
mu: float = 1.0, Reverse engineering parameter mu. (default = 1.0)
pe: float = 0.1, Reverse engineering parameter p. (default = 0.1)
tol: float, Tollerance of convergence. (default = 1e-12)
silent: bool, Set to true to prevent printing. (default = False)
kwargs: Other arguments that will be given to the method’s solve function.
Returns:
s_fictitious: iDEA.system.System, fictitious system object.
iDEA.reverse_engineering.reverse_propagation(s_fictitious: System, state_fictitious: State, target_n: ndarray, method: Container, v_ptrb: ndarray, t: ndarray, restricted: bool = False, tol: float = 1e-10, **kwargs) Evolution[source]

Determines what ficticious evolution is needed for a given method, when solving the system, to produce a given time dependent target density. If the given target density is from solving the interacting electron problem (iDEA.methods.interacting), and the method is the non-interacting electron solver (iDEA.methods.non_interacting) the output is the Kohn-Sham system.

Args:
s_fictitious: iDEA.system.System, System object.
state_fictitious: iDEA.state.State, Fictitious initial state.
target_n: np.ndarray, Target density to reverse engineer.
method: Container, The method used to solve the system.
v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
t: np.ndarray, Grid of time values.
restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default = False)
tol: float, Tollerance of convergence. (default = 1e-10)
kwargs: Other arguments that will be given to the method’s solve function.
Returns:
evolution_fictitious, error: iDEA.system.Evolution, fictitious evolution object along with time dependent error.