-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
134 lines (107 loc) · 4.55 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import numpy as np
import crystalninja as cn
origin = np.array([0.0,0.0,0.0])
## lattice fcc ${latticeConstant} orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
# Ncellx = 3
# Ncelly = 3
# Ncellz = 3
# lattice_constant = 1.0
# orientx = np.array([1.0, 0.0, 0.0])
# orienty = np.array([0.0, 1.0, 0.0])
# orientz = np.array([0.0, 0.0, 1.0])
# pythagorasFactorx = np.linalg.norm(orientx)
# pythagorasFactory = np.linalg.norm(orienty)
# pythagorasFactorz = np.linalg.norm(orientz)
# xdir_celllength = lattice_constant*pythagorasFactorx
# ydir_celllength = lattice_constant*pythagorasFactory
# zdir_celllength = lattice_constant*pythagorasFactorz
# xdir_supercelllength = xdir_celllength*Ncellx
# ydir_supercelllength = ydir_celllength*Ncelly
# zdir_supercelllength = zdir_celllength*Ncellz
## lattice fcc ${latticeConstant} orient x 1 0 0 orient y 0 1 1 orient z 0 -1 1
# Ncellx = 3
# Ncelly = 3
# Ncellz = 3
# lattice_constant = 1.0
# orientx = np.array([ 1.0, 0.0, 0.0])
# orienty = np.array([ 0.0, 1.0, 1.0])
# orientz = np.array([ 0.0, -1.0, 1.0])
# pythagorasFactorx = np.linalg.norm(orientx)
# pythagorasFactory = np.linalg.norm(orienty)
# pythagorasFactorz = np.linalg.norm(orientz)
# xdir_celllength = lattice_constant*pythagorasFactorx
# ydir_celllength = lattice_constant*pythagorasFactory
# zdir_celllength = lattice_constant*pythagorasFactorz
# xdir_supercelllength = xdir_celllength*Ncellx
# ydir_supercelllength = ydir_celllength*Ncelly
# zdir_supercelllength = zdir_celllength*Ncellz
## lattice fcc ${latticeConstant} orient x -1 -1 2 orient y 1 -1 0 orient z 1 1 1
# Ncellx = 3
# Ncelly = 3
# Ncellz = 3
# lattice_constant = 1.0
# orientx = np.array([ -1.0, -1.0, 2.0])
# orienty = np.array([ 1.0, -1.0, 0.0])
# orientz = np.array([ 1.0, 1.0, 1.0])
# pythagorasFactorx = np.linalg.norm(orientx)
# pythagorasFactory = np.linalg.norm(orienty)
# pythagorasFactorz = np.linalg.norm(orientz)
# xdir_celllength = lattice_constant*pythagorasFactorx
# ydir_celllength = lattice_constant*pythagorasFactory
# zdir_celllength = lattice_constant*pythagorasFactorz
# xdir_supercelllength = xdir_celllength*Ncellx
# ydir_supercelllength = ydir_celllength*Ncelly
# zdir_supercelllength = zdir_celllength*Ncellz
## Problem 5.2.1 in Bulatov and Cai
## lattice bcc, orientation [1,1,-2] [1,1,0] [1,1,1]
#Ncellx = 8
#Ncelly = 19
#Ncellz = 3
#lattice_constant = 2.856
#orientx = np.array([ 1.0, 1.0, -2.0])
#orienty = np.array([ -1.0, 1.0, 0.0])
#orientz = np.array([ 1.0, 1.0, 1.0])
#pythagorasFactorx = np.linalg.norm(orientx)
#pythagorasFactory = np.linalg.norm(orienty)
#pythagorasFactorz = np.linalg.norm(orientz)
#xdir_celllength = lattice_constant*pythagorasFactorx
#ydir_celllength = lattice_constant*pythagorasFactory
#zdir_celllength = lattice_constant*pythagorasFactorz
#xdir_supercelllength = xdir_celllength*Ncellx
#ydir_supercelllength = ydir_celllength*Ncelly
#zdir_supercelllength = zdir_celllength*Ncellz
## Problem 5.2.1 in Bulatov and Cai - adapted for LAMMPS triclinic cell system.
## lattice bcc, orientation [1,1,1] [1,-1,0] [1,1,-2]
Ncellx = 3
Ncelly = 19
Ncellz = 8
lattice_constant = 2.856
orientx = np.array([ 1.0, 1.0, 1.0])
orienty = np.array([ 1.0, -1.0, 0.0])
orientz = np.array([ 1.0, 1.0, -2.0])
pythagorasFactorx = np.linalg.norm(orientx)
pythagorasFactory = np.linalg.norm(orienty)
pythagorasFactorz = np.linalg.norm(orientz)
xdir_celllength = lattice_constant*pythagorasFactorx
ydir_celllength = lattice_constant*pythagorasFactory
zdir_celllength = lattice_constant*pythagorasFactorz
xdir_supercelllength = xdir_celllength*Ncellx
ydir_supercelllength = ydir_celllength*Ncelly
zdir_supercelllength = zdir_celllength*Ncellz
## Use Crystal Ninja.
box1 = cn.box(origin,xdir_supercelllength,ydir_supercelllength,zdir_supercelllength)
#box1.create_crystal("fcc", lattice_constant, orientx, orienty, orientz)
box1.create_crystal("bcc", lattice_constant, orientx, orienty, orientz)
box1.print_lammps_dump_format("lammpsOut.dat")
## Introduce a screw dislocation dipole.
screw1_pos = np.array([19.185,27.98])
screw2_pos = np.array([57.555,27.98])
burgersVector = 0.5 * np.array([1,1,1]) * lattice_constant
print("The Burgers Vector is: ", burgersVector)
burgersVectorMagnitude = np.linalg.norm(burgersVector)
print("The magnitude of the Burgers Vector is: ", burgersVectorMagnitude)
#box1.introduce_screw_dipole_in_xyplane(burgersVectorMagnitude,screw1_pos,screw2_pos)
box1.introduce_screw_dipole_general("y", burgersVectorMagnitude, screw1_pos, screw2_pos)
box1.setTiltFactors(0.0,-1.0,0.0)
box1.print_lammps_dump_format("lammpsOut_screwdipole.dat")
box1.print_lammps_data_format("screwdipole.data")