-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect_shell_poly.cpp
60 lines (46 loc) · 1.46 KB
/
connect_shell_poly.cpp
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
void connect_shell_poly()
{
int ii, jj, kk;
double temp;
double linkdist2 = 95.0*SHELL_RADIUS;
int linkmono;
double dist_from_center = 95.0*SHELL_RADIUS;
for(ii=0; ii < NUMBER_OF_SHELL_POLY_CONNECTIONS; ii++)
{
dist_from_center = 95.0*SHELL_RADIUS;
while(dist_from_center > (SHELL_RADIUS - 2.0)*(SHELL_RADIUS - 2.0))
{
jj= (int)(unif_rand()*NUMBER_IN_POLYMER);
for(kk = 0; kk < DIMENSION; kk++)
{
dist_from_center = (mono_list[jj].get_prev_pos(kk)-L[kk]*0.5)*(mono_list[jj].get_prev_pos(kk)-L[kk]*0.5);
}
}
linkdist2 = 95.0*SHELL_RADIUS;
if(!mono_list[jj].get_shell_poly_link())
{
for(kk = NUMBER_IN_POLYMER; kk < NUMBER_OF_MONOMERS; kk++)
{
if(!mono_list[kk].get_shell_poly_link())
{
temp = mono_list[jj].calculate_distance_sq(&mono_list[kk], PREVIOUS);
if(temp < linkdist2)
{
linkdist2 = temp;
linkmono = kk;
}
}//if kk !linked
}//for(kk
fprintf(stderr, "shell poly connect %i %i\n", jj, linkmono);
monomer_pair temp_crosslinkpair(&mono_list[jj], &mono_list[linkmono], true, BOND_SPRING, 0., 0., 0.);
temp_crosslinkpair.set_bond_length(MONO_RAD+cl_polymer_mono_rad);
crosslinkpairs.push_back(temp_crosslinkpair);
mono_list[jj].set_shell_poly_link(true);
mono_list[linkmono].set_shell_poly_link(true);
}//if jj !crossli
else
{
ii = ii - 1;
}
}//for(ii
}