Commit 09d0df43 authored by julient31's avatar julient31
Browse files

Commit JT 022120

- added message for only one precession/spin (+doc)
- added a per pair/spin class emag table
parent 361f7bb0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ function for the same parameters.

.. image:: JPG/zeeman_langevin.jpg
   :align: center
   :width: 600

The temperature effects are accounted for by connecting the spin
:math:`i` to a thermal bath using a Langevin thermostat (see
@@ -159,11 +160,15 @@ No information about this fix is written to :doc:`binary restart files <restart>
Restrictions
""""""""""""


The *precession/spin* style is part of the SPIN package.  This style
is only enabled if LAMMPS was built with this package, and if the
atom\_style "spin" was declared.  See the :doc:`Build package <Build_package>` doc page for more info.

The *precession/spin* style can only be declared once. If more
than one precession type (for example combining an anisotropy and a Zeeman interactions)
has to be declared, they have to be chained in the same command
line (as shown in the examples above). 

Related commands
""""""""""""""""

+17 −1
Original line number Diff line number Diff line
@@ -69,6 +69,22 @@ void ComputeSpin::init()
  hbar = force->hplanck/MY_2PI;
  kb = force->boltz;

  // loop 1: obtain # of Pairs, and # of Pair/Spin styles

  if (force->pair_match("spin",0,0)) {        // only one Pair/Spin style
    pair = force->pair_match("spin",0,0);
    npairs = pair->instance_total;
    npairspin = 1;
  } else if (force->pair_match("spin",0,1)) { // more than one Pair/Spin style
    pair = force->pair_match("spin",0,1);
    npairs = pair->instance_total;
    for (int i = 0; i<npairs; i++) {
      if (force->pair_match("spin",0,i)) {
        npairspin ++;
      }
    }
  }

  // init length of vector of ptrs to Pair/Spin styles

  if (npairspin > 0) {
@@ -166,7 +182,7 @@ void ComputeSpin::compute_vector()

        if (pair_spin_flag) {
          for (int k = 0; k < npairspin; k++) {
            // spin_pairs[k]->compute_single_pair(i,fmi);
            magenergy += spin_pairs[k]->emag[i];
          }
        }

+9 −0
Original line number Diff line number Diff line
@@ -197,6 +197,15 @@ void FixPrecessionSpin::init()
        error->all(FLERR,"Illegal precession/spin command");
  }

  // check that fix precession/spin is only declared once

  int iprec = 0;
  for (int iforce = 0; iforce < modify->nfix; iforce++)
    if (strstr(modify->fix[iforce]->style,"precession/spin")) iprec++;
  if (iprec > 1)
    error->all(FLERR,"precession/spin command can only be declared once");


  varflag = CONSTANT;
  if (magfieldstyle != CONSTANT) varflag = EQUAL;

+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "fix.h"
#include "force.h"
#include "math_const.h"
#include "memory.h"
#include "modify.h"
#include "neighbor.h"
#include "neigh_request.h"
@@ -98,4 +99,9 @@ void PairSpin::init_style()
  if (ifix >=0)
    lattice_flag = ((FixNVESpin *) modify->fix[ifix])->lattice_flag;

  // test emag list storing mag energies
  // init. size of energy stacking lists

  nlocal_max = atom->nlocal;
  memory->grow(emag,nlocal_max,"pair/spin:emag");
}
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ friend class FixNVESpin;
  virtual void compute(int, int) {}
  virtual void compute_single_pair(int, double *) {}
  
  // test emag list storing mag energies
  int nlocal_max;                       // max value of nlocal (for size of lists)
  double *emag;                         // energy list

 protected:
  double hbar;                          // Planck constant (eV.ps.rad-1)
  int lattice_flag;                     // flag for mech force computation
Loading