Пример #1
0
    def __init__(self):
        points = np.array([
            [0.0, 0.0],
            [1.0, 0.0],
            [2.0, 0.0],
            [3.0, 0.0],
            [4.0, 0.0],
            [5.0, 0.0],
            [0.5, np.sqrt(3) / 2],
            [1.5, np.sqrt(3) / 2],
            [2.5, np.sqrt(3) / 2],
            [3.5, np.sqrt(3) / 2],
            [4.5, np.sqrt(3) / 2],
            [5.5, np.sqrt(3) / 2],
        ],
                          dtype=np.float64)
        vectors = np.array([[6.0, 0.0], [3.0, np.sqrt(3)]], dtype=np.float64)
        cluster = Lattice(points, vectors)
        intra, inter = cluster.bonds(nth=1)
        x_bonds = []
        y_bonds = []
        z_bonds = []
        for bond in intra + inter:
            p0, p1 = bond.endpoints
            index0 = cluster.getIndex(site=p0, fold=True)
            index1 = cluster.getIndex(site=p1, fold=True)
            bond_index = (index0, index1)

            azimuth = bond.getAzimuth(ndigits=0)
            if azimuth in (-180, 0, 180):
                x_bonds.append(bond_index)
            elif azimuth in (-120, 60):
                z_bonds.append(bond_index)
            elif azimuth in (-60, 120):
                y_bonds.append(bond_index)
            else:
                raise RuntimeError("Invalid bond azimuth: {0}".format(azimuth))

        self._identity = "Triangle12"
        self._cluster = cluster
        self._x_bonds = tuple(x_bonds)
        self._y_bonds = tuple(y_bonds)
        self._z_bonds = tuple(z_bonds)
Пример #2
0
import matplotlib.pyplot as plt
import numpy as np
from HamiltonianPy import KPath, Lattice

SQRT3 = np.sqrt(3)
POINTS = np.array(
    [[0.0, 0.0], [1.0, SQRT3], [2.0, 0.0], [3.0, SQRT3], [1.0, 1.0 / SQRT3]],
    dtype=np.float64)
VECTORS = np.array([[4.0, 0.0], [2.0, 2 * SQRT3]], dtype=np.float64)

t0 = 0.0
t1 = -1.00
t2 = -0.25
id = "t0={0:.2f}_t1={1:.2f}_t2={2:.2f}".format(t0, t1, t2)
cluster = Lattice(POINTS, VECTORS)
intra_bonds_1st, inter_bonds_1st = cluster.bonds(nth=1)
intra_bonds_2nd, inter_bonds_2nd = cluster.bonds(nth=2)
intra_bonds_6th, inter_bonds_6th = cluster.bonds(nth=6)

HTerms = []
for bond in intra_bonds_1st + inter_bonds_1st:
    p0, p1 = bond.endpoints
    p0_eqv, dR0 = cluster.decompose(p0)
    p1_eqv, dR1 = cluster.decompose(p1)
    index0 = cluster.getIndex(p0_eqv)
    index1 = cluster.getIndex(p1_eqv)
    HTerms.append((index0, index1, t0, dR0 - dR1))

for bond in intra_bonds_2nd + inter_bonds_2nd:
    p0, p1 = bond.endpoints
    p0_eqv, dR0 = cluster.decompose(p0)
