-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
The DF-MP2 example as per our discussion.
# Initialize base objects
iaQ = DiskTensor("iaQ DF Tensor", oshape, vshape, Qshape)
eps_o = CoreTensor("Occupied eigenvalues", oshape)
eps_v = CoreTensor("Virtual eigenvalues", vshape)
# Initialize temps
Qv_1 = CoreTensor("Qv_1", Qshape, vshape)
Qv_2 = CoreTensor("Qv_2", Qshape, vshape)
vv_numer_1 = CoreTensor("vv_numer_1", vshape, vshape)
vv_numer_2 = CoreTensor("vv_numer_2", vshape, vshape)
denom = CoreTensor("vv_denom", vshape, vshape)
vv_denom = CoreTensor("vv_denom", vshape, vshape)
vv_denom["i,j"] = - eps_v["i"] - eps_v["j"]
for i in range(ndocc):
Qv_1[“ab"] = READ(iaQ, {j, "a", "b"})
for j in range(ndocc):
Qv_2["ab"] = READ(iaQ, {j, "a", “b"})
# Form integrals
vv_numer_1["ab"] = Qv_1["aQ"] * Qv_2["bQ"]
# Form denominator
denom["ab"] = vv_denom["ab"]
denom["ab"] += (eps_o[i] + eps_o[j])
# OS correlation
vv_numer_2["ab"] = vv_numer_1["ab"]
vv_numer_2["ab"] *= vv_numer_1["ab"]
MP2corr_OS += vv_numer_2["ab"] / denom["ab"]
# SS correlation
vv_numer_2["ab"] = vv_numer_1["ab"]
vv_numer_2["ab"] -= vv_numer_1["ba"]
vv_numer_2["ab"] *= vv_numer_1["ab"]
MP2corr_SS += vv_numer_2["ab"] / denom["ab"]Features needed
- Slicing syntax for read/writing from/to Core/Disk tensors. As a note if we do like the
READsyntax it can be done in C++ through the use ofstd::tuplesinstead ofstd::vector. - Element-wise arithmetic
-, +, /, * - Broadcasting. At its simplest form this is the ability to add a single number to a tensor.
- Reduce (sum) operations. It would be nice if we could do
reduce(vv_numer_2["ab"] / denom["ab"])that would not require a second tensor to hold the product of the divisor. Some describe this as lazy evaluation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels