Jupyter Notebook#
The program can be run through a Jupyter notebook on a personal computer. This is the recommended approach for testing and visualization.
Setting up the reference state#
All methods in Penguin use the results of a HF calculation as input. This is done by creating a reference state from the various objects used to run the HF calculation. As of now, Penguin can use two different HF calculations, VeloxChem and PySCF. Below, we show the creation of a reference state for both programs for a simple. We refer to the examples for more complicated systems and inclusion of a molecular environment.
For VeloxChem:
import penguin
import veloxchem as vlx
xyz_string = """
O 0.941414391 0.061806555 0.056540617
H 1.897745723 0.036140170 0.097929548
H 0.668559886 -0.421976725 0.836569836"""
molecule = penguin.get_molecule(xyz_string)
basis = penguin.get_molecular_basis(molecule, "cc-pVDZ")
scf_drv = vlx.ScfRestrictedDriver()
scf_drv.compute(molecule, basis)
reference_state = penguin.create_reference_state(molecule, basis, scf_drv)
For PySCF:
import penguin
from pyscf import scf
xyz_string = """
O 0.941414391 0.061806555 0.056540617
H 1.897745723 0.036140170 0.097929548
H 0.668559886 -0.421976725 0.836569836"""
basis = 'cc-pVDZ'
molecule = penguin.get_molecule_pyscf(xyz_string,basis)
scf_drv = scf.RHF(molecule)
scf_drv.kernel()
reference_state = penguin.create_reference_state(molecule, basis, scf_drv)
Running the calculation#
Once the reference state has been defined, it needs to be passed to the method object along with any additional settings. Here we show the calculation of the CC2 ground state energy.
cc2_drv = penguin.CC2()
settings_dict = {
'reference_state': reference_state,
'solver_thresh':1e-10,
}
cc2_drv.update_settings(settings_dict)
cc2_drv.compute()
Output:
CC2 Driver Setup
================
ERI Screening Threshold : 1.0e-13
Frozen Core : False
Number of occupied orbitals : 5
Number of virtual orbitals : 19
Max. memory allowed in calculation : 1.0 GiB
Threshold 1.0e-10
Max iterations 100
DIIS vectors 10
Use CROP True
------------------------
Iter Residual CC Energy
### 1 3.02229969e-02 -2.04075060e-01
### 2 5.73372360e-03 -2.04753594e-01
### 3 5.18990582e-04 -2.04919565e-01
### 4 1.05934223e-04 -2.04925208e-01
### 5 1.07074463e-05 -2.04925740e-01
### 6 1.31073559e-06 -2.04925723e-01
### 7 1.55893820e-07 -2.04925726e-01
### 8 1.51477302e-08 -2.04925726e-01
### 9 1.70772549e-09 -2.04925726e-01
### 10 1.52308712e-10 -2.04925726e-01
### 11 1.77965687e-11 -2.04925726e-01
System converged in 11 iterations!
Time in CCsolver: 0.35 sec.
*** CC2 correlation energy: -0.204925725635 a.u.