I'm trying to model a 2D TMD (transition metal dichalcogenide) nanocrystal on a graphene substrate. I know how to generate 2D TMDs through the MX2 module, and I certainly know how to make graphene on ASE, but I am unsure how to stack the two together. Is there a specific module that could get the job done? The ASE documentation has not been too helpful.

Any help would be appreciated!

  • $\begingroup$ Welcome to the site! Just as a heads up, there is some ongoing discussion about limiting the participation of unregistered users on the site: mattermodeling.meta.stackexchange.com/questions/317/…. If you register your account, you won't have to worry if any limits are put in place for unregistered accounts. $\endgroup$
    – Tyberius
    Feb 24, 2022 at 14:25
  • $\begingroup$ @ShaunHan it was probably not closed for being "bad", but more likely due to the user being unregistered at the time. If you want any question to he reopened, you can write that in a custom flag or leave a comment, or say something in the "Ask a moderator" chat room. $\endgroup$ Jul 14, 2023 at 17:22
  • $\begingroup$ @ShaunHan I reopened the question. Note the OP hasn't returned to the site since asking the question, so they won't be around for clarification, but if the question is answerable as is and seems like it is of general interest, I'm all for seeing it get answered. $\endgroup$
    – Tyberius
    Jul 14, 2023 at 19:08

1 Answer 1


To stack two 2D structures in ASE, a matching of the two unit cells is required. I will assume your graphene and TMD unit cells have the same $\alpha$, $\beta$, $\gamma$ lattice parameters but slightly different $a$ and $b$. The common choice is to use the larger unit cell as reference, and scale the atomic coordinates in the smaller unit cell to fit in the larger cell. The stacking can be done by ase.build.add_adsorbate, where you can play around the height parameter to adjust the relative position of the adsorbate in the z direction. This often results in a decent heterogeneous structure, but if you want to adjust the adsorbate in the x and y directions, the easiest way is to move the atoms in the ASE's GUI by pressing Ctrl+M.

Below is an example of stacking a 3-layer MoS$_2$ (larger cell) on top of a graphene monolayer (samller cell) in ASE:

from ase.build import graphene, mx2
from ase.build import add_adsorbate
from ase.visualize import view

# Build a graphene monolayer
atoms = graphene()

# Build a 3-layer MoS2 
MoS2 = mx2(formula='MoS2', kind='2H', a=3., thickness=3.19, vacuum=5.)
# Match the two unit cells in the z direction
atoms.cell[2] = MoS2.cell[2]

# Save the fractional coordinates of graphene
fracs = atoms.get_scaled_positions()
# Match the two unit cells in all directions
atoms.cell = MoS2.cell
# Scale the atomic coordinates of graphene
atoms.positions = fracs @ MoS2.cell

# Stack the two structures
add_adsorbate(atoms, adsorbate=MoS2, height=3.)
# Center the structure in the z direction
atoms.center(vacuum=5., axis=2)
# Visualize

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .