Examples¶
- Included in the DFT_1d download is an example folder including several scripts
demonstrating possible uses of DFT_1d.
Hartree-Fock Self-Consistent Field Example¶
- Summary:
Generates Hartree-Fock (HF) a tabel from the [Baker2015] paper which includes Li atom and Li, Be, He, and H atoms.
-
examples.hf_scf_example.hf_scf_atom(grids, N_e, Z)[source]¶ - Example HF-SCF calculation for a 1D atom with
exponential interactions, see ext_potentials.exp_hydrogenic.
- Parameters
grids – grids: numpy array of grid points for evaluating 1d potential.
(num_grids –
) –
N_e – the number of electrons in the atom.
Z – the nuclear charge Z of the atom.
- Returns
HF-SCF solver class.
-
examples.hf_scf_example.get_latex_table_atoms(grids)[source]¶ Example Reproduce HF results in table 2 of [Baker2015].
- Parameters
grids – grids: numpy array of grid points for evaluating 1d potential.
(num_grids –
) –
- Prints:
copyable latex-formatted table.
Kohn-Sham DFT Example¶
- Summary:
Generates LDA DFT values from a tabel from the [Baker2015] paper which includes Li atom and Li, Be, He, and H atoms.
-
examples.ks_dft_example.lda_ks_dft_atom(grids, N_e, Z)[source]¶ - local density approximation (LDA) KS-DFT calculation for a 1D atom with
exponential interactions, see ext_potentials.exp_hydrogenic.
- Parameters
grids – grids: numpy array of grid points for evaluating 1d potential.
(num_grids –
) –
N_e – the number of electrons in the atom.
Z – the nuclear charge Z of the atom.
- Returns
KS-DFT solver class.
-
examples.ks_dft_example.get_latex_table_atoms(grids)[source]¶ Reproduce LDA results in table 2 of [Baker2015].
- Parameters
grids – grids: numpy array of grid points for evaluating 1d potential.
(num_grids –
) –
- Prints:
copyable latex-formatted table.
Poschl-Teller potentials¶
- Summary:
Calculates a system with two Poschl-Teller wells
-
examples.two_poschl_teller.get_plotting_params()[source]¶ Initialize figure for plots.
- Returns
a Figure object with initialized parameters. ax: an Axes object with initialized parameters.
- Return type
fig
-
examples.two_poschl_teller.plot_and_save(x_list, y_list, x_label, y_label, name, xlim=(None, None), ylim=(None, None), folder=None)[source]¶ Plot a single curve on a graph and save it as .png file.
- Parameters
x_list – list (or array), specify the x-axis points.
y_list – list (or array), specify the y-axis points.
x_label – label for x-axis.
y_label – label for y-axis.
name – str, name of the image saved (without .png).
folder – str, the path to the folder to save the image in. Does not need to pre-exist before running.
-
examples.two_poschl_teller.plot_multiple_and_save(plot_list, name, xlim=(None, None), ylim=(None, None), folder=None)[source]¶ Plot mutiple curves on a single graph and save it as .png file.
- Parameters
plot_list – list of lists, specify plotting parameters for each curve in the form of [label, x_list, y_list, linestyle, color].
name – str, name of the image saved (without .png).
xlim – tuple, xlim[0] == left limit, xlim[1] == right limit; setting to None means flexible ranges.
ylim – tuple, ylim[0] == bottom limit, ylim[1] == top limit; setting to None means flexible ranges.
folder – str, the path to the folder to save the image in. Does not need to pre-exist before running.
-
examples.two_poschl_teller.two_poschl_teller(grids, d, lam=1.0, a=1.0)[source]¶ Two Poschl-Teller potential wells seperated by distance d.
- Parameters
grids – numpy array of grid points for evaluating 1d potential. (num_grids,)
d – float, distance seperated by two Poschl-Teller potential wells.
lam – float, lambda in the Poschl-Teller potential function.
a – float, coefficient in the Poschl-Teller potential function.
center – float, the center of the potential.
- Returns
Potential on grid with shape (num_grid,)
- Raises
ValueError – If lam is not positive.