[USE JUPYTER] Create and run a PySCF notebook named caffeine_dft_gap.ipynb that optimizes caffeine with DFT and reports the HOMO-LUMO gap
Research Activity · 8 steps
Jupyter Editor
Starting JupyterLab...
Jupyter Editor
Replacing and running notebook...
Jupyter Editor
Notebook finished with errors.
- Path:
sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb - Cells: 9 total (0 before)
- Execution: 8/8 code cells ran
- Outputs: 5 text, 0 image, 2 errors
Error:
- Cell 7 failed with NameError: name 'mol_opt' is not defined
Failed cells:
- Cell 7: `# Single-point DFT on optimized geometry and HOMO-LUMO gap.
mf = dft.RKS(mol_opt)
mf.xc = XC
mf.disp = DISP
mf.conv_tol = 1e-9
mf.grids.level = 4
mf.max_cycle = 100
energy_h = mf.kernel()
print('Final SCF converged:', mf.converged)
print(f'Final electronic energy: {energy_h:.10f} Hartree')
mo_energ
... (truncated)` -> NameError: name 'mol_opt' is not defined
- Cell 8: `# Post-optimization geometry sanity checks: selected covalent bond lengths.
coords_opt = mol_opt.atom_coords(unit='Angstrom')
print('Representative optimized bond lengths using RDKit topology (Angstrom):')
for bond in list(mol_h.GetBonds())[:15]:
i, j = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx
... (truncated)` -> NameError: name 'mol_opt' is not defined
Text outputs:
- Cell 1: Missing packages: none
- Cell 2:
SMILES: Cn1cnc2c1c(=O)n(C)c(=O)n2C
Formula from RDKit: C8H10N4O2 (expected C8H10N4O2)
Charge: 0
Spin multiplicity: 1 (PySCF spin=0)
Method: B3LYP-D3BJ/def2-svp
Geometry optimization backend: geomeTRIC via pyscf.geomopt.geometric_solver
Coordinate units: Angstrom
- Cell 3:
RDKit ETKDG embed status: 0
RDKit MMFF94 optimize status: 0 (0 means converged)
Number of atoms including H: 24
First five starting coordinates (Angstrom):
C 3.248057 -0.565506 0.487139
N 2.124774 0.302631 0.240978
C 2.171711 1.663385 0.089886
N 0.973683 2.170383 -0.124264
C 0.141496 1.092087 -0.107778
- Cell 4:
Electron count: 102
Closed-shell even-electron check: True
Representative starting bond lengths from RDKit topology (Angstrom):
0- 1 C-N: 1.441
1- 2 N-C: 1.370
2- 3 C-N: 1.318
3- 4 N-C: 1.362
4- 5 C-C: 1.362
5- 6 C-C: 1.421
6- 7 C-O: 1.227
6- 8 C-N: 1.398
8- 9 N-C: 1.450
8-10 N-C: 1.411
- Cell 5:
System: uname_result(system='Linux', node='2271c040-d5b7-4bc1-a2a4-a5336931f03a', release='6.17.0-1010-oracle', version='#10~24.04.1-Ubuntu SMP Thu Mar 26 20:08:26 UTC 2026', machine='x86_64') Threads 48
Python 3.12.10 (main, May 21 2025, 23:34:56) [GCC 12.2.0]
numpy 2.4.6 scipy 1.17.1 h5py 3.16.0
Date: Sun Jun 21 10:16:45 2026
PySCF version 2.13.0
PySCF path /usr/local/lib/python3.12/site-packages/pyscf
[CONFIG] conf_file None
[INPUT] verbose = 4
[INPUT] num. atoms = 24
[INPUT] num. electrons = 102
[INPUT] charge = 0
[INPUT] spin (= nelec alpha-beta = 2S) = 0
[INPUT] symmetry False subgroup None
[INPUT] Mole.unit = Angstrom
[INPUT] Symbol X Y Z unit X Y Z unit Magmom
[INPUT] 1 C 3.2480572
# ... (truncated)
- Cell 7: NameError: name 'mol_opt' is not defined
- Cell 8: NameError: name 'mol_opt' is not defined
Note: Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary.
Full cell source is in the notebook; compact output shows results only.
Jupyter Editor
Replacing cell 6...
Jupyter Editor
Notebook action summary:
{
"action": "replace_cell",
"effect": "replaced_cell",
"status": "execution_error",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"execution_summary": {
"state_returned": "post_execution_notebook_state",
"code_cells_executed": 3,
"total_code_cells": 8,
"cells_with_text_output": 6,
"cells_with_image_output": 0,
"cells_with_html_output": 0,
"error_count": 3,
"outputs_present": true,
"visual_output_present": false
},
"error_summary": {
"ename": "ModuleNotFoundError",
"evalue": "No module named 'pyscf.dispersion'",
"message": "Cell 6 failed with ModuleNotFoundError: No module named 'pyscf.dispersion'",
"cell_index": 6,
"traceback_tail": " 11 print(f'Optimizer method: {METHOD}/{BASIS}')\n---> 12 mol_opt = optimize(opt_mf, maxsteps=80)\n 13 print('Optimization finished.')\n 14 print('Optimized geometry has atoms:', mol_opt.natm)\n 15 print('Optimized molecule charge/spin:', mol_opt.charge, mol_opt.spin)\nFile /usr/local/lib/python3.12/site-packages/pyscf/geomopt/geometric_solver.py:191, in optimize(method, assert_convergence, include_ghost, constraints, callback, maxsteps, **kwargs)\n 174 '''Optimize geometry with geomeTRIC libr\n# ... (truncated)"
},
"diff_summary": {
"changed": true,
"lines_added": 20,
"lines_removed": 0,
"chars": 926
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell index=0 markdown (8 lines, 554 chars):
# Caffeine DFT geometry optimization and HOMO–LUMO gap
This notebook builds caffeine from a SMILES string, generates a 3D conformer with RDKit/MMFF as the starting geometry, optimizes the geometry with PySCF DFT, and reports the Kohn–Sham HOMO–LUMO gap.
**Scientific caveats**
- The reported gap is
# ... (truncated)
Cell In[1] index=1 code (6 lines, 301 chars):
import importlib.util
required = ['pyscf', 'rdkit']
missing = [pkg for pkg in required if importlib.util.find_spec(pkg) is None]
print('Missing packages:', missing if missing else 'none')
if missing:
raise ImportError('Install missing packages in Compute Shell, then rerun: ' + ', '.join(missing)
# ... (truncated)
Output:
Missing packages: none
Cell In[2] index=2 code (33 lines, 1096 chars):
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem, rdMolDescriptors
from pyscf import gto, dft
try:
from pyscf.geomopt.geometric_solver import optimize
geomopt_backend = 'geomeTRIC via pyscf.geomopt.geometric_solver'
except Exception as exc:
optimize = None
ge
# ... (truncated)
Output:
SMILES: Cn1cnc2c1c(=O)n(C)c(=O)n2C
Formula from RDKit: C8H10N4O2 (expected C8H10N4O2)
Charge: 0
Spin multiplicity: 1 (PySCF spin=0)
Method: B3LYP-D3BJ/def2-svp
Geometry optimization backend: geomeTRIC via pyscf.geomopt.geometric_solver
Coordinate units: Angstrom
Cell In[3] index=3 code (27 lines, 1180 chars):
# Generate a 3D starting conformer with explicit hydrogens using RDKit ETKDG, then MMFF94 minimize.
mol_h = Chem.AddHs(mol_rd)
params = AllChem.ETKDGv3()
params.randomSeed = 20260621
embed_status = AllChem.EmbedMolecule(mol_h, params)
print('RDKit ETKDG embed status:', embed_status)
if embed_status
# ... (truncated)
Output:
RDKit ETKDG embed status: 0
RDKit MMFF94 optimize status: 0 (0 means converged)
Number of atoms including H: 24
First five starting coordinates (Angstrom):
C 3.248057 -0.565506 0.487139
N 2.124774 0.302631 0.240978
C 2.171711 1.663385 0.089886
N 0.973683 2.170383 -0.124264
C 0.141496 1.092087 -0.107778
Cell In[4] index=4 code (19 lines, 951 chars):
# Geometry and electron-count sanity checks before DFT.
atomic_numbers = [atom.GetAtomicNum() for atom in mol_h.GetAtoms()]
nelec = int(sum(atomic_numbers) - CHARGE)
print(f'Electron count: {nelec}')
print('Closed-shell even-electron check:', nelec % 2 == 0 and SPIN == 0)
assert nelec == 102, 'Caffe
# ... (truncated)
Output:
Electron count: 102
Closed-shell even-electron check: True
Representative starting bond lengths from RDKit topology (Angstrom):
0- 1 C-N: 1.441
1- 2 N-C: 1.370
2- 3 C-N: 1.318
3- 4 N-C: 1.362
4- 5 C-C: 1.362
5- 6 C-C: 1.421
6- 7 C-O: 1.227
6- 8 C-N: 1.398
8- 9 N-C: 1.450
8-10 N-C: 1.411
Cell In[5] index=5 code (14 lines, 445 chars):
# Build PySCF molecule from RDKit/MMFF starting geometry.
pyscf_atom = [(sym, xyz) for sym, xyz in atom_lines]
mol = gto.Mole()
mol.atom = pyscf_atom
mol.unit = UNIT
mol.charge = CHARGE
mol.spin = SPIN
mol.basis = BASIS
mol.verbose = 4
mol.build()
print('PySCF built molecule')
print('Number of basis
# ... (truncated)
Output:
System: uname_result(system='Linux', node='2271c040-d5b7-4bc1-a2a4-a5336931f03a', release='6.17.0-1010-oracle', version='#10~24.04.1-Ubuntu SMP Thu Mar 26 20:08:26 UTC 2026', machine='x86_64') Threads 48
Python 3.12.10 (main, May 21 2025, 23:34:56) [GCC 12.2.0]
numpy 2.4.6 scipy 1.17.1 h5py 3.16.0
Date: Sun Jun 21 10:16:45 2026
PySCF version 2.13.0
PySCF path /usr/local/lib/python3.12/site-packages/pyscf
[CONFIG] conf_file None
[INPUT] verbose = 4
[INPUT] num. atoms = 24
[INPUT] num. electrons = 102
[INPUT] charge = 0
[INPUT] spin (= nelec alpha-beta = 2S) = 0
[INPUT] symmetry False subgroup None
[INPUT] Mole.unit = Angstrom
[INPUT] Symbol X Y Z unit X Y Z unit Magmom
[INPUT] 1 C 3.2480572
... (truncated)
number of shells = 114
number of NR pGTOs = 406
number of NR cGTOs = 246
basis = def2-svp
ecp = {}
CPU time: 1.73
PySCF built molecule
Number of basis functions: 246
Number of electrons (alpha, beta): (51, 51)
Nuclear repulsion energy (Hartree): 931.2913326323076
Cell In[8] index=6 code (20 lines, 879 chars):
# DFT geometry optimization.
# This is a real quantum-chemical geometry optimization, initialized from the RDKit/MMFF conformer above.
# def2-SVP is selected for runtime; use a larger basis for production-quality energetics.
opt_mf = dft.RKS(mol)
opt_mf.xc = XC
opt_mf.disp = DISP
opt_mf.conv_tol = 1
# ... (truncated)
Output:
Starting DFT geometry optimization...
Optimizer method: B3LYP-D3BJ/def2-svp
Create scanner for
Create scanner for
geometric-optimize called with the following command line:
/usr/local/lib/python3.12/site-packages/ipykernel_launcher.py -f /tmp/tmpqg3kc9og.json
())))))))))))))))/
())))))))))))))))))))))))),
)))))))))))))))))))))))))))))))))
#, ()))))))))/ .)))))))))),
#%%%%, ()))))) .))))))))
%%%%%%, )) .. ,))))))).
%%%%%%, **/. .)))))))
#%%/ (%%%%%%, /***. )))))))
.%%%%%%# %%%%%%, */, *, .))))))
.%%%%%%/ %%%%%%, ** * .))))))
## .%%%%%%/ (%%%%%%, ,* /)))))
%%%%%% .%%%%%%# *%%%%%%, ,/////. * ))))))
#% %% .%%%%%%/ %%%%%%, ////////, / ,)))))
#%% %%% %%%# .%%%%%%/ (%%%%%%, ///////. / ))))).
#%%%%. %%%%%# /%%%%%% #%%%%%% /////) ))))),
#%%%%##% %%%# .%%%%%%/ (%%%%%%, ///////. / ))))).
## %%% .%%%%%%/ %%%%%%, ////////. / ,)))))
#%%%%# /%%%%%%/ (%%%%%% /)/)// * ))))))
## .%%%%%%/ (%%%%%%, * ))))))
.%%%%%%/ %%%%%%, . /* .))))))
%%%%%%/ (%%%%%% */..,/* ))))))
#%%/ (%%%%%%, ***/ )))))))
%%%%%%, ,**/ ,))))))/
(%%%%%% () ))))))))
#%%%%, ()))))) ,)))))))),
#, ()))))))))) ,)))))))))).
()))))))))))))))))))))))))))))))/
())))))))))))))))))))))))).
())))))))))))))),
-=# geomeTRIC started. Version: 1.1 #=-
Current date and time: 2026-06-21 10:17:01
========================================================
| Arguments passed to driver run_optimizer(): |
========================================================
customengine
input /tmp/tmpyqp8pcn7/541f539c-d3b6-48e6-ac5d-c7799e919b1f
logIni /usr/local/lib/python3.12/site-packages/pyscf/geomopt/log.ini
maxiter 80
Custom engine selected.
Bonds will be generated from interatomic distances less than 1.20 times sum of covalent radii
72 internal coordinates being used (instead of 72 Cartesians)
Internal coordinate system (atoms numbered from 1):
Distance 1-2
Distance 1-15
Distance 1-16
Distance 1-17
Distance 2-3
Distance 2-6
Distance 3-4
Distance 3-18
Distance 4-5
Distance 5-6
Distance 5-13
Distance 6-7
Distance 7-8
Distance 7-9
Distance 9-10
Distance 9-11
Distance 10-19
Distance 10-20
Distance 10-21
Distance 11-12
Distance 11-13
Distance 13-14
Distance 14-22
Distance 14-23
Distance 14-24
Angle 2-1-15
Angle 2-1-16
Angle 2-1-17
Angle 15-1-16
Angle 15-1-17
Angle 16-1-17
Angle 1-2-6
Angle 3-2-6
Angle 2-3-18
Angle 4-3-18
Angle 3-4-5
Angle 4-5-13
Angle 6-5-13
Angle 2-6-7
Angle 5-6-7
Angle 6-7-9
Angle 8-7-9
Angle 7-9-11
Angle 10-9-11
Angle 9-10-19
Angle 9-10-20
Angle 9-10-21
Angle 19-10-20
Angle 19-10-21
Angle 20-10-21
Angle 9-11-13
Angle 12-11-13
Angle 5-13-14
Angle 11-13-14
Angle 13-
... (truncated)
===== Optimization Info: ====
Job type: Energy minimization
Maximum number of optimization cycles: 80
Initial / maximum trust radius (Angstrom): 0.100 / 0.300
Convergence Criteria:
Will converge when all 5 criteria are reached:
|Delta-E| < 1.00e-06
RMS-Grad < 3.00e-04
Max-Grad < 4.50e-04
RMS-Disp < 1.20e-03
Max-Disp < 1.80e-03
=== End Optimization Info ===
Geometry optimization cycle 1
Cartesian coordinates (Angstrom)
Atom New coordinates dX dY dZ
C 3.248057 -0.565506 0.487139 0.000000 0.000000 0.000000
N 2.124774 0.302631 0.240978 0.000000 0.000000 0.000000
C 2.171711 1.663385 0.089886 -0.000000 -0.000000 -0.000000
N 0.973683 2.170383 -0.124264 0.000000 0.000000 0.000000
C 0.141496 1.092087 -0.107778 0.000000 0.000000 0.000000
C 0.817193 -0.069237 0.114123 -0.000000 0.000000 -0.000000
C 0.182980 -1.339361 0.178479 0.000000 0.000000 -0.000000
O 0.801419 -2.380432 0.379053 0.000000 0.000000 0.000000
N -1.200176 -1.263588 -0.009899 0.000000 0.000000 0.000000
C -1.964139 -2.494997 0.033134 0.000000 0.000000 0.000000
... (truncated)
New geometry
1 C 3.248057287297 -0.565506124430 0.487138672338 AA 6.137938709889 -1.068651696938 0.920558675403 Bohr
2 N 2.124773951629 0.302631209067 0.240978258579 AA 4.015240845189 0.571890101882 0.455382910688 Bohr
3 C 2.171711423173 1.663384530694 0.089886160582 AA 4.103939811386 3.143341202850 0.169860225889 Bohr
4 N 0.973682944137 2.170383225066 -0.124263756112 AA 1.839994096579 4.101429880725 -0.234824466261 Bohr
5 C 0.141495638340 1.092087136228 -0.107777509902 AA 0.267388004283 2.063745591632 -0.203669976103 Bohr
6 C 0.817192721482 -0.069236888047 0.114123479552 AA 1.544270434589 -0.130838756126 0.215662120736 Bohr
7 C 0.182980316814 -1.339360955490 0.178478987141 AA 0.345782684965 -2.531025387811 0.337276404686 Bohr
8 O 0.801419016656 -2.380431509966 0.379052654530 AA 1.514462452498 -4.498363612121 0.716305703851 Bohr
9 N -1.200175597332 -1.263588289944 -0.009899395636 AA -2.268003180343 -2.387835802201 -0.018707146552 Bohr
10 C -1.964139201419 -2.494997081162 0.033134077248 AA -3.711685161204 -4.714861164985 0.062614331389 Bohr
11 C -1.935386015820 -0.081973735594 -0.241872058488 AA -3.657349515213 -0.154907909681 -0.457071947727 Bohr
12 O -3.159861477599 -0.117175256712 -0.396822507133 AA -5.971272784225 -0.221429143761 -0.749885858545 Bohr
13 N -1.220308635761 1.115271310453 -0.287308401467 AA -2.306049109029 2.107557331341 -0.542934192060 Bohr
14 C -1.901575040437 2.375350408086 -0.521340165681 AA -3.593456031735 4.488761721156 -0.985190130872 Bohr
15 H 3.089444180879 -1.078630399237 1.438872177293 AA 5.838203378993 -2.038316044189 2.719074343341 Bohr
16 H 3.319641463369 -1.283389972278 -0.333696055145 AA 6.273213197517 -2.425255558619 -0.630594153073 Bohr
17 H 4.164017487478 0.028837235357 0.537435204798 AA 7.868852629234 0.054494477014 1.015605346768 Bohr
18 H 3.092874828548 2.230116024141 0.144048430411 AA 5.844686363517 4.214308511631 0.272212082151 Bohr
19 H -2.485615499783 -2.623534539091 -0.921091585104 AA -4.697132545563 -4.957761757218 -1.740610831488 Bohr
20 H -1.338580748470 -3.372172591047 0.215693138091 AA -2.529551010224 -6.372482641843 0.407600957941 Bohr
21 H -2.712852488604 -2.421405579332 0.828759365113 AA -5.126548219805 -4.575793381432 1.566128223232 Bohr
22 H -1.729293996607 3.038641774494 0.332228746265 AA -3.267892042442 5.742200744456 0.627821341149 Bohr
23 H -2.979087805906 2.239638112958 -0.645598684404 AA -5.629660054194 4.232302651628 -1.220004699904 Bohr
24 H -1.500414752066 2.835061955787 -1.430159232870 AA -2.835372954661 5.357490642612 -2.702609264642 Bohr
* *
method = RKS_Scanner
initial guess = minao
damping factor = 0
level_shift factor = 0
DIIS =
diis_start_cycle = 1
diis_space = 8
diis_damp = 0
SCF conv_tol = 1e-08
SCF conv_tol_grad = None
SCF max_cycles = 80
direct_scf = True
direct_scf_tol = 1e-13
chkfile to save SCF result = /tmp/tmp4sd4njmb
max_memory 4000 MB (current use 238 MB)
XC library pyscf.dft.libxc version 7.0.0
S. Lehtola, C. Steigemann, M. J.T. Oliveira, and M. A.L. Marques., SoftwareX 7, 1–5 (2018)
XC functionals = b3lyp
P. J. Stephens, F. J. Devlin, C. F. Chabalowski, and M. J. Frisch., J. Phys. Chem. 98, 11623 (1994)
radial grids:
Treutler-Ahlrichs [JCP 102, 346 (1995); DOI:10.1063/1.469408] (M4) radial grids
becke partition: Becke, JCP 88, 2547 (1988); DOI:10.1063/1.454033
pruning grids:
grids dens level: 3
symmetrized grids: False
atomic radii adjust function:
small_rho_cutoff = 0
Set gradient conv threshold to 0.0001
Initial guess from minao.
tot grids = 294800
dftd3 and dftd4 not available. Install them with pip install pyscf-dispersion
Error: ModuleNotFoundError: No module named 'pyscf.dispersion'
Cell In[9] index=7 code (28 lines, 1067 chars):
# Single-point DFT on optimized geometry and HOMO-LUMO gap.
mf = dft.RKS(mol_opt)
mf.xc = XC
mf.disp = DISP
mf.conv_tol = 1e-9
mf.grids.level = 4
mf.max_cycle = 100
energy_h = mf.kernel()
print('Final SCF converged:', mf.converged)
print(f'Final electronic energy: {energy_h:.10f} Hartree')
mo_energ
# ... (truncated)
Output:
Error: NameError: name 'mol_opt' is not defined
Cell In[10] index=8 code (11 lines, 690 chars):
# Post-optimization geometry sanity checks: selected covalent bond lengths.
coords_opt = mol_opt.atom_coords(unit='Angstrom')
print('Representative optimized bond lengths using RDKit topology (Angstrom):')
for bond in list(mol_h.GetBonds())[:15]:
i, j = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx
# ... (truncated)
Output:
Error: NameError: name 'mol_opt' is not defined
Jupyter Editor
Editing cell 0...
Jupyter Editor
Notebook action summary:
{
"action": "edit_cell",
"effect": "edited_cell_source",
"status": "ok",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"diff_summary": {
"changed": true,
"lines_added": 1,
"lines_removed": 1,
"chars": 507
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell index=0 markdown (8 lines, 644 chars):
# Caffeine DFT geometry optimization and HOMO–LUMO gap
This notebook builds caffeine from a SMILES string, generates a 3D conformer with RDKit/MMFF as the starting geometry, optimizes the geometry with PySCF DFT, and reports the Kohn–Sham HOMO–LUMO gap.
**Scientific caveats**
- The reported gap is
# ... (truncated)
Jupyter Editor
Editing cell 2...
Jupyter Editor
Notebook action summary:
{
"action": "edit_cell",
"effect": "edited_cell_source",
"status": "ok",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"diff_summary": {
"changed": true,
"lines_added": 2,
"lines_removed": 2,
"chars": 325
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell In[2] index=2 code (33 lines, 1142 chars):
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem, rdMolDescriptors
from pyscf import gto, dft
try:
from pyscf.geomopt.geometric_solver import optimize
geomopt_backend = 'geomeTRIC via pyscf.geomopt.geometric_solver'
except Exception as exc:
optimize = None
ge
# ... (truncated)
Output:
SMILES: Cn1cnc2c1c(=O)n(C)c(=O)n2C
Formula from RDKit: C8H10N4O2 (expected C8H10N4O2)
Charge: 0
Spin multiplicity: 1 (PySCF spin=0)
Method: B3LYP-D3BJ/def2-svp
Geometry optimization backend: geomeTRIC via pyscf.geomopt.geometric_solver
Coordinate units: Angstrom
Jupyter Editor
Editing cell 6...
Jupyter Editor
Notebook action summary:
{
"action": "edit_cell",
"effect": "edited_cell_source",
"status": "execution_error",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"diff_summary": {
"changed": true,
"lines_added": 2,
"lines_removed": 1,
"chars": 292
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell In[8] index=6 code (21 lines, 904 chars):
# DFT geometry optimization.
# This is a real quantum-chemical geometry optimization, initialized from the RDKit/MMFF conformer above.
# def2-SVP is selected for runtime; use a larger basis for production-quality energetics.
opt_mf = dft.RKS(mol)
opt_mf.xc = XC
if DISP is not None:
opt_mf.disp =
# ... (truncated)
Output:
Starting DFT geometry optimization...
Optimizer method: B3LYP-D3BJ/def2-svp
Create scanner for
Create scanner for
geometric-optimize called with the following command line:
/usr/local/lib/python3.12/site-packages/ipykernel_launcher.py -f /tmp/tmpqg3kc9og.json
())))))))))))))))/
())))))))))))))))))))))))),
)))))))))))))))))))))))))))))))))
#, ()))))))))/ .)))))))))),
#%%%%, ()))))) .))))))))
%%%%%%, )) .. ,))))))).
%%%%%%, **/. .)))))))
#%%/ (%%%%%%, /***. )))))))
.%%%%%%# %%%%%%, */, *, .))))))
.%%%%%%/ %%%%%%, ** * .))))))
## .%%%%%%/ (%%%%%%, ,* /)))))
%%%%%% .%%%%%%# *%%%%%%, ,/////. * ))))))
#% %% .%%%%%%/ %%%%%%, ////////, / ,)))))
#%% %%% %%%# .%%%%%%/ (%%%%%%, ///////. / ))))).
#%%%%. %%%%%# /%%%%%% #%%%%%% /////) ))))),
#%%%%##% %%%# .%%%%%%/ (%%%%%%, ///////. / ))))).
## %%% .%%%%%%/ %%%%%%, ////////. / ,)))))
#%%%%# /%%%%%%/ (%%%%%% /)/)// * ))))))
## .%%%%%%/ (%%%%%%, * ))))))
.%%%%%%/ %%%%%%, . /* .))))))
%%%%%%/ (%%%%%% */..,/* ))))))
#%%/ (%%%%%%, ***/ )))))))
%%%%%%, ,**/ ,))))))/
(%%%%%% () ))))))))
#%%%%, ()))))) ,)))))))),
#, ()))))))))) ,)))))))))).
()))))))))))))))))))))))))))))))/
())))))))))))))))))))))))).
())))))))))))))),
-=# geomeTRIC started. Version: 1.1 #=-
Current date and time: 2026-06-21 10:17:01
========================================================
| Arguments passed to driver run_optimizer(): |
========================================================
customengine
input /tmp/tmpyqp8pcn7/541f539c-d3b6-48e6-ac5d-c7799e919b1f
logIni /usr/local/lib/python3.12/site-packages/pyscf/geomopt/log.ini
maxiter 80
Custom engine selected.
Bonds will be generated from interatomic distances less than 1.20 times sum of covalent radii
72 internal coordinates being used (instead of 72 Cartesians)
Internal coordinate system (atoms numbered from 1):
Distance 1-2
Distance 1-15
Distance 1-16
Distance 1-17
Distance 2-3
Distance 2-6
Distance 3-4
Distance 3-18
Distance 4-5
Distance 5-6
Distance 5-13
Distance 6-7
Distance 7-8
Distance 7-9
Distance 9-10
Distance 9-11
Distance 10-19
Distance 10-20
Distance 10-21
Distance 11-12
Distance 11-13
Distance 13-14
Distance 14-22
Distance 14-23
Distance 14-24
Angle 2-1-15
Angle 2-1-16
Angle 2-1-17
Angle 15-1-16
Angle 15-1-17
Angle 16-1-17
Angle 1-2-6
Angle 3-2-6
Angle 2-3-18
Angle 4-3-18
Angle 3-4-5
Angle 4-5-13
Angle 6-5-13
Angle 2-6-7
Angle 5-6-7
Angle 6-7-9
Angle 8-7-9
Angle 7-9-11
Angle 10-9-11
Angle 9-10-19
Angle 9-10-20
Angle 9-10-21
Angle 19-10-20
Angle 19-10-21
Angle 20-10-21
Angle 9-11-13
Angle 12-11-13
Angle 5-13-14
Angle 11-13-14
Angle 13-
... (truncated)
===== Optimization Info: ====
Job type: Energy minimization
Maximum number of optimization cycles: 80
Initial / maximum trust radius (Angstrom): 0.100 / 0.300
Convergence Criteria:
Will converge when all 5 criteria are reached:
|Delta-E| < 1.00e-06
RMS-Grad < 3.00e-04
Max-Grad < 4.50e-04
RMS-Disp < 1.20e-03
Max-Disp < 1.80e-03
=== End Optimization Info ===
Geometry optimization cycle 1
Cartesian coordinates (Angstrom)
Atom New coordinates dX dY dZ
C 3.248057 -0.565506 0.487139 0.000000 0.000000 0.000000
N 2.124774 0.302631 0.240978 0.000000 0.000000 0.000000
C 2.171711 1.663385 0.089886 -0.000000 -0.000000 -0.000000
N 0.973683 2.170383 -0.124264 0.000000 0.000000 0.000000
C 0.141496 1.092087 -0.107778 0.000000 0.000000 0.000000
C 0.817193 -0.069237 0.114123 -0.000000 0.000000 -0.000000
C 0.182980 -1.339361 0.178479 0.000000 0.000000 -0.000000
O 0.801419 -2.380432 0.379053 0.000000 0.000000 0.000000
N -1.200176 -1.263588 -0.009899 0.000000 0.000000 0.000000
C -1.964139 -2.494997 0.033134 0.000000 0.000000 0.000000
... (truncated)
New geometry
1 C 3.248057287297 -0.565506124430 0.487138672338 AA 6.137938709889 -1.068651696938 0.920558675403 Bohr
2 N 2.124773951629 0.302631209067 0.240978258579 AA 4.015240845189 0.571890101882 0.455382910688 Bohr
3 C 2.171711423173 1.663384530694 0.089886160582 AA 4.103939811386 3.143341202850 0.169860225889 Bohr
4 N 0.973682944137 2.170383225066 -0.124263756112 AA 1.839994096579 4.101429880725 -0.234824466261 Bohr
5 C 0.141495638340 1.092087136228 -0.107777509902 AA 0.267388004283 2.063745591632 -0.203669976103 Bohr
6 C 0.817192721482 -0.069236888047 0.114123479552 AA 1.544270434589 -0.130838756126 0.215662120736 Bohr
7 C 0.182980316814 -1.339360955490 0.178478987141 AA 0.345782684965 -2.531025387811 0.337276404686 Bohr
8 O 0.801419016656 -2.380431509966 0.379052654530 AA 1.514462452498 -4.498363612121 0.716305703851 Bohr
9 N -1.200175597332 -1.263588289944 -0.009899395636 AA -2.268003180343 -2.387835802201 -0.018707146552 Bohr
10 C -1.964139201419 -2.494997081162 0.033134077248 AA -3.711685161204 -4.714861164985 0.062614331389 Bohr
11 C -1.935386015820 -0.081973735594 -0.241872058488 AA -3.657349515213 -0.154907909681 -0.457071947727 Bohr
12 O -3.159861477599 -0.117175256712 -0.396822507133 AA -5.971272784225 -0.221429143761 -0.749885858545 Bohr
13 N -1.220308635761 1.115271310453 -0.287308401467 AA -2.306049109029 2.107557331341 -0.542934192060 Bohr
14 C -1.901575040437 2.375350408086 -0.521340165681 AA -3.593456031735 4.488761721156 -0.985190130872 Bohr
15 H 3.089444180879 -1.078630399237 1.438872177293 AA 5.838203378993 -2.038316044189 2.719074343341 Bohr
16 H 3.319641463369 -1.283389972278 -0.333696055145 AA 6.273213197517 -2.425255558619 -0.630594153073 Bohr
17 H 4.164017487478 0.028837235357 0.537435204798 AA 7.868852629234 0.054494477014 1.015605346768 Bohr
18 H 3.092874828548 2.230116024141 0.144048430411 AA 5.844686363517 4.214308511631 0.272212082151 Bohr
19 H -2.485615499783 -2.623534539091 -0.921091585104 AA -4.697132545563 -4.957761757218 -1.740610831488 Bohr
20 H -1.338580748470 -3.372172591047 0.215693138091 AA -2.529551010224 -6.372482641843 0.407600957941 Bohr
21 H -2.712852488604 -2.421405579332 0.828759365113 AA -5.126548219805 -4.575793381432 1.566128223232 Bohr
22 H -1.729293996607 3.038641774494 0.332228746265 AA -3.267892042442 5.742200744456 0.627821341149 Bohr
23 H -2.979087805906 2.239638112958 -0.645598684404 AA -5.629660054194 4.232302651628 -1.220004699904 Bohr
24 H -1.500414752066 2.835061955787 -1.430159232870 AA -2.835372954661 5.357490642612 -2.702609264642 Bohr
* *
method = RKS_Scanner
initial guess = minao
damping factor = 0
level_shift factor = 0
DIIS =
diis_start_cycle = 1
diis_space = 8
diis_damp = 0
SCF conv_tol = 1e-08
SCF conv_tol_grad = None
SCF max_cycles = 80
direct_scf = True
direct_scf_tol = 1e-13
chkfile to save SCF result = /tmp/tmp4sd4njmb
max_memory 4000 MB (current use 238 MB)
XC library pyscf.dft.libxc version 7.0.0
S. Lehtola, C. Steigemann, M. J.T. Oliveira, and M. A.L. Marques., SoftwareX 7, 1–5 (2018)
XC functionals = b3lyp
P. J. Stephens, F. J. Devlin, C. F. Chabalowski, and M. J. Frisch., J. Phys. Chem. 98, 11623 (1994)
radial grids:
Treutler-Ahlrichs [JCP 102, 346 (1995); DOI:10.1063/1.469408] (M4) radial grids
becke partition: Becke, JCP 88, 2547 (1988); DOI:10.1063/1.454033
pruning grids:
grids dens level: 3
symmetrized grids: False
atomic radii adjust function:
small_rho_cutoff = 0
Set gradient conv threshold to 0.0001
Initial guess from minao.
tot grids = 294800
dftd3 and dftd4 not available. Install them with pip install pyscf-dispersion
Error: ModuleNotFoundError: No module named 'pyscf.dispersion'
Jupyter Editor
Editing cell 7...
Jupyter Editor
Notebook action summary:
{
"action": "edit_cell",
"effect": "edited_cell_source",
"status": "execution_error",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"diff_summary": {
"changed": true,
"lines_added": 2,
"lines_removed": 1,
"chars": 239
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell In[9] index=7 code (29 lines, 1092 chars):
# Single-point DFT on optimized geometry and HOMO-LUMO gap.
mf = dft.RKS(mol_opt)
mf.xc = XC
if DISP is not None:
mf.disp = DISP
mf.conv_tol = 1e-9
mf.grids.level = 4
mf.max_cycle = 100
energy_h = mf.kernel()
print('Final SCF converged:', mf.converged)
print(f'Final electronic energy: {energy_h:
# ... (truncated)
Output:
Error: NameError: name 'mol_opt' is not defined
Jupyter Editor
Editing cell 5...
Jupyter Editor
Notebook action summary:
{
"action": "edit_cell",
"effect": "edited_cell_source",
"status": "ok",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9,
"cell_count_after": 9
},
"diff_summary": {
"changed": true,
"lines_added": 1,
"lines_removed": 1,
"chars": 211
},
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}
Jupyter cells:
Cell In[5] index=5 code (14 lines, 445 chars):
# Build PySCF molecule from RDKit/MMFF starting geometry.
pyscf_atom = [(sym, xyz) for sym, xyz in atom_lines]
mol = gto.Mole()
mol.atom = pyscf_atom
mol.unit = UNIT
mol.charge = CHARGE
mol.spin = SPIN
mol.basis = BASIS
mol.verbose = 3
mol.build()
print('PySCF built molecule')
print('Number of basis
# ... (truncated)
Output:
System: uname_result(system='Linux', node='2271c040-d5b7-4bc1-a2a4-a5336931f03a', release='6.17.0-1010-oracle', version='#10~24.04.1-Ubuntu SMP Thu Mar 26 20:08:26 UTC 2026', machine='x86_64') Threads 48
Python 3.12.10 (main, May 21 2025, 23:34:56) [GCC 12.2.0]
numpy 2.4.6 scipy 1.17.1 h5py 3.16.0
Date: Sun Jun 21 10:16:45 2026
PySCF version 2.13.0
PySCF path /usr/local/lib/python3.12/site-packages/pyscf
[CONFIG] conf_file None
[INPUT] verbose = 4
[INPUT] num. atoms = 24
[INPUT] num. electrons = 102
[INPUT] charge = 0
[INPUT] spin (= nelec alpha-beta = 2S) = 0
[INPUT] symmetry False subgroup None
[INPUT] Mole.unit = Angstrom
[INPUT] Symbol X Y Z unit X Y Z unit Magmom
[INPUT] 1 C 3.2480572
... (truncated)
number of shells = 114
number of NR pGTOs = 406
number of NR cGTOs = 246
basis = def2-svp
ecp = {}
CPU time: 1.73
PySCF built molecule
Number of basis functions: 246
Number of electrons (alpha, beta): (51, 51)
Nuclear repulsion energy (Hartree): 931.2913326323076
Jupyter Runner
Restarting kernel...
Jupyter Runner
Notebook action summary:
{
"action": "restart_kernel",
"effect": "restarted_kernel",
"status": "ok",
"notebook": {
"path": "sessions/203712_dft-optimization-of-caffeine-gap/caffeine_dft_gap.ipynb",
"cell_count_before": 9
},
"kernel_restarted": true,
"note": "Notebook/session files stay in the science computer. Do not copy files to /root as a Workspace save; use workspace_compute_transfer to move one file across the Workspace/Compute boundary."
}