Пример #1
0
    def __init__(self,
                 l=10,
                 grid_length=10,
                 num_grid_points=201,
                 alpha=1.0,
                 a=0.25,
                 Omega=0.25,
                 omega=2,
                 epsilon0=1,
                 nparticles=2,
                 antisymmetrize=True):

        self.potential = ODQD.HOPotential(Omega)

        odho = ODQD(l,
                    grid_length,
                    num_grid_points,
                    a,
                    alpha,
                    potential=self.potential)
        self.system = GeneralOrbitalSystem(n=nparticles,
                                           basis_set=odho,
                                           anti_symmetrize=antisymmetrize)

        self.nparticles = nparticles
        self.Omega = Omega
        self.omega = omega
        self.epsilon0 = epsilon0
Пример #2
0
    def __init__(self,
                 l=10,
                 grid_length=10,
                 num_grid_points=201,
                 alpha=1.0,
                 a=0.25,
                 Omega=0.25,
                 omega=2,
                 epsilon0=1,
                 nparticles=2,
                 potential=None,
                 antisymmetrize=False):

        self.potential = ODQD.HOPotential(Omega)

        self.system = ODQD(l,
                           grid_length,
                           num_grid_points,
                           a,
                           alpha,
                           potential=self.potential)
        self.nparticles = nparticles
        self.Omega = Omega
        self.omega = omega
        self.epsilon0 = epsilon0
Пример #3
0
def get_odho():
    n = 2
    l = 10

    grid_length = 5
    num_grid_points = 1001
    omega = 1

    odho = GeneralOrbitalSystem(
        n,
        ODQD(
            l, grid_length, num_grid_points, potential=ODQD.HOPotential(omega)
        ),
    )

    return odho
Пример #4
0
def test_spin_squared():
    n = 2
    l = 2
    dim = 2

    spas = SpatialOrbitalSystem(n, RandomBasisSet(l, dim))
    spas = SpatialOrbitalSystem(
        n, ODQD(l, 8, 1001, potential=ODQD.HOPotential(1)))
    gos = spas.construct_general_orbital_system(a=[1, 0], b=[0, 1])

    overlap = spas.s
    overlap_sq = np.einsum("pr, qs -> pqrs", overlap, overlap)

    a = gos._basis_set.a
    b = gos._basis_set.b

    aa = np.kron(a, a)
    ab = np.kron(a, b)
    ba = np.kron(b, a)
    bb = np.kron(b, b)

    triplets = [aa, 1 / np.sqrt(2) * (ab + ba), bb]
    singlet = [1 / np.sqrt(2) * (ab - ba)]

    # S^2 with alpha = [1, 0]^T and beta = [0, 1]^T
    S_sq_spin = np.zeros((4, 4))
    S_sq_spin[0, 0] = 2
    S_sq_spin[3, 3] = 2
    S_sq_spin[1, 1] = 1
    S_sq_spin[2, 2] = 1
    S_sq_spin[1, 2] = 1
    S_sq_spin[2, 1] = 1
    S_sq_spin = S_sq_spin.reshape(2, 2, 2, 2)

    for trip in triplets:
        # Check that the eigenvalue of all triplet states is 2
        np.testing.assert_allclose(trip.T @ S_sq_spin.reshape(4, 4) @ trip, 2)

    # Check that the eigenvalue of the singlet state is 0
    np.testing.assert_allclose(
        singlet[0].T @ S_sq_spin.reshape(4, 4) @ singlet[0], 0)
Пример #5
0
def save_data(system, system_name):
    np.save(f"{system_name}_dipole_moment", system.dipole_moment)
    np.save(f"{system_name}_h", system.h)
    np.save(f"{system_name}_u", system.u)
    np.save(f"{system_name}_spf", system.spf)


n = 2
l = 20

grid_length = 5
num_grid_points = 1001
omega = 1

odho = ODQD(n, l, grid_length, num_grid_points)
odho.setup_system(potential=ODQD.HOPotential(omega))
save_data(odho, "odho")

length_of_dw = 5

oddw = ODQD(n, l, 6, num_grid_points)
oddw.setup_system(potential=ODQD.DWPotential(omega, length_of_dw))
save_data(oddw, "oddw")

weight = 1
center = 0
deviation = 2.5

odgauss = ODQD(n, l, 20, num_grid_points)
odgauss.setup_system(
    potential=ODQD.GaussianPotential(weight, center, deviation, np=np))