Skip to content

Commit 329faed

Browse files
Merge pull request #31 from lammpstutorials/improve-tutorial-2
Homogenize and clean tutorial 2
2 parents dd686b1 + e42cd97 commit 329faed

46 files changed

Lines changed: 2915 additions & 6928 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,4 @@ _region_.*
3131
*.rej
3232

3333
# LAMMPS output files
34-
dump.*.jpg
35-
dump.*.ppm
36-
dump.*.ppm
3734
myimage-*.ppm
163 KB
Loading

figures/CNT-lenght-unbreakable.png

39.5 KB
Loading
105 KB
Loading
94.6 KB
Loading

figures/CNT-unbreakable.png

272 KB
Loading

files/tutorial1/improved.min.lmp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# 1) Initialization
2-
units lj
3-
dimension 3
4-
atom_style atomic
5-
boundary p p p
2+
units lj
3+
dimension 3
4+
atom_style atomic
5+
boundary p p p
66
# 2) System definition
77
# 3) Settings
8-
mass 1 1.0
9-
mass 2 10.0
10-
pair_style lj/cut 4.0
11-
pair_coeff 1 1 1.0 1.0
12-
pair_coeff 2 2 0.5 3.0
8+
mass 1 1.0
9+
mass 2 10.0
10+
pair_style lj/cut 4.0
11+
pair_coeff 1 1 1.0 1.0
12+
pair_coeff 2 2 0.5 3.0
1313
# 4) Visualization
14-
thermo 10
15-
thermo_style custom step etotal press
14+
thermo 10
15+
thermo_style custom step etotal press
1616
# 5) Run
17-
minimize 1.0e-6 1.0e-6 1000 10000
17+
minimize 1.0e-6 1.0e-6 1000 10000
1818
# 6) Save status
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
# 1) Initialization
2-
units lj
3-
dimension 3
4-
atom_style atomic
5-
boundary p p p
2+
units lj
3+
dimension 3
4+
atom_style atomic
5+
boundary p p p
66
# 2) System definition
7-
pair_style lj/cut 4.0
8-
read_data min_coords.data
9-
region cyl_in cylinder z 0 0 10 INF INF side in
10-
region cyl_out cylinder z 0 0 10 INF INF side out
11-
group grp_t1 type 1
12-
group grp_t2 type 2
13-
group grp_in region cyl_in
14-
group grp_out region cyl_out
15-
group grp_t1_in intersect grp_t1 grp_in
16-
group grp_t2_out intersect grp_t2 grp_out
17-
delete_atoms group grp_t1_in
18-
delete_atoms group grp_t2_out
7+
pair_style lj/cut 4.0
8+
read_data min_coords.data
9+
region cyl_in cylinder z 0 0 10 INF INF side in
10+
region cyl_out cylinder z 0 0 10 INF INF side out
11+
group grp_t1 type 1
12+
group grp_t2 type 2
13+
group grp_in region cyl_in
14+
group grp_out region cyl_out
15+
group grp_t1_in intersect grp_t1 grp_in
16+
group grp_t2_out intersect grp_t2 grp_out
17+
delete_atoms group grp_t1_in
18+
delete_atoms group grp_t2_out
1919
# delete unnecessary groups
20-
group grp_in delete
21-
group grp_out delete
22-
group grp_t1_in delete
23-
group grp_t2_out delete
24-
variable n1_in equal count(grp_t1,cyl_in)
25-
variable n2_in equal count(grp_t2,cyl_in)
26-
compute coor12 grp_t1 coord/atom cutoff 2.0 group grp_t2
27-
compute sumcoor12 grp_t1 reduce ave c_coor12
20+
group grp_in delete
21+
group grp_out delete
22+
group grp_t1_in delete
23+
group grp_t2_out delete
24+
variable n1_in equal count(grp_t1,cyl_in)
25+
variable n2_in equal count(grp_t2,cyl_in)
26+
compute coor12 grp_t1 coord/atom cutoff 2.0 group grp_t2
27+
compute sumcoor12 grp_t1 reduce ave c_coor12
2828
# 3) Settings
2929
# 4) Visualization
30-
thermo 1000
31-
thermo_style custom step temp pe ke etotal press v_n1_in v_n2_in c_sumcoor12
30+
thermo 1000
31+
thermo_style custom step temp pe ke etotal press v_n1_in v_n2_in c_sumcoor12
3232

33-
dump mydmp all image 100 dump.md.*.ppm type type shiny 0.1 box no 0.01 view 0 0 zoom 1.8 fsaa yes
34-
dump_modify mydmp adiam 1 1 adiam 2 3 acolor 1 turquoise acolor 2 royalblue backcolor white
33+
dump viz all image 100 myimage.md.*.ppm type type shiny 0.1 box no 0.01 view 0 0 zoom 1.8 fsaa yes
34+
dump_modify viz adiam 1 1 adiam 2 3 acolor 1 turquoise acolor 2 royalblue backcolor white
3535

