Example #1
0
def tkdrawer(filename):
    geos = read(filename, do_center=1)
    geo = geos[-1]
    nat = len(geo)
    objects = []
    for i in range(nat):
        atnoi, xyzi = geo[i]
        xi, yi, zi = xyzi
        for j in range(i):
            atnoj, xyzj = geo[j]
            xj, yj, zj = xyzj
            rij = distance(xyzi, xyzj)
            rij0 = 0.6 * (radius[atnoi] + radius[atnoj])
            if 0.3 < rij < rij0:
                xm, ym, zm = (xi + xj) / 2.0, (yi + yj) / 2.0, (zi + zj) / 2.0
                objects.append(PolyLine3D(array([[xi, yi, zi], [xm, ym, zm]]), color="blue"))
                objects.append(PolyLine3D(array([[xj, yj, zj], [xm, ym, zm]]), color="red"))

    graphics = VisualizationGraphics(objects)

    window = Frame()
    window.pack(fill=BOTH, expand=YES)

    c = VisualizationCanvas(window, "100m", "100m", relief=SUNKEN, border=2)
    c.pack(side=TOP, fill=BOTH, expand=YES)
    c.draw(graphics)

    Button(window, text="Draw", command=lambda o=graphics: c.draw(o)).pack(side=LEFT)
    Button(window, text="Clear", command=c.clear).pack(side=LEFT)
    Button(window, text="Redraw", command=c.redraw).pack(side=LEFT)
    Button(window, text="Quit", command=window.quit).pack(side=RIGHT)

    window.mainloop()
Example #2
0
def convert(xyz_filename):
    geo = read(xyz_filename)[-1]
    if xyz_filename[-5:] == ".xmol":
        tinker_filename = xyz_filename[:-5] + ".xyz"
    elif xyz_filename[-4:] == ".xyz":
        tinker_filename = xyz_filename[:-4] + "_tink.xyz"
    else:
        tinker_filename = xyz_filename + "_tink.xyz"
    write_tinker_xyz(geo, tinker_filename)
    return
Example #3
0
#!/usr/bin/env python
"""\
 Convert the ReaxFF xmolout output file to a standard xyz file.

Copyright (c) 2003 Richard P. Muller (rmuller@sandia.gov). All rights
reserved. See the LICENSE file for licensing details.
"""

from Pistol.XYZ import read, write

import os

if os.path.exists("xmolout"):
    print "Converting ReaxFF xmolout file to traj.xyz"
    geos = read("xmolout")
    write("traj.xyz", geos)
else:
    print "No ReaxFF trajectory file xmolout found"
Example #4
0
 This example shows how the simple BallStick module may be
 used to create a molecular renderer.

Copyright (c) 2003 Richard P. Muller (rmuller@sandia.gov). All rights
reserved. See the LICENSE file for licensing details.
"""

import sys
from Pistol.BallStickGtkGL import BSWindow
from Pistol.Element import color, radius
from Pistol.Util import distance
from Pistol.XYZ import read


for filename in sys.argv[1:]:
    geos = read(filename, do_center=1)
    geo = geos[-1]
    spheres = []
    for atno, (x, y, z) in geo:
        r, g, b = color[atno]
        rad = radius[atno]
        rad *= 0.25
        r /= 255.0
        g /= 255.0
        b /= 255.0
        spheres.append(((x, y, z), rad, (r, g, b), 20, 20))

    cyls = []
    nat = len(geo)
    for i in range(nat):
        atno1, (x1, y1, z1) = geo[i]