Examples and docs

This commit is contained in:
julient31
2018-03-21 07:55:41 -06:00
parent 436a5de3a6
commit 65b7e43a91
15 changed files with 45 additions and 12940 deletions

View File

@ -36,6 +36,7 @@ fix 3 all integration/spin lattice yes
timestep 0.0001
# compute and output options
compute out_mag all compute/spin
compute out_pe all pe

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
#!/usr/bin/env python
# This file reads in the file log.lammps generated by the script ELASTIC/in.elastic
# It prints out the 6x6 tensor of elastic constants Cij
# followed by the 6x6 tensor of compliance constants Sij
# It uses the same conventions as described in:
# Sprik, Impey and Klein PRB (1984).
# The units of Cij are whatever was used in log.lammps (usually GPa)
# The units of Sij are the inverse of that (usually 1/GPa)
from numpy import zeros
from numpy.linalg import inv
# define logfile layout
nvals = 21
valpos = 4
valstr = '\nElastic Constant C'
# define order of Cij in logfile
cindices = [0]*nvals
cindices[0] = (0,0)
cindices[1] = (1,1)
cindices[2] = (2,2)
cindices[3] = (0,1)
cindices[4] = (0,2)
cindices[5] = (1,2)
cindices[6] = (3,3)
cindices[7] = (4,4)
cindices[8] = (5,5)
cindices[9] = (0,3)
cindices[10] = (0,4)
cindices[11] = (0,5)
cindices[12] = (1,3)
cindices[13] = (1,4)
cindices[14] = (1,5)
cindices[15] = (2,3)
cindices[16] = (2,4)
cindices[17] = (2,5)
cindices[18] = (3,4)
cindices[19] = (3,5)
cindices[20] = (4,5)
# open logfile
logfile = open("log.lammps",'r')
txt = logfile.read()
# search for 21 elastic constants
c = zeros((6,6))
s2 = 0
for ival in range(nvals):
s1 = txt.find(valstr,s2)
if (s1 == -1):
print "Failed to find elastic constants in log file"
exit(1)
s1 += 1
s2 = txt.find("\n",s1)
line = txt[s1:s2]
# print line
words = line.split()
(i1,i2) = cindices[ival]
c[i1,i2] = float(words[valpos])
c[i2,i1] = c[i1,i2]
print "C tensor [GPa]"
for i in range(6):
for j in range(6):
print "%10.8g " % c[i][j],
print
# apply factor of 2 to columns of off-diagonal elements
for i in range(6):
for j in range(3,6):
c[i][j] *= 2.0
s = inv(c)
# apply factor of 1/2 to columns of off-diagonal elements
for i in range(6):
for j in range(3,6):
s[i][j] *= 0.5
print "S tensor [1/GPa]"
for i in range(6):
for j in range(6):
print "%10.8g " % s[i][j],
print

View File

@ -1,142 +0,0 @@
# NOTE: This script should not need to be
# modified. See in.elastic for more info.
#
# Find which reference length to use
if "${dir} == 1" then &
"variable len0 equal ${lx0}"
if "${dir} == 2" then &
"variable len0 equal ${ly0}"
if "${dir} == 3" then &
"variable len0 equal ${lz0}"
if "${dir} == 4" then &
"variable len0 equal ${lz0}"
if "${dir} == 5" then &
"variable len0 equal ${lz0}"
if "${dir} == 6" then &
"variable len0 equal ${ly0}"
# Reset box and simulation parameters
clear
box tilt large
read_restart restart.equil
include potential.mod
# Negative deformation
variable delta equal -${up}*${len0}
variable deltaxy equal -${up}*xy
variable deltaxz equal -${up}*xz
variable deltayz equal -${up}*yz
if "${dir} == 1" then &
"change_box all x delta 0 ${delta} xy delta ${deltaxy} xz delta ${deltaxz} remap units box"
if "${dir} == 2" then &
"change_box all y delta 0 ${delta} yz delta ${deltayz} remap units box"
if "${dir} == 3" then &
"change_box all z delta 0 ${delta} remap units box"
if "${dir} == 4" then &
"change_box all yz delta ${delta} remap units box"
if "${dir} == 5" then &
"change_box all xz delta ${delta} remap units box"
if "${dir} == 6" then &
"change_box all xy delta ${delta} remap units box"
# Relax atoms positions
minimize ${etol} ${ftol} ${maxiter} ${maxeval}
# Obtain new stress tensor
variable tmp equal pxx
variable pxx1 equal ${tmp}
variable tmp equal pyy
variable pyy1 equal ${tmp}
variable tmp equal pzz
variable pzz1 equal ${tmp}
variable tmp equal pxy
variable pxy1 equal ${tmp}
variable tmp equal pxz
variable pxz1 equal ${tmp}
variable tmp equal pyz
variable pyz1 equal ${tmp}
# Compute elastic constant from pressure tensor
variable C1neg equal ${d1}
variable C2neg equal ${d2}
variable C3neg equal ${d3}
variable C4neg equal ${d4}
variable C5neg equal ${d5}
variable C6neg equal ${d6}
# Reset box and simulation parameters
clear
box tilt large
read_restart restart.equil
include potential.mod
# Positive deformation
variable delta equal ${up}*${len0}
variable deltaxy equal ${up}*xy
variable deltaxz equal ${up}*xz
variable deltayz equal ${up}*yz
if "${dir} == 1" then &
"change_box all x delta 0 ${delta} xy delta ${deltaxy} xz delta ${deltaxz} remap units box"
if "${dir} == 2" then &
"change_box all y delta 0 ${delta} yz delta ${deltayz} remap units box"
if "${dir} == 3" then &
"change_box all z delta 0 ${delta} remap units box"
if "${dir} == 4" then &
"change_box all yz delta ${delta} remap units box"
if "${dir} == 5" then &
"change_box all xz delta ${delta} remap units box"
if "${dir} == 6" then &
"change_box all xy delta ${delta} remap units box"
# Relax atoms positions
minimize ${etol} ${ftol} ${maxiter} ${maxeval}
# Obtain new stress tensor
variable tmp equal pe
variable e1 equal ${tmp}
variable tmp equal press
variable p1 equal ${tmp}
variable tmp equal pxx
variable pxx1 equal ${tmp}
variable tmp equal pyy
variable pyy1 equal ${tmp}
variable tmp equal pzz
variable pzz1 equal ${tmp}
variable tmp equal pxy
variable pxy1 equal ${tmp}
variable tmp equal pxz
variable pxz1 equal ${tmp}
variable tmp equal pyz
variable pyz1 equal ${tmp}
# Compute elastic constant from pressure tensor
variable C1pos equal ${d1}
variable C2pos equal ${d2}
variable C3pos equal ${d3}
variable C4pos equal ${d4}
variable C5pos equal ${d5}
variable C6pos equal ${d6}
# Combine positive and negative
variable C1${dir} equal 0.5*(${C1neg}+${C1pos})
variable C2${dir} equal 0.5*(${C2neg}+${C2pos})
variable C3${dir} equal 0.5*(${C3neg}+${C3pos})
variable C4${dir} equal 0.5*(${C4neg}+${C4pos})
variable C5${dir} equal 0.5*(${C5neg}+${C5pos})
variable C6${dir} equal 0.5*(${C6neg}+${C6pos})
# Delete dir to make sure it is not reused
variable dir delete

View File

@ -1,59 +0,0 @@
# fcc cobalt in a 3d periodic box
clear
units metal
atom_style spin
dimension 3
boundary p p p
# check why?
atom_modify map array
lattice fcc 3.54
region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box
create_atoms 1 box
# setting mass, mag. moments, and interactions for cobalt
mass 1 58.93
set group all spin/random 31 1.72
velocity all create 100 4928459 rot yes dist gaussian
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/cobalt/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.1 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.1 21
fix 3 all integration/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]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag temp etotal
thermo 10
#dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz
run 1000

View File

@ -1,204 +0,0 @@
# Compute elastic constant tensor for a crystal
#
# Written by Aidan Thompson (Sandia, athomps@sandia.gov)
#
# This script uses the following three include files.
#
# init.mod (must be modified for different crystal structures)
# Define units, deformation parameters and initial
# configuration of the atoms and simulation cell.
#
#
# potential.mod (must be modified for different pair styles)
# Define pair style and other attributes
# not stored in restart file
#
#
# displace.mod (displace.mod should not need to be modified)
# Perform positive and negative box displacements
# in direction ${dir} and size ${up}.
# It uses the resultant changes
# in stress to compute one
# row of the elastic stiffness tensor
#
# Inputs variables:
# dir = the Voigt deformation component
# (1,2,3,4,5,6)
# Global constants:
# up = the deformation magnitude (strain units)
# cfac = conversion from LAMMPS pressure units to
# output units for elastic constants
#
#
# To run this on a different system, it should only be necessary to
# modify the files init.mod and potential.mod. In order to calculate
# the elastic constants correctly, care must be taken to specify
# the correct units in init.mod (units, cfac and cunits). It is also
# important to verify that the minimization of energy w.r.t atom
# positions in the deformed cell is fully converged.
# One indication of this is that the elastic constants are insensitive
# to the choice of the variable ${up} in init.mod. Another is to check
# the final max and two-norm forces reported in the log file. If you know
# that minimization is not required, you can set maxiter = 0.0 in
# init.mod.
#
include init.mod
include potential.mod
# Compute initial state
fix 3 all box/relax aniso 0.0
minimize ${etol} ${ftol} ${maxiter} ${maxeval}
variable tmp equal pxx
variable pxx0 equal ${tmp}
variable tmp equal pyy
variable pyy0 equal ${tmp}
variable tmp equal pzz
variable pzz0 equal ${tmp}
variable tmp equal pyz
variable pyz0 equal ${tmp}
variable tmp equal pxz
variable pxz0 equal ${tmp}
variable tmp equal pxy
variable pxy0 equal ${tmp}
variable tmp equal lx
variable lx0 equal ${tmp}
variable tmp equal ly
variable ly0 equal ${tmp}
variable tmp equal lz
variable lz0 equal ${tmp}
# These formulas define the derivatives w.r.t. strain components
# Constants uses $, variables use v_
variable d1 equal -(v_pxx1-${pxx0})/(v_delta/v_len0)*${cfac}
variable d2 equal -(v_pyy1-${pyy0})/(v_delta/v_len0)*${cfac}
variable d3 equal -(v_pzz1-${pzz0})/(v_delta/v_len0)*${cfac}
variable d4 equal -(v_pyz1-${pyz0})/(v_delta/v_len0)*${cfac}
variable d5 equal -(v_pxz1-${pxz0})/(v_delta/v_len0)*${cfac}
variable d6 equal -(v_pxy1-${pxy0})/(v_delta/v_len0)*${cfac}
displace_atoms all random ${atomjiggle} ${atomjiggle} ${atomjiggle} 87287 units box
# Write restart
unfix 3
write_restart restart.equil
# uxx Perturbation
variable dir equal 1
include displace.mod
# uyy Perturbation
variable dir equal 2
include displace.mod
# uzz Perturbation
variable dir equal 3
include displace.mod
# uyz Perturbation
variable dir equal 4
include displace.mod
# uxz Perturbation
variable dir equal 5
include displace.mod
# uxy Perturbation
variable dir equal 6
include displace.mod
# Output final values
variable C11all equal ${C11}
variable C22all equal ${C22}
variable C33all equal ${C33}
variable C12all equal 0.5*(${C12}+${C21})
variable C13all equal 0.5*(${C13}+${C31})
variable C23all equal 0.5*(${C23}+${C32})
variable C44all equal ${C44}
variable C55all equal ${C55}
variable C66all equal ${C66}
variable C14all equal 0.5*(${C14}+${C41})
variable C15all equal 0.5*(${C15}+${C51})
variable C16all equal 0.5*(${C16}+${C61})
variable C24all equal 0.5*(${C24}+${C42})
variable C25all equal 0.5*(${C25}+${C52})
variable C26all equal 0.5*(${C26}+${C62})
variable C34all equal 0.5*(${C34}+${C43})
variable C35all equal 0.5*(${C35}+${C53})
variable C36all equal 0.5*(${C36}+${C63})
variable C45all equal 0.5*(${C45}+${C54})
variable C46all equal 0.5*(${C46}+${C64})
variable C56all equal 0.5*(${C56}+${C65})
# Average moduli for cubic crystals
variable C11cubic equal (${C11all}+${C22all}+${C33all})/3.0
variable C12cubic equal (${C12all}+${C13all}+${C23all})/3.0
variable C44cubic equal (${C44all}+${C55all}+${C66all})/3.0
variable bulkmodulus equal (${C11cubic}+2*${C12cubic})/3.0
variable shearmodulus1 equal ${C44cubic}
variable shearmodulus2 equal (${C11cubic}-${C12cubic})/2.0
variable poissonratio equal 1.0/(1.0+${C11cubic}/${C12cubic})
# For Stillinger-Weber silicon, the analytical results
# are known to be (E. R. Cowley, 1988):
# C11 = 151.4 GPa
# C12 = 76.4 GPa
# C44 = 56.4 GPa
print "========================================="
print "Components of the Elastic Constant Tensor"
print "========================================="
print "Elastic Constant C11all = ${C11all} ${cunits}"
print "Elastic Constant C22all = ${C22all} ${cunits}"
print "Elastic Constant C33all = ${C33all} ${cunits}"
print "Elastic Constant C12all = ${C12all} ${cunits}"
print "Elastic Constant C13all = ${C13all} ${cunits}"
print "Elastic Constant C23all = ${C23all} ${cunits}"
print "Elastic Constant C44all = ${C44all} ${cunits}"
print "Elastic Constant C55all = ${C55all} ${cunits}"
print "Elastic Constant C66all = ${C66all} ${cunits}"
print "Elastic Constant C14all = ${C14all} ${cunits}"
print "Elastic Constant C15all = ${C15all} ${cunits}"
print "Elastic Constant C16all = ${C16all} ${cunits}"
print "Elastic Constant C24all = ${C24all} ${cunits}"
print "Elastic Constant C25all = ${C25all} ${cunits}"
print "Elastic Constant C26all = ${C26all} ${cunits}"
print "Elastic Constant C34all = ${C34all} ${cunits}"
print "Elastic Constant C35all = ${C35all} ${cunits}"
print "Elastic Constant C36all = ${C36all} ${cunits}"
print "Elastic Constant C45all = ${C45all} ${cunits}"
print "Elastic Constant C46all = ${C46all} ${cunits}"
print "Elastic Constant C56all = ${C56all} ${cunits}"
print "========================================="
print "Average properties for a cubic crystal"
print "========================================="
print "Bulk Modulus = ${bulkmodulus} ${cunits}"
print "Shear Modulus 1 = ${shearmodulus1} ${cunits}"
print "Shear Modulus 2 = ${shearmodulus2} ${cunits}"
print "Poisson Ratio = ${poissonratio}"

View File

@ -1,55 +0,0 @@
# NOTE: This script can be modified for different atomic structures,
# units, etc. See in.spin.curie_temperature for more info.
#
# Define the finite deformation size. Try several values of this
# variable to verify that results do not depend on it.
variable up equal 1.0e-6
# Define the amount of random jiggle for atoms
# This prevents atoms from staying on saddle points
variable atomjiggle equal 1.0e-5
# Uncomment one of these blocks, depending on what units
# you are using in LAMMPS and for output
# metal units, elastic constants in eV/A^3
#units metal
#variable cfac equal 6.2414e-7
#variable cunits string eV/A^3
# metal units, elastic constants in GPa
units metal
variable cfac equal 1.0e-4
variable cunits string GPa
# real units, elastic constants in GPa
#units real
#variable cfac equal 1.01325e-4
#variable cunits string GPa
# Define minimization parameters
variable etol equal 0.0
variable ftol equal 1.0e-10
variable maxiter equal 100
variable maxeval equal 1000
variable dmax equal 1.0e-2
# generate the box and atom positions using a diamond lattice
variable a equal 5.43
boundary p p p
lattice fcc 3.54
region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box
create_atoms 1 box
#lattice diamond $a
#region box prism 0 2.0 0 3.0 0 4.0 0.0 0.0 0.0
#create_box 1 box
#create_atoms 1 box
# Need to set mass (even for fixed lattice calculation, just to satisfy LAMMPS)
mass 1 58.93

View File

@ -1,30 +0,0 @@
# NOTE: This script can be modified for different pair styles
# See in.elastic for more info.
# Choose potentials (spin or spin-lattice)
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/cobalt/Co_PurjaPun_2012.eam.alloy Co
air_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
# Setup neighbor style
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
# Setup minimization style
min_style cg
min_modify dmax ${dmax} line quadratic
# Setup output
compute out_mag all compute/spin
compute out_temp all temp
variable magnorm equal c_out_mag[5]
variable tmag equal c_out_mag[7]
thermo_style custom step time v_magnorm v_tmag temp
thermo 1
#thermo 1
#thermo_style custom step temp pe press pxx pyy pzz pxy pxz pyz lx ly lz vol
#thermo_modify norm no

File diff suppressed because it is too large Load Diff

View File

@ -1,129 +0,0 @@
###################
#######Init########
###################
clear
units metal
dimension 3
#boundary p p p
boundary p p p
#newton off
#setting atom_style to spin:
atom_style spin
#Define sort for paramagnetic simulations (if no pair interaction)
#atom_modify sort 1000 4.0
atom_modify map array
###########################
#######Create atoms########
###########################
lattice fcc 3.54
region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box
create_atoms 1 box
#######################
#######Settings########
#######################
#isolating 1 atom into a group
group single_spin id 10
#Setting one or more properties of one or more atoms.
mass 1 58.93
#Setting spins orientation and moment
set group all spin/random 31 1.72
#set group all spin 1.72 0.0 0.0 1.0
#set group single_spin spin/random 11 1.72
#velocity all create 200 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
#pair_style eam/alloy
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/dev/Co_PurjaPun_2012.eam.alloy Co
#pair_coeff * * ../Co_PurjaPun_2012.eam.alloy Co
#pair_style pair/spin/exchange 4.0
#type i and j | interaction type | cutoff | J1 (eV) | J2 (adim) | J3 (Ang) (for Exchange)
#pair_coeff * * exchange 4.0 -0.0446928 0.003496 1.4885
#pair_coeff * * exchange 4.0 0.0 0.003496 1.4885
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
#pair_coeff * * pair/spin/exchange exchange 2.5 0.0446928 0.003496 1.4885
#pair_coeff * * pair/spin/exchange exchange 4.0 0.0 0.003496 1.4885
#type i and j | interaction type | cutoff | Int (eV) | [dx,dy,dz] (for DMI and ME)
#pair_coeff * * dmi 2.6 0.001 0.0 0.0 1.0
#pair_coeff * * me 2.6 0.01 1.0 1.0 1.0
#type i and j | interaction type | cutoff | K1 (eV) | K2 (adim) | K3 (Ang) (for SOC)
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
pair_coeff * * pair/spin/soc/neel neel 4.0 0.0048 0.234 1.168 2.6905 0.705 0.652
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.0 0.864159 2.13731
#Define a skin distance, update neigh list every
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
#neighbor 1.0 bin
#neigh_modify every 1 check no delay 0
#Magnetic field fix
#Type | Intensity (T or eV) | Direction
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0
#fix 1 all force/spin anisotropy 0.01 0.0 0.0 1.0
#Fix Langevin spins (merging damping and temperature)
#Temp | Alpha_trans | Alpha_long | Seed
#fix 2 all langevin/spin 0.0 0.1 21
fix 2 all langevin/spin 0.0 0.0 21
#Magnetic integration fix
fix 3 all integration/spin lattice yes
#fix 3 all integration/spin lattice no
#compute real time, total magnetization, magnetic energy, and spin temperature
#Iteration | Time | Mx | My | Mz | |M| | Em | Tm
#Setting the timestep for the simulation (in ps)
timestep 0.0001
##################
#######run########
##################
compute out_mag all compute/spin
compute out_pe all pe
compute out_ke all ke
compute out_temp all temp
variable magx equal c_out_mag[1]
variable magy equal c_out_mag[2]
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 50
#thermo_style custom step time v_magx v_magy v_magy v_magnorm v_emag v_tmag
thermo_style custom step time pe ke v_emag etotal
thermo_modify format float %20.15g
#Dump the positions and spin directions of magnetic particles (vmd format)
#dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz
#Running the simulations for N timesteps
#run 10
run 20000

View File

@ -1,126 +0,0 @@
###################
#######Init########
###################
clear
#setting units to metal (Ang, picosecs, eV, ...):
units metal
#setting dimension of the system (N=2 or 3):
dimension 3
#setting boundary conditions. (p for periodic, f for fixed, ...)
boundary p p p
#boundary f f f
#setting atom_style to spin:
atom_style spin
#Define sort for paramagnetic simulations (if no pair interaction)
#atom_modify sort 1000 4.0
#why?
atom_modify map array
#newton off for pair spin in SEQNEI
#newton off off
###########################
#######Create atoms########
###########################
#Lattice constant of fcc Cobalt
lattice fcc 3.54
#lattice sc 2.50
#Test Kagome
#variable a equal sqrt(3.0)/8.0
#variable b equal 3.0*sqrt(3.0)/8.0
#variable c equal sqrt(3.0)/4.0
#lattice custom 2.5 a1 1.0 0.0 0.0 &
# a2 0.0 1.0 0.0 &
# a3 0.0 0.0 1.0 &
# basis 0.0 $a 0.0 &
# basis 0.25 $a 0.0 &
# basis 0.375 0.0 0.0 &
# basis 0.25 $b 0.0 &
# basis 0.5 $b 0.0 &
# basis 0.625 $c 0.0
#Defining a geometric region of space. Sets ID(user's choice), style(block, sphere, ...), then, args depends on the style chosen
#(for block, one has x0, xf, y0, yf, z0, zf, in distance units)
region box block 0.0 5.0 0.0 5.0 0.0 5.0
#Creating a simulation box based on the specified region. Entries: number of atom types and box ref.
create_box 1 box
#Creating atoms (or molecules) on a lattice, or a single atom (or molecule), ...
#Entries: atom type,
create_atoms 1 box
#Replicating NxNxN the entire set of atoms
#replicate 1 1 1
#######################
#######Settings########
#######################
#Setting one or more properties of one or more atoms.
#Setting mass
mass 1 1.0
#set group all mass 1.0
#Setting spins orientation and moment
#set group all spin/random 11 1.72
set group all spin 1.72 1.0 0.0 0.0
#Magnetic exchange interaction coefficient for bulk fcc Cobalt
pair_style pair/spin 4.0
#type i and j | interaction type | cutoff | J1 (eV) | J2 (adim) | J3 (Ang) (for Exchange)
pair_coeff * * exchange 4.0 0.0446928 0.003496 1.4885
#type i and j | interaction type | cutoff | Int (eV) | [dx,dy,dz] (for DMI and ME)
#pair_coeff * * dmi 2.6 0.001 0.0 0.0 1.0
#pair_coeff * * me 2.6 0.01 1.0 1.0 1.0
#Define a skin distance, update neigh list every
#neighbor 1.0 bin
#neigh_modify every 10 check yes delay 20
neighbor 0.0 bin
neigh_modify every 1 check no delay 0
#Magnetic field fix
#Type | Intensity (T or eV) | Direction
fix 1 all force/spin zeeman 1.0 0.0 0.0 1.0
#fix 1 all force/spin anisotropy 0.001 0.0 0.0 1.0
#fix 1 all force/spin anisotropy -0.1 0.0 0.0 1.0
#fix 1 all force/spin anisotropy 0.1 0.0 1.0 0.0
#Fix Langevin spins (merging damping and temperature)
#Temp | Alpha_trans | Alpha_long | Seed
#fix 2 all langevin/spin 0.0 0.1 0.0 21
fix 2 all langevin/spin 1.0 0.1 0.0 21
#fix 2 all langevin/spin 0.0 0.0 0.0 21
#Magnetic integration fix
fix 3 all nve/spin mpi
#compute real time, total magnetization, magnetic energy, and spin temperature
#Iteration | Time | Mx | My | Mz | |M| | Em | Tm
compute mag all compute/spin
fix outmag all ave/time 1 1 10 c_mag[1] c_mag[2] c_mag[3] c_mag[4] c_mag[5] c_mag[6] c_mag[7] file mag_Co_nodamp.dat format %20.16g
#Setting the timestep for the simulation (in ps)
timestep 0.0001
##################
#######run########
##################
#Dump the positions and spin directions of magnetic particles (vmd format)
dump 1 all custom 100 dump_spin_T100.lammpstrj type x y z spx spy spz
#Running the simulations for N timesteps
run 2000
#run 1

View File

@ -0,0 +1,5 @@
2.492 2.803
3.524 0.0816
4.316 0.35
4.983 0.16
5.572 0.0408

View File

