Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FundamentalForces.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def calculate_gravity(a_pos, a_type, b_pos, b_type):


def calculate_electromagnetic(a_pos, a_type, b_pos, b_type):
if a_type or b_type == 'n':
if a_type == "n" or b_type == 'n':
return [0, 0]

x_diff = b_pos[0] - a_pos[0]
Expand Down
8 changes: 4 additions & 4 deletions ParticleSimulator_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ def __init__(self, particletype, position, acceleration, velocity):
continue
force = [0, 0]
# Gravity function
force += calculate_gravity(a_position, a_type, b_position, b_type)
g_force = calculate_gravity(a_position, a_type, b_position, b_type)
# Electromagnetic Function
force += calculate_electromagnetic(a_position, a_type, b_position, b_type)
e_force = calculate_electromagnetic(a_position, a_type, b_position, b_type)
# Strong Nuclear Force Function

fx_total += force[0]
fy_total += force[1]
fx_total += force[0] + g_force[0] + e_force[0]
fy_total += force[1] + g_force[1] + e_force[1]

a_acceleration[0] = fx_total / a_mass
a_acceleration[1] = fy_total / a_mass
Expand Down