[ase-users] Difficulties making rotate work
Thomas Aarholt
thomas.aarholt at smn.uio.no
Mon Oct 23 11:36:21 CEST 2017
Dear ase-users,
I'm trying to use ASE to rotate my hexagonal crystal to make two separate crystals with new orientations. One with the 100 and one with the 110 directions along the c-ax?is, respectively. I need to rotate the atoms without rotating the cell, as I want change the array of atom positions for export and import into electron microscope simulation software (the simulation software must be fed a sample file oriented with the viewing direction along the c-axis).
I've attempted to use the ase.build.rotate function (as well as the atoms.rotate). I get what I expect for the 100 direction, but it is a "bit off" for the 110 rotation (by , which I cannot explain. I'm certain that the directions are correct, both from experiments and from looking down the respective directions in VESTA.
I've attached a jupyter notebook with the code, in addition to pasting a smaller example below. Attached is also the ZnO hexagonal crystal file and a png showing what the resulting 110 direction should look like.
Could someone please offer me some advice?
Code:
from ase import io
from ase.visualize import view
from ase.build import make_supercell, rotate
import numpy as np
sample = io.read("ZnO_Unitcell_Hex.cif")
stacked_sample = make_supercell(sample, 5*np.eye(3))
view(stacked_sample)
stacked_sample = make_supercell(sample, 5*np.eye(3))
# Aligns 100 direction with 001, and aligns the 001 with the 100 (the x-axis of the image)
a1 = (1,0,0)
a2 = (0,0,1)
b1 = (0,0,1)
b2 = (1,0,0)
rotate(stacked_sample, a1, a2, b1, b2, rotate_cell=False)
view(stacked_sample)
# Works!
stacked_sample = make_supercell(sample, 5*np.eye(3))
# Aligns 110 direction with 001 and aligns the 001 with the 100
a1 = (1,1,0)
a2 = (0,0,1)
b1 = (0,0,1)
b2 = (1,0,0)
rotate(stacked_sample, a1, a2, b1, b2, rotate_cell=True)
view(stacked_sample)
# Does not produce what I expected!
End Code
Best regards,
Thomas Aarholt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20171023/4e53140d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 110_Direction.PNG
Type: image/png
Size: 69559 bytes
Desc: 110_Direction.PNG
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20171023/4e53140d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ZnO_Unitcell_Hex.cif
Type: application/octet-stream
Size: 1192 bytes
Desc: ZnO_Unitcell_Hex.cif
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20171023/4e53140d/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ASE Rotate Cell.ipynb
Type: application/octet-stream
Size: 3133 bytes
Desc: ASE Rotate Cell.ipynb
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20171023/4e53140d/attachment-0003.obj>
More information about the ase-users
mailing list