コード例 #1
0
def calculate(model, domain_size, buffer_size=0, diis=True):
    hf = dchf.DCHF(model)
    assign_chain_domains(hf, domain_size, buffer_size)

    # Since the convergence criterion is never met an exception will be raised
    try:
        hf.kernel(tolerance=0, maxiter=maxiter, fock_hook="diis" if diis else None)
    except RuntimeError:
        pass
    return hf.convergence_history
コード例 #2
0
def setup_full(model):
    hf = dchf.DCHF(model)
    assign_chain_domains(hf, model.natm, 0)
    return hf
コード例 #3
0
times = []
titles = []
errors = []

pyplot.figure(figsize=(12, 4.8))
pyplot.subplot(121)
for domain_size in [2, 4, 6, 8, 12, 24]:
    print "Size={:d}".format(domain_size)
    x = list(sorted(set([0, 2, (domain_size // 4) * 2, domain_size])))
    y = []
    for buffer_size in x:
        print "  buff={:d}".format(buffer_size)

        t = time.time()
        hf = dchf.DCHF(model)
        assign_chain_domains(hf, domain_size, buffer_size)
        hf.kernel(tolerance=1e-9, maxiter=30)
        t = time.time() - t
        times.append(t)

        error = abs(ref_e - hf.e_tot)

        titles.append("{:d}({:d})".format(domain_size, buffer_size))
        errors.append(error)
        y.append(error)

        if buffer_size + domain_size >= N:
            break

    pyplot.semilogy(x[:len(y)],
コード例 #4
0
def setup(model):
    hf = dchf.DCHF(model)
    assign_chain_domains(hf, 1, 0)
    return hf