Skip to content

Commit 5b12c17

Browse files
committedMay 3, 2017
fixed up kenotaxis aligner. Next going to change it to affect the whole tissue
1 parent 628cc6d commit 5b12c17

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
*.pyc
3+
.*.swp

‎src/aligner/external/external_kenotaxis_aligner.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,15 @@ void ExternalKenotaxisAlign::compute()
5151
Particle& pi = m_system->get_particle(i);
5252
if (pi.boundary)
5353
{
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
5458
double force_sign = 1.0;
5559
double X = pi.x - xcm, Y = pi.y - ycm, Z = pi.z - zcm;
5660
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
5863
Particle& pj = m_system->get_particle(pi.boundary_neigh[0]);
5964
Particle& pk = m_system->get_particle(pi.boundary_neigh[1]);
6065
double xji = pj.x - pi.x, yji = pj.y - pi.y, zji = pj.z - pi.z;
@@ -63,10 +68,11 @@ void ExternalKenotaxisAlign::compute()
6368
double xki = pk.x - pi.x, yki = pk.y - pi.y, zki = pk.z - pi.z;
6469
double len_ki = sqrt(xki*xki + yki*yki + zki*zki);
6570
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
6773
double len_r = sqrt(x*x + y*y + z*z);
6874
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)
7076
if ((x*X + y*Y + z*Z) < 0.0)
7177
force_sign = -1.0;
7278
double J_factor = force_sign*J;

‎src/aligner/external/external_shape_aligner.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* \brief Declaration of ExternalShapeAlign class
2828
*/
2929

30+
// Problem with shape alignment is that orientation can flip like a nematic
31+
3032

3133
#include "external_shape_aligner.hpp"
3234

@@ -61,8 +63,8 @@ void ExternalShapeAlign::compute()
6163
}
6264
A /= V.dual.size(); B /= V.dual.size(); C /= V.dual.size();
6365
// Maximum eigenvalue is
64-
double l1 = 0.5*(A+C + sqrt((A-C)*(A-C)+4*B*B));
65-
double l2 = 0.5*(A+C - sqrt((A-C)*(A-C)+4*B*B));
66+
double l1 = 0.5*(A+C + sqrt((A+C)*(A+C)+4*B*B));
67+
double l2 = 0.5*(A+C - sqrt((A+C)*(A+C)+4*B*B));
6668
double lambda = (l1 > l2) ? l1 : l2;
6769
// compute corresponding eigen vector
6870
ax = B;

‎utils/pvmodel/analyse_cells.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def process_commands():
7878
help='Mirrors exclude_boundary flag in samso')
7979

8080

81-
# Want a sub parser for simple operations on mesh which don't involve stress calcualtion
81+
# Want a sub parser for simple operations on mesh which don't involve stress calculation
8282
# Examples. Calculating the structure tensor, calculating cell neighbour topology
8383
# Associated with the 'Property' senario
8484
meshparser = subparsers.add_parser('mesh', help='Analysis on the mesh')

‎utils/pvmodel/cellmesh.py

-4
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ def _parts(self):
620620
# still ignoring kinetic part for now
621621
stress = dict([(i, self.stress[i]) for i in self.clist])
622622
evalues, evectors = {}, {}
623-
#print stress
624623
for i in self.clist:
625624
st = stress[i]
626625

@@ -1290,8 +1289,6 @@ def makecellparts(self):
12901289
stress += struct
12911290
self.cellparts[vhi] = stress
12921291

1293-
#print vhi
1294-
#print stress
12951292

12961293

12971294
self.structure = structure
@@ -1322,7 +1319,6 @@ def vvext(rings, last_ring, adj):
13221319

13231320
rings.append(last_ring)
13241321
adj -= 1
1325-
#print adj
13261322
vvext(rings, last_ring, adj)
13271323

13281324
vvext(rings, last_ring, adj)

‎utils/pvmodel/senario.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def _operate(self):
407407
pv.calculate_forces()
408408

409409
pv.makecellparts()
410-
pv.on_centres()
410+
pv.on_centres(args.adj)
411411

412412
if self.fid == self.ref_index:
413413
self.ref_structure = {}
@@ -416,9 +416,10 @@ def _operate(self):
416416
if args.test:
417417
self.test_convergence(pv)
418418

419-
# for real
420-
adjlist = [0, 4]
421-
#self.calculate_U(pv, adjlist)
419+
# for real
420+
print 'stress averaging adj = ', args.adj
421+
adjlist = [0, args.adj]
422+
self.calculate_U(pv, adjlist)
422423

423424
# pickle useful datas
424425
self.pkr.update(pv, outnum)
@@ -428,7 +429,7 @@ def _operate(self):
428429

429430
def calculate_U(self, pv, adjlist):
430431
self.adjavg_structure(pv, adjlist)
431-
pv.structure_xx
432+
#pv.structure_xx
432433

433434

434435
def test_convergence(self, pv):

0 commit comments

Comments
 (0)
Please sign in to comment.