# Force the local gqcpy to be imported
import sys
sys.path.insert(0, '../../build/gqcpy/')
import gqcpy
import numpy as np
Set up two different domains#
Hubbard_domain_1 = gqcpy.HubbardDomain([0, 1, 2], 3)
Hubbard_domain_2 = gqcpy.HubbardDomain([2, 3, 4], 3)
Check some properties between the two domains#
Hubbard_domain_1.overlapWith(Hubbard_domain_2)
1
Hubbard_domain_1.domainIndices()
[0, 1, 2]
Hubbard_domain_1.inDomain(3)
False
Projection#
We can construct a projection matrix of the domains. We can choose between restricted and unrestricted (R/U). We need to pass the number of sites of the Hubbard system.
P_restricted = Hubbard_domain_1.RProjectionMatrix(5)
By constructing the Hubbard overlap matrix (unit matrix) we can partition it to create a domain operator.
S = gqcpy.ScalarRSQOneElectronOperator_d(np.eye(5))
operator = S.partitioned(P_restricted)
print(operator.parameters())
[[1. 0. 0. 0. 0.]
[0. 1. 0. 0. 0.]
[0. 0. 1. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]
P_unrestricted = Hubbard_domain_1.UProjectionMatrix(5)
US = gqcpy.ScalarUSQOneElectronOperator_d(gqcpy.ScalarUSQOneElectronOperatorComponent_d(np.eye(5)), gqcpy.ScalarUSQOneElectronOperatorComponent_d(np.eye(5)))
unrestricted_operator = US.partitioned(P_unrestricted)
print(unrestricted_operator.alpha.parameters())
[[1. 0. 0. 0. 0.]
[0. 1. 0. 0. 0.]
[0. 0. 1. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]
print(unrestricted_operator.beta.parameters())
[[1. 0. 0. 0. 0.]
[0. 1. 0. 0. 0.]
[0. 0. 1. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]