public MainWindow() { InitializeComponent(); pList.Add(new Particle(-2, -3, 0, -1)); pList.Add(new Particle(2, -2, 0, 1)); pList.Add(new Particle(2, 2, 0, 1)); pList.Add(new Particle(-2, 4, 0, -1)); pList.ShowAll(group); potential = new BornAttractive(); }
public void updatePotential(List <Particle> others, BasePotential potential) { Potential = 0; foreach (Particle other in others) { if (other == null) { throw new ArgumentNullException("Particle " + other.number); } if (this == other) { continue; } Potential += potential.U(this, other); } }
public void updateVelocity(List <Particle> others, BasePotential potential) { Velocity *= velmult; //Keep some of the prior velocity, makes optimization nonlinear foreach (Particle other in others) { if (other == null) { throw new ArgumentNullException("Particle " + other.number); } if (this == other) { continue; } Velocity += potential.delU(this, other); } Console.WriteLine("Particle " + number + " velocity: " + Velocity.ToString()); }