Revisão | 7daa2efe2a234e86ad0fef57281ddceed76ef937 (tree) |
---|---|
Hora | 2008-06-18 00:04:52 |
Autor | iselllo |
Commiter | iselllo |
I modified test_interaction.tcl by
1)introducing the possibility of initializing the random number generator: I do not need to read the particle positions from an input file any
longer
2)I moved all the input parameters towards the beginning of the file.
3)while ramping up the potential, the code was also calculating the minimum distance separation; this is very time-consuming and useless, so I
removed it.
@@ -1,4 +1,4 @@ | ||
1 | -set n_part 5000; #set density 0.00002 | |
1 | +set n_part 50; #set density 0.00002 | |
2 | 2 | #set box_l [expr pow($n_part/$density,1./3.)] |
3 | 3 | |
4 | 4 | #set box_l 36. |
@@ -14,15 +14,68 @@ | ||
14 | 14 | |
15 | 15 | puts "the density is, $density" |
16 | 16 | |
17 | -set box_l [expr pow($n_part/$density,1./3.)] | |
18 | -set volume [expr pow($box_l,3.)] | |
17 | + | |
18 | +set tot_time 300. | |
19 | + | |
20 | + | |
21 | +set my_step 0.00125 | |
22 | + | |
23 | + | |
24 | + | |
25 | +# number of configurations I want to save | |
26 | + | |
27 | +set N_save 150 | |
28 | + | |
29 | + | |
30 | +#initialization random seed | |
31 | + | |
32 | +set random_ini 200 | |
33 | + | |
34 | + | |
35 | +#End of the primary parameters of the simulation | |
36 | + | |
37 | +########################################################################################## | |
38 | +########################################################################################## | |
39 | +########################################################################################## | |
40 | +########################################################################################## | |
41 | +########################################################################################## | |
19 | 42 | |
20 | 43 | |
21 | 44 | |
22 | 45 | |
23 | -set magnification 1. | |
24 | 46 | |
25 | -setmd box_l [expr $magnification*$box_l] [expr $magnification*$box_l] [expr $magnification*$box_l] | |
47 | +set box_l [expr pow($n_part/$density,1./3.)] | |
48 | +set volume [expr pow($box_l,3.)] | |
49 | + | |
50 | +set N_step [expr $tot_time/$my_step] | |
51 | + | |
52 | +set N_step [expr round($N_step)] | |
53 | + | |
54 | + | |
55 | +set integ_steps 1 | |
56 | + | |
57 | +#I save a configuration every time steps | |
58 | + | |
59 | +set every [expr $N_step/$N_save] | |
60 | + | |
61 | +puts "every is, $every" | |
62 | + | |
63 | + | |
64 | + | |
65 | +puts "the total number of time steps is, $N_step" | |
66 | + | |
67 | + | |
68 | + | |
69 | + | |
70 | + | |
71 | +# set magnification 1. | |
72 | + | |
73 | +# setmd box_l [expr $magnification*$box_l] [expr $magnification*$box_l] [expr $magnification*$box_l] | |
74 | + | |
75 | + | |
76 | +setmd box_l $box_l $box_l $box_l | |
77 | + | |
78 | + | |
26 | 79 | setmd periodic 1 1 1 |
27 | 80 | |
28 | 81 | puts "the box side is, $box_l" |
@@ -36,10 +89,10 @@ | ||
36 | 89 | |
37 | 90 | |
38 | 91 | |
39 | -set filename "ini_pos_table.dat" | |
40 | -set fp [open $filename "r"] | |
41 | -set data [split [read $fp [file size $filename]] "\n"] | |
42 | -close $fp | |
92 | +# set filename "ini_pos_table.dat" | |
93 | +# set fp [open $filename "r"] | |
94 | +# set data [split [read $fp [file size $filename]] "\n"] | |
95 | +# close $fp | |
43 | 96 | |
44 | 97 | |
45 | 98 |
@@ -53,10 +106,31 @@ | ||
53 | 106 | # part $i pos $posx $posy $posz q $q type $type |
54 | 107 | # } |
55 | 108 | |
56 | -set pos_part {} | |
109 | + | |
110 | + | |
111 | +#The bits above are no longer necessary: I can now initialize the random number generator with a different seed to make sure | |
112 | +#I can run independent simulations | |
113 | + | |
114 | + | |
115 | + | |
116 | + | |
117 | + | |
118 | +#Initialization of the random number generator | |
119 | + | |
120 | +#initialization random numbers | |
121 | + | |
122 | +expr srand($random_ini) | |
123 | +set l ""; for {set i 0} {$i < [setmd n_nodes]} {incr i} { | |
124 | + lappend l [expr int(32768*rand())] | |
125 | +} | |
126 | +eval t_random seed $l | |
127 | + | |
128 | + | |
129 | + | |
130 | +#set pos_part {} #I no longer need this variable since I am no longer reading the particle positions from an input file | |
57 | 131 | |
58 | 132 | for {set i 0} { $i < $n_part } {incr i} { |
59 | -set p [lindex $data $i] | |
133 | +#set p [lindex $data $i] | |
60 | 134 | #puts "p is, $p" |
61 | 135 | #set p2 [expr $box_l*$p] |
62 | 136 | #puts "p2 is, $p2" |
@@ -64,13 +138,19 @@ | ||
64 | 138 | #puts "pos_part[1] is, $pos_part(1)" |
65 | 139 | |
66 | 140 | |
67 | -set posx [lindex $p 0 ] | |
68 | -set posy [lindex $p 1 ] | |
69 | -set posz [lindex $p 2 ] | |
141 | +# set posx [lindex $p 0 ] | |
142 | +# set posy [lindex $p 1 ] | |
143 | +# set posz [lindex $p 2 ] | |
70 | 144 | |
71 | -set posx [expr $posx*$box_l] | |
72 | -set posy [expr $posy*$box_l] | |
73 | -set posz [expr $posz*$box_l] | |
145 | +# set posx [expr $posx*$box_l] | |
146 | +# set posy [expr $posy*$box_l] | |
147 | +# set posz [expr $posz*$box_l] | |
148 | + | |
149 | +set posx [expr $box_l*[t_random]] | |
150 | +set posy [expr $box_l*[t_random]] | |
151 | +set posz [expr $box_l*[t_random]] | |
152 | + | |
153 | + | |
74 | 154 | |
75 | 155 | puts "posz is, $posz" |
76 | 156 |
@@ -89,31 +169,8 @@ | ||
89 | 169 | |
90 | 170 | |
91 | 171 | |
92 | -set tot_time 3000. | |
93 | - | |
94 | - | |
95 | -set my_step 0.00125 | |
96 | - | |
97 | - | |
98 | -set N_step [expr $tot_time/$my_step] | |
99 | - | |
100 | -set N_step [expr round($N_step)] | |
101 | 172 | |
102 | 173 | |
103 | -set integ_steps 1 | |
104 | - | |
105 | -# number of configurations I want to save | |
106 | - | |
107 | -set N_save 1500 | |
108 | -#I save a configuration every time steps | |
109 | - | |
110 | -set every [expr $N_step/$N_save] | |
111 | - | |
112 | -puts "every is, $every" | |
113 | - | |
114 | - | |
115 | - | |
116 | -puts "the total number of time steps is, $N_step" | |
117 | 174 | |
118 | 175 | |
119 | 176 | setmd time_step $my_step; setmd skin 0.4 |
@@ -176,11 +233,11 @@ | ||
176 | 233 | |
177 | 234 | set cap [expr $cap + $lin_coeff*$delta_t ] |
178 | 235 | |
179 | -set min [analyze mindist] | |
236 | +#set min [analyze mindist] | |
180 | 237 | |
181 | 238 | } |
182 | 239 | |
183 | -puts "Warmup finished. Minimal distance now $min" | |
240 | +#puts "Warmup finished. Minimal distance now $min" | |
184 | 241 | |
185 | 242 | |
186 | 243 | analyze set chains 0 1 $n_part |