Ejemplo n.º 1
0
def PDE_loss(x, psi, E):
    psi_dx = dfx(x, psi)
    psi_ddx = dfx(x, psi_dx[:, 0])[:, 0] + dfx(x, psi_dx[:, 1])[:, 1] + dfx(
        x, psi_dx[:, 2])[:, 2]
    diff = (prefactor_laplacian * psi_ddx + (potential(x) - E) * psi)
    loss = torch.mean(diff**2)
    return loss
Ejemplo n.º 2
0
def PDE_loss(x, psi, E):
    psi_dx = dfx(x, psi)
    psi_ddx = dfx(x, psi_dx[:, 0])[:, 0] + dfx(x, psi_dx[:, 1])[:, 1]
    diff = 1 / 2 * psi_ddx + (E - potential(
        x)) * psi  # -hbar**2/(2*m_e) * psi_ddx + potential(x) * psi  - E * psi
    loss = torch.mean(diff**2)
    return loss
Ejemplo n.º 3
0
def PDE_loss(x, psi, E):
    psi_dx = dfx(x, psi)
    psi_ddx = dfx(x, psi_dx[:, 0])[:, 0] + dfx(x, psi_dx[:, 1])[:, 1] + dfx(
        x, psi_dx[:, 2])[:, 2]
    r = torch.sqrt(torch.sum(x**2, dim=1))
    diff = laplacian_prefactor * psi_ddx + 1 / r * psi + energy_prefactor * E * psi
    loss = torch.mean(diff**2)
    return loss
Ejemplo n.º 4
0
def PDE_loss(x, psi, E):
    psi_dx = dfx(x, psi)
    psi_ddx = dfx(x, psi_dx)
    diff = 1 / 2 * psi_ddx + E * psi  # -hbar**2/(2*m_e) * psi_ddx + potential(x) * psi  - E * psi
    loss = torch.mean(diff**2)
    return loss