diff --git a/doc/src/Eqs/pair_spin_exchange_function.pdf b/doc/src/Eqs/pair_spin_exchange_function.pdf
new file mode 100644
index 0000000000..4c80a14de8
Binary files /dev/null and b/doc/src/Eqs/pair_spin_exchange_function.pdf differ
diff --git a/doc/src/Eqs/pair_spin_exchange_function.tex b/doc/src/Eqs/pair_spin_exchange_function.tex
new file mode 100644
index 0000000000..054c6992f0
--- /dev/null
+++ b/doc/src/Eqs/pair_spin_exchange_function.tex
@@ -0,0 +1,13 @@
+\documentclass[preview]{standalone}
+\usepackage{varwidth}
+\usepackage[utf8x]{inputenc}
+\usepackage{amsmath, amssymb, graphics, setspace}
+
+\begin{document}
+\begin{varwidth}{50in}
+ \begin{equation}
+ {J}\left( r_{ij} \right) = 4 a \left( \frac{r_{ij}}{d} \right)^2 \left( 1 - b \left( \frac{r_{ij}}{d} \right)^2 \right) e^{-\left( \frac{r_{ij}}{d}
+ \right)^2 }\Theta (R_c - r_{ij}) \nonumber
+ \end{equation}
+\end{varwidth}
+\end{document}
diff --git a/doc/src/Eqs/pair_spin_exchange_interaction.pdf b/doc/src/Eqs/pair_spin_exchange_interaction.pdf
new file mode 100644
index 0000000000..d1246c15aa
Binary files /dev/null and b/doc/src/Eqs/pair_spin_exchange_interaction.pdf differ
diff --git a/doc/src/Eqs/pair_spin_exchange_interaction.tex b/doc/src/Eqs/pair_spin_exchange_interaction.tex
new file mode 100644
index 0000000000..6e598f75ac
--- /dev/null
+++ b/doc/src/Eqs/pair_spin_exchange_interaction.tex
@@ -0,0 +1,11 @@
+\documentclass[preview]{standalone}
+\usepackage{varwidth}
+\usepackage[utf8x]{inputenc}
+\usepackage{amsmath,amssymb,amsthm,bm}
+\begin{document}
+\begin{varwidth}{50in}
+ \begin{equation}
+ \bm{H}_{exchange} ~=~ -\sum_{i,j,i\neq j}^{N} {J} \left(r_{ij} \right)\, \vec{s}_{i}\cdot \vec{s}_{j} \nonumber
+ \end{equation}
+\end{varwidth}
+\end{document}
diff --git a/doc/src/compute_spin.txt b/doc/src/compute_spin.txt
index 4cef1c0143..9067a9859f 100644
--- a/doc/src/compute_spin.txt
+++ b/doc/src/compute_spin.txt
@@ -25,20 +25,35 @@ Define a computation that calculates the magnetic quantities for a system
of atoms having spins.
This compute calculates 6 magnetic quantities.
-The three first ones are the x,y and z cooredinates of the total magnetization.
+
+The three first quantities are the x,y and z coordinates of the total magnetization.
+
The fourth quantity is the norm of the total magnetization.
+
The fifth one is referred to as the spin temperature, according
to the work of "(Nurdin)"_#Nurdin1.
The sixth quantity is the magnetic energy.
+The simplest way to output the results of the compute spin calculation
+is to define some of the quantities as variables, and to use the thermo and
+thermo_style commands, for example
+for example:
-A simple way to output the results of the compute spin
-calculation to a file is to use the "fix ave/time"_fix_ave_time.html
-command, for example:
+compute out_mag all compute/spin :pre
+
+variable mag_z equal c_out_mag\[4\]
+variable mag_norm equal c_out_mag\[5\]
+variable temp_mag equal c_out_mag\[7\] :pre
+
+thermo 10
+thermo_style custom step v_mag_z v_mag_norm v_temp_mag :pre
+
+This serie of commands evaluates the total magnetization along z, the norm of
+the total magnetization, and the magnetic temperature. Three variables are
+assigned to those quantities. The thermo and thermo_style commands print them
+every 10 timesteps.
-compute mag all compute/spin
-fix outmag all ave/time 1 1 50 c_mag[2] c_mag[3] c_mag[4] c_mag[7] file mag.dat
[Output info:]
@@ -50,6 +65,7 @@ metal units ("units"_units.html).
The {spin} compute is part of the SPIN package.
This compute is only enabled if LAMMPS was built with this package.
See the "Making LAMMPS"_Section_start.html#start_3 section for more info.
+The atom_style has to be "spin" for this compute to be valid.
[Related commands:] none
diff --git a/doc/src/pair_spin_exchange.txt b/doc/src/pair_spin_exchange.txt
new file mode 100644
index 0000000000..cd94984230
--- /dev/null
+++ b/doc/src/pair_spin_exchange.txt
@@ -0,0 +1,82 @@
+
+
+
+
+"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
+
+:link(lws,http://lammps.sandia.gov)
+:link(ld,Manual.html)
+:link(lc,Section_commands.html#comm)
+
+:line
+
+pair_style pair/spin/exchange command :h3
+
+[Syntax:]
+
+pair_style pair/spin/exchange cutoff :pre
+
+cutoff = global cutoff pair (distance in metal units) :ulb,l
+
+:ule
+
+[Examples:]
+
+pair_style pair/spin/exchange 4.0
+pair_coeff * * exchange 4.0 0.0446928 0.003496 1.4885
+pair_coeff 1 2 exchange 6.0 -0.01575 0.0 1.965 :pre
+
+[Description:]
+
+Style {pair/spin/exchange} computes the exchange interaction between
+pairs of magnetic spins.
+
+:c,image(Eqs/pair_spin_exchange_interaction.pdf)
+
+where si and sj are two neighboring magnetic spins of two particles,
+rij = ri - rj is the inter-atomic distance between the two particles,
+and J(rij) is a function defining the intensity and the sign of the exchange
+interaction.
+
+This function is defined as:
+
+:c,image(Eqs/pair_spin_exchange_function.pdf)
+
+where a, b and d are the three constants defined in the associated "pair_coeff"
+command.
+
+More explanations the {pair/spin/exchange} and its parametrization are reported
+in "(Tranchida)"_#Tranchida1.
+
+
+
+The {lj/cut} and {lj/cut/coul/long} pair styles support the use of the
+{inner}, {middle}, and {outer} keywords of the "run_style
+respa"_run_style.html command, meaning the pairwise forces can be
+
+:line
+
+[Restrictions:]
+
+All the {pair/spin} styles are part of the SPIN package.
+These styles are only enabled if LAMMPS was built with this package, and
+if the atom_style "spin" was declared.
+See the "Making LAMMPS"_Section_start.html#start_3 section for more info.
+
+[Related commands:]
+
+"eam"
+
+"pair_coeff"_pair_coeff.html
+
+[Default:] none
+
+:line
+
+:link(Tranchida1)
+[(Tranchida)]https://arxiv.org/abs/1801.10233
+
diff --git a/examples/SPIN/in.spin.cobalt b/examples/SPIN/in.spin.cobalt
index 1f740f0741..dc93920585 100644
--- a/examples/SPIN/in.spin.cobalt
+++ b/examples/SPIN/in.spin.cobalt
@@ -43,7 +43,7 @@ set group all spin/random 31 1.72
#set group single_spin spin/random 11 1.72
#velocity all create 200 4928459 rot yes dist gaussian
-velocity all create 10 4928459 rot yes dist gaussian
+velocity all create 200 4928459 rot yes dist gaussian
#Magneto-mechanic interactions for bulk fcc Cobalt
#pair_style pair/spin/exchange 4.0
@@ -88,7 +88,7 @@ neigh_modify every 10 check yes delay 20
#Magnetic integration fix
#fix 3 all integration/spin mpi
-fix 3 all integration/spin serial lattice no
+fix 3 all integration/spin serial lattice yes
#compute real time, total magnetization, magnetic energy, and spin temperature
#Iteration | Time | Mx | My | Mz | |M| | Em | Tm
diff --git a/src/SPIN/fix_integration_spin.cpp b/src/SPIN/fix_integration_spin.cpp
index a2724b106e..8a21463b7f 100644
--- a/src/SPIN/fix_integration_spin.cpp
+++ b/src/SPIN/fix_integration_spin.cpp
@@ -297,7 +297,6 @@ void FixIntegrationSpin::initial_integrate(int vflag)
} else error->all(FLERR,"Illegal fix integration/spin command");
}
-
// update x for all particles
if (mech_flag) {