Skip to content
Permalink
Browse files

Improvements to dissociation plots

  • Loading branch information...
mfherbst committed Apr 30, 2018
1 parent bc3804c commit 6e7e351c7b4dbc1a4dd255b75e617c6fcb50efc4
@@ -28,7 +28,7 @@

def compute_curve(atom, basis_set="sto-3g", conv_tol=1e-6, zrange=(0.5, 8.0), n_points=25,
restricted=False, verbose=False, method="hf"):
if method not in ["hf", "mp2"]:
if method not in ["hf", "mp2", "fci"]:
raise ValueError("Only implemented for hf and mp2")

z = np.linspace(zrange[0], zrange[1], n_points)
@@ -49,10 +49,16 @@ def compute_curve(atom, basis_set="sto-3g", conv_tol=1e-6, zrange=(0.5, 8.0), n_

if previous_hf is None:
previous_hf = hf
if method == "mp2":
hf = molsturm.posthf.mp2(hf)

f[i] = hf["energy_ground_state"]
if method == "hf":
f[i] = hf["energy_ground_state"]
elif method == "mp2":
mp2 = molsturm.posthf.mp2(hf)
f[i] = mp2["energy_ground_state"]
elif method == "fci":
fci = molsturm.posthf.fci(hf, n_roots=1)
f[i] = fci["states"][0]["energy"]

except RuntimeError as e:
print("Caught error for z=", z[i])
print(str(e))
@@ -23,6 +23,7 @@

import dissociation
from matplotlib import pyplot as plt
import molsturm.posthf

z, f = dissociation.compute_curve("h", "def2-sv(p)", n_points=35,
restricted=True, method="hf")
@@ -36,5 +37,11 @@
z, f = dissociation.compute_curve("h", "def2-sv(p)", n_points=35,
restricted=False, method="mp2")
plt.plot(z, f, label="MP2 unrestricted")

if "fci" in molsturm.posthf.available_methods:
z, f = dissociation.compute_curve("h", "def2-sv(p)", n_points=35,
restricted=False, method="fci")
plt.plot(z, f, label="FCI")

plt.legend()
plt.show()
@@ -49,6 +49,11 @@ def empirical_kopt(system):
raise ValueError("Can only work on atomic systems")
Z = system.atom_numbers[0]

# TODO Generally speaking these values are optimal for *large* basis sets
# but not that optimal for smaller basis sets.
# Maybe we should change this, because in larger basis sets
# the error is smaller anyways

# TODO This is just something where we fitted some data to get this.
# I guess one could make some rationalisation here using the scaling of
# Z_eff and E_hydrogenic vs Z and such.
@@ -23,6 +23,11 @@

namespace molsturm {

// TODO Better design:
// - Every Fock matrix term does not only know how to apply itself, but also
// how to compute its energy. A default implementation for this would be
// tr(C^T Term C)

template <typename StoredMatrix>
struct IntegralTermContainer {
typedef StoredMatrix stored_matrix_type;

0 comments on commit 6e7e351

Please sign in to comment.
You can’t perform that action at this time.