3636
# 5) Run
37-
velocity all create 1.0 49284 mom yes dist gaussian
38-
fix mynve all nve
39-
fix mylgv all langevin 1.0 1.0 0.1 1530917 zero yes
40-
timestep 0.005
41-
run 300000
37+
velocity all create 1.0 49284 mom yes dist gaussian
38+
fix mynve all nve
39+
fix mylgv all langevin 1.0 1.0 0.1 1530917 zero yes
40+
timestep 0.005
41+
run 300000
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# 1) Initialization
2-
units lj
3-
dimension 3
4-
atom_style atomic
5-
boundary p p p
2+
units lj
3+
dimension 3
4+
atom_style atomic
5+
boundary p p p
66
# 2) System definition
7-
region simbox block -20 20 -20 20 -20 20
8-
create_box 2 simbox
7+
region simbox block -20 20 -20 20 -20 20
8+
create_box 2 simbox
99
# for creating atoms
10-
region cyl_in cylinder z 0 0 10 INF INF side in
11-
region cyl_out cylinder z 0 0 10 INF INF side out
12-
create_atoms 1 random 1000 34134 cyl_out
13-
create_atoms 2 random 150 12756 cyl_in
10+
region cyl_in cylinder z 0 0 10 INF INF side in
11+
region cyl_out cylinder z 0 0 10 INF INF side out
12+
create_atoms 1 random 1000 34134 cyl_out
13+
create_atoms 2 random 150 12756 cyl_in
1414
# 3) Settings
15-
mass 1 1.0
16-
mass 2 10.0
17-
pair_style lj/cut 4.0
18-
pair_coeff 1 1 1.0 1.0
19-
pair_coeff 2 2 0.5 3.0
15+
mass 1 1.0
16+
mass 2 10.0
17+
pair_style lj/cut 4.0
18+
pair_coeff 1 1 1.0 1.0
19+
pair_coeff 2 2 0.5 3.0
2020
# 4) Visualization
21-
thermo 10
22-
thermo_style custom step etotal press
21+
thermo 10
22+
thermo_style custom step etotal press
2323
# 5) Run
24-
minimize 1.0e-6 1.0e-6 1000 10000
24+
minimize 1.0e-6 1.0e-6 1000 10000
2525
# 6) Save status
26-
write_data min_coords.data
26+
write_data min_coords.data
2727

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
# PART A - ENERGY MINIMIZATION
22
# 1) Initialization
3-
units lj
4-
dimension 3
5-
atom_style atomic
6-
boundary p p p
3+
units lj
4+
dimension 3
5+
atom_style atomic
6+
boundary p p p
77
# 2) System definition
8-
region simbox block 20 20 20 20 20 20
9-
create_box 2 simbox
10-
create_atoms 1 random 1500 34134 simbox overlap 0.3
11-
create_atoms 2 random 100 12756 simbox overlap 0.3
8+
region simbox block -20 20 -20 20 -20 20
9+
create_box 2 simbox
10+
create_atoms 1 random 1500 34134 simbox overlap 0.3
11+
create_atoms 2 random 100 12756 simbox overlap 0.3
1212
# 3) Settings
13-
mass 1 1.0
14-
mass 2 5.0
15-
pair_style lj/cut 4.0
16-
pair_coeff 1 1 1.0 1.0
17-
pair_coeff 2 2 0.5 3.0
13+
mass 1 1.0
14+
mass 2 5.0
15+
pair_style lj/cut 4.0
16+
pair_coeff 1 1 1.0 1.0
17+
pair_coeff 2 2 0.5 3.0
1818
# 4) Visualization
19-
thermo 10
20-
thermo_style custom step etotal press
19+
thermo 10
20+
thermo_style custom step etotal press
2121
# 5) Run
22-
minimize 1.0e6 1.0e6 1000 10000
22+
minimize 1.0e-6 1.0e-6 1000 10000
2323

2424
# PART B - MOLECULAR DYNAMICS
2525
# 4) Visualization
26-
thermo 50
27-
thermo_style custom step temp etotal pe ke press
28-
dump viz all image 100 myimage*.ppm type type size 800 800 zoom 1.452 shiny 0.7 fsaa yes &
29-
view 80 10 box yes 0.025 axes no 0.0 0.0 center s 0.483725 0.510373 0.510373
30-
dump_modify viz pad 9 boxcolor darkblue backcolor white adiam 1 1.6 adiam 2 4.8
26+
thermo 50
27+
thermo_style custom step temp etotal pe ke press
28+
dump viz all image 100 myimage-*.ppm type type size 800 800 zoom 1.452 shiny 0.7 fsaa yes &
29+
view 80 10 box yes 0.025 axes no 0.0 0.0 center s 0.483725 0.510373 0.510373
30+
dump_modify viz pad 9 boxcolor darkblue backcolor white adiam 1 1.6 adiam 2 4.8
3131
# 5) Run
32-
fix mynve all nve
33-
fix mylgv all langevin 1.0 1.0 0.1 1530917
34-
timestep 0.005
35-
run 10000
32+
fix mynve all nve
33+
fix mylgv all langevin 1.0 1.0 0.1 1530917
34+
timestep 0.005
35+
run 10000

0 commit comments

Comments
 (0)