Example #1
0
def main(outname,pltname):
    mol_info = read_output_as_dict(outname)
    plt_info = read_plt(pltname)
    name = mol_info['name']
    scene = Scene(name)
    #scene.set_camera((0,4,0.5),(0,0,0.5))
    scene.set_camera((0,10,0))
    atoms = mol_info['structure']
    for i,j in get_bonds_from_distance(atoms):
        atnoi,xyzi = atoms[i]
        atnoj,xyzj = atoms[j]
        scene.add(Cylinder(xyzi,xyzj,0.1))
    for atno,xyz in atoms:
        r,g,b  = color[atno]
        sphere = Sphere(xyz,rscale*radius[atno],(r/255.,g/255.,b/255.))
        scene.add(sphere)

    ptris = mcube_contour(plt_info,0.1)
    ntris = mcube_contour(plt_info,-0.1)

    # if desired, compute normals at each vertex
    ptris = smooth_tris(ptris)
    ntris = smooth_tris(ntris)
    if ptris: scene.add(TriangleMesh(ptris,(1,0,0)))
    if ntris: scene.add(TriangleMesh(ntris,(0,0,1)))
    
    scene.write_pov()
    scene.render()
    scene.display()
    return