Let us now define the geometry of the reaction volume in the section called “ An introductory Example ”. Before we define the compartments, we note that the geometry as defined in the example has three functionally distinct regions "1", "2" and "3". These regions will map exactly to the three compartments we are about to define.
    We will use the sphere primitive
    to model the ellipsoid and slightly rotated compartment two. To
    achieve this we make a sphere with a radius of 2 micrometres. We
    make it ellipsoid by scaling the sphere two times in the y
    direction. Next we rotate the ellipsoid slightly around the
    z-axis. To described this for MesoRD, the
    listOfCompartments may begin like
    shown below.  Note that we make use of the previously defined
    um unit.
    
<listOfCompartments>
  <compartment id="CompartmentTwo"
                  units="litre">
   
    <annotation>
     <MesoRD:csg xmlns:MesoRD="http://www.icm.uu.se">
      <MesoRD:rotation MesoRD:x="0"
                       MesoRD:y="0"
                       MesoRD:z="1"
                       MesoRD:angle="20"
                       MesoRD:units="degree">
        <MesoRD:scale MesoRD:x="1" 
                      MesoRD:y="2" 
                      MesoRD:z="1">
          <MesoRD:sphere MesoRD:radius="2"
                         MesoRD:units="um"/>
        </MesoRD:scale>
      </MesoRD:rotation >
     </MesoRD:csg>
    </annotation>
  </compartment>
    
    Next, we will define the cytosol-like
    CompartmentOne.  It is built as
    union of a cylinder and three spheres. Two spheres forms the caps
    of the cylinder and an additional sphere forms a budding
    structure. This compartment must exclude
    CompartmentTwo, defined above. To
    do this we subtract the
    CompartmentTwo from the union of
    the cylinder and the three spheres.
    
  <compartment id="CompartmentOne"
                  units="litre">
   
    <annotation>
     <MesoRD:csg xmlns:MesoRD="http://www.icm.uu.se">
      <MesoRD:difference>
        <MesoRD:union>
          <MesoRD:cylinder MesoRD:radius="4.5" 
                           MesoRD:height="8"
                           MesoRD:units="um"/>
          <MesoRD:translation MesoRD:x="0.00" 
                              MesoRD:y="-4" 
                              MesoRD:z="0"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="4.5"
                           MesoRD:units="um"/>
          </MesoRD:translation>
          <MesoRD:translation MesoRD:x="0.00" 
                              MesoRD:y="4" 
                              MesoRD:z="0"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="4.5"
                           MesoRD:units="um"/>
          </MesoRD:translation>
          <MesoRD:translation MesoRD:x="0" 
                              MesoRD:y="7" 
                              MesoRD:z="3.5"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="4.5"
                          MesoRD:units="um"/>
          </MesoRD:translation>
        </MesoRD:union>
        <MesoRD:compartment MesoRD:id="CompartmentTwo" /> 
      </MesoRD:difference>
     </MesoRD:csg>
   </annotation>
  </compartment>
    
    To form the membrane like compartment we define a geometry that is
    slightly larger than
    CompartmentOne and subtract both
    compartments defined above.
    
  <compartment id="CompartmentThree"
                  units="litre">
  
   <annotation>
     <MesoRD:csg xmlns:MesoRD="http://www.icm.uu.se">
      <MesoRD:difference>
        <MesoRD:union>
          <MesoRD:translation MesoRD:x="-0.00" 
                              MesoRD:y="-0.00" 
                              MesoRD:z="0"
                              MesoRD:units="um">
            <MesoRD:cylinder MesoRD:radius="5.0" 
                             MesoRD:height="8.0"
                             MesoRD:units="um"/>
          </MesoRD:translation>
          <MesoRD:translation MesoRD:x="0.0" 
                              MesoRD:y="-4" 
                              MesoRD:z="0"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="5"
                           MesoRD:units="um"/>
          </MesoRD:translation>
          <MesoRD:translation MesoRD:x="0.0" 
                              MesoRD:y="4" 
                              MesoRD:z="0.0"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="5"
                           MesoRD:units="um"/>
          </MesoRD:translation>
          <MesoRD:translation MesoRD:x="0" 
                              MesoRD:y="7" 
                              MesoRD:z="3.5"
                              MesoRD:units="um">
            <MesoRD:sphere MesoRD:radius="5"
                          MesoRD:units="um"/>
          </MesoRD:translation>
        </MesoRD:union>
        <MesoRD:union>
          <MesoRD:compartment MesoRD:id="CompartmentOne" /> 
          <MesoRD:compartment MesoRD:id="CompartmentTwo" /> 
        </MesoRD:union>
      </MesoRD:difference>
     </MesoRD:csg>
    </annotation>
  </compartment>  
</listOfCompartments>
    
    The last line in the code above closes the
    listOfCompartments we started
    earlier.