Forum: Forums structure solution RSS
Help: Error in generate_stack_sequences : w_layers.n() > w_max_stacks_allowed
Random but reproducible error in stacking fault simulation
berndhinrichsen #1
User title: Research Manager
Member for 3 months · 1 post · Location: Stuttgart
Group memberships: Members
Show profile · Link to this post
Subject: Help: Error in generate_stack_sequences : w_layers.n() > w_max_stacks_allowed
Hello all,

after being inspired by the John and Robert groups great work with stacking fault simulation using TOPAS, I have tried it on a structure that has been irritating me for a while. I'm afraid I cannot mention which, due to "intellectual property" issues but I hope I can reveal enough to illustrate my problem.

5 polymorph layers based on a sublayer. Each of the polymorphs is described by a stack of 2-4 sublayers with differing stacking vectors. To demonstrate my issue a tiny subset of probabilities will do:

#list P12 P13 P14 P15 P23 P24 P25 P34 P35 P45
{
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.1 0.0 0.1 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.1 0.1 0.0 0.0 0.1 0.0 0.0
0.0 0.0 0.0 0.2 0.0 0.2 0.0 0.0 0.0 0.0
}

and I use 200 sequences of 200 layers to write out a pattern

    num_runs 4
    iters 0
    macro Nseq { 200  }
    macro Nv { 200 }
    yobs_eqn aac.xy = 1;
      min 5
      max 40
      del 0.02
      Out_X_Ycalc(diff##Run_Number##.txt)

Here are my stack definitions. As you can see, I have tried to avoid probabilities of 0. I have constrained the probability of of one polymorph stacking on the identical polymorph to be the same (P11). Not sure that is sensible at the moment, but it does limit the possibilities.
        seed
        generate_stack_sequences
        {
            number_of_sequences Nseq
            number_of_stacks_per_sequence Nv
           
            prm !layer_height  5.0
           
            prm Probability_12 = If(P12(Run_Number)==0,0.001,P12(Run_Number));:0.00100
            prm Probability_13 = If(P13(Run_Number)==0,0.001,P13(Run_Number));:0.00100
            prm Probability_14 = If(P14(Run_Number)==0,0.001,P14(Run_Number));:0.00100
            prm Probability_15 = If(P15(Run_Number)==0,0.001,P15(Run_Number));:0.20000
            prm Probability_23 = If(P23(Run_Number)==0,0.001,P23(Run_Number));:0.00100
            prm Probability_24 = If(P24(Run_Number)==0,0.001,P24(Run_Number));:0.20000
            prm Probability_25 = If(P25(Run_Number)==0,0.001,P25(Run_Number));:0.00100
            prm Probability_34 = If(P34(Run_Number)==0,0.001,P34(Run_Number));:0.00100
            prm Probability_35 = If(P35(Run_Number)==0,0.001,P35(Run_Number));:0.00100
            prm Probability_45 = If(P45(Run_Number)==0,0.001,P45(Run_Number));:0.00100
            prm P11 = 1.0 - Probability_12 - Probability_13 - Probability_14 - Probability_15;:0.79700
           
            'Polymorph 1
            Transition(A, A, layer_height)
                to B = 1; a_add =  0;   b_add = 0;
            Transition(B, A, layer_height)
                to A = P11           ; a_add =  0;   b_add = 0;
                to C = Probability_12; a_add =  0;   b_add = 0;
                to F = Probability_13; a_add =  0;   b_add = 0;
                to K = Probability_14; a_add =  0;   b_add = 0;
                to P = Probability_15; a_add =  0;   b_add = 0;

           
            'Polymorph 2
            Transition(C, A, layer_height)
                to D = 1; a_add =  0;   b_add = -1/3;
            Transition(D, A, layer_height)
                to E = 1; a_add = -1/3; b_add =    0;
            Transition(E, A, layer_height)
                to A = Probability_12; a_add =  0;   b_add = 0;
                to C = P11           ; a_add =  0;   b_add = 0;
                to F = Probability_23; a_add =  0;   b_add = 0;
                to K = Probability_24; a_add =  0;   b_add = 0;
                to P = Probability_25; a_add =  0;   b_add = 0;
               
            'Polymorph 3
            Transition(F, A, layer_height)
                to G = 1;   a_add =    0; b_add = -1/3;
            Transition(G, A, layer_height)   
                to H = 1;   a_add = -1/3; b_add =    0;
            Transition(H, A, layer_height)
                to I = 1;   a_add =    0; b_add =  1/3;
            Transition(I, A, layer_height)
                to J = 1;   a_add = -1/3; b_add =    0;
            Transition(J, A, layer_height)
                to A = Probability_13; a_add =  0;   b_add = 0;
                to C = Probability_23; a_add =  0;   b_add = 0;
                to F = P11           ; a_add =  0;   b_add = 0;
                to K = Probability_34; a_add =  0;   b_add = 0;
                to P = Probability_35; a_add =  0;   b_add = 0;

            'Polymorph 4
            Transition(K, A, layer_height)
                to L = 1;   a_add = -1/3; b_add =    0;
            Transition(L, A, layer_height)   
                to M = 1;   a_add =    0; b_add = -1/3;
            Transition(M, A, layer_height)
                to N = 1;   a_add =  1/3; b_add =    0;
            Transition(N, A, layer_height)
                to O = 1;   a_add =    0; b_add =  1/3;
            Transition(O, A, layer_height)
                to A = Probability_14; a_add =  0;   b_add = 0;
                to C = Probability_24; a_add =  0;   b_add = 0;
                to F = Probability_34; a_add =  0;   b_add = 0;
                to K = P11           ; a_add =  0;   b_add = 0;
                to P = Probability_45; a_add =  0;   b_add = 0;

            'Polymorph 5
            Transition(P, A, layer_height)
                to Q = 1;   a_add =  1/3; b_add =    0;
            Transition(Q, A, layer_height)   
                to R = 1;   a_add =    0; b_add = -1/3;
            Transition(R, A, layer_height)
                to S = 1;   a_add = -1/3; b_add =    0;
            Transition(S, A, layer_height)
                to T = 1;   a_add =    0; b_add =  1/3;
            Transition(T, A, layer_height)
                to A = Probability_15; a_add =  0;   b_add = 0;
                to C = Probability_25; a_add =  0;   b_add = 0;
                to F = Probability_35; a_add =  0;   b_add = 0;
                to K = Probability_45; a_add =  0;   b_add = 0;
                to P = P11           ; a_add =  0;   b_add = 0;
        }

Now to the problem :)
With two polymorph layers the model works perfectly.
With three it randomly throws "max stack allowed error"
With more than three it always throws the error.

Fiddling with the number of layers and number of sequences does not seem to influence the matter too much.

I am using the current commercial version 6 of TOPAS.

Any help will be greatly appreciated.

Greetings from Ludwigshafen,
Bernd
AlanCoelho #2
Member since Aug 2011 · 280 posts
Group memberships: Members
Show profile · Link to this post
The problem is probably due to not being able to generate layers according to the probability matrix, see Fig. 1 in the paper Coelho, A. A.; Evans, J. S. O. & Lewis, J. W. (2016). J. Appl. Cryst. 49, 1740-1749.

You can change the tolerance in how the layers are generated (q as seen in Fig. 1) using:


               generate_stack_sequences {
                              pr_str { B layers_tol } 1 ' this changed q to 1
                              …

Here, q is set to 1 and your INP file may now works Note: Using ‘pr_str’ (process_string) is not the normal way of accessing an object. Nevertheless it works fine. layer_tol is in fact the internal name given to q. 

You may want to then check to see what type of match_transition_matrix_stats matrix has been generated.
cheers
alan
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Current time: 2019-09-15, 17:07:55 (UTC +00:00)