This is the main problem:
step 5: implement a fix into lammps that can apply a magnetic field
LAMMPS does not understand magnetic dipoles.
Take a look at this web page:
http://lammps.sandia.gov/doc/pair_dipole.html
You can run simulations in LAMMPS with dipole particles, but they are
electric, not magnetic. Although the force due to either type of
dipole has the same form, the dipoles implemented in LAMMPS will
change their orientation in response to a nearby charged atom. I
don't think there is a way to prevent that in LAMMPS without editing
the code (see below).
I am guessing that this is the main problem trying to simulate
magnetic materials in LAMMPS.
I could be completely wrong about this, so I hope someone will correct
me if I am. (Most LAMMPS users simulate particles at temperatures low
enough that they can ignore the magnetic field they generate. I am
also assuming that the force due to a static magnetic field on a
moving charged atom is negligible compared to the inter-atomic
pairwise forces. If not, then LAMMPS might not be the right program
to use. In that case, perhaps you should look at the software people
use to simulate plasmas.)
If I am correct, and if all of the particles in your simulation which
have magnetic moments also have zero charge, then I think it would be
sufficient to use "pair_style dipole/cut" and simply turn off the
dipole-charge ("Eqp") interactions between your dipoles and the
surrounding charges.
Alternately, if you want to write your own "pair_style
dipole/mag/cut", that would be nice too.
What code should you edit?
I cd to the "src" directory where LAMMPS is installed and type:
grep "dipole/cut" *.cpp */*.cpp
I get:
DIPOLE/pair_dipole_cut.cpp
GPU//pair_dipole_cut_gpu.cpp
So take a look at DIPOLE/pair_dipole_cut.cpp, and try to turn off the
dipole-monopole interactions.
If this is a bad idea, hopefully somebody will reply.
Cheers.
Andrew