Beispiel #1
0
def bilayer_lipid():
    import matplotlib.pyplot as plt
    outfile = "/home/mho/Downloads/new-self-ass.h5"
    n_particles_per_frame, positions, types, ids = load_trajectory_to_npy(
        outfile, stride=10)
    config = readdyviewer.Configuration()
    t = readdy.Trajectory(outfile)

    config.colors[t.particle_types['Head']] = readdyviewer.Color(
        plt.cm.jet(0)[0],
        plt.cm.jet(0)[1],
        plt.cm.jet(0)[2])
    config.radii[t.particle_types['Head']] = .7
    config.colors[t.particle_types['Tail']] = readdyviewer.Color(
        plt.cm.jet(1.)[0],
        plt.cm.jet(1.)[1],
        plt.cm.jet(1.)[2])
    config.radii[t.particle_types['Tail']] = .7

    config.stride = 1
    config.smoothing = 5
    config.cutoff = 5
    config.bond_radius = .02
    config.wait = 3
    config.draw_periodic = True
    config.set_box_size(25, 25, 25)
    readdyviewer.watch_npy(positions, types, ids, n_particles_per_frame,
                           config)  #
Beispiel #2
0
def more_topologies_sim():
    trajfile = "/home/mho/Development/readdyviewer/tests/more_topologies_simulation.h5"
    n_particles_per_frame, positions, types, ids = load_trajectory_to_npy(
        trajfile)
    config = readdyviewer.Configuration()
    t = readdy.Trajectory(trajfile)
    entries = t.read()
    time, topology_records = t.read_observable_topologies()

    edges = []
    for timestep, tops in enumerate(topology_records):
        current_edges = []
        for top in tops:
            for e1, e2 in top.edges:
                ix1 = top.particles[e1]
                ix2 = top.particles[e2]
                current_edges.append((ix1, ix2))
                p1 = entries[timestep][ix1]
                p2 = entries[timestep][ix2]
                assert p1.type == 'T' or p1.type == 'center T', "expected topology type but got {} -- {}".format(
                    p1, p2)
                assert p2.type == 'T' or p2.type == 'center T', "expected topology type but got {} -- {}".format(
                    p1, p2)
        edges.append(current_edges)
    config.colors[t.particle_types['center T']] = readdyviewer.Color(
        153. / 255., 255. / 255., 0.)
    config.radii[t.particle_types['center T']] = .5
    config.colors[t.particle_types['T']] = readdyviewer.Color(
        255. / 255., 153. / 255., 0.)
    config.radii[t.particle_types['T']] = .5
    config.clearcolor = readdyviewer.Color(155. / 255., 155. / 255.,
                                           155. / 255.)

    config.stride = 1
    print(positions.shape)
    print("go!")
    readdyviewer.watch_npy(positions, types, ids, n_particles_per_frame,
                           config, edges)
Beispiel #3
0
 def to_numpy(self, name="", start=None, stop=None):
     from readdy.api.utils import load_trajectory_to_npy
     return load_trajectory_to_npy(self._filename, begin=start, end=stop, name=name)