The code snippet is as follows:
# Import the SurfaceGenerator class
from OgreInterface.generate import SurfaceGenerator
# Create a surface generator instance from a CIF file
subs = SurfaceGenerator.from_file(
"MoS2_mp-1434.cif",
miller_index=[0, 0, 1], # Specify the Miller index for the surface
layers=1, # Number of layers in the generated surface
vacuum=15 # Vacuum spacing around the surface
# refine_structure=False # Don't refine the initial structure; uncomment if needed
)
# Print the number of generated surfaces
print(len(subs))
# Select the first generated surface
sub = subs._slabs[0]
# Remove layers from the selected surface
# sub.remove_layers(num_layers=3, top=True) # Remove 3 layers from the bottom side
# Write the modified surface to a file with the `c`-axis orthogonal to the `ab` plane
sub.write_file("POSCAR", orthogonal=True)
The result is as follows:

The top structure looks like the Mo and S atoms are far apart in some positions, which is weird. All the files mentioned above have been attached.
MoS2-Ogre.zip
Regards,
Zhao
The code snippet is as follows:
The result is as follows:
The top structure looks like the
MoandSatoms are far apart in some positions, which is weird. All the files mentioned above have been attached.MoS2-Ogre.zip
Regards,
Zhao