Hi, please post unrelated questions separately, otherwise it gets quite messy. Using your question numbers:
1. to access all contacts with the memberane, you can either loop through all membrane elements and then over all its contacts, or over all contacts and filter out only those with membrane:
# option one
for c in S.dem.con:
# skip contacts where neither particles is a Membrane
if not isinstance(c.pA.shape,woo.fem.Membrane) and not isinstance(c.pB.shape,woo.dem.Membrane): continue
# do something, such as sum forces etc.
# option two
for p in S.dem.par:
if not isinstance(p.shape,woo.fem.Membrane): continue
for c in p.con:
# do something with c, which is a contact between Membrane and something
2. I'd guess every time you run the script, the numbering will be the same -- deterministic but arbitrary (maybe not if python sequences come into play). But node numbering is an implementation detail and is not guaranteed to be anything. You should loop over all nodes and find the corner nodes by comparing coordinates -- something like this (make sure you do it just once and store the result e.g. in S.lab, as it traverses all nodes every time called):
from minieigen import *
# construct box around the coordinate
# return all nodes within the box, the caller should get the item (s)he wants
return [n for n in S.dem.nodes if n.pos in box]
S.lab.cornerNodes=[findNodesAround(S.dem,coord) for coord in (0,0,0),(0,1,0),(1,0,0),(0,0,1)] # in this example, corners of unit square in xy-plane
3. To set the total mass, find volume and compute density from required mass and volume (to compute the volume, call SpherePack.solidVolume, obviously after calling makeCloud and before calling toSimulation). If you use more sophisticated generators, you can set the mass you require directly (see tutorial on inlets).
4. Nodal force: Node.dem.force (DemData.force, read the docs, really) so it will be S.dem.nodes[i].dem.force if you start with Scene, i being the node number.