Revisão | a134fe015697b1a82ae1fc360e75f0bd8cdae57d (tree) |
---|---|
Hora | 2008-04-03 02:00:08 |
Autor | iselllo |
Commiter | iselllo |
I modified fold_positions.py which now, besides folding the clusters,
shifts them in the middle of the new box.
@@ -7,7 +7,7 @@ | ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | -size_cluster=50 | |
10 | +size_cluster=5 | |
11 | 11 | density=0.03 |
12 | 12 | |
13 | 13 | box_size=(size_cluster/density)**(1./3.) #here the box size does not depend on the total particle number |
@@ -21,4 +21,64 @@ | ||
21 | 21 | |
22 | 22 | p.save("initial_state_folded", pos_arr) |
23 | 23 | |
24 | +#Now I want to relocate each cluster in such a way that all the clusters (NOT just the centre of mass | |
25 | +# of the system) is relocated at the centre of the new computational box I will use | |
26 | + | |
27 | +new_box_size=200. | |
28 | + | |
29 | +centre=new_box_size/2. #this is , along x,y, and z, the centre of the new computational box I am using | |
30 | + | |
31 | +dim=s.shape(pos_arr) | |
32 | + | |
33 | +n_clus=dim[0]/size_cluster | |
34 | + | |
35 | +print "the number of clusters is, ", n_clus | |
36 | + | |
37 | +ini_pos_clusters=s.zeros((n_clus,3)) #this will contain the positions (in 3D!!!) of the centre of masses of all the clusters | |
38 | +print "pos_arr folded is, ",pos_arr | |
39 | + | |
40 | +print "the shape of pos_arr is, ", s.shape(pos_arr) | |
41 | + | |
42 | +for i in xrange(n_clus): | |
43 | + print "i is, ", i | |
44 | + ini_pos_clusters[i,0]=pos_arr[(i*size_cluster):((i+1)*size_cluster),0].mean() | |
45 | + ini_pos_clusters[i,1]=pos_arr[(i*size_cluster):((i+1)*size_cluster),1].mean() | |
46 | + ini_pos_clusters[i,2]=pos_arr[(i*size_cluster):((i+1)*size_cluster),2].mean() | |
47 | + | |
48 | + | |
49 | +print "the initial positions of the clusters are, ", ini_pos_clusters | |
50 | + | |
51 | +#Now I compute the shifts for every cluster | |
52 | + | |
53 | +shift_vec=centre-ini_pos_clusters | |
54 | + | |
55 | +print "the shift_vec is, ", shift_vec | |
56 | + | |
57 | +#Now I actually perform the shift | |
58 | + | |
59 | +for i in xrange(n_clus): | |
60 | + print "i is, ", i | |
61 | + pos_arr[(i*size_cluster):((i+1)*size_cluster),0]=pos_arr[(i*size_cluster):((i+1)*size_cluster),0]\ | |
62 | + +shift_vec[i,0] | |
63 | + pos_arr[(i*size_cluster):((i+1)*size_cluster),1]=pos_arr[(i*size_cluster):((i+1)*size_cluster),1]\ | |
64 | + +shift_vec[i,1] | |
65 | + | |
66 | + pos_arr[(i*size_cluster):((i+1)*size_cluster),2]=pos_arr[(i*size_cluster):((i+1)*size_cluster),2]\ | |
67 | + +shift_vec[i,2] | |
68 | + | |
69 | +#Now a test to make sure everything is OK | |
70 | + | |
71 | +p.save("initial_state_folded_and_shifted", pos_arr) | |
72 | + | |
73 | + | |
74 | +for i in xrange(n_clus): | |
75 | + print "i is, ", i | |
76 | + ini_pos_clusters[i,0]=pos_arr[(i*size_cluster):((i+1)*size_cluster),0].mean() | |
77 | + ini_pos_clusters[i,1]=pos_arr[(i*size_cluster):((i+1)*size_cluster),1].mean() | |
78 | + ini_pos_clusters[i,2]=pos_arr[(i*size_cluster):((i+1)*size_cluster),2].mean() | |
79 | + | |
80 | + | |
81 | +print "the shifted positions of the clusters are, ", ini_pos_clusters | |
82 | + | |
83 | + | |
24 | 84 | print "So far so good" |