예제 #1
0
def makeEnes(number):
    atoms = Atoms(
        [
            Atom("H", (-1.0 * np.cos(np.pi / 6.0), 0.7 + 1.0 * np.sin(np.pi / 6.0), 0.0)),
            Atom("H", (-1.0 * np.cos(np.pi / 6.0), -0.7 - 1.0 * np.sin(np.pi / 6.0), 0.0)),
        ],
        cell=(2.41, 16.00, 10),
        pbc=[False, False, False],
    )
    atoms_unit = Atoms(
        [
            Atom("C", (0.0, 0.7, 0.0)),
            Atom("C", (0.0, -0.7, 0.0)),
            Atom("H", (1.2, -2.4, 0.0)),
            Atom("C", (1.2, -1.4, 0.0)),
            Atom("C", (1.2, 1.4, 0.0)),
            Atom("H", (1.2, 2.4, 0.0)),
        ],
        cell=(2.41, 16.00, 10),
        pbc=[False, False, True],
    )
    atoms += atoms_unit.repeat((number + 1, 1, 1))
    atoms = atoms[:-4]
    max_x = atoms.positions[-1, 0]

    postpend = Atoms(
        [
            Atom("H", (max_x + 1.0 * np.cos(np.pi / 6.0), 0.7 + 1.0 * np.sin(np.pi / 6.0), 0.0)),
            Atom("H", (max_x + 1.0 * np.cos(np.pi / 6.0), -0.7 - 1.0 * np.sin(np.pi / 6.0), 0.0)),
        ],
        cell=(2.41, 16.00, 10),
        pbc=[False, False, True],
    )
    atoms += postpend

    maxi = atoms.positions.max(axis=0)
    mini = atoms.positions.min(axis=0)
    av = (maxi + mini) / 2.0
    ran = maxi - mini

    atoms.positions -= av
    atoms.cell[0, 0] = ran[0] + 10
    atoms.cell[1, 1] = ran[1] + 10
    atoms.cell[2, 2] = ran[2] + 10

    return atoms