Exemplo n.º 1
0
  def view_trajectory(self):
    """
    Output the trajectory as a DCD file and views it in VMD
    """
    if self.args['grid_LJr'].endswith('.nc') and (not os.path.isfile(self.args['grid_LJr'][:-2]+'dx')):
      import AlGDock.IO
      IO_Grid = AlGDock.IO.Grid()
      IO_Grid.read(self.args['grid_LJr'])
      IO_Grid.write(self.args['grid_LJr'][:-2]+'dx')
    
    scriptFN = 'script.vmd'

    script = ''
    script +=  'set ligand [mol new '+self.args['ligand_prmtop']+']\n'
    script += 'mol addfile '+self.args['output_dcd']+' type dcd waitfor all\n'
    script += 'mol new {%s} type {dx} first 0 last -1 step 1 waitfor 1\n'%(self.args['grid_LJr'][:-2]+'dx')
    script += 'mol modstyle 0 1 Isosurface 10.000000 0 2 0 1 1\n'

    scriptF = open(scriptFN,'w')
    scriptF.write(script)
    scriptF.close()

    import AlGDock
    vmdFN = AlGDock.findPaths(['vmd'])['vmd']
    vmd_args = [vmdFN] + ['-e', scriptFN]
    import subprocess
    p = subprocess.call(vmd_args)