Пример #3
0
    def __init__(self, num1=4, num2=6, direction="xy"):
        """
        On triangular lattice, the nearest-neighbor (NN) bonds along the
        zero-degree direction is defined as the x-type bond (x-bond); NN bonds
        along the 120-degree direction is defined as the y-type bond (y-bond);
        NN bonds along the 60-degree direction is defined as the z-type bond
        (z-bond). The definition of the x, y, z bond is counterclockwise.

        Parameters
        ----------
        num1, num2 : int, optional
            The number of lattice site along the 1st and 2nd translation vector.
            The default values for `num1` and `num2` are 4 and 6 respectively.
        direction : ["xy" | "xz" | "yx" | "yz" | "zx" | "zy"], optional
            Define the direction of the cluster. This parameter determine the
            interpretation of the `num1` and `num2` parameters. For example,
            if `direction` is set to "xy", then there are `num1` lattice sites
            along the x-bond direction and `num2` lattice sites along the
            y-bond direction.
            Default: "xy".
        """

        assert isinstance(num1, int) and num1 > 0
        assert isinstance(num2, int) and num2 > 0
        assert direction in ("xy", "xz", "yx", "yz", "zx", "zy")

        identity = "num1={0}_num2={1}_direction={2}".format(
            num1, num2, direction
        )

        RX = np.array([1.0, 0.0], dtype=np.float64)
        RY = np.array([-0.5, np.sqrt(3) / 2], dtype=np.float64)
        RZ = np.array([0.5, np.sqrt(3) / 2], dtype=np.float64)
        AS = {
            "xy": np.array([RX, RY], dtype=np.float64),
            "xz": np.array([RX, RZ], dtype=np.float64),
            "yx": np.array([RY, RX], dtype=np.float64),
            "yz": np.array([RY, RZ], dtype=np.float64),
            "zx": np.array([RZ, RX], dtype=np.float64),
            "zy": np.array([RZ, RY], dtype=np.float64),
        }

        As = AS[direction]
        vectors = As * np.array([[num1], [num2]])
        points = np.dot([[i, j] for i in range(num1) for j in range(num2)], As)
        cluster = Lattice(points=points, vectors=vectors, name=identity)
        intra, inter = cluster.bonds(nth=1)
        x_bonds = []
        y_bonds = []
        z_bonds = []
        for bond in intra + inter:
            p0, p1 = bond.endpoints
            index0 = cluster.getIndex(site=p0, fold=True)
            index1 = cluster.getIndex(site=p1, fold=True)
            bond_index = (index0, index1)

            azimuth = bond.getAzimuth(ndigits=0)
            # The definition of x, y, z bond in a trio is counterclockwise.
            if azimuth in (-180, 0, 180):
                x_bonds.append(bond_index)
            elif azimuth in (-120, 60):
                z_bonds.append(bond_index)
            elif azimuth in (-60, 120):
                y_bonds.append(bond_index)
            else:
                raise RuntimeError("Invalid bond azimuth: {0}".format(azimuth))

        self._num1 = num1
        self._num2 = num2
        self._direction = direction
        self._identity = identity
        self._cluster = cluster
        self._x_bonds = tuple(x_bonds)
        self._y_bonds = tuple(y_bonds)
        self._z_bonds = tuple(z_bonds)
Пример #4
0
import matplotlib.pyplot as plt
import numpy as np
from HamiltonianPy import Lattice

from database import POINTS, VECTORS

cluster_points = np.append(POINTS, [[0.0, 0.0]], axis=0)
cluster = Lattice(cluster_points, VECTORS)
intra_bonds_1st, inter_bonds_1st = cluster.bonds(nth=1)
intra_bonds_3rd, inter_bonds_3rd = cluster.bonds(nth=3)

fig, ax = plt.subplots()
for point in cluster_points:
    cluster_index = cluster.getIndex(point, fold=True)
    if cluster_index == 12:
        color = "tab:red"
        marker_size = 25
    else:
        color = "black"
        marker_size = 20
    ax.plot(point[0],
            point[1],
            marker="o",
            ms=marker_size,
            color=color,
            zorder=2)
    ax.text(point[0],
            point[1] - 0.2,
            str(cluster_index),
            ha="center",
            va="top",
Пример #5
0
    [0.5, 0.5 * SQRT3],
    [1.5, 0.5 * SQRT3],
    [2.5, 0.5 * SQRT3],
    [3.5, 0.5 * SQRT3],
    [1.0, SQRT3],
    [2.0, SQRT3],
    [3.0, SQRT3],
    [4.0, SQRT3],
    [1.5, 1.5 * SQRT3],
    [2.5, 1.5 * SQRT3],
    [3.5, 1.5 * SQRT3],
    [4.5, 1.5 * SQRT3],
],
                  dtype=np.float64)
CLUSTER = Lattice(POINTS, np.array([[4.0, 0.0], [2.0, 2 * SQRT3]]))
INTRA_BONDS, INTER_BONDS = CLUSTER.bonds(nth=1)

_SPIN_UP = [-1, 1, 1]
_SPIN_DOWN = [1, -1, -1]
VECTORS0 = np.array([
    _SPIN_UP,
    _SPIN_UP,
    _SPIN_UP,
    _SPIN_UP,
    _SPIN_DOWN,
    _SPIN_DOWN,
    _SPIN_DOWN,
    _SPIN_DOWN,
    _SPIN_UP,
    _SPIN_UP,
    _SPIN_UP,