Commit 53a77906 authored by julient31's avatar julient31
Browse files

Commit JT 092418

- ewald_dipole_spin added
- accuracy problem (with eval of gewald and Newton solver)
parent cce9fe4a
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
# hcp cobalt in a 3d periodic box

clear 
units	 	metal
atom_style 	spin

dimension 	3
boundary 	p p p

# necessary for the serial algorithm (sametag)
atom_modify 	map array 

lattice 	hcp 2.5071
region 		box block 0.0 8.0 0.0 8.0 0.0 8.0
create_box 	1 box
create_atoms 	1 box

# setting mass, mag. moments, and interactions for hcp cobalt

mass		1 58.93

#set 		group all spin/random 31 1.72
set 		group all spin 1.72 0.0 0.0 1.0 
velocity 	all create 100 4928459 rot yes dist gaussian

pair_style 	hybrid/overlay eam/alloy spin/exchange 4.0 spin/long 8.0
#pair_style 	hybrid/overlay eam/alloy spin/exchange 4.0 spin/long/qsymp 8.0
#pair_style 	hybrid/overlay eam/alloy spin/exchange 4.0
pair_coeff 	* * eam/alloy ../examples/SPIN/pppm_spin/Co_PurjaPun_2012.eam.alloy Co
pair_coeff 	* * spin/exchange exchange 4.0 0.3593 1.135028015e-05 1.064568567
#pair_coeff 	* * spin/long/qsymp long 8.0
pair_coeff 	* * spin/long long 8.0

neighbor 	0.1 bin
neigh_modify 	every 10 check yes delay 20

#kspace_style pppm/dipole/spin 1.0e-4
#kspace_style ewald/dipole/spin 1.0e-4
kspace_style ewald/dipole/spin 1.0e-2
kspace_modify mesh 32 32 32

#fix 		1 all precession/spin zeeman 1.0 0.0 0.0 1.0
fix 		1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 		2 all langevin/spin 0.0 0.0 21
fix 		3 all nve/spin lattice yes

timestep	0.0001


compute 	out_mag    all compute/spin
compute 	out_pe     all pe
compute 	out_ke     all ke
compute 	out_temp   all temp

variable 	magz      equal c_out_mag[3]
variable 	magnorm   equal c_out_mag[4]
variable 	emag      equal c_out_mag[5]
variable 	tmag      equal c_out_mag[6]

thermo_style    custom step time v_magnorm v_emag temp etotal
thermo          10

compute 	outsp all property/atom spx spy spz sp fmx fmy fmz
dump 		100 all custom 1 dump_cobalt_hcp.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]

#run 		20000
run 		1
+3 −3
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@ void EwaldDipole::init()
  // zprd used rather than zprd_slab

  if (!gewaldflag) {
    if (accuracy <= 0.0)
      error->all(FLERR,"KSpace accuracy must be > 0");
    double g_ewald_new =
      NewtonSolve(g_ewald,cutoff,natoms,xprd*yprd*zprd,mu2);
    if (g_ewald_new > 0.0) g_ewald = g_ewald_new;
@@ -778,14 +780,12 @@ void EwaldDipole::slabcorr()
{
  // compute local contribution to global dipole moment

  //double *q = atom->q;
  double **x = atom->x;
  double zprd = domain->zprd;
  int nlocal = atom->nlocal;

  double dipole = 0.0;
  double **mu = atom->mu;
  //for (int i = 0; i < nlocal; i++) dipole += q[i]*x[i][2];
  for (int i = 0; i < nlocal; i++) dipole += mu[i][2];

  // sum local contributions to get global dipole moment
@@ -856,7 +856,7 @@ void EwaldDipole::musum_musq()
  }

  if (mu2 == 0 && comm->me == 0)
    error->all(FLERR,"Using kspace solver PPPMDipole on system with no dipoles");
    error->all(FLERR,"Using kspace solver EwaldDipole on system with no dipoles");
}

/* ----------------------------------------------------------------------
+0 −3
Original line number Diff line number Diff line
@@ -38,9 +38,6 @@ class EwaldDipole : public Ewald {
  double **tk;			// field for torque 
  double **vc;			// virial per k

  //virtual void allocate();
  //void deallocate();

  void musum_musq(); 
  double rms_dipole(int, double, bigint);
  virtual void eik_dot_r();
+895 −0

File added.

Preview size limit exceeded, changes collapsed.

+102 −0
Original line number Diff line number Diff line
/* -*- c++ -*- ----------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#ifdef KSPACE_CLASS

KSpaceStyle(ewald/dipole/spin,EwaldDipoleSpin)

#else

#ifndef LMP_EWALD_DIPOLE_SPIN_H
#define LMP_EWALD_DIPOLE_SPIN_H

#include "ewald_dipole.h"

namespace LAMMPS_NS {

class EwaldDipoleSpin : public EwaldDipole {
 public:
  EwaldDipoleSpin(class LAMMPS *, int, char **);
  virtual ~EwaldDipoleSpin();
  void init();
  void setup();
  void compute(int, int);

 protected:
  double hbar;                  // reduced Planck's constant      
  double mub;                   // Bohr's magneton                
  double mu_0;                  // vacuum permeability
  double mub2mu0;               // prefactor for mech force
  double mub2mu0hbinv;          // prefactor for mag force

  void spsum_musq(); 
  virtual void eik_dot_r();
  void slabcorr();

};

}

#endif
#endif

/* ERROR/WARNING messages:

E: Illegal ... command

Self-explanatory.  Check the input script syntax and compare to the
documentation for the command.  You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.

E: Cannot use EwaldDipoleSpin with 2d simulation

The kspace style ewald cannot be used in 2d simulations.  You can use
2d EwaldDipoleSpin in a 3d simulation; see the kspace_modify command.

E: Kspace style requires atom attribute q

The atom style defined does not have these attributes.

E: Cannot use nonperiodic boundaries with EwaldDipoleSpin

For kspace style ewald, all 3 dimensions must have periodic boundaries
unless you use the kspace_modify command to define a 2d slab with a
non-periodic z dimension.

E: Incorrect boundaries with slab EwaldDipoleSpin

Must have periodic x,y dimensions and non-periodic z dimension to use
2d slab option with EwaldDipoleSpin.

E: Cannot (yet) use EwaldDipoleSpin with triclinic box and slab correction

This feature is not yet supported.

E: KSpace style is incompatible with Pair style

Setting a kspace style requires that a pair style with matching
long-range Coulombic or dispersion components be used.

E: KSpace accuracy must be > 0

The kspace accuracy designated in the input must be greater than zero.

E: Must use 'kspace_modify gewald' for uncharged system

UNDOCUMENTED

E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems

This option is not yet supported.

*/