Hello everyone,
I am simulating a tensile test on a nanowire in which my load direction is along the y-direction. I have got the result from command stress/atom but I want to get the same result from the force. However, anytime that I try to get the same results from force, it shows a weird trend which can be seen in the figure. From the figure, it seems the overall force is zero! I mention also my code here for you to help me with it and tell me where my problem is. Also, I have the periodic condition in all directions even in the y-direction and already I made the atoms in another code and I used read_data to read their coordinates.
# Reading the coordinates of the atoms from the dataset, then defining mass and cutoff distance
units metal
dimension 3
boundary p p p
atom_style atomic
read_data Datafile.dat
replicate 1 1 1
# Determining the upper and lower grains for deformation purposes
print "h = $(lx)"
print "u = $(ly)"
print "z = $(lz)"
variable a equal lx
variable b equal lz
region lower block INF INF -128.89323194605481149 -0.01 INF INF units box
region upper block INF INF 0.01 128.89323194605481149 INF INF units box
region deformation block INF INF -21.53173447 21.53173447 INF INF units box
group upper1 region upper
group lower1 region lower
group deformation1 region deformation
set group upper1 type 1
set group lower1 type 2
set group deformation1 type 3
# Energy minimization and calculating the potential energy
pair_style eam/alloy
pair_coeff * * Cu01.eam.alloy Cu Cu Cu Cu Cu
compute csym all centro/atom fcc
compute peratom all pe/atom
min_style cg
minimize 1e-25 1e-25 5000 10000
# Equilibration
reset_timestep 0
timestep 0.001
velocity all create 300 12345 mom yes rot no
fix 5 all npt temp 300 300 1 iso 0 0 1 drag 1
# Set thermo output
thermo 1000
thermo_style custom step lx ly lz pxx pyy pzz pe temp
# Run for at least 10 picosecond (assuming 1 fs timestep)
run 20000
unfix 5
# Deformation for strain rate of 10^9(1/sec) as the article stated
reset_timestep 0
compute force deformation1 reduce/region deformation sum fy
compute displacement deformation1 displace/atom
compute displacement1 deformation1 reduce ave c_displacement[2]
fix 5 all npt temp 300 300 1 x 0 0 1 z 0 0 1
variable srate equal 1.0e9
variable srate1 equal "v_srate / 1.0e12"
fix 6 upper1 deform 1 y erate ${srate1} units box remap x
# Output strain and stress info to file
variable f equal "c_force"
variable stress equal "v_f / (lx * lz)"
variable strain equal "c_displacement1"
fix force all print 100 "${f}" file Cu_510_100.force.txt screen no
fix stress all print 100 "${stress}" file Cu_510_100.stress.txt screen no
fix strain all print 100 "${strain}" file Cu_510_100.strain.txt screen no
# Use custom for OVITO
dump 7 all custom 2000 s.txt x y z xs ys zs fx fy fz c_csym c_displacement[2]
run 150000
print "All done"
Thanks everyone