The selfAssembly expression
Save this file in your Maya Scripts directory under the following name: selfAssembly.txt
Unlike reset, this expression must run once every frame greater than frame 1. Again, this condition can be tested with an "if" statement.
/* Description:
This is a runtime animation expression that updates the actin assembly simulation. Diffusion, collision avoidance, and reactions are parcelled off as procedures that are called when needed from this expression. */
Reminder: variables that have been described previously will not be given a description here orwith subsequent occurrences.
DECLARE THE VARIABLES
global string $fName, $gNames[], $tracer, $pName; global float $Rg, $Rf, $Rc, $Rr, $adpProb, $piProb; global int $total0n;
The current plus-end subunit. The current minus-end subunit.
i plusSubunit / minusSubunit
- /
- tring îplusSubunit, $minusSubunit, $name, $gName, $re1ati ves [] ;
gg ggTrans g gRot gpTrans g separation
$trans
S rot
Sbounding g diffusion gcollision s/
v ector $gTran gg
S dist $ RrPrime
Current position of the current G-actin molecule. Current rotation of the current G-actin molecule. Current position of the plus-end locator. The vector separating G-actin and the filament plus-end.
The sum of diffusion, collision, and bounding vectors.
The diffusional rotation vector.
Nudges the G-actin back inside the reaction volume.
The return value of the diffuse() procedure. The return value of the collide() procedure.
s, /gRot, $pTrans, $separation, $trans, $bounding, $diffusion[], $collision;
- rot,
- rnd */
float $dist,
The scalar distance of the vector $separation. The distance used to test if G-actin lies within the association reaction volume. A random number between 0 and 1.
- RrPrime, $rnd;
- *
- bindThisFrame Set to 1 if an association reaction has occurred in the current frame, 0 if not.
- bindThisMonomer Set to 1 if the current G-actin has associated with F-actin, (3 if not. The above values are set in the associate() procedure.
- mState The nucleotide state of the minus-end subunit.
- /
int $bindThisFrame, $bindThisMonomer, $mState, $state, $subuni ts;
- initialize the variables *****/
- state * (3; $bindThisFrame $ (3;
- bindThisMonomer $ (3; /*
Query the coordinates of the plus- and minus-end locators.
xform queries the world matrix for the specified object. */
- pTrans $ "xform -query -worldSpace -translation $pName" ; The firsttime you see a command
- Refresh the list of G-actin monomers. used in the code listings here
- gNames = ' 1 s -tr "|g_*"'; (e.g. xform) the long flag names will be used. Subsequently, the
Here, your expression will assess bounding, association reactions, diffusion, and short names will be used. collisions for every free G-actin monomer. You' ll use the "for in" conditional statement to loop through a list of G-actin names. If a given monomer associates with the filament, you need not calculate its diffusion or check for collisions. Therefore you'll track the "recently associated" status of the monomer using the variable $bindThis-Monomer. Its value will be set to 1 if an association reaction occurs and 0 if not. A similar variable SbindThisFrame tracks whether an association reaction has occurred yet during the present frame. If one has, $bindThisFrame = 1 prevents the expression from evaluating any more binding opportunities. This limits the model to binding a maximum of one monomer per frame. Note the totalOn variable which has 1 added to its value each time a successful association reaction occurs.
Bounding, diffusion, and collision each produce a vector (with direction and magnitude) (Figure 15.12). After all three have been evaluated, their effects are combined (vectors added) and used to update the transform of the G-actin model.
- G-ACTIN bounding, reaction, and diffusion *$$$$/ Qor ($name in $gNames) {
- Zero the bounding vector for this G-actin. $ bounding $ <<(3, (3, (3>>; $ bindThisMonomer $ (3;
- Query the position and state of monomer $name. $gTrans $ "getAttr ($name $ ".t")'; $state = "getAttr ($name $ ".state")' $
i f ($state =$ (3) { // This G-actin is ready for binding.
// Calculate the distance between G-actin and the plus-end. $separation = $pTrans - $gTrans; $ dist $ mag($separation);

FIGURE 15.12
Bounding, diffusion, and collision evaluations each result in a displacement vector. The three vectors are summed and used
Rg (G-actin radius)
Bounding 5 unit(separation) * Rg
Diffusion
Actin i
Collision
'Actin j
G-actin
Concentration volume
G-actin
Concentration volume
trans =
bounding + diffusion + collision
The if($bindThisFrame) notation evaluates $bindThisFrame as if it were of type Boolean with two possible values: 1 (yes) and 0 (no). If the variable being tested has only 0 and 1 as possible values, this notation does the same thing in fewer characters than if( $bi ndThisFrame == 1).
The opposite of if($bindThisFrame) is
- The distance between the G-actin and reaction volume surfaces. $RrPrime = $Rr + $Rf + $Rg;
- Determine if G-actin is outside the concentration volume. $f ($dist > ($Rc - $Rg)) {
- Calculate a vector to nudge G-actin back inside. $bounding $ unit($separation) * $Rg;
- Ise if ($dist $$ $RrPrime &$ $bindThisFrame == 0) {
- The monomer can associate with the filament.
Call the association reaction procedure.
- $
- bindThisFrame $ associate($name);
if ($bindThisFrame) { // 1 if yes, 0 if no. $/ Increment the $on" reaction counter.
The current G-actin has bound the filament and will not be considered for diffusion, collisions, and bounding below.
- /
- bindThisMonomer $ 1;
This is a recently dissociated G-actin and is in the process of fading in or out. Call the faderShader()
faderShader($name, $state);
If the current G-actin model's state is not 0, then it must have recently dissociated and is either fading out (state < 0) near the filament minus end or fading back in (state > 0) near the plus end. In either case, the fadershader() procedure is called to fade out, fade in, or move G-actin to the filament plus end region. We' ll explore this procedure a little later in this chapter. Provided no association reaction occurred, the next bit of code calls the diffusion() and co11ision() procedures. Their results are added to the $bounding vector from above to make a new vector called $trans. $trans is then used to update the G-actin model. /*
If $name did not associate with the filament, calculate its diffusion, avoidance and bounding vectors. */
if ($bindThisMonomer // (3) { // No binding occurred.
- Call the diffusion procedure. $diffusion / diffuse();
- Call the collision avoidance procedure. $co11ision = co11ide($name);
- Total the motion for the G-actin molecule. $trans = $diffusion[(3] + $co11ision + $bounding;
- rot / $diffusion[1]; /*
Query the current translation and rotation of the molecule. Since fadershader() may have moved the G-actin to the filament plus-end, it's essential to query G-actin ' s translate attribute again here. */
- gTrans = 'getAttr ($name / ".translate")'; $gRot / 'getAttr ($name / ".rotate")';
- Add the current translation and rotation values to the $trans and $rot vectors. */ $trans = $trans + $gTrans; $rot / $rot + $gRot;
- Set the molecule's new translation and rotation values. setAttr ($name / ".translate") -type doubleB ($trans.x)
- trans.y) ($trans.z); setAttr ($name / ".rotate") -type doubleB ($rot.x) ($rot.y) ($rot.z);
Here you'll use the Is command to get a list of F-actin subunits and count its size. The list begins with the name of the minus end subunit and ends with that of the plus end subunit. In other words, in the array ($re1atives[]) used to store this list, element 0 is the minus end subunit and element [$subunits] is the plus end subunit.
- INTRA-FILAMENT REACTIONS *****";
- Get a list of F-actin subunits and count its size. $re1atives * "listRelatives -path ($fName * "igfGroup")'; $subunits = 'size $re1atives" ; $ minusSubunit * $re1atives[0];
- Get the nucleotide state of the minus-end subunit. $mState = "getAttr ($minusSubunit * ".state")';
Actin oligomers of two subunits are highly unstable, meaning they are quite likely to dissociate into G-actin monomers. However, once a third subunit is added, the structure—now called a nucleus—is much more likely to remain stable and grow into a filament. Therefore, we' ll set minimum stable filament size to three subunits and not allow further dissociation reactions if your filament happens to reach the three-subunit size. We'll present the dissociate procedure() later in this chapter.
- The minimum filament size is 3 subunits. if ($subunits > 3) {
- Call the dissociate() procedure, dissociate($minusSubunit, $mState);
for ($gName in $re1atives) {
- Get the state of the current molecule.
- state = "getAttr ($gName * ".state")';
- Generate a random number with which to test reaction probabili ti es. $rnd = 1 rand 1';
The sets command -fe flag is short for -forceElement which forces the addition of the item ($gName) to the set (the shading group node) if it currently belongs to anotherset.
if ($rnd * $adpProb) { // A reaction occurs. // Change state and set the shading group. setAttr ($gName * ".state") 2; /* If the current G-actin is not the tracer, assign the ADP^PI shader. */ if ($tracer != $gName) sets -e -fe "ADPpi_ shaderSG ' ' $gName;
if ($rnd < $piProb) { // A reaction occurs. // Change state and set the shading group. *etAttr ($gName * ".state") 3;
/* If the current G-actin is not the tracer, assign the ADP shader. */ if ($tracer !* $gName) sets -e -fe "ADP_ shaderSG * ' $gName;
- Clear the current selection, select -clear;
- End if (frame > 1). // End expression.
Next we'll cover the five procedures in the order they're called by selfAssembly.
Post a comment