Esempio n. 1
0
def depthView(
        figure,
        atoms,
        colormap='hot',
        resolution=32,
        vmax=3.5,
        depth=4,
        ):
    import numpy as np
    from mayavi import mlab

    input_atoms = atoms.copy()
    vmin = vmax - depth

    cell_center = cellCenter(input_atoms)
    scale_factors = numpy.ones(len(input_atoms))*2

    addDepthMap(
            figure=figure,
            input_atoms=input_atoms,
            scale_factors=scale_factors,
            colormap=colormap,
            resolution=resolution,
            vmin=vmin,
            vmax=vmax,
            )
Esempio n. 2
0
def standardView(figure, atoms, resolution=32, scale=1):
    from mayavi import mlab
    input_atoms = atoms.copy()
    del input_atoms.constraints
    cell_center = cellCenter(input_atoms)

    numbers = input_atoms.get_atomic_numbers()
    u_numbers = np.unique(numbers)
    vmin, vmax = input_atoms.positions[:,2].min(), input_atoms.positions[:,2].max()
    vmin += (vmax - vmin)/2

    for number in u_numbers:
        take = np.array(numbers == number, bool)
        atoms = input_atoms[take]
        points = atoms.positions
        points = points.transpose()
        color = tuple(jmol_colors[number])
        radius = my_radii[number]
        if np.isnan(radius):
            radius = 3.00
        radius *= 2*scale
        mlab.points3d(points[0], points[1], points[2], color=color,
                      scale_factor=radius,
                      resolution=resolution,
                      )