Skip to content
Snippets Groups Projects
Commit b780462b authored by moritz.buchhorn's avatar moritz.buchhorn
Browse files

Some basic interactions with scf.py

parent 1791295c
No related branches found
No related tags found
1 merge request!2Week2
%% Cell type:markdown id: tags:
# B.CTC: SCF
In diesem Notebook werden wir einen auf das Nötigste reduzierten SCF-Code verwenden, um einen Einblick in die einzelnen Iterationen zu gewinnen.
%% Cell type:code id: tags:
```
``` python
import scf
import numpy as np
from pyscf import gto
import plotly.graph_objects as go
```
%% Cell type:code id: tags:
``` python
coordinates='''
C 0.00 0.00 0.00
O 0.00 1.54 0.00
O 0.00 -1.54 0.00
'''
# To build such a molecule object, specific information is required, which is defined in the following code line. (In this oversimplified case, only the molecular coordinates and the basis set are used.) With this information, PySCF can now calculate the individual system-dependent parameters.
mol = gto.M(atom=coordinates, basis='sto-3g')
# nuclei-nuclei potential
E_nuc = mol.energy_nuc()
# number of atomic orbitals
NAO = mol.nao
# number of electrons
NEL = mol.nelectron
# overlap integrals
S= mol.intor('int1e_ovlp')
# kinetic energy integrals
T_e = mol.intor('int1e_kin')
# electrons-nuclei potential energy integrals
V_ne = mol.intor('int1e_nuc')
# two electron Coulomb integrals
J = mol.intor('int2e')
Hc = scf.build_hc(T_e, V_ne)
X = scf.build_ortho_mat(S)
finished_scf = scf.scf(Hc,X,J, E_nuc, NAO, NEL)
```
%% Cell type:code id: tags:
``` python
fig = go.Figure()
fig.add_trace(go.Scatter(
x = list(range(finished_scf["iterations"])),
y = finished_scf["tot_energies"],
))
fig.show()
```
%% Cell type:code id: tags:
``` python
fig = go.Figure()
orb_eigenvalues = finished_scf["orb_eigenvalues"].T
for i in range(len(orb_eigenvalues)):
fig.add_trace(go.Scatter(
x = list(range(finished_scf["iterations"])),
y = orb_eigenvalues[i],
))
fig.show()
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment