Esempio n. 1
0
#   wrap this as an attribute in a subclass of grendel.Molecule (examples of this
#   will be given elsewhere), but for this simple example, using the bare
#   CachedComputation object will suffice.
comp = comp_cache.get_computation(
    # The first argument can be an xyz string (as shown here) or anything else
    #   for which grendel.Molecule(arg) returns something sensible.  It can
    #   also be a grendel.Molecule instance, which is necessary to access more
    #   complicated features like charge and multiplicity.
    """
    8
    Ethane
    C     0.76500000   0.00000000  -0.00000000
    C    -0.76500000  -0.00000000  -0.00000000
    H     1.12830000  -0.51380000   0.89000000
    H     1.12830000  -0.51380000  -0.89000000
    H     1.12830000   1.02770000   0.00000000
    H    -1.12830000   0.51380000   0.89000000
    H    -1.12830000   0.51380000  -0.89000000
    H    -1.12830000  -1.02770000   0.00000000
    """,
    # The rest of the call is typically just keyword arguments that get passed
    #   in one form or another to the CachedComputation constructor.  Valid keywords
    #   should be one of the values in ComputationCache.required_attributes,
    #   one of the keys in ComputationCache.optional_attributes, or
    #   ComputationCache.available_psi_options.  The details of these three
    #   types of keywords are explained elsewhere.  Currently, the only required
    #   argument is "basis", which should be a string naming a valid basis set.
    basis="6-31G"
)

# Get the two electron AO integrals into a grenel.Tensor object, which is basically
#   a slightly-more-user-friendly subclass of numpy.ndarray.
Esempio n. 2
0
#   Read through schwarz_1.py first before reading this script.
#------------- Begin documented in schwarz_1.py -------------#
my_dir = dirname(abspath(__file__))
comp_cache = ComputationCache(
    path_join(my_dir, ".comp_cache"),
    make_directory=True
)

comp = comp_cache.get_computation(
    """
    8
    Ethane
    C     0.76500000   0.00000000  -0.00000000
    C    -0.76500000  -0.00000000  -0.00000000
    H     1.12830000  -0.51380000   0.89000000
    H     1.12830000  -0.51380000  -0.89000000
    H     1.12830000   1.02770000   0.00000000
    H    -1.12830000   0.51380000   0.89000000
    H    -1.12830000   0.51380000  -0.89000000
    H    -1.12830000  -1.02770000   0.00000000
    """,
    basis="6-31G"
)

g = comp.get_datum(
    "ao_eri",
    pre_computation_callback=lambda: print("Computing two electron integrals for ERI kernel"),
    post_computation_callback=lambda: print("Done!"),
).value.view(Tensor)

schwarz = Tensor(shape=g.shape[:2])