Skip to content

Commit

Permalink
Basis set studies
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkin committed Dec 26, 2017
1 parent 744e98a commit 5f9bee0
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 4 deletions.
17 changes: 16 additions & 1 deletion doc/dchf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,28 @@ The benchmark model is :math:`\mathrm{C_{6} H_{14}}` split into 6 clusters.

.. image:: plots/alkane-6-domains.svg

The density matrix
Basis set: cc-pvdz
------------------

The density matrix comparison:

.. plot:: plots/27-dchf-errors-locality-alkane_cached.py

DM error: 1.27165943285

DM intrinsic error: 0.00862713587552

Energy diff: 0.769603364653

Basis set: sto3g
----------------

The density matrix comparison:

.. plot:: plots/27-dchf-errors-locality-alkane-alt_cached.py

DM error: 0.0747824565832

DM intrinsic error: 0.0108856898115

Energy diff: 0.0193028866541
6 changes: 3 additions & 3 deletions doc/plots/20-dchf-convergence-he_cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
This file was generated automatically.
"""
from matplotlib import pyplot
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591153214613, 0.00043273689330769471, 3.2776507787213305e-05, 2.4824612465668139e-06, 1.8801861234596373e-07, 1.4240298940038087e-08, 1.0785429216397802e-09, 8.1687989705869768e-11, 6.1879390500507725e-12, 4.6851411639181606e-13, 3.652633751016765e-14, 3.5527136788005009e-15, 1.6653345369377348e-15, 5.5511151231257827e-16, 6.6613381477509392e-16, 7.7715611723760958e-16, 8.8817841970012523e-16, 1.1102230246251565e-15, 6.6613381477509392e-16, 4.4408920985006262e-16, 5.5511151231257827e-16, 9.9920072216264089e-16, 1.2212453270876722e-15, 9.9920072216264089e-16, 5.5511151231257827e-16, 1.1102230246251565e-15, 4.4408920985006262e-16, 8.8817841970012523e-16, 9.9920072216264089e-16, 6.6613381477509392e-16], marker="o", label="N=6 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591153214613, 0.00043273689330769471, 3.5462193736401915e-05, 1.0875156331024982e-10, 3.2423286278060459e-11, 1.5575540857071246e-11, 9.1507912358679278e-12, 6.0241811539185619e-12, 4.2644776598876888e-12, 2.4936497311500716e-11, 4.6068704406820871e-12, 1.8608448115742249e-12, 8.4920959153578224e-13, 5.4978244179437752e-13, 4.0811798385220754e-13, 3.2462921240039577e-13, 2.708944180085382e-13, 2.333688797762079e-13, 1.7763568394002505e-15, 4.2188474935755949e-14, 2.55351295663786e-14, 1.787459069646502e-14, 1.3211653993039363e-14, 9.8809849191638932e-15, 6.106226635438361e-15, 3.7747582837255322e-15, 1.8873791418627661e-15, 1.6653345369377348e-15, 9.9920072216264089e-16, 1.2212453270876722e-15], marker="o", label="N=6 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591153214613, 0.00043273689330769471, 3.2776507787213305e-05, 2.4824612465668139e-06, 1.8801861234596373e-07, 1.4240298940038087e-08, 1.0785429216397802e-09, 8.1687989705869768e-11, 6.1879390500507725e-12, 4.6851411639181606e-13, 3.652633751016765e-14, 3.5527136788005009e-15, 1.6653345369377348e-15, 5.5511151231257827e-16, 6.6613381477509392e-16, 7.7715611723760958e-16, 8.8817841970012523e-16, 1.1102230246251565e-15, 6.6613381477509392e-16, 4.4408920985006262e-16, 5.5511151231257827e-16, 9.9920072216264089e-16, 1.2212453270876722e-15, 9.9920072216264089e-16, 5.5511151231257827e-16, 1.1102230246251565e-15, 4.4408920985006262e-16, 8.8817841970012523e-16, 9.9920072216264089e-16, 6.6613381477509392e-16], marker="o", label="N=6 plain")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591274012429, 0.00043273688941170008, 3.2776507492449092e-05, 2.4824612235851973e-06, 1.8801860990347308e-07, 1.424029905106039e-08, 1.0785440318628048e-09, 8.1688322772777155e-11, 6.1872729162359974e-12, 4.6962433941644122e-13, 3.6304292905242619e-14, 3.219646771412954e-15, 1.2212453270876722e-15, 1.3322676295501878e-15, 1.2212453270876722e-15, 8.8817841970012523e-16, 8.8817841970012523e-16, 8.8817841970012523e-16, 8.8817841970012523e-16, 6.6613381477509392e-16, 6.6613381477509392e-16, 8.8817841970012523e-16, 9.9920072216264089e-16, 9.9920072216264089e-16, 6.6613381477509392e-16, 1.4432899320127035e-15, 1.5543122344752192e-15, 1.9984014443252818e-15, 1.4432899320127035e-15, 8.8817841970012523e-16], marker="o", label="N=12 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591274012429, 0.00043273688941170008, 3.5462193419211196e-05, 1.0875289557787937e-10, 3.2419511519776734e-11, 1.5577095169305721e-11, 9.1509022581703903e-12, 6.0238480870111744e-12, 4.2651437937024639e-12, 2.4940716158994292e-11, 4.6108672435707376e-12, 1.8606227669692998e-12, 8.4920959153578224e-13, 5.5000448639930255e-13, 4.0767389464235748e-13, 3.2474023470285829e-13, 2.7189361873070084e-13, 2.3314683517128287e-13, 1.8873791418627661e-15, 4.2854608750531042e-14, 2.5313084961453569e-14, 1.8762769116165146e-14, 1.2989609388114332e-14, 9.1038288019262836e-15, 5.9952043329758453e-15, 3.9968028886505635e-15, 1.5543122344752192e-15, 1.4432899320127035e-15, 1.5543122344752192e-15, 1.1102230246251565e-15], marker="o", label="N=12 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591274012429, 0.00043273688941170008, 3.2776507492449092e-05, 2.4824612235851973e-06, 1.8801860990347308e-07, 1.424029905106039e-08, 1.0785440318628048e-09, 8.1688322772777155e-11, 6.1872729162359974e-12, 4.6962433941644122e-13, 3.6304292905242619e-14, 3.219646771412954e-15, 1.2212453270876722e-15, 1.3322676295501878e-15, 1.2212453270876722e-15, 8.8817841970012523e-16, 8.8817841970012523e-16, 8.8817841970012523e-16, 8.8817841970012523e-16, 6.6613381477509392e-16, 6.6613381477509392e-16, 8.8817841970012523e-16, 9.9920072216264089e-16, 9.9920072216264089e-16, 6.6613381477509392e-16, 1.4432899320127035e-15, 1.5543122344752192e-15, 1.9984014443252818e-15, 1.4432899320127035e-15, 8.8817841970012523e-16], marker="o", label="N=12 plain")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591314280218, 0.00043273688811196198, 3.2776507393750265e-05, 2.4824612164797699e-06, 1.8801860945938387e-07, 1.4240298829015785e-08, 1.0785442539074097e-09, 8.1688322772777155e-11, 6.1876059831433849e-12, 4.6973536171890373e-13, 3.6415315207705135e-14, 3.3306690738754696e-15, 1.4432899320127035e-15, 1.1102230246251565e-15, 8.8817841970012523e-16, 1.1102230246251565e-15, 1.3322676295501878e-15, 9.9920072216264089e-16, 6.6613381477509392e-16, 1.2212453270876722e-15, 1.1102230246251565e-15, 9.9920072216264089e-16, 7.7715611723760958e-16, 1.4432899320127035e-15, 7.7715611723760958e-16, 1.1102230246251565e-15, 9.9920072216264089e-16, 7.7715611723760958e-16, 8.8817841970012523e-16, 8.8817841970012523e-16], marker="o", label="N=18 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591314280218, 0.00043273688811218403, 3.5462193312518764e-05, 1.0875345068939168e-10, 3.2418845385961959e-11, 1.5576540057793409e-11, 9.152567592707328e-12, 6.0231819531963993e-12, 4.2649217490975389e-12, 2.4940605136691829e-11, 4.6107562212682751e-12, 1.8613999230865375e-12, 8.4876550232593218e-13, 5.49671419491915e-13, 4.0800696154974503e-13, 3.2496227930778332e-13, 2.708944180085382e-13, 2.3292479056635784e-13, 1.5543122344752192e-15, 4.3076653355456074e-14, 2.5979218776228663e-14, 1.787459069646502e-14, 1.3211653993039363e-14, 9.3258734068513149e-15, 6.4392935428259079e-15, 3.7747582837255322e-15, 1.5543122344752192e-15, 1.7763568394002505e-15, 1.2212453270876722e-15, 9.9920072216264089e-16], marker="o", label="N=18 DIIS")
pyplot.semilogy([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [0.0057099591314280218, 0.00043273688811196198, 3.2776507393750265e-05, 2.4824612164797699e-06, 1.8801860945938387e-07, 1.4240298829015785e-08, 1.0785442539074097e-09, 8.1688322772777155e-11, 6.1876059831433849e-12, 4.6973536171890373e-13, 3.6415315207705135e-14, 3.3306690738754696e-15, 1.4432899320127035e-15, 1.1102230246251565e-15, 8.8817841970012523e-16, 1.1102230246251565e-15, 1.3322676295501878e-15, 9.9920072216264089e-16, 6.6613381477509392e-16, 1.2212453270876722e-15, 1.1102230246251565e-15, 9.9920072216264089e-16, 7.7715611723760958e-16, 1.4432899320127035e-15, 7.7715611723760958e-16, 1.1102230246251565e-15, 9.9920072216264089e-16, 7.7715611723760958e-16, 8.8817841970012523e-16, 8.8817841970012523e-16], marker="o", label="N=18 plain")
pyplot.xlabel("Step")
pyplot.ylabel("Error in the density matrix")
Expand Down
47 changes: 47 additions & 0 deletions doc/plots/27-dchf-errors-locality-alkane-alt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from pyscf import scf

from dchf import DCHF

import numpy

from plot_common import load_pyscf_cluster_model, draw_cluster_model
import fake
pyplot = fake.pyplot()

tolerance = 1e-5

draw_cluster_model("alkane-4", width=800, height=200)

dchf = load_pyscf_cluster_model("alkane-4", basis='sto3g')
dchf.__mol__.verbose = 4
dchf.kernel(tolerance=tolerance, fock_hook=None)

# dchf_nb = load_pyscf_cluster_model("alkane-12", isolated_cluster=True)
# dchf_nb.__mol__.verbose = 4
# dchf_nb.kernel(fock_hook=None)

hf = scf.RHF(dchf.__mol__)
hf.conv_tol = tolerance
hf.kernel()
dm_ref = hf.make_rdm1()

print "DM error:", abs(dchf.dm - dm_ref).max()
mask = numpy.logical_not(dchf.domains_pattern(2))
print "DM intrinsic error:", abs(dm_ref*mask).max()
print "Energy diff:", abs(dchf.e_tot - hf.e_tot)

# pyplot.figure(figsize=(20, 4.8))
pyplot.figure(figsize=(12, 4.8))
for hf, subplot, title in (
# (hf, 131, "HF"),
# (dchf_nb, 132, "DC-HF (no buffer)"),
# (dchf, 133, "DC-HF"),
(hf, 121, "HF"),
(dchf, 122, "DC-HF"),
):
pyplot.subplot(subplot)
pyplot.imshow(abs(hf.dm if isinstance(hf, DCHF) else hf.make_rdm1()), vmin=0, vmax=2)
pyplot.title(title)
pyplot.colorbar()

pyplot.show()
16 changes: 16 additions & 0 deletions doc/plots/27-dchf-errors-locality-alkane-alt_cached.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions doc/plots/alkane-4-alt-domains.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions doc/plots/alkane-4-domains.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions doc/plots/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
{"core": [16, 17, 18, 19], "buffer": [10, 11, 12, 13, 14, 15]}
]
},
"alkane-4-alt": {
"pyscf-string": "C 5.29939098 3.54076487 3.37924476; H 5.29939098 2.91360568 4.25848952; H 5.29939098 2.91360568 2.50000000; C 6.45909854 4.36797623 3.37924476; H 6.45909854 4.99513542 4.25848952; H 6.45909854 4.99513542 2.50000000; C 7.61880609 3.54076487 3.37924476; H 7.61880609 2.91360568 4.25848952; H 7.61880609 2.91360568 2.50000000; C 8.77851365 4.36797623 3.37924476; H 8.77851365 4.99513542 4.25848952; H 8.77851365 4.99513542 2.50000000; C 9.93822121 3.54076487 3.37924476; H 9.93822121 2.91360568 4.25848952; H 9.93822121 2.91360568 2.50000000; C 11.09792876 4.36797623 3.37924476; H 11.09792876 4.99513542 4.25848952; H 11.09792876 4.99513542 2.50000000",
"domains": [
{"core": [0, 1, 2], "buffer": [3, 4, 5, 6, 7, 8]} ,
{"core": [3, 4, 5], "buffer": [0, 1, 2, 6, 7, 8, 9, 10, 11]} ,
{"core": [6, 7, 8], "buffer": [0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14]} ,
{"core": [9, 10, 11], "buffer": [3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17]} ,
{"core": [12, 13, 14], "buffer": [6, 7, 8, 9, 10, 11, 15, 16, 17]} ,
{"core": [15, 16, 17], "buffer": [9, 10, 11, 12, 13, 14]}
]
},
"alkane-12": {
"pyscf-string": "H 4.42014622 4.16792406 3.37924476; C 5.29939098 3.54076487 3.37924476; H 5.29939098 2.91360568 4.25848952; H 5.29939098 2.91360568 2.50000000; C 6.45909854 4.36797623 3.37924476; H 6.45909854 4.99513542 4.25848952; H 6.45909854 4.99513542 2.50000000; C 7.61880609 3.54076487 3.37924476; H 7.61880609 2.91360568 4.25848952; H 7.61880609 2.91360568 2.50000000; C 8.77851365 4.36797623 3.37924476; H 8.77851365 4.99513542 4.25848952; H 8.77851365 4.99513542 2.50000000; C 9.93822121 3.54076487 3.37924476; H 9.93822121 2.91360568 4.25848952; H 9.93822121 2.91360568 2.50000000; C 11.09792876 4.36797623 3.37924476; H 11.09792876 4.99513542 4.25848952; H 11.09792876 4.99513542 2.50000000; C 12.25763632 3.54076487 3.37924476; H 12.25763632 2.91360568 4.25848952; H 12.25763632 2.91360568 2.50000000; C 13.41734387 4.36797623 3.37924476; H 13.41734387 4.99513542 4.25848952; H 13.41734387 4.99513542 2.50000000; C 14.57705143 3.54076487 3.37924476; H 14.57705143 2.91360568 4.25848952; H 14.57705143 2.91360568 2.50000000; C 15.73675898 4.36797623 3.37924476; H 15.73675898 4.99513542 4.25848952; H 15.73675898 4.99513542 2.50000000; C 16.89646654 3.54076487 3.37924476; H 16.89646654 2.91360568 4.25848952; H 16.89646654 2.91360568 2.50000000; C 18.05617410 4.36797623 3.37924476; H 18.05617410 4.99513542 4.25848952; H 18.05617410 4.99513542 2.50000000; H 18.93541886 3.74081704 3.37924476",
"domains": [
Expand Down

0 comments on commit 5f9bee0

Please sign in to comment.