Code site: https://github.com/ajjackson/ascii-phonons
These slides: http://ajjackson.github.io/ascii-phonons-slides
Figure 1: Modes are represented by arrows
Figure 2: Mode 13 in SnS at T-point (local minimum in dispersion plot)
Figure 4: Screenshot from the Sintel open film project
Figure 5: Blender tooltip (cursor is hidden from screenshot)
Figure 6: ascii-phonons GUI
Lattice vectors
dxx dyx dyy dzx dzy dzz
dxx 0. 0. dxy dyy 0. dzx dzy dzz
Eigenvectors and frequencies are given with corresponding q-points. This is expressed as commented metadata for backwards compatibility
#metaData: qpt=[0.000000;0.500000;0.000000;129.279993 \ #; 0.028286; -0.008664; -0.031412; -0.000000; -0.000000; 0.000000 \ #; 0.000010; -0.000003; -0.000011; 0.028285; -0.008664; -0.031409 \ #; -0.000003; 0.000001; -0.000003; -0.028288; 0.008663; -0.031407 \ #; -0.028289; 0.008663; -0.031408; 0.000007; -0.000002; 0.000008 \
\[ \mathbf{r^\prime}(jl,t,\nu) = \\ \mathbf{r}(jl) + \mathbf{U}(j,\mathbf{q},\nu) \exp(i[\mathbf{q r}(jl) - \omega (\mathbf{k},\nu) t]) \]
for frame in range(start_frame, end_frame+1):
bpy.context.scene.frame_set(frame)
exponent = cmath.exp( complex(0,1) *
(r.dot(qpt) - 2 * math.pi*frame/n_frames))
atom.location = r + mass**-.5 * magnitude *
Vector([x.real for x in
[x * exponent for x in displacement_vector]])
atom.keyframe_insert(data_path="location",index=-1)
Arrow model imported from a file
bpy.ops.wm.link(directory=os.path.dirname(__file__) +
'/arrow_cylinder.blend/Object/',
filepath="arrow_cylinder.blend", filename="Arrow")
Ignore what you learned in undergrad and read Ashcroft/Mermin
The Miller indices of a lattice plane are the coordinates of the shortest reciprocal lattice vector normal to that plane, with respect to a specified set of primitive reciprocal lattice vectors
camera_direction_vector = sum([i * x for i, x in
zip(miller, reciprocal(lattice_vectors))],
Vector((0,0,0)))
Tkinter provides three layout options
Object-oriented programming is the way to go
def add_appearance_row(self, padding=20):
...
self.camera_rot = tk.DoubleVar(value=360)
...
Appearance = tk.Frame(self.LeftFrame, borderwidth=3, relief="groove")
tk.Label(Appearance, text="Appearance settings").pack(side="top", fill="x")
AppearanceRow1 = tk.Frame(Appearance)
tk.Entry(AppearanceRow1,
textvariable=self.camera_rot, width=4
).pack(side="right")
...
def init_material(symbol, col=False, shadeless=True):
"""
Create material if non-existent. Assign a random colour if none is specified.
:param col: RGB color. If False, use a random colour.
:type col: 3-tuple, list or Boolean False
:param shadeless: Enable set_shadeless material parameter. Informally known as "lights out".
:type shadeless: Boolean
:returns: bpy material object
"""
Use it!
Use the issue tracker to keep track of development, report bugs and make feature requests