# trajectory generated by Raimund Dutzler
from PyQt5 import QtCore

class Anim(QtCore.QTimer):
    def __init__(self,cg,go):
        QtCore.QTimer.__init__(self)
        self.cg_=cg
        self.go_=go
        self.frame_=0
        self.timeout.connect(self.OnTimer)
        
    def OnTimer(self):
        self.frame_=(self.frame_+1)%self.cg_.GetFrameCount()
        self.cg_.CopyFrame(self.frame_)
        go.UpdatePositions()


eh = io.LoadCRD("mpor_trj.crd")
cg = io.LoadCHARMMTraj(eh,"mpor_trj_short.trj")
go=gfx.Entity("test",eh.CreateFullView())

scene.Add(go)
scene.SetCenter(go.GetCenter())
scene.AutoAutoslab(True)

anim=Anim(cg,go)
anim.start(10)
