Ejemplo n.º 1
0
def update_velocity(stepsize, particle):
    """ Part 2 of the Velocity Verlet Algorithm """
    position = particle["position"]
    velocity = particle["velocity"]
    acceleration = particle["acceleration"]
    v_plus_one = velocity + 0.5 * acceleration * stepsize
    return particle_storage.store_single_particle(position, v_plus_one, acceleration)
Ejemplo n.º 2
0
def update_position(stepsize, particle):
    """ Part 1 of the Velocity Verlet Algorithm """
    position = particle["position"]
    velocity = particle["velocity"]
    acceleration = particle["acceleration"]
    v_plus_one_half = velocity + 0.5 * acceleration * stepsize
    x_plus_one = position + v_plus_one_half * stepsize
    return particle_storage.store_single_particle(x_plus_one, v_plus_one_half, acceleration)
Ejemplo n.º 3
0
def update_velocity(stepsize, particle):
    """ Part 2 of the Velocity Verlet Algorithm """
    position = particle["position"]
    velocity = particle["velocity"]
    acceleration = particle["acceleration"]
    v_plus_one = velocity + 0.5 * acceleration * stepsize
    return particle_storage.store_single_particle(position, v_plus_one,
                                                  acceleration)
Ejemplo n.º 4
0
def update_position(stepsize, particle):
    """ Part 1 of the Velocity Verlet Algorithm """
    position = particle["position"]
    velocity = particle["velocity"]
    acceleration = particle["acceleration"]
    v_plus_one_half = velocity + 0.5 * acceleration * stepsize
    x_plus_one = position + v_plus_one_half * stepsize
    return particle_storage.store_single_particle(x_plus_one, v_plus_one_half,
                                                  acceleration)
Ejemplo n.º 5
0
def update_accelerations(particles, potential, masses):
    force_matrix = dynamics.calculate_force_matrix(particles, potential)
    forces = dynamics.sum_forces(force_matrix)
    accels = dynamics.calculate_accelerations(masses, forces)
    tmp_particles = []
    num_particles = len(particles)
    for i in range(0, num_particles):
        position = particles[i]["position"]
        velocity = particles[i]["velocity"]
        accel    = accels[i]
        tmp_particle = particle_storage.store_single_particle(position, velocity, accel)
        tmp_particles.append(tmp_particle)
    return tmp_particles
def update_accelerations(particles, potential, masses):
    force_matrix = dynamics.calculate_force_matrix(particles, potential)
    forces = dynamics.sum_forces(force_matrix)
    accels = dynamics.calculate_accelerations(masses, forces)
    tmp_particles = []
    num_particles = len(particles)
    for i in range(0, num_particles):
        position = particles[i]["position"]
        velocity = particles[i]["velocity"]
        accel = accels[i]
        tmp_particle = particle_storage.store_single_particle(
            position, velocity, accel)
        tmp_particles.append(tmp_particle)
    return tmp_particles