In [1]:
import numpy as np
import mogli
import gr
In [2]:
molecules = mogli.read('700K_460.xyz')
angles = np.load('700K_460.npy')
lens = []
In [3]:
gr.inline('mov')

for t in range(100):

    gr.clearws()
    gr.setviewport(0, 1, 0, 1)
    gr.setwindow(0.1, 0.9, 0.05, 0.85)
    mogli.draw(molecules[t], bonds_param=1.15, camera=((60, 0, 0),
                                                       (0, 0, 0),
                                                       (0, 1, 0)))

    gr.settextalign(gr.TEXT_HALIGN_CENTER, gr.TEXT_VALIGN_HALF)
    gr.text(0.5, 95, '700K (%.1f ps)  # of bonds: %d' %
            (t / 10.0, len(angles[t])))
    lens.append(len(angles[t]))
    if t > 0:
        gr.setwindow(0, 10, 3500, 5000)
        gr.setviewport(0.1, 0.9, 0.05, 0.1)
        gr.axes(1, 0, 0, 3500, 2, 0, 0.005)
        gr.polyline(np.arange(t + 1) / 10.0, lens)

    gr.updatews()
In [4]:
gr.show()
Out[4]: