# Cu2O crystal, qeq on, minimizes, then calculates elastic constants

units		metal
atom_style	charge
dimension       3
boundary        p p p

read_data	data.Cu2O
mass		1 63.54
group    	type1 type 1
compute   	charge1 type1 property/atom q
compute   	q1 type1 reduce ave c_charge1
mass		2 16.00
group    	type2 type 2
compute   	charge2 type2 property/atom q
compute   	q2 type2 reduce ave c_charge2

velocity	all create 1.0 277387

pair_style	comb
pair_coeff	* * ffield.comb Cu O

neighbor	0.5 bin
neigh_modify	every 20 delay 0 check no

timestep        0.00020

thermo_style	custom step temp etotal pe evdwl ecoul c_q1 c_q2 lx ly lz vol 
thermo_modify	norm yes
thermo		1
fix   		1 all nve
fix   	 	2 all qeq/comb 1 0.0001

#dump		1 all cfg 1 *.cfg id type xs ys zs q f_2 vx vy vz fx fy fz
#dump_modify	1 element Cu O

run		2

unfix   	1
fix		1 all box/relax aniso 0.0 vmax 0.001
minimize	1.0e-14  1.0e-20  1000  10000
min_modify	dmax 0.2 line quadratic

unfix		1
fix   		1 all nve
run		1

unfix  		1
unfix  		2
#undump	  	1

### copy lines after this to any input script for elastic calculations ###
## 		Elastic constants calculations: strain box, measure box stress
##		strain x, measure s_x, s_y, s_z, s_yz:
##                calculates C11, C12, C13 and C14

fix  		2 all deform 1 x scale 1.0001 remap x 
compute   	perfx all stress/atom NULL pair
compute   	fx all reduce sum &
		c_perfx[1] c_perfx[2] c_perfx[3] &
		c_perfx[4] c_perfx[5] c_perfx[6]
thermo_style	custom  step lx ly lz xy xz yz &
		c_fx[1] c_fx[2] c_fx[3] c_fx[4] c_fx[5] c_fx[6]
run		10

##		strain z, measure s_z: calculates C33

fix  		2 all deform 1 z scale 1.0001 remap x 
compute   	perfz all stress/atom NULL pair
compute   	fz all reduce sum &
		c_perfz[1] c_perfz[2] c_perfz[3] &
		c_perfz[4] c_perfz[5] c_perfz[6]
thermo_style	custom  step lx ly lz xy xz yz &
		c_fz[1] c_fz[2] c_fz[3] c_fz[4] c_fz[5] c_fz[6]
run		10

##		strain yz, measure s_yz: calculates C44

fix  		2 all deform 1 yz erate 0.0001 remap x 
compute   	perfyz all stress/atom NULL pair
compute   	fyz all reduce sum &
		c_perfyz[1] c_perfyz[2] c_perfyz[3] &
		c_perfyz[4] c_perfyz[5] c_perfyz[6]
thermo_style	custom  step lx ly lz xy xz yz &
		c_fyz[1] c_fyz[2] c_fyz[3] c_fyz[4] c_fyz[5] c_fyz[6]
run		10

##		strain xy, measure s_xy: calculates C66

fix  		2 all deform 1 xy erate 0.0001 remap x 
compute   	perfxy all stress/atom NULL pair
compute   	fxy all reduce sum &
		c_perfxy[1] c_perfxy[2] c_perfxy[3] &
		c_perfxy[4] c_perfxy[5] c_perfxy[6]
thermo_style	custom  step lx ly lz xy xz yz &
		c_fxy[1] c_fxy[2] c_fxy[3] c_fxy[4] c_fxy[5] c_fxy[6]
run		10
