mcellteam / mcell

MCell Monte Carlo Simulator of Cellular Microphysiology
Other
33 stars 10 forks source link

Surface molecule CROSSINGS and HITS don't work #27

Open jczech opened 8 years ago

jczech commented 8 years ago

FRONT, BACK, or ALL CROSSINGS/HITS don't work for surface molecules, although the QRG suggests otherwise:

For a volume molecule output the number of times the named molecule has hit the named region (or object). For a surface molecule output the number of times the named molecule hit the boundary of the named region. The hits specifier should be one of FRONT_HITS, BACK_HITS, ALL_HITS, FRONT_CROSSINGS, BACK_CROSSINGS, and ALL_CROSSINGS. For a volume molecule the meaning of these specifiers is obvious. For a surface molecule FRONT means inside out direction, and BACK means outside in direction. The count is cumulative.

Also, when I say these count statements don't work, I mean that the counts reported are all zero.

We should either fix this or print an error during parsing to indicate that this functionality isn't supported.

Here's an MDL that demonstrates this problem:

ITERATIONS = 1000
TIME_STEP = 1e-06
VACANCY_SEARCH_DISTANCE = 10

DEFINE_MOLECULES {
  sm { DIFFUSION_CONSTANT_2D = 1e-06 }
}

Plane POLYGON_LIST
{
  VERTEX_LIST
  {
    [ -0.074999988079071, -0.0899999886751175, 0 ]
    [ 0.104999989271164, -0.0899999886751175, 0 ]
    [ -0.074999988079071, 0.0899999886751175, 0 ]
    [ 0.104999989271164, 0.0899999886751175, 0 ]
    [ -0.0299999937415123, -0.0899999886751175, 0 ]
    [ 0.0599999949336052, -0.0899999886751175, 0 ]
    [ 0.0599999949336052, 0.0899999886751175, 0 ]
    [ -0.0299999937415123, 0.0899999886751175, 0 ]
    [ -0.074999988079071, 0.0449999943375587, 0 ]
    [ -0.074999988079071, -0.0449999943375587, 0 ]
    [ 0.104999989271164, -0.0449999943375587, 0 ]
    [ 0.104999989271164, 0.0449999943375587, 0 ]
    [ -0.0299999937415123, -0.0449999943375587, 0 ]
    [ -0.0299999937415123, 0.0449999943375587, 0 ]
    [ 0.0599999949336052, -0.0449999943375587, 0 ]
    [ 0.0599999949336052, 0.0449999943375587, 0 ]
  }
  ELEMENT_CONNECTIONS
  {
    [ 11, 3, 6 ]
    [ 13, 7, 2 ]
    [ 15, 6, 7 ]
    [ 5, 14, 12 ]
    [ 14, 15, 13 ]
    [ 4, 12, 9 ]
    [ 12, 13, 8 ]
    [ 1, 10, 14 ]
    [ 10, 11, 15 ]
    [ 15, 11, 6 ]
    [ 8, 13, 2 ]
    [ 13, 15, 7 ]
    [ 4, 5, 12 ]
    [ 12, 14, 13 ]
    [ 0, 4, 9 ]
    [ 9, 12, 8 ]
    [ 5, 1, 14 ]
    [ 14, 10, 15 ]
  }
  DEFINE_SURFACE_REGIONS
  {
    sr_inner
    {
      ELEMENT_LIST = [4, 13]
    }
    sr_outer
    {
      ELEMENT_LIST = [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17]
    }
  }
}

INSTANTIATE Scene OBJECT {
  Plane OBJECT Plane {}
  Release_Site RELEASE_SITE {
   SHAPE = Scene.Plane[sr_inner]
   MOLECULE = sm'
   NUMBER_TO_RELEASE = 1
  }
}

REACTION_DATA_OUTPUT {
  STEP=1e-6
  {COUNT[sm,Scene.Plane[sr_outer],FRONT_HITS]}=> "./sm.sr_outer.fh.dat"
  {COUNT[sm,Scene.Plane[sr_inner],FRONT_HITS]}=> "./sm.sr_inner.fh.dat"
  {COUNT[sm,Scene.Plane[sr_outer],FRONT_CROSSINGS]}=> "./sm.sr_outer.fc.dat"
  {COUNT[sm,Scene.Plane[sr_inner],FRONT_CROSSINGS]}=> "./sm.sr_inner.fc.dat"

  {COUNT[sm,Scene.Plane[sr_outer],BACK_HITS]}=> "./sm.sr_outer.bh.dat"
  {COUNT[sm,Scene.Plane[sr_inner],BACK_HITS]}=> "./sm.sr_inner.bh.dat"
  {COUNT[sm,Scene.Plane[sr_outer],BACK_CROSSINGS]}=> "./sm.sr_outer.bc.dat"
  {COUNT[sm,Scene.Plane[sr_inner],BACK_CROSSINGS]}=> "./sm.sr_inner.bc.dat"

  {COUNT[sm,Scene.Plane[sr_outer],ALL_HITS]}=> "./sm.sr_outer.ah.dat"
  {COUNT[sm,Scene.Plane[sr_inner],ALL_HITS]}=> "./sm.sr_inner.ah.dat"
  {COUNT[sm,Scene.Plane[sr_outer],ALL_CROSSINGS]}=> "./sm.sr_outer.ac.dat"
  {COUNT[sm,Scene.Plane[sr_inner],ALL_CROSSINGS]}=> "./sm.sr_inner.ac.dat"
}
jczech commented 8 years ago

TRIGGERS for surface molecules also don't work. This isn't terribly surprising. There's even a comment about this in diffuse_2D:

To-do: This doesn't work with triggers. Change style of counting code so that it can update as we go, like with 3D diffusion.