/* * The magnetic potential of an atom is always zero, because magnetic force does not do any work. But for a dipole * moment, it is not zero. * * FIXME: I didn't find a closed-form solution for an electric dipole's magnetic potential. */ double getPotential(Particle p, float time) { if (bounds != null && !bounds.contains(p.getRx(), p.getRy())) return 0; double poten = 0.0; if (p instanceof GayBerneParticle) { GayBerneParticle gb = (GayBerneParticle) p; if (Math.abs(gb.dipoleMoment) > 0) { double temp = Math.sin(gb.theta) * gb.vx - Math.cos(gb.theta) * gb.vy; if (o == OUTWARD) temp = -temp; poten = gb.dipoleMoment * b * temp; } } return poten; }
void dyn(Particle p) { if (bounds != null && !bounds.contains(p.getRx(), p.getRy())) return; double temp = Math.abs(b) * p.charge * MDModel.GF_CONVERSION_CONSTANT / p.getMass(); if (o == OUTWARD) temp = -temp; p.fx += temp * p.vy; p.fy -= temp * p.vx; if (p instanceof GayBerneParticle) { GayBerneParticle gb = (GayBerneParticle) p; if (Math.abs(gb.dipoleMoment) > 0) { temp = Math.cos(gb.theta) * gb.vx + Math.sin(gb.theta) * gb.vy; if (o == OUTWARD) temp = -temp; gb.tau -= gb.dipoleMoment * temp * b / gb.inertia * MDModel.GF_CONVERSION_CONSTANT; } } }