1:mod:`lib` --- Helper functions, parameters, and C extensions
2*************************************************************
3
4.. module:: lib
5   :synopsis: Helper functions, parameters, and C extensions.
6
7
8:mod:`lib.parameters`
9=====================
10
11.. automodule:: lib.parameters
12
13
14:mod:`lib.logger`
15=================
16
17.. automodule:: lib.logger
18
19Logger object
20-------------
21.. autoclass:: lib.logger.Logger
22
23.. autofunction:: lib.logger.new_logger
24
25
26numpy extensions
27================
28
29.. automodule:: lib.numpy_helper
30   :members:
31
32
33scipy extensions
34================
35
36.. automodule:: lib.linalg_helper
37   :members:
38
39
40:mod:`lib.chkfile`
41==================
42
43Chkfile is a HDF5 file.
44
45Functions to access key/value in chkfile
46----------------------------------------
47
48.. automodule:: lib.chkfile
49   :members: save, load, save_mol, load_mol
50
51
52Quickly loading object from chkfile
53-----------------------------------
54
55The results of SCF and MCSCF methods are saved as a Python dictionary in
56the chkfile.  One can fast load the results and update the SCF and MCSCF
57objects using the python built in methods ``.__dict__.update``, e.g.::
58
59    from pyscf import gto, scf, mcscf, lib
60    mol = gto.M(atom='N 0 0 0; N 1 1 1', basis='ccpvdz')
61    mf = mol.apply(scf.RHF).set(chkfile='n2.chk).run()
62    mc = mcscf.CASSCF(mf, 6, 6).set(chkfile='n2.chk').run()
63
64    # load SCF results
65    mf = scf.RHF(mol)
66    mf.__dict__.update(lib.chkfile.load('n2.chk', 'scf'))
67
68    # load MCSCF results
69    mc = mcscf.CASCI(mf, 6, 6)
70    mc.__dict__.update(lib.chkfile.load('n2.chk', 'mcscf'))
71    mc.kernel()
72
73
74:mod:`lib.diis`
75===============
76
77.. automodule:: lib.diis
78   :members: DIIS, restore
79
80
81Other helper functions
82======================
83
84Background mode
85---------------
86.. autofunction:: lib.call_in_background
87
88
89Temporary HDF5 file
90-------------------
91.. autoclass:: lib.H5TmpFile
92
93
94OpenMP threads
95--------------
96.. autofunction:: lib.num_threads
97
98.. autoclass:: lib.with_omp_threads
99
100
101Capture stdout
102--------------
103.. autoclass:: lib.capture_stdout
104
105
106Other helper functions in :mod:`lib.misc`
107-----------------------------------------
108.. automodule:: lib.misc
109  :members: flatten, light_speed
110