iDEA package¶
Submodules¶
Module contents¶
iDEA.utilities module¶
Contains many utilities useful for efficient iDEA usage.
-
class
iDEA.utilities.
Experiment
[source]¶ Bases:
iDEA.utilities.Container
Container to hold all results, quantities and definitions for an experiment.
-
iDEA.utilities.
load_experiment
(file_name: str) → iDEA.utilities.Experiment[source]¶ Load an experiment from an experiment file.
Args:file_name: str, file name.Returnsexperiment: iDEA.utilities.Experiment, Loaded Experiment object.
-
iDEA.utilities.
save_experiment
(experiment: iDEA.utilities.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.
raw_interaction
(x: numpy.ndarray, strength: float = 1.0) → numpy.ndarray[source]¶ Constructs the raw interaction potential.
\[v_\mathrm{int}(x,x') = \frac{s}{|x-x'| + 10^{-10}}\]Args:x: np.ndarray, x grid.strength: float, Strength of the interaction .. math:: s. (default = 1.0)Returns:v_int: np.ndarray, Softened interaction potential on x grid of the System.
-
iDEA.interactions.
softened_interaction
(x: numpy.ndarray, strength: float = 1.0, softening: float = 1.0) → numpy.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: numpy.ndarray, strength: float = 1.0, softening: float = 1.0) → numpy.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: numpy.ndarray, v_ext: numpy.ndarray, v_int: numpy.ndarray, electrons: str, stencil: int = 13)[source]¶ Bases:
object
Model system, containing all defining properties.
-
property
dx
¶
-
property
electrons
¶
-
property
x
¶
-
property
-
iDEA.system.
load_system
(file_name: str) → iDEA.system.System[source]¶ Load a system from an system file.
Args:file_name: str, file name.Returnssystem: iDEA.system.System, Loaded System object.
-
iDEA.system.
save_system
(s: iDEA.system.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.ABC
Interface class representing a time-dependent evolution of a state.
-
class
iDEA.state.
ManyBodyEvolution
(initial_state: iDEA.state.ManyBodyState)[source]¶ Bases:
iDEA.state.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: numpy.ndarray = None, spin: numpy.ndarray = None, full=None, energy=None)[source]¶ Bases:
iDEA.state.State
State of interacting particles.
-
class
iDEA.state.
SingleBodyEvolution
(initial_state: iDEA.state.SingleBodyState)[source]¶ Bases:
iDEA.state.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:
iDEA.state.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.
iDEA.observables module¶
-
iDEA.observables.
density
(s: iDEA.system.System, state: Union[iDEA.state.SingleBodyState, iDEA.state.ManyBodyState] = None, evolution: Union[iDEA.state.SingleBodyEvolution, iDEA.state.ManyBodyEvolution] = None, time_indices: numpy.ndarray = None, return_spins: bool = False) → numpy.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: iDEA.system.System, state: Union[iDEA.state.SingleBodyState, iDEA.state.ManyBodyState] = None, evolution: Union[iDEA.state.SingleBodyEvolution, iDEA.state.ManyBodyEvolution] = None, time_indices: numpy.ndarray = None, return_spins: bool = False) → numpy.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: iDEA.system.System, p: numpy.ndarray, v_x: numpy.ndarray) → Union[float, numpy.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: iDEA.system.System, p: numpy.ndarray) → numpy.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: iDEA.system.System, n: numpy.ndarray, v_ext: numpy.ndarray) → Union[float, numpy.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: iDEA.system.System) → numpy.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: iDEA.system.System, n: numpy.ndarray, v_h: numpy.ndarray) → Union[float, numpy.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: iDEA.system.System, n: numpy.ndarray) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState = None, evolution: iDEA.state.SingleBodyEvolution = None) → Union[float, numpy.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: iDEA.system.System, observable_operator: numpy.ndarray, state: Union[iDEA.state.SingleBodyState, iDEA.state.ManyBodyState] = None, evolution: Union[iDEA.state.SingleBodyEvolution, iDEA.state.ManyBodyEvolution] = None, return_spins: bool = False) → Union[float, numpy.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: iDEA.system.System, state: iDEA.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¶
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: iDEA.system.System) → scipy.sparse._dia.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: iDEA.system.System) → scipy.sparse._dia.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: iDEA.system.System) → scipy.sparse._dia.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: iDEA.system.System, state: iDEA.state.ManyBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, H: scipy.sparse._dia.dia_matrix = None) → iDEA.state.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: iDEA.system.System, evolution: iDEA.state.ManyBodyEvolution, H: scipy.sparse._dia.dia_matrix, v_ptrb: numpy.ndarray, j: int, dt: float, objs: tuple) → iDEA.state.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: iDEA.system.System, H: numpy.ndarray = None, k: int = 0, level=None) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, state: iDEA.state.SingleBodyState, k: int) → iDEA.state.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: iDEA.system.System) → numpy.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: iDEA.system.System, up_n: numpy.ndarray = None, down_n: numpy.ndarray = None, up_p: numpy.ndarray = None, down_p: numpy.ndarray = None, K: numpy.ndarray = None, Vext: numpy.ndarray = None) → numpy.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: iDEA.system.System) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, hamiltonian_function: collections.abc.Callable = None, restricted: bool = False, name: str = 'non_interacting', **kwargs) → iDEA.state.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. nhamiltonian_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: iDEA.system.System, evolution: iDEA.state.SingleBodyEvolution, j: int, hamiltonian_function: collections.abc.Callable, v_ptrb: numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, up_H: numpy.ndarray, down_H: numpy.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: iDEA.system.System, hamiltonian_function: collections.abc.Callable = None, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple = None, name: str = 'non_interacting', silent: bool = False, **kwargs) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, up_n: numpy.ndarray, down_n: numpy.ndarray, up_p: numpy.ndarray, down_p: numpy.ndarray, K: numpy.ndarray = None, Vext: numpy.ndarray = None) → numpy.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: iDEA.system.System, n: numpy.ndarray) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, hamiltonian_function: collections.abc.Callable = None, restricted: bool = False) → iDEA.state.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: iDEA.system.System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple = None, silent: bool = False) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, p: numpy.ndarray) → numpy.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: iDEA.system.System, up_n: numpy.ndarray, down_n: numpy.ndarray, up_p: numpy.ndarray, down_p: numpy.ndarray, K: numpy.ndarray = None, Vext: numpy.ndarray = None) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, hamiltonian_function: collections.abc.Callable = None, restricted: bool = False) → iDEA.state.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: iDEA.system.System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple = None, silent: bool = False) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, n: numpy.ndarray, separate: bool = False) → numpy.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: iDEA.system.System, n: numpy.ndarray, separate: bool = False) → numpy.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: iDEA.system.System, n: numpy.ndarray) → numpy.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: iDEA.system.System, up_n: numpy.ndarray, down_n: numpy.ndarray, up_p: numpy.ndarray, down_p: numpy.ndarray, K: numpy.ndarray = None, Vext: numpy.ndarray = None) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, hamiltonian_function: collections.abc.Callable = None, restricted: bool = False) → iDEA.state.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: iDEA.system.System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple = None, silent: bool = False) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, up_n: numpy.ndarray, down_n: numpy.ndarray, up_p: numpy.ndarray, down_p: numpy.ndarray, K: numpy.ndarray = None, Vext: numpy.ndarray = None, **kwargs) → numpy.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: iDEA.system.System, state: iDEA.state.SingleBodyState, v_ptrb: numpy.ndarray, t: numpy.ndarray, hamiltonian_function: collections.abc.Callable = None, restricted: bool = False, alpha: float = 0.8) → iDEA.state.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: iDEA.system.System, k: int = 0, restricted: bool = False, mixing: float = 0.5, tol: float = 1e-10, initial: tuple = None, silent: bool = False, alpha: float = 0.8) → iDEA.state.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: iDEA.system.System, state: iDEA.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: iDEA.system.System, target_n: numpy.ndarray, method: collections.abc.Container, v_guess: numpy.ndarray = None, mu: float = 1.0, pe: float = 0.1, tol: float = 1e-12, silent: bool = False, **kwargs) → iDEA.state.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: iDEA.system.System, state_fictitious: iDEA.state.State, target_n: numpy.ndarray, method: collections.abc.Container, v_ptrb: numpy.ndarray, t: numpy.ndarray, restricted: bool = False, tol: float = 1e-10, **kwargs) → iDEA.state.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.