@@ -51,10 +51,15 @@ void ExternalKenotaxisAlign::compute()
51
51
Particle& pi = m_system->get_particle (i);
52
52
if (pi .boundary )
53
53
{
54
+ // Compute the direction perpendicular to the boundary.
55
+ // We cheat by using the centre of mass position to deterimine the outside and inside of the tissue.
56
+
57
+ // vector (X, Y, Z) points from centre of mass to particle i
54
58
double force_sign = 1.0 ;
55
59
double X = pi .x - xcm, Y = pi .y - ycm, Z = pi .z - zcm;
56
60
double len_R = sqrt (X*X + Y*Y + Z*Z);
57
- X /= len_R; Y /= len_R; Y /= len_R;
61
+ X /= len_R; Y /= len_R; Z /= len_R;
62
+ // get relative vectors of neighbouring boundary particles
58
63
Particle& pj = m_system->get_particle (pi .boundary_neigh [0 ]);
59
64
Particle& pk = m_system->get_particle (pi .boundary_neigh [1 ]);
60
65
double xji = pj.x - pi .x , yji = pj.y - pi .y , zji = pj.z - pi .z ;
@@ -63,10 +68,11 @@ void ExternalKenotaxisAlign::compute()
63
68
double xki = pk.x - pi .x , yki = pk.y - pi .y , zki = pk.z - pi .z ;
64
69
double len_ki = sqrt (xki*xki + yki*yki + zki*zki);
65
70
xki /= len_ki; yki /= len_ki; zki /= len_ki;
66
- double x = -(xji+xki), y = -(yji+yki), z = -(zji+zki);
71
+ // compute vector perpendicular to r_kj
72
+ double x = -(yji-yki), y = (xji-xki), z = 0.0 ; // give up with three dimensions, z=0
67
73
double len_r = sqrt (x*x + y*y + z*z);
68
74
x /= len_r; y /= len_r; z /= len_r;
69
- // compute dot product with radius the vector connecting center of mass and pi
75
+ // compute dot product with vector connecting center of mass and (x,y,z)
70
76
if ((x*X + y*Y + z*Z) < 0.0 )
71
77
force_sign = -1.0 ;
72
78
double J_factor = force_sign*J;
0 commit comments