We will here go over the basics of using Jupyter notebooks with a focus on carrying out and analyzing quantum chemical calculations as well as different functions and routines that are used in eChem.
A Jupyter notebook consists of a number of different cells which can be executed in any order, the most relevant being:
Markdown, where you write text and equations, insert hyperlinks, figures, and more
Code, which contains executable (Python) code
A cell is executed by marking the cell and pressing shift+enter, or the run botton at the top. For a markdown cell this formats the text, and for code cells it runs the code. You can also press ctrl+enter, which only runs the cell, while shift+enter runs the cell and then selects the next one. Results from cells are saved in memory, so it is often a good idea to separate complicated workflows into several blocks, e.g. performing heavy calculations in one block and doing post-processing in another block.
The cell-type is selected in a scroll-down window at the top of the notebook window, which for this cell is Markdown. For editing the formatted markdown cells you double-click on the text, which changes the format to plain text.
Equations can be written with similar syntax as Latex, *e.g.*
$$
\overline{F} = m \overline{a}
$$
as well as in sentences, such as $\overline{F} = m \overline{a}$.
Equations can be written with similar syntax as Latex, e.g.
Markdown cells are used throughout eChem, and the above examples should cover the main functionalities you need to be familiar with. More examples can be found here.
Code cells are written in Python, for which tutorials can be found, e.g., here and here.
As a basic example, we define a function in one cell (saving it in memory), and call this function in a different cell.
def sum_numbers(a, b):
return a + b
sum_numbers(1, 2.0)
3.0
Assigning this to a variable and printing the results:
a = 1
b = 2.0
n_sum = sum_numbers(a, b)
print(n_sum)
3.0
Note that Python automatically assign variable type, and here understands that an integer and a float can be added together by converting the integer to a float.
We can print this with more advanced formatting, and add comments (#) in the code cells:
print(f"The sum of {a} and {b} is {n_sum}")
# tweaking position, number of decimals, and notation format
print(f"The sum of {a:2d} and {b:5.4f} is {n_sum:.2E}")
The sum of 1 and 2.0 is 3.0
The sum of 1 and 2.0000 is 3.00E+00
If you have the jupyterlab_code_formatter package installed (included in the eChem environment), you can format the code cells by running the Format notebook command at the top of the window (between cell type selection and the clock symbol). This will, for instance, take the following code cell:
import numpy as np
import matplotlib.pyplot as plt
import veloxchem as vlx
call_funtion(argument1, argument2,argument3, argument4,argument5) # commenting this function
And reformat this to a to:
import matplotlib.pyplot as plt
import numpy as np
import veloxchem as vlx
call_funtion(
argument1, argument2, argument3, argument4, argument5
) # commenting this function
One of the advantages of Python is the extensive number of available modules and packages, with some examples including:
numpy: large collection of mathematical functionalities
matplotlib: library for plotting
scipy: library for scientific and technical computing
veloxchem: quantum chemical program
py3Dmol: for visualizing molecules
These modules can be loaded as a whole (often being given an alias to avoid function collisions and overwriting), or by loading specific functions. Loading the required modules for this notebook:
import matplotlib.pyplot as plt
import numpy as np
import py3Dmol as p3d
import scipy
import veloxchem as vlx
Functionalities from the packages are then used by calling the appropriate package and function, e.g. to print the value of π we run:
Results are stored in the scf_drv and scf_results objects and can be used for analysis, further calculations, and more. In order to better understand what an object is and what it contains, we can run:
scf_drv?
Type: ScfRestrictedDriver
String form: <veloxchem.scfrestdriver.ScfRestrictedDriver object at 0x7f2f90d4d4d0>
File: ~/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/scfrestdriver.py
Docstring:
Implements spin restricted closed shell SCF method with C2-DIIS and
two-level C2-DIIS convergence accelerators.
:param comm:
The MPI communicator.
:param ostream:
The output stream.
Init docstring:
Initializes spin restricted closed shell SCF driver to default setup
(convergence threshold, initial guess, etc) by calling base class
constructor.
This returns the docstring and some basic information on the object. You can get more extensive information by running help(scf_drv):
help(scf_drv)
Help on ScfRestrictedDriver in module veloxchem.scfrestdriver object:
class ScfRestrictedDriver(veloxchem.scfdriver.ScfDriver)
| ScfRestrictedDriver(comm=None, ostream=None)
|
| Implements spin restricted closed shell SCF method with C2-DIIS and
| two-level C2-DIIS convergence accelerators.
|
| :param comm:
| The MPI communicator.
| :param ostream:
| The output stream.
|
| Method resolution order:
| ScfRestrictedDriver
| veloxchem.scfdriver.ScfDriver
| builtins.object
|
| Methods defined here:
|
| __deepcopy__(self, memo)
| Implements deepcopy.
|
| :param memo:
| The memo dictionary for deepcopy.
|
| :return:
| A deepcopy of self.
|
| __init__(self, comm=None, ostream=None)
| Initializes spin restricted closed shell SCF driver to default setup
| (convergence threshold, initial guess, etc) by calling base class
| constructor.
|
| get_scf_type_str(self)
| Gets string for spin restricted closed shell SCF calculation.
| Overloaded base class method.
|
| :return:
| The string for spin restricted closed shell SCF calculation.
|
| ----------------------------------------------------------------------
| Methods inherited from veloxchem.scfdriver.ScfDriver:
|
| compute(self, molecule, ao_basis, min_basis=None)
| Performs SCF calculation using molecular data.
|
| :param molecule:
| The molecule.
| :param ao_basis:
| The AO basis set.
| :param min_basis:
| The minimal AO basis set.
|
| compute_s2(self, molecule, scf_tensors)
| Computes expectation value of the S**2 operator.
|
| :param molecule:
| The molecule.
| :param scf_tensors:
| The dictionary of tensors from converged SCF wavefunction.
|
| :return:
| Expectation value <S**2>.
|
| get_scf_energy(self)
| Gets SCF energy from previous SCF iteration.
|
| :return:
| The SCF energy.
|
| maximum_overlap(self, molecule, basis, orbitals, alpha_list, beta_list)
| Constraint the SCF calculation to find orbitals that maximize overlap
| with a reference set.
|
| :param molecule:
| The molecule.
| :param basis:
| The AO basis set.
| :param orbitals:
| The reference MolecularOrbital object.
| :param alpha_list:
| The list of alpha occupied orbitals.
| :param beta_list:
| The list of beta occupied orbitals.
|
| print_attributes(self)
| Prints attributes in SCF driver.
|
| print_keywords(self)
| Prints input keywords in SCF driver.
|
| set_start_orbitals(self, molecule, basis, array)
| Creates checkpoint file from numpy array containing starting orbitals.
|
| :param molecule:
| The molecule.
| :param basis:
| The AO basis set.
| :param array:
| The numpy array (or list/tuple of numpy arrays).
|
| update_settings(self, scf_dict, method_dict=None)
| Updates settings in SCF driver.
|
| :param scf_dict:
| The dictionary of scf input.
| :param method_dict:
| The dicitonary of method settings.
|
| write_checkpoint(self, nuclear_charges, basis_set)
| Writes molecular orbitals to checkpoint file.
|
| :param nuclear_charges:
| The nuclear charges.
| :param basis_set:
| Name of the basis set.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from veloxchem.scfdriver.ScfDriver:
|
| comm
| Returns the MPI communicator.
|
| density
| Returns the density matrix.
|
| is_converged
| Returns whether SCF is converged.
|
| mol_orbs
| Returns the molecular orbitals (for backward compatibility).
|
| molecular_orbitals
| Returns the molecular orbitals.
|
| nnodes
| Returns the number of MPI processes.
|
| nodes
| Returns the number of MPI processes.
|
| num_iter
| Returns the current number of SCF iterations.
|
| ostream
| Returns the output stream.
|
| rank
| Returns the MPI rank.
|
| scf_energy
| Returns SCF energy.
|
| scf_tensors
| Returns the SCF tensors.
|
| scf_type
| Returns the SCF type.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from veloxchem.scfdriver.ScfDriver:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| filename
| Getter function for protected filename attribute.
Finally, in order to see which instances and functions can be accessed, you can use auto-completion by writing scf_drv. and pressing tab. This shows all options with the same start as what you have written in a scroll-down window. For example, you can find a function called get_scf_energy, which returns the SCF energy:
Molecular orbitals can be visualized using a light-weight, interactive function called OrbitalViewer. A viewer object is initiated, and provided information on the molecular structure, basis set, and SCF:
This results in seven molecular orbitals (selected by drop-down menu at the lower left), as the use of a minimal basis set (STO-3G) yields one basis function per hydrogen (1s), and five basis functions for oxygen (1s, 2s, and three 2p). You can change the visualization options in the upper right menu, with, e.g., the selected isosurface values under Objects>Orbitals>... (positive/negative isosurfaces are treated individually).
Next, let us consider impact of different basis sets on the total energy, and see if there are any general trends for increasing basis set sizes. First, define a function which takes a molecular structure and basis set, and return the SCF energy and number of basis functions:
Create two empty lists for storing SCF energies and basis set sizes:
scf_energies = []
basis_size = []
Python lists are collections of elements (numbers, strings, other lists, ...), which can be modified. A list can be created by placing these elements within brackets, e.g:
list_example = [0.0, "Cat", np.pi, ["dog", np.e]]
The individual elements can be called:
print(list_example[0])
print(list_example[1] + " and " + list_example[3][0])
Tweaking the plot setting for a more appealing figure:
plt.figure(figsize=(5, 3.5)) # Tweak figure size
plt.title("Nicer figure") # Title
# plot circles at points, connected with a dashed line:
plt.plot(basis_size, scf_energies, "d--", color='red', label="Line")
plt.legend() # insert legend, using defined label
plt.xlim((6.0, 37.0)) # limits of x-axis
plt.ylim((-76.2, -74.8)) # limits of y-axis
plt.grid() # Include a grid
plt.xlabel("Basis set size")
plt.ylabel("Total energy [Hartree]")
plt.show()
It is clear that the total energy decrease with basis set size, as a larger basis set generally provide more flexibility. This is not always the case, as smaller basis sets can be more suitable for describing a particular electronic structure.
An important concept in computational chemistry is that of the potential energy surface (PES), which describe the energy of a system as a function of some parameter (typically atomic positions). We here wish to construct this for carbon monoxide, by tracking the total energy as a function of the bond length.
In order to create a list of bond distances we can use np.arange or np.linspace, which returns evenly spaced values within a given interval. These values are returned using either a specified step length (np.arange), or a specified number of steps (np.linspace). Note that np.arange gives values up to, but not including, the end point.
We write 10.0 instead of 10 to ensure that Python understand that we want float numbers.
For calculating the PES we will use the replace command, which works as follows:
start_str = "John went bowling with Jane."
print(start_str)
end_str = start_str.replace("John", "Andrew")
end_str = end_str.replace("bowling", "to the cinema")
end_str = end_str.replace("Jane", "Sarah")
print(end_str)
John went bowling with Jane.
Andrew went to the cinema with Sarah.
Next, we use np.arange, replace, and calc_scf to create the PES.
co_base = """2
O 0.0 0.0 0.0
C L 0.0 0.0
"""
bond_e = []
bond_l = np.arange(1.00, 1.40, 0.04)
for l in bond_l:
co_tmp = co_base.replace("L", "{}".format(l)) # change C position
energy_tmp, n_bas_tmp = calc_scf(co_tmp, "STO-3G")
bond_e.append(energy_tmp)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 25.4005061233 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.143611678654 a.u. Time: 0.02 sec.
* Info * Overlap matrix computed in 0.01 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.143611699477 0.0000000000 0.00011513 0.00002230 0.00000000
2 -111.143611702124 -0.0000000026 0.00007565 0.00001694 0.00008690
3 -111.143611702755 -0.0000000006 0.00000311 0.00000064 0.00003701
4 -111.143611702757 -0.0000000000 0.00000010 0.00000003 0.00000285
*** SCF converged in 4 iterations. Time: 0.02 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.1436117028 a.u.
Electronic Energy : -136.5441178261 a.u.
Nuclear Repulsion Energy : 25.4005061233 a.u.
------------------------------------
Gradient Norm : 0.0000001007 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.57552 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.75) ( 1 O 1p+1: -0.28)
( 2 C 1s : 0.15) ( 2 C 2s : -0.20) ( 2 C 1p+1: 0.17)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.72113 a.u.
( 1 O 2s : 0.65) ( 1 O 1p+1: -0.72) ( 2 C 2s : -0.38)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.64241 a.u.
( 1 O 1p0 : 0.76) ( 2 C 1p0 : 0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.64241 a.u.
( 1 O 1p-1: -0.76) ( 2 C 1p-1: -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.45542 a.u.
( 1 O 1p+1: -0.36) ( 2 C 1s : -0.18) ( 2 C 2s : 0.85)
( 2 C 1p+1: 0.56)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.37448 a.u.
( 1 O 1p0 : 0.72) ( 2 C 1p0 : -0.95)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.37448 a.u.
( 1 O 1p-1: -0.72) ( 2 C 1p-1: 0.95)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 1.29137 a.u.
( 1 O 2s : 1.50) ( 1 O 1p+1: 1.06) ( 2 C 2s : -1.31)
( 2 C 1p+1: 1.44)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 24.4235635801 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.186169774106 a.u. Time: 0.04 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.186169803024 0.0000000000 0.00014420 0.00003031 0.00000000
2 -111.186169807214 -0.0000000042 0.00011083 0.00002447 0.00010534
3 -111.186169808616 -0.0000000014 0.00000287 0.00000061 0.00005420
4 -111.186169808617 -0.0000000000 0.00000010 0.00000003 0.00000232
*** SCF converged in 4 iterations. Time: 0.04 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.1861698086 a.u.
Electronic Energy : -135.6097333888 a.u.
Nuclear Repulsion Energy : 24.4235635801 a.u.
------------------------------------
Gradient Norm : 0.0000000973 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.53849 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.75) ( 1 O 1p+1: -0.26)
( 2 C 2s : -0.22) ( 2 C 1p+1: 0.17)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.71408 a.u.
( 1 O 2s : -0.65) ( 1 O 1p+1: 0.69) ( 2 C 1s : -0.15)
( 2 C 2s : 0.43)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.61228 a.u.
( 1 O 1p-1: -0.77) ( 2 C 1p-1: -0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.61228 a.u.
( 1 O 1p0 : -0.77) ( 2 C 1p0 : -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.45260 a.u.
( 1 O 1p+1: 0.38) ( 2 C 1s : 0.17) ( 2 C 2s : -0.82)
( 2 C 1p+1: -0.56)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.35399 a.u.
( 1 O 1p0 : -0.70) ( 2 C 1p0 : 0.95)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.35399 a.u.
( 1 O 1p-1: 0.70) ( 2 C 1p-1: -0.95)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 1.20972 a.u.
( 1 O 2s : 1.35) ( 1 O 1p+1: 1.03) ( 2 C 2s : -1.19)
( 2 C 1p+1: 1.37)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 23.5189871512 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.01 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.211593445294 a.u. Time: 0.02 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.211593469711 0.0000000000 0.00013710 0.00002210 0.00000000
2 -111.211593473585 -0.0000000039 0.00011770 0.00002531 0.00010359
3 -111.211593475213 -0.0000000016 0.00000231 0.00000058 0.00005619
4 -111.211593475214 -0.0000000000 0.00000006 0.00000001 0.00000122
*** SCF converged in 4 iterations. Time: 0.03 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.2115934752 a.u.
Electronic Energy : -134.7305806265 a.u.
Nuclear Repulsion Energy : 23.5189871512 a.u.
------------------------------------
Gradient Norm : 0.0000000552 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.50222 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.76) ( 1 O 1p+1: -0.24)
( 2 C 2s : -0.23) ( 2 C 1p+1: 0.17)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.70724 a.u.
( 1 O 2s : -0.65) ( 1 O 1p+1: 0.66) ( 2 C 1s : -0.16)
( 2 C 2s : 0.48)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.58366 a.u.
( 1 O 1p0 : 0.77) ( 2 C 1p0 : 0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.58366 a.u.
( 1 O 1p-1: -0.77) ( 2 C 1p-1: -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.44988 a.u.
( 1 O 1p+1: -0.40) ( 2 C 1s : -0.17) ( 2 C 2s : 0.80)
( 2 C 1p+1: 0.57)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.33484 a.u.
( 1 O 1p0 : 0.68) ( 2 C 1p0 : -0.94)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.33484 a.u.
( 1 O 1p-1: -0.68) ( 2 C 1p-1: 0.94)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 1.13059 a.u.
( 1 O 2s : -1.22) ( 1 O 1p+1: -1.00) ( 2 C 2s : 1.09)
( 2 C 1p+1: -1.30)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 22.6790233244 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.223524407463 a.u. Time: 0.12 sec.
* Info * Overlap matrix computed in 0.03 sec.
* Info * Kinetic energy matrix computed in 0.01 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.223524414116 0.0000000000 0.00006725 0.00001142 0.00000000
2 -111.223524415276 -0.0000000012 0.00005356 0.00001070 0.00006322
3 -111.223524415615 -0.0000000003 0.00000332 0.00000087 0.00002175
4 -111.223524415617 -0.0000000000 0.00000005 0.00000001 0.00000144
*** SCF converged in 4 iterations. Time: 0.07 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.2235244156 a.u.
Electronic Energy : -133.9025477400 a.u.
Nuclear Repulsion Energy : 22.6790233244 a.u.
------------------------------------
Gradient Norm : 0.0000000512 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.46702 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.76) ( 1 O 1p+1: -0.22)
( 2 C 2s : -0.24) ( 2 C 1p+1: 0.17)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.70073 a.u.
( 1 O 2s : -0.65) ( 1 O 1p+1: 0.63) ( 2 C 1s : -0.16)
( 2 C 2s : 0.53)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.55650 a.u.
( 1 O 1p-1: -0.79) ( 2 C 1p-1: -0.45)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.55650 a.u.
( 1 O 1p0 : -0.79) ( 2 C 1p0 : -0.45)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.44707 a.u.
( 1 O 1p+1: -0.43) ( 2 C 1s : -0.17) ( 2 C 2s : 0.77)
( 2 C 1p+1: 0.57)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.31693 a.u.
( 1 O 1p0 : 0.66) ( 2 C 1p0 : -0.92)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.31693 a.u.
( 1 O 1p-1: 0.66) ( 2 C 1p-1: -0.92)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 1.05505 a.u.
( 1 O 2s : 1.11) ( 1 O 1p+1: 0.97) ( 2 C 2s : -0.99)
( 2 C 1p+1: 1.24)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 21.8969880374 a.u.
* Info * Overlap matrix computed in 0.01 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.01 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.224874723528 a.u. Time: 0.05 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.01 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.224874728425 0.0000000000 0.00009506 0.00002282 0.00000000
2 -111.224874729894 -0.0000000015 0.00007203 0.00001586 0.00005227
3 -111.224874730573 -0.0000000007 0.00000355 0.00000085 0.00003636
4 -111.224874730577 -0.0000000000 0.00000008 0.00000002 0.00000382
*** SCF converged in 4 iterations. Time: 0.03 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.2248747306 a.u.
Electronic Energy : -133.1218627679 a.u.
Nuclear Repulsion Energy : 21.8969880374 a.u.
------------------------------------
Gradient Norm : 0.0000000808 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.43312 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.77) ( 1 O 1p+1: -0.20)
( 2 C 2s : -0.25) ( 2 C 1p+1: 0.16)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.69471 a.u.
( 1 O 2s : -0.64) ( 1 O 1p+1: 0.60) ( 2 C 1s : -0.17)
( 2 C 2s : 0.58)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.53073 a.u.
( 1 O 1p-1: -0.76) ( 1 O 1p0 : 0.24) ( 2 C 1p-1: -0.43)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.53073 a.u.
( 1 O 1p-1: 0.24) ( 1 O 1p0 : 0.76) ( 2 C 1p0 : 0.43)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.44396 a.u.
( 1 O 1p+1: -0.45) ( 2 C 1s : -0.16) ( 2 C 2s : 0.74)
( 2 C 1p+1: 0.58)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.30020 a.u.
( 1 O 1p-1: 0.63) ( 1 O 1p0 : -0.16) ( 2 C 1p-1: -0.90)
( 2 C 1p0 : 0.23)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.30020 a.u.
( 1 O 1p-1: 0.16) ( 1 O 1p0 : 0.63) ( 2 C 1p-1: -0.23)
( 2 C 1p0 : -0.90)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.98373 a.u.
( 1 O 2s : -1.01) ( 1 O 1p+1: -0.95) ( 2 C 2s : 0.91)
( 2 C 1p+1: -1.19)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 21.1670884361 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.01 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.01 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.217981258495 a.u. Time: 0.03 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.01 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.217981329528 0.0000000000 0.00028093 0.00006598 0.00000000
2 -111.217981343494 -0.0000000140 0.00031472 0.00006508 0.00021097
3 -111.217981356469 -0.0000000130 0.00000566 0.00000106 0.00015195
4 -111.217981356474 -0.0000000000 0.00000007 0.00000002 0.00000414
*** SCF converged in 4 iterations. Time: 0.03 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.2179813565 a.u.
Electronic Energy : -132.3850697926 a.u.
Nuclear Repulsion Energy : 21.1670884361 a.u.
------------------------------------
Gradient Norm : 0.0000000749 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.40066 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.79) ( 1 O 1p+1: -0.19)
( 2 C 2s : -0.25) ( 2 C 1p+1: 0.16)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.68929 a.u.
( 1 O 2s : -0.63) ( 1 O 1p+1: 0.57) ( 2 C 1s : -0.18)
( 2 C 2s : 0.62)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.50632 a.u.
( 1 O 1p0 : 0.80) ( 2 C 1p0 : 0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.50632 a.u.
( 1 O 1p-1: -0.80) ( 2 C 1p-1: -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.44038 a.u.
( 1 O 1p+1: -0.48) ( 2 C 1s : -0.16) ( 2 C 2s : 0.70)
( 2 C 1p+1: 0.58)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.28458 a.u.
( 1 O 1p-1: 0.63) ( 2 C 1p-1: -0.92)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.28458 a.u.
( 1 O 1p0 : 0.63) ( 2 C 1p0 : -0.92)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.91697 a.u.
( 1 O 2s : 0.92) ( 1 O 1p+1: 0.93) ( 2 C 2s : -0.83)
( 2 C 1p+1: 1.14)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 20.4842791317 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.204722461404 a.u. Time: 0.04 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.204722882303 0.0000000000 0.00003746 0.00000769 0.00000000
2 -111.204722882453 -0.0000000002 0.00001831 0.00000405 0.00001970
3 -111.204722882514 -0.0000000001 0.00000373 0.00000087 0.00000846
4 -111.204722882516 -0.0000000000 0.00000011 0.00000003 0.00000296
*** SCF converged in 4 iterations. Time: 0.03 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.2047228825 a.u.
Electronic Energy : -131.6890020142 a.u.
Nuclear Repulsion Energy : 20.4842791317 a.u.
------------------------------------
Gradient Norm : 0.0000001061 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.36972 a.u.
( 1 O 1s : 0.22) ( 1 O 2s : -0.80) ( 1 O 1p+1: -0.17)
( 2 C 2s : -0.26) ( 2 C 1p+1: 0.16)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.68457 a.u.
( 1 O 2s : -0.61) ( 1 O 1p+1: 0.54) ( 2 C 1s : -0.19)
( 2 C 2s : 0.67)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.48322 a.u.
( 1 O 1p-1: 0.81) ( 2 C 1p-1: 0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.48322 a.u.
( 1 O 1p0 : -0.81) ( 2 C 1p0 : -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.43620 a.u.
( 1 O 1p+1: -0.50) ( 2 C 1s : -0.15) ( 2 C 2s : 0.67)
( 2 C 1p+1: 0.59)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.26999 a.u.
( 1 O 1p-1: 0.20) ( 1 O 1p0 : -0.59) ( 2 C 1p-1: -0.30)
( 2 C 1p0 : 0.87)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.26999 a.u.
( 1 O 1p-1: 0.59) ( 1 O 1p0 : 0.20) ( 2 C 1p-1: -0.87)
( 2 C 1p0 : -0.30)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.85486 a.u.
( 1 O 2s : 0.84) ( 1 O 1p+1: 0.91) ( 2 C 2s : -0.77)
( 2 C 1p+1: 1.10)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 19.8441454089 a.u.
* Info * Overlap matrix computed in 0.01 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.00 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.186608847878 a.u. Time: 0.04 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.186609899161 0.0000000000 0.00007159 0.00001224 0.00000000
2 -111.186609899826 -0.0000000007 0.00001990 0.00000346 0.00003005
3 -111.186609899887 -0.0000000001 0.00000231 0.00000056 0.00000829
4 -111.186609899888 -0.0000000000 0.00000022 0.00000005 0.00000206
*** SCF converged in 4 iterations. Time: 0.03 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.1866098999 a.u.
Electronic Energy : -131.0307553088 a.u.
Nuclear Repulsion Energy : 19.8441454089 a.u.
------------------------------------
Gradient Norm : 0.0000002235 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.34032 a.u.
( 1 O 1s : -0.23) ( 1 O 2s : 0.81) ( 1 O 1p+1: 0.16)
( 2 C 2s : 0.26) ( 2 C 1p+1: -0.15)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.68061 a.u.
( 1 O 2s : -0.60) ( 1 O 1p+1: 0.51) ( 2 C 1s : -0.20)
( 2 C 2s : 0.71)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.46140 a.u.
( 1 O 1p-1: -0.81) ( 2 C 1p-1: -0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.46140 a.u.
( 1 O 1p0 : -0.81) ( 2 C 1p0 : -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.43129 a.u.
( 1 O 1p+1: -0.52) ( 2 C 2s : 0.63) ( 2 C 1p+1: 0.59)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.25639 a.u.
( 1 O 1p-1: 0.50) ( 1 O 1p0 : -0.34) ( 2 C 1p-1: -0.76)
( 2 C 1p0 : 0.51)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.25639 a.u.
( 1 O 1p-1: 0.34) ( 1 O 1p0 : 0.50) ( 2 C 1p-1: -0.51)
( 2 C 1p0 : -0.76)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.79738 a.u.
( 1 O 2s : -0.76) ( 1 O 1p+1: -0.89) ( 2 C 2s : 0.71)
( 2 C 1p+1: -1.06)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 19.2428076692 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.01 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.164854822922 a.u. Time: 0.05 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.164856772284 0.0000000000 0.00006035 0.00001226 0.00000000
2 -111.164856772574 -0.0000000003 0.00004300 0.00000687 0.00003618
3 -111.164856772884 -0.0000000003 0.00000795 0.00000183 0.00001742
4 -111.164856772900 -0.0000000000 0.00000026 0.00000008 0.00000751
*** SCF converged in 4 iterations. Time: 0.04 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.1648567729 a.u.
Electronic Energy : -130.4076644421 a.u.
Nuclear Repulsion Energy : 19.2428076692 a.u.
------------------------------------
Gradient Norm : 0.0000002620 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.31247 a.u.
( 1 O 1s : 0.23) ( 1 O 2s : -0.82) ( 2 C 2s : -0.26)
( 2 C 1p+1: 0.15)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.67744 a.u.
( 1 O 2s : -0.58) ( 1 O 1p+1: 0.47) ( 2 C 1s : -0.21)
( 2 C 2s : 0.75)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.44081 a.u.
( 1 O 1p-1: 0.82) ( 2 C 1p-1: 0.44)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.44081 a.u.
( 1 O 1p0 : -0.82) ( 2 C 1p0 : -0.44)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.42558 a.u.
( 1 O 1p+1: 0.54) ( 2 C 2s : -0.59) ( 2 C 1p+1: -0.60)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.24372 a.u.
( 1 O 1p-1: 0.59) ( 2 C 1p-1: -0.91)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.24372 a.u.
( 1 O 1p0 : 0.59) ( 2 C 1p0 : -0.91)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.74437 a.u.
( 1 O 2s : -0.70) ( 1 O 1p+1: -0.88) ( 2 C 2s : 0.66)
( 2 C 1p+1: -1.03)
* Info * Reading basis set from file: /Users/panor/miniconda3/envs/echem/lib/python3.11/site-packages/veloxchem/basis/STO-3G
Molecular Basis (Atomic Basis)
================================
Basis: STO-3G
Atom Contracted GTOs Primitive GTOs
O (2S,1P) (6S,3P)
C (2S,1P) (6S,3P)
Contracted Basis Functions : 10
Primitive Basis Functions : 30
Self Consistent Field Driver Setup
====================================
Wave Function Model : Spin-Restricted Hartree-Fock
Initial Guess Model : Superposition of Atomic Densities
Convergence Accelerator : Two Level Direct Inversion of Iterative Subspace
Max. Number of Iterations : 50
Max. Number of Error Vectors : 10
Convergence Threshold : 1.0e-06
ERI Screening Scheme : Cauchy Schwarz + Density
ERI Screening Mode : Dynamic
ERI Screening Threshold : 1.0e-12
Linear Dependence Threshold : 1.0e-06
* Info * Nuclear repulsion energy: 18.6768427378 a.u.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.01 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
* Info * SAD initial guess computed in 0.01 sec.
* Info * Starting Reduced Basis SCF calculation...
* Info * ...done. SCF energy in reduced basis set: -111.140437444853 a.u. Time: 0.05 sec.
* Info * Overlap matrix computed in 0.00 sec.
* Info * Kinetic energy matrix computed in 0.00 sec.
* Info * Nuclear potential matrix computed in 0.00 sec.
* Info * Orthogonalization matrix computed in 0.00 sec.
Iter. | Hartree-Fock Energy | Energy Change | Gradient Norm | Max. Gradient | Density Change
--------------------------------------------------------------------------------------------
1 -111.140440344095 0.0000000000 0.00008035 0.00001361 0.00000000
2 -111.140440344296 -0.0000000002 0.00012604 0.00002350 0.00007310
3 -111.140440346461 -0.0000000022 0.00002079 0.00000484 0.00004349
4 -111.140440346569 -0.0000000001 0.00000038 0.00000011 0.00001883
*** SCF converged in 4 iterations. Time: 0.02 sec.
Spin-Restricted Hartree-Fock:
-----------------------------
Total Energy : -111.1404403466 a.u.
Electronic Energy : -129.8172830843 a.u.
Nuclear Repulsion Energy : 18.6768427378 a.u.
------------------------------------
Gradient Norm : 0.0000003797 a.u.
Ground State Information
------------------------
Charge of Molecule : 0.0
Multiplicity (2S+1) : 1.0
Magnetic Quantum Number (M_S) : 0.0
Spin Restricted Orbitals
------------------------
Molecular Orbital No. 3:
--------------------------
Occupation: 2.000 Energy: -1.28614 a.u.
( 1 O 1s : -0.23) ( 1 O 2s : 0.83) ( 2 C 2s : 0.26)
Molecular Orbital No. 4:
--------------------------
Occupation: 2.000 Energy: -0.67507 a.u.
( 1 O 2s : -0.56) ( 1 O 1p+1: 0.44) ( 2 C 1s : -0.22)
( 2 C 2s : 0.78)
Molecular Orbital No. 5:
--------------------------
Occupation: 2.000 Energy: -0.42143 a.u.
( 1 O 1p-1: -0.78) ( 1 O 1p0 : 0.28) ( 2 C 1p-1: -0.41)
Molecular Orbital No. 6:
--------------------------
Occupation: 2.000 Energy: -0.42143 a.u.
( 1 O 1p-1: 0.28) ( 1 O 1p0 : 0.78) ( 2 C 1p0 : 0.41)
Molecular Orbital No. 7:
--------------------------
Occupation: 2.000 Energy: -0.41903 a.u.
( 1 O 2s : -0.17) ( 1 O 1p+1: 0.56) ( 2 C 2s : -0.55)
( 2 C 1p+1: -0.61)
Molecular Orbital No. 8:
--------------------------
Occupation: 0.000 Energy: 0.23194 a.u.
( 1 O 1p-1: 0.49) ( 1 O 1p0 : -0.31) ( 2 C 1p-1: -0.77)
( 2 C 1p0 : 0.49)
Molecular Orbital No. 9:
--------------------------
Occupation: 0.000 Energy: 0.23194 a.u.
( 1 O 1p-1: 0.31) ( 1 O 1p0 : 0.49) ( 2 C 1p-1: -0.49)
( 2 C 1p0 : -0.77)
Molecular Orbital No. 10:
--------------------------
Occupation: 0.000 Energy: 0.69564 a.u.
( 1 O 2s : -0.64) ( 1 O 1p+1: -0.87) ( 2 C 2s : 0.61)
( 2 C 1p+1: -0.99)
A smoother, more aesthetically pleasing figure line can be constructed by using spline, which interpolate between data points with piece-wise polynomials of a desired order. A cubic spline tends to yield relatively smooth curves, and can be constructed as:
Such potential fits can be used to form a force field which are then used for molecular dynamics. In order to do this, we will use scipy.optimize.curve_fit for optimizing the parameters. For this, we shift the energy so that the minima is zero and define the function to be fitted:
This fit takes the approximate shape of the calculate PES, but with a minima in the wrong location and an incorrect shape. This is due to a number of factor, including the inadequacies of a harmonic potential and fitting it to a somewhat unsuitable region, as discussed more here.
This e-book and our software makes use of np.einsum as a simple tool for performing Einstein summation, which is descried in the manual, and with basic examples found here.
Consider a vector A and a matrix B:
A = np.array([0, 1, 2])
B = np.array([[1, 1, 3], [3, 4, 5], [5, 6, 7]])
print("A:\n", A)
print("\nB:\n", B)
# \n adds a new line
In np.einsum this can be performed in a single step:
print(np.einsum("i,ij->i", A, B))
[ 0 12 36]
Here i and j select axis in the objects, and you can change the indices to any letter (provided you use them consistently). The operation carried out takes all Ai and multiply with Bij, summing over j and returning a new object with elements along i. Removing the i on the right-hand side instead gives the total sum:
print(np.einsum("i,ij->", A, B))
48
In other words, repeating an index tells np.einsum that it should multiply the objects along these dimensions, and omitting on the right-hand side tells it to sum along that dimension.
This can be used for simpler operations such as taking the sum of an object, performing element-wise multiplication, calculating the trace, and more. It can also be used for more complicated matrix-matrix operations and considering more arrays, and we will use it to perform a transformation from atomic to molecular orbitals (AO and MO, respectively).
Integrals are calculate in an atomic orbital (AO) basis, while we would in most cases prefer to work in the molecular orbital (MO) basis. For this, we then need to perform an AO to MO transformation. As an example, consider the expectation value of the kinetic energy:
The MO coefficient matrix C is real, so you can here ignore the complex conjugate.
We will use np.einsum to construct Tpq, and use the results to calculate the expectation value of the kinetic energy operator from before. For we need to know how to slice NumPy arrays.
As an example, the orbital energies are extracted as:
To print the energy of the occupied and unoccupied orbitals we use splicing:
print("Energy of occupied:\n", orbital_energies[:nocc])
print("Energy of unoccupied:\n", orbital_energies[nocc:])
Energy of occupied:
[-20.24238972 -1.26646064 -0.61558541 -0.45278475 -0.39106556]
Energy of unoccupied:
[0.60181634 0.73720765]
When using np.einsum, look at the above equation and use this to guide the construction of the operation, following the same order of indices and variable (but interchanging the left- and right-hand sides). The order is pq on the left-hand side, and αp, βq, and αβ on the right-hand side, so the summation becomes:
T_mo = np.einsum("ap, bq, ab -> pq", C, C, T_ao)
Finally, the expectation value of the kinetic operator is:
The eigenvalues and eigenvectors of a Hermitian matrix can be calculated with np.linalg.eigh(), and as an example we consider the overlap matrix (S). This is constructed from the overlap between each pair of orbitals:
We have chosen to use Python as the high-level programming and interfacing layer on account of its flexibility, ease of use, and extensive ecosystem. As the framework for carrying out the calculation and analysis, as well as enabling the intermingling of calculation and text, we use Jupyter. If you are unfamiliar in the use of these software packages, there is a wealth of resources which can help you get better accomodated with these tools, such as:
For Python you can start with W3Schools, which hosts comprehensive tutorials for a large number of programming languages and modules, or the tutorial from the Python project.
The construction of Jupyter books is documented on the host site, which also contains a gallery of different e-books, such as this one dedicated to teaching scientific computing for chemists (describing the use Python, Jupyter, and more), or this page.
The use of JupyterHub for serving Jupyter notebooks for multiple users is described on the project page, with instructions on how to deploy it on a cloud found here.
For visualization there are examples and tutorials for using matplotlib on the project page and W3Schools, and you can also look at tutorials for the high-level seaborn visualization library.