• R/O
  • SSH

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂8a76795b249604fea20655be7267d81550c8d7cc (tree)
時間2008-09-06 00:07:55
作者iselllo
Commiteriselllo

Log Message

I added a code for studying aggregate diffusion using the DPD
thermostat.

Change Summary

差異

diff -r f42379b7664f -r 8a76795b2496 TCL-codes/restart_aggregates_dpd.tcl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TCL-codes/restart_aggregates_dpd.tcl Fri Sep 05 15:07:55 2008 +0000
@@ -0,0 +1,365 @@
1+#I now read a single configuration already containing many clusters
2+
3+# number of monomers in each cluster
4+
5+set n_part 50
6+
7+#number of clusters
8+
9+set type_of_part 200
10+
11+#total number of monomers
12+
13+set tot_part [expr $n_part*$type_of_part]
14+
15+puts "tot_part is, $tot_part"
16+
17+#Now the situation is different: the box size is chosen and density is not relevant.
18+
19+
20+set box_l 10000.
21+
22+# set density 0.03
23+
24+# puts "the density is, $density"
25+
26+# set volume [expr pow($box_l,3.)]
27+
28+
29+
30+
31+set magnification 1.
32+
33+setmd box_l [expr $magnification*$box_l] [expr $magnification*$box_l] [expr $magnification*$box_l]
34+setmd periodic 1 1 1
35+
36+puts "the box side is, $box_l"
37+
38+
39+set q 0
40+
41+
42+
43+
44+
45+# set j 14
46+
47+
48+# Now I am going to read a simple text file, NOT a block file
49+#set filename "clusters_ini_$j"
50+set filename "copy_of_cluster50_200"
51+#set filename "initial_state_folded"
52+
53+set fp [open $filename "r"]
54+set data [split [read $fp [file size $filename]] "\n"]
55+close $fp
56+
57+
58+
59+
60+
61+ for {set i 0} { $i < $tot_part } {incr i} {
62+set p [lindex $data $i]
63+#puts "p is, $p"
64+#set p2 [expr $box_l*$p]
65+#puts "p2 is, $p2"
66+#set pos_part $p
67+#puts "pos_part[1] is, $pos_part(1)"
68+
69+set type [expr $i/$n_part]
70+
71+puts "type is, $type"
72+
73+
74+set posx [lindex $p 0 ]
75+set posy [lindex $p 1 ]
76+set posz [lindex $p 2 ]
77+
78+
79+# set posx [expr $posx*$box_l]
80+# set posy [expr $posy*$box_l]
81+# set posz [expr $posz*$box_l]
82+
83+#puts "posz is, $posz"
84+
85+part $i pos $posx $posy $posz q $q type $type
86+
87+
88+ }
89+
90+
91+
92+
93+#parameters of the simulation
94+
95+
96+set tot_time 400.
97+
98+
99+set my_step 0.00125
100+
101+
102+set N_step [expr $tot_time/$my_step]
103+
104+set N_step [expr round($N_step)]
105+
106+
107+set integ_steps 1
108+
109+# number of configurations I want to save
110+
111+set N_save 4000
112+#I save a configuration every time steps
113+
114+set every [expr $N_step/$N_save]
115+
116+puts "every is, $every"
117+
118+
119+
120+puts "the total number of time steps is, $N_step"
121+
122+
123+setmd time_step $my_step; setmd skin 0.4
124+set temp 0.5 ; set gamma 1.
125+
126+
127+set cutoff 1.06
128+
129+set WF 1
130+
131+
132+set TGAMMA 0.
133+
134+set TCUTOFF 0.
135+
136+set TWF 1
137+
138+
139+# thermostat langevin $temp $gamma
140+# Now I am going to introduce a different thermostat. See email with Christoph Junghans
141+
142+thermostat inter_dpd $temp
143+
144+
145+
146+#setting up the interaction
147+
148+
149+
150+set test_pos [part 0 print pos]
151+
152+puts "the position of the zero-th particle is, $test_pos"
153+
154+# Now I can set up the interaction
155+
156+
157+for {set i 0} { $i <= $type_of_part } { incr i} {
158+
159+inter $i $i tabulated tabulated_interaction.dat
160+
161+# Now I also add another interaction potential, which come directly from the DPD thermostat
162+# inter X Y inter_dpd GAMMA CUTOFF WF TGAMMA TCUTOFF TWF
163+
164+inter $i $i inter_dpd $gamma $cutoff $WF $TGAMMA $TCUTOFF $TWF
165+
166+
167+
168+}
169+
170+
171+# I am not sure if the following part is really needed; a non-defined interaction between particles of kind i and j should
172+# be equivalent to setting it to zero.
173+
174+
175+# #Now I explicitely set the dpd interaction as zero for monomers of two different kinds
176+
177+
178+# for {set i 0} { $i <= $type_of_part } { incr i} {
179+
180+# for {set j 0} { $j <= $type_of_part } { incr j} {
181+
182+# if {$i != $j} {
183+
184+# # inter $i $i inter_dpd gamma cutoff WF TGAMMA TCUTOFF TWF
185+
186+# inter $i $j inter_dpd 0. 0. 1 0. 0. 1
187+
188+
189+# }
190+
191+# }
192+
193+# }
194+
195+
196+
197+# }
198+
199+
200+
201+
202+
203+
204+
205+
206+
207+set vmd "no"
208+
209+
210+puts "OK here after inter_dpd"
211+
212+
213+if { $vmd == "yes" } {
214+# This calls a small tcl script which starts the program #
215+# VMD and opens a socket connection between ESPResSo and #
216+# VMD. #
217+ prepare_vmd_connection tutorial 3000
218+
219+# Just wait a moment until VMD has started. #
220+# The 'exec' command is quite useful since with that you can#
221+# call any other program from within your simulation script.#
222+ exec sleep 4
223+
224+
225+#puts $obs4 "[setmd time] [part 0 print pos]"
226+
227+}
228+
229+
230+
231+#prepare the saving of the results
232+
233+set count 0
234+set label 0
235+
236+
237+#set obs [open "temp.dat" "w"]
238+#set obs2 [open "tot_energy.dat" "w"]
239+#set obs3 [open "aggregation.dat" "w"]
240+#set obs3 [open "rgyr.dat" "w"]
241+
242+#set obs4 [open "part_pos.dat" "w"]
243+set obs5 [open "time.dat" "w"]
244+
245+
246+#initialization random numbers
247+
248+expr srand(200)
249+set l ""; for {set i 0} {$i < [setmd n_nodes]} {incr i} {
250+ lappend l [expr int(32768*rand())]
251+}
252+eval t_random seed $l
253+
254+
255+
256+
257+#puts "the simulation time now is, [setmd time]"
258+
259+# for {set i 0} { $i < 3000 } { incr i} {
260+for {set i 0} { $i < $N_step } { incr i $integ_steps} {
261+
262+
263+set my_rem [expr $count%$every]
264+
265+#puts "my_rem is, $my_rem"
266+
267+
268+if {$my_rem== 0 } {
269+#set f [open "config_vel_$i" "w"]
270+set f [open "config_vel_$label" "w"]
271+incr label
272+
273+#blockfile $f write particles "id folded_position v"
274+
275+#I use the variant above if I want to save the folded
276+#positions, but I can do that myself and it is not interesting
277+
278+blockfile $f write particles "id pos v"
279+
280+close $f
281+
282+
283+#set temp [expr [analyze energy kinetic]/(1.5*$n_part)]
284+puts "t=[setmd time] "
285+
286+
287+#set energy [lindex [analyze energy total] 0]
288+#puts $obs "[setmd time] $temp"
289+
290+#puts $obs2 "[setmd time] $energy"
291+
292+
293+
294+
295+#Now I calculate the radius of gyration
296+# set rg [lindex [analyze rg 0 1 $n_part] 0]
297+#puts "the radius of gyration is, $rg"
298+#puts $obs3 "[setmd time] $rg"
299+
300+puts $obs5 "[setmd time]"
301+
302+
303+# if you have turned on the vmd option you can now
304+ # follow what your simulation is doing
305+
306+# The additional command imd steers the socket connection #
307+# to VMD, e.g. sending the actual coordinates #
308+# imd positions
309+#pbc wrap -sel "index 13"
310+
311+
312+ if { $vmd == "yes" } { imd positions }
313+
314+
315+
316+
317+
318+
319+
320+
321+
322+
323+}
324+
325+incr count
326+
327+integrate $integ_steps
328+
329+
330+
331+#puts $obs4 "[setmd time] [part 0 print pos]"
332+
333+}
334+
335+#close $obs
336+#close $obs
337+#close $obs2
338+#close $obs3
339+close $obs5
340+puts "end of integration"
341+
342+puts "the simulation time now is, [setmd time]"
343+
344+#plotObs "rg.dat" { 1:2 } labels { "time" "rg" } out "rg"
345+#exec gv rg.ps
346+
347+#set f [open "config_1" "r"]
348+#while { [blockfile $f read auto] != "eof" } {}
349+#close $f
350+
351+#puts "ok reading the block file"
352+
353+#set rdf [analyze rdf 0 0 0.9 [expr $box_l/2] 100]
354+#set rlist ""
355+#set rdflist ""
356+#foreach value [lindex $rdf 1] {
357+#lappend rlist [lindex $value 0]
358+#lappend rdflist [lindex $value 1]
359+#}
360+
361+
362+
363+
364+
365+puts "So far so good"
\ No newline at end of file