hello all

I have question about

Compute … property / atom fx fy fz

According to the manual, if there is a magnetic diple-diple interaction between particles, a mechanical force is created between particle i and particle j (between pairs of particles), so why when I use the above compute statement to calculate the amount of force on the particles it count as zero? (There is no force field in the system other than magnetic dipole)

You are mixing two different manual pages. Compute property/atom does not “compute” anything, but just makes properties available. The documentation for that command is quite clear.

So why does the dipole-dipole interaction have no effect on particles motion? Particles must move after the mechanical force is applied, but they do not move.

thanks for your help

There is not enough information here to make any suggestion. Most likely your input is not correct.

Using the loop command, I wrote the algorithm for calculating this mechanical force with the formula provided in the Lammp manual, and this force is not zero.

Do I have to calculate this force this way (with an algorithm) and then apply this calculated force to the particles with the addforce command? This way I can see the motion of the particles.

There is only dipole-dipole interaction in the system and I have no other force field.

Thank you very much for your help

It is not clear to me what you are trying to say here.

I cannot give advice on such vague statements.

According to the manual, if there is a dipole-dipole magnetic interaction between particles, a mechanical force is created between particle i and particle j (between pairs of particles).

So why, when I used the pair_style spin / dipole / cut command to simulate the motion of particles under a dipole-dipole interaction, the amount of force applied to the particles is zero and the particles do not move? (There is only dipole-dipole interaction in the system and I have no other force field.)

Using the variable loop, I wrote the algorithm for calculating this mechanical force with the formula provided in the Lammps manual, and this force is not zero.

Do I have to first calculate this force by programming and then apply this calculated force to the particles with the addforce command? This way I can see the motion of the particles.

In short, how can I see the motion of particles that are only affected by magnetic dipole-dipole interaction?

I hope I was able to clarify the issue

Thank you very much

This is still vague and impossible to figure out what you are actually doing.

Why can’t you just create a minimal input file that showcases what your issue is rather than talking around it.

hi

According to basic physics we know that for 2 particles with M1 and M2 magnetic moments there are dipole-dipole interactions between them but when I see the out-put files this D-D interaction seems to be absent among the other defined interactions. Although the D-D interaction could be very weak in comparison with them but even I extinguished the other interactions again the D-D didn’t bolded.

This is just more talk and no proof that you are not making mistakes. If you like to continue like this, you are welcome, but don’t expect any more responses from me.

```
clear
echo both
units metal
dimension 3
boundary f f f
timestep 0.0001
atom_style hybrid spin sphere full
atom_modify map array
# ---------- Create Atoms ---------------------
region BOX block -5 5 -5 5 -5 5 units box
create_box 2 BOX
variable Number1 equal 3
create_atoms 1 random ${Number1} 12345 BOX
variable Number2 equal 3
create_atoms 2 random ${Number2} 4589155 BOX
fix xzwalls all wall/reflect xlo EDGE xhi EDGE ylo EDGE yhi EDGE zlo EDGE zhi EDGE
fix_modify xzwalls energy no
group one id <= ${Number1}
group two id > ${Number1}
#variable nt equal ${Number1}+${Number2}
#variable ntj equal ${nt}+1
set group one type 1
set group two type 2
set group one spin 2.8 0.0 0.0 1.0
set group two spin 2.8 0.0 0.0 1.0
set type 1 mass 32
set type 2 mass 32
#variable mu0bar4P equal 1.0e-7
#variable magnetonbohr equal 5.788*1.0e-5
#variable gg equal 1
#variable hbar equal 6.582*1.0e-7
#variable coeffyeka equal 0.160205062*1.0e12
#variable coeff equal 3*v_mu0bar4P*v_magnetonbohr*v_magnetonbohr*v_gg
#variable m1 equal 2.8
#variable m2 equal 2.8
pair_style spin/dipole/cut 50
pair_coeff * * 50
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
compute dipole_energy all pair spin/dipole/cut
compute pe_energy all pe
#------------------------------- definition output.txt file to save loop results ---------------------------
#print "loop results" file loop.txt screen no
#print "---------------" append loop.txt screen no
#variable Udd equal 0.0
#variable udd equal 0.0
#label loopi
#variable i loop ${nt}
#variable fx equal 0.0
#variable fy equal 0.0
#variable fz equal 0.0
#label loopj
#variable j loop ${ntj}
#if "$i > ${nt}" then "jump SELF break"
#if "$j > ${nt}" then "jump SELF break"
#if "$i == $j" then "next j" &
#"jump SELF loopj" &
#variable dx equal x[$i]-x[$j]
#variable dy equal y[$i]-y[$j]
#variable dz equal z[$i]-z[$j]
#variable r2menhayer1_norm equal sqrt(v_dx*v_dx+v_dy*v_dy+v_dz*v_dz)
#variable r2menhayer1_norm3 equal v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm
#variable r2menhayer1_norm5 equal v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm
#variable r2menhayer1_norm7 equal v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm*v_r2menhayer1_norm
#variable m1dotr2menhayer1 equal v_m1*v_dz
#variable m2dotr2menhayer1 equal v_m2*v_dz
#variable m1dotm2 equal v_m1*v_m2
#variable FX1 equal (v_m1dotm2*v_dx/v_r2menhayer1_norm5)-(5*v_m1*v_dz*v_m2*v_dz*v_dx/v_r2menhayer1_norm7)
#variable FY1 equal (v_m1dotm2*v_dy/v_r2menhayer1_norm5)-(5*v_m1*v_dz*v_m2*v_dz*v_dy/v_r2menhayer1_norm7)
#variable FZ1 equal (v_m1dotm2*v_dz/v_r2menhayer1_norm5)-(5*v_m1*v_dz*v_m2*v_dz*v_dz/v_r2menhayer1_norm7)+(v_m1*v_dz*v_m2/v_r2menhayer1_norm5)+(v_m2*v_dz*v_m1/v_r2menhayer1_norm5)
#variable FX equal (v_coeff)*(v_FX1)*v_coeffyeka
#variable FY equal (v_coeff)*(v_FY1)*v_coeffyeka
#variable FZ equal (v_coeff)*(v_FZ1)*v_coeffyeka
#print "FX($j)to($i)=${FX}" append loop.txt screen no
#print "FY($j)to($i)=${FY}" append loop.txt screen no
#print "FZ($j)to($i)=${FZ}" append loop.txt screen no
#print "-------------------------" append loop.txt screen no
#variable Udd1 equal ((v_m1dotm2/v_r2menhayer1_norm3)-(3*v_m1dotr2menhayer1*v_m2dotr2menhayer1/v_r2menhayer1_norm5))
#variable Udd equal (v_coeff/3)*(v_Udd1)*v_coeffyeka
#print "Udd($i)($j)=${Udd}" append loop.txt screen no
#print "-------------------------" append loop.txt screen no
##group yek id == $i
##fix $j yek addforce v_FX v_FY v_FZ
#variable udd equal ${udd}+${Udd}
#variable fx equal ${fx}+${FX}
#variable fy equal ${fy}+${FY}
#variable fz equal ${fz}+${FZ}
#label break
#next j
#jump SELF loopj
#print "fx to($i)=${fx}" append loop.txt screen no
#print "fy to($i)=${fy}" append loop.txt screen no
#print "fz to($i)=${fz}" append loop.txt screen no
#print "-------------------------" append loop.txt screen no
#group yek id == $i
#fix $i yek addforce v_fx v_fy v_fz
#label break
#next i
#jump SELF loopi
#variable dipole_eng equal ${udd}/2
#print " all commands have been done succesfully" append loop.txt screen no
fix 1_nvt all nvt temp 293 293 $(100.0*dt)
fix 2_langvin all langevin/spin 293 0.01 21
thermo 100
thermo_style custom step pe c_dipole_energy #v_dipole_eng
dump 1 all custom 10 tmp.lammpstrj id type x y z
run 20000
```

We have two types of particles with magnetic moments M1 and M2 that have only a dipole-dipole interaction.

When I look at the output files,this D-D interaction seems to be absent among the other defined interactions.

I extinguished the other interactions to see how bold the D-D interaction is.

I calculated the interaction energy between the particles using the spin / dipole / cut command. According to the manual, if there is a dipole-dipole magnetic interaction between particles, a mechanical force is created between particle i and particle j (between pairs of particles) and we expect the particles to move, but this did not happen, the amount of force applied to the particles was zero and the particles did not move. Why?

The lines that start with ‘#’ are algorithm that I wrote for calculating this mechanical force according to the formula provided in the lammps manual, and this force is not zero.

I hope I was able to express my problem clearly

All The best

This is not at all clear and the many commented lines make it particularly hard to read.

So here is what I figured out by creating my own (really) simple example (added below).

First off, I have never done any calculations with the SPIN package outside of just running the examples to test for their technical correctness (no memory leaks, no uninitialized variables, no out of range memory accesses etc.). So this is what I just figured out in a bit over half an hour using my dusty knowledge about magnetic spins from when I was a grad student (i.e. over 25 years ago), looking through information in the manual, the examples, and the source code.

The most important point: magnetic interactions need a special treatment. They do not evolve like, e.g. coulomb forces and you cannot treat them like that. Because of that the SPIN package differentiates between “mechanical” forces on the atoms due to the evolution of the spins and “magnetic” forces.

By default, the SPIN package assumes a “frozen” lattice, i.e. the “mechanical” force is not computed and only the evolution of the spins considered.

Thus to see the interaction from the pair style you must use compute property/atom to access the “magnetic” force (fmx, fmy, fmz).

To enable the “mechanical” force, you can for example add fix nve/spin as shown below.

**This** is what is a clear and minimal example demonstrating just the required items looks like.

```
units metal
atom_style spin
atom_modify map array
region box block -5 5 -5 5 -5 5
create_box 2 box
create_atoms 1 single -1 0 0
create_atoms 2 single 1 0 0
mass * 55.00
set atom 1 spin 2.2 -1.0 0.0 0.0
set atom 2 spin 2.2 -1.0 0.0 0.0
pair_style spin/dipole/cut 8.0
pair_coeff * * 8.0
compute 1 all property/atom fmx fmy fmz
#fix 2 all nve/spin lattice moving
dump 1 all custom 1 dump.forces id fx fy fz c_1[*]
run 0 post no
```