how to build a MoS2 nanotube using ASE? seems like ASE can only build single-element nanotube.
Using a bit of maths we can wrap a nanosheet into a nanotube. This looks nice to me, but I don’t work on these materials so perhaps it is nonsense. A bit more complexity will be needed to roll in arbitary directions!
from ase.build import mx2
import ase.visualize
import numpy as np
# Create initial sheet
atoms = mx2(size=(12, 1, 1))
# Work out size of target circle; here we roll the x axis perpendicular to y
circumference = atoms.cell[0, 0]
radius = circumference / (2 * np.pi)
# Use parametric definition of circle x = cos(t), y = sin(t)
param = (atoms.positions[:, 0] * 2 * np.pi / circumference)
x = radius * np.cos(param)
y = radius * np.sin(param)
atoms.positions[:, 0] = x # Replace position along line with x of circle
atoms.positions[:, 2] = y # Roll into z-direction as we weren't using it
# 1-D system, only the y component of original b axis remains
atoms.cell = [[0, 0, 0], [0, atoms.cell[1, 1], 0], [0, 0, 0]]
atoms.pbc = [False, True, False]
# Expand cylinder by target number of cells for visualisation
ase.visualize.view(atoms * [1, 20, 1])
# Dump output as unit cell
atoms.write("MoS2_nanotube_example.extxyz")