@ -0,0 +1,32 @@
# program fitting the exchange interaction
# model curve: Bethe-Slater function
import numpy as np, pylab, tkinter
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from decimal import *
print("Loop begin")
# definition of the Bethe-Slater function
def func(x,a,b,c):
return 4*a*((x/c)**2)*(1-b*(x/c)**2)*np.exp(-(x/c)**2)
# exchange coeff table (data to fit)
rdata, Jdata = np.loadtxt('exchange_fcc_ni.dat', usecols=(0,1), unpack=True)
plt.plot(rdata, Jdata, 'b-', label='data')
# perform the fit
popt, pcov = curve_fit(func, rdata, Jdata, bounds=(0, [500.,5.,5.]))
plt.plot(rdata, func(rdata, *popt), 'r--', label='fit')
# print the fitted parameters
print("Parameters: a={:.10} (in meV), b={:.10} (adim), c={:.10} (in Ang)".format(*popt))
# ploting the result
plt.xlabel('r_ij')
pylab.xlim([0,6.5])
plt.ylabel('J_ij')
plt.legend()
plt.show()
print("Loop end")

View File

@ -10,29 +10,29 @@ boundary p p p
# check why?
atom_modify map array
lattice fcc 3.54
lattice fcc 3.524
region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box
create_atoms 1 box
# setting mass, mag. moments, and interactions for cobalt
mass 1 58.93
mass 1 58.69
set group all spin/random 31 1.72
set group all spin/random 31 0.6
velocity all create 100 4928459 rot yes dist gaussian
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/cobalt/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
pair_coeff * * eam/alloy ../examples/SPIN/nickel/Ni99.eam.alloy Ni
pair_coeff * * pair/spin/exchange exchange 4.0 0.009718152197 0.000153 1.243
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.1 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.1 21
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin lattice yes

View File

@ -1,81 +0,0 @@
# initial variables
# dimensions of the box and of each layer
variable box_size equal 50.0
variable ir_thick equal 4.0
variable fe_thick equal 0.5
variable pd_thick equal 0.5
variable fe_hi equal ${ir_thick}+${fe_thick}
variable pd_hi equal ${ir_thick}+${fe_thick}+${pd_thick}
units metal
atom_style spin
dimension 3
boundary p p f
# check why?
atom_modify map array
lattice fcc 3.839 orient x 1 -1 0 orient y 1 1 -2 orient z 1 1 1
region box block 0.0 ${box_size} 0.0 ${box_size} 0.0 ${pd_hi}
region box_ir block 0.0 ${box_size} 0.0 ${box_size} 0.0 ${ir_thick}
region box_fe block 0.0 ${box_size} 0.0 ${box_size} ${ir_thick} ${fe_hi}
region box_pd block 0.0 ${box_size} 0.0 ${box_size} ${fe_hi} ${pd_hi}
create_box 3 box
create_atoms 1 region box_ir
create_atoms 2 region box_fe
create_atoms 3 region box_pd
group ir_atoms region box_ir
group fe_atoms region box_fe
group pd_atoms region box_pd
# setting mass, mag. moments, and interactions for cobalt
mass 1 192.217 # mass of Ir atoms
mass 2 55.845 # mass of Fe atoms
mass 3 106.42 # mass of Pd atoms
set group ir_atoms spin/random 31 0.01 # has to set a length for LAMMPS to be happy
set group fe_atoms spin/random 89 2.7
set group pd_atoms spin/random 55 0.3
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay pair/spin/exchange 4.0
#pair_style hybrid/overlay pair/spin/exchange 4.0 pair/spin/soc/dmi 2.6
pair_coeff * * pair/spin/exchange exchange 4.0 0.0 0.003496 1.4885
pair_coeff 2 2 pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
#pair_coeff * * pair/spin/soc/dmi dmi 2.6 0.01 0.0 0.0 1.0
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
fix 1 fe_atoms force/spin anisotropy 0.0001 0.0 0.0 1.0
fix 2 all force/spin zeeman 0.1 0.0 0.0 1.0
fix 3 all langevin/spin 0.0 0.1 21
fix 4 all integration/spin lattice no
timestep 0.0002
# define output and run
compute out_mag all compute/spin
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]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag etotal
thermo 10
dump 1 all custom 50 dump_skyrmion.lammpstrj type x y z spx spy spz
run 1000