コード例 #1
0
def test_generator_collocation(basis_name, spherical):

    trans = "spherical" == spherical
    kwargs = {
        "spherical_order": gg.spherical_order(),
        "cartesian_order": gg.cartesian_order(),
        "spherical": trans,
        "grad": 2
    }

    basis = ref_basis.test_basis[basis_name]

    t = time.time()
    gen_results = gg.collocation_basis(xyzw, basis, **kwargs)
    gg_time = time.time() - t

    t = time.time()
    ref_results = gg.ref.collocation_basis(xyzw, basis, **kwargs)
    ref_time = time.time() - t

    # Print time with py.test -s flags
    print("")
    print("%s-%s time REF: %8.4f GG: %8.4f" %
          (basis_name, spherical, ref_time, gg_time))

    th.compare_collocation_results(gen_results, ref_results)
コード例 #2
0
def test_generator_orbital(basis_name, spherical):

    trans = "spherical" == spherical
    kwargs = {
        "spherical_order": gg.spherical_order(),
        "cartesian_order": gg.cartesian_order(),
        "spherical": trans,
        "grad": 0
    }

    basis = ref_basis.test_basis[basis_name]

    t = time.time()
    phi = gg.collocation_basis(xyzw, basis, **kwargs)["PHI"]
    orbs = np.random.rand(5, phi.shape[0])
    benchmark = np.dot(orbs, phi)
    ref_time = time.time() - t

    t = time.time()
    del kwargs["grad"]
    ref_results = gg.orbital_basis(orbs, xyzw, basis, **kwargs)
    gg_time = time.time() - t

    # Print time with py.test -s flags
    print("")
    print("%s-%s time REF: %8.4f GG: %8.4f" % (basis_name, spherical, ref_time, gg_time))
    # print(benchmark)
    # print(ref_results)

    th.compare_collocation_results({"ORBITALS": benchmark}, {"ORBITALS": ref_results})
コード例 #3
0
def test_generator_derivs_spherical(grad):

    basis = ref_basis.test_basis["cc-pVDZ"]

    gen_results = gg.collocation_basis(xyzw, basis, spherical=True, grad=grad)
    ref_results = gg.ref.collocation_basis(xyzw, basis, spherical=True, grad=grad)

    th.compare_collocation_results(gen_results, ref_results)
コード例 #4
0
def test_generator_derivs_spherical(grad):
    kwargs = {
        "spherical_order": "cca",
        "cartesian_order": "cca",
        "spherical": True,
        "grad": grad
    }

    basis = ref_basis.test_basis["cc-pVDZ"]

    gen_results = gg.collocation_basis(xyzw, basis, **kwargs)
    ref_results = gg.ref.collocation_basis(xyzw, basis, **kwargs)

    th.compare_collocation_results(gen_results, ref_results)
コード例 #5
0
def test_generator_collocation(basis_name, spherical):

    trans = "spherical" == spherical
    basis = ref_basis.test_basis[basis_name]

    t = time.time()
    gen_results = gg.collocation_basis(xyzw, basis, spherical=trans, grad=2)
    gg_time = time.time() - t

    t = time.time()
    ref_results = gg.ref.collocation_basis(xyzw, basis, spherical=trans, grad=2)
    ref_time = time.time() - t

    # Print time with py.test -s flags
    print("")
    print("%s-%s time REF: %8.4f GG: %8.4f" % (basis_name, spherical, ref_time, gg_time))

    th.compare_collocation_results(gen_results, ref_results)