Forum: Forums topas RSS
How to Use remove_phase Keyword in TOPAS 6
Gmattei #1
Member since Jun 2018 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to Use remove_phase Keyword in TOPAS 6
Hi everyone,

I'm reading through the TOPAS 6 technical reference and I noticed there is syntax for removing phases during refinement, if their contributing weight percent is too low after convergence. This seems useful for batch processing of input files, since it avoids having to manually generate input files with different phases present/absent.

Syntax below:
"remove_phase = Get(weight_percent) < 10.0;: 0.0"

If inserted within an str phase, my understanding is that the phase will be removed if its weight percent is below the threshold, but I've tried refining an input file using two str phases where only one phase is actually present (Al fcc). The output file clearly indicates that the phase which is not present/should be removed is still contributing a small, residual wt percent to the calculated pattern (~0.91 %).

I'm curious if the remove_phase keyword is working as intended and what a successful phase removal should look like, in terms of the generated output file. Will (for example) the scale factor be fixed to a value of 0?

Cheers,
-Gerry
AlanCoelho #2
Member since Aug 2011 · 354 posts
Group memberships: Members
Show profile · Link to this post
Hi Gerry

Phases are removed at the end of Cycles. Are you using continue_after_convergence.

See test_examples\remove-phase.inp

cheers
alan
Gmattei #3
Member since Jun 2018 · 4 posts
Group memberships: Members
Show profile · Link to this post
Hi Alan,

I just did a test run using the remove-phase.inp file and adding
continue_after_convergence to my own input file. It worked exactly as described.

As always thank you for the help!
-Gerry
jobe #4
Member since Sep 2019 · 4 posts · Location: Aarhus, Denmark
Group memberships: Members
Show profile · Link to this post
Hi everyone,

So as I understand it, the "continue_after_convergence" keyword have to be included for Remove_Phase to work, right?

I'm asking since I have some problems with the Remove_Phase macro. I want to do a sequential refinement on temperature variable PXRD data. At some point, I see the development of a new phase in the data but not before some 100s of data sets.

What I'm looking for is a way to include the "new" phase in all my refinements but remove the phase if it is not present. This would also be useful for data sets where secondary phases come and go.

The problem is that the remove_phase keyword terminates the entire sequential refinement (and not only the "present" refinement) whenever a phase is removed. Is it possible to circumvent this termination somehow?

I've set up my sequential refinement according to http://topas.dur.ac.uk/topaswiki/doku.…?id=sequential_re…, where I essentially use the "num_runs" keyword to define a macro that receives a list of data files.

Thanks for your help,
Jonas
johnsoevans (Administrator) #5
User title: John Evans
Member since Aug 2009 · 272 posts
Group memberships: Administrators, Members
Show profile · Link to this post
I've never personally used the remove phase option.  I've always preferred to set the file up in such a way that if a phase disappears its scale factor refines to zero (within uncertainty).  This can be done parametrically or often more simply by equating peak shapes etc between phases (to stop peaks becoming extremely broad and correlating with scale factors).  There's a bit on this in chapter 12 of the Rietveld/Topas book.

You can also set up phases for different ranges manually.  e.g. the book has this example code in it:

' Phase boundaries
#prm t = 100 + (Run_Number 4);   ‘Temperature = 100 + Run_Number * 4
#if Or(t < 158, t > 226);
   #define Phase1
#elseif And(t > 158, t < 198);
   #define Phase1
   #define Phase2
#elseif And(t > 198, t < 226);  
   #define Phase2
#endif
...
#ifdef Phase1
          str
         ...
#endif
chrlj #6
User title: ChristianLund
Member since Feb 2020 · 1 post · Location: Denmark
Group memberships: Members
Show profile · Link to this post
Subject: Remove_phase for seq. refinement
Hi everyone,

I am having the same problem as jobe/Jonas. I would like to exclude a phase, when the weight percent is below a certain value, but the refinement terminates when "No phases removed after one Cycle, refinement terminated".

I would also very much like to know, if there is a way to tell it to move to next data file, when this happens, instead of terminating?

Thanks in advance,

Christian
Silveira #7
Member since Jan 2021 · 8 posts · Location: Bremen, Germany
Group memberships: Members
Show profile · Link to this post
Subject: trying to set scale to 0 if the error is too big
Greetings everyone,

I am trying to write an if statement where if the Weight percentage error of the phase is too big the scale factor is set as 0.

Here is what I wrote, it is inside a str:

    If(Error(weight_percent) < 5*weight_percent,
    scale @ 1e-008` val_on_continue = Val+ Val*Rand(-.5, 0.5);,
    scale 0)

It does not work, I keep getting this error:

      • Error loading sstring_in at
    { If }
     unknown or misplaced keyword

Does anyone know what is wrong? As always it must be some rookie mistake...
Also, what are the differences between #if and If for topas? I tried to adapt this for #if but then I get an error:

weight_percent is not defined

I read the Topas v6 technical reference but I did not understand the difference between them and where should I use one or the other.

thanks in advance!

Antonio
AlanCoelho #8
Member since Aug 2011 · 354 posts
Group memberships: Members
Show profile · Link to this post
Hi Silveria

The 'If' statement can only appear inside equations.

Setting scale to zero is possible using the 'update' attribute; ie.

     scale @ 0.123 update = 0;

However, Error(weight_percent) is only calculated at the end of refinement.

Use remove_phase to accomplish what you are trying to do.

cheers
alan
Silveira #9
Member since Jan 2021 · 8 posts · Location: Bremen, Germany
Group memberships: Members
Show profile · Link to this post
Hi Alan,

Thank you very much for your clarifications, however, as already stated by the other users, using remove_phase for sequential refinement is a little bit problematic. In my case, when a phase is removed, the whole batch process stops.

What I managed to do is the following:

scale @  2e-008` update=If(And(GS_t==1, CS_Lt==5), 0, Val + Val*Rand(-.2, 0.2));

by adding the If statement inside the update, I set a rule that if both microstrain and crystallite reach their maximum and minimum values, respectively, (very broad peak) the scale value should be 0. If both parameters are not within their limits, the refinement continues.

This way, whenever Topas tries to fit a very broad, unrealistic peak, the phase goes to 0.

It did not work when I tried to use the error of a parameter instead of the actual parameter. For example:

scale @  2e-008` update=If(And(GS_t==1, Error(GS_t)>=1), 0, Val + Val*Rand(-.2, 0.2));

Hope this can help someone :)

Antonio
AlanCoelho #10
Member since Aug 2011 · 354 posts
Group memberships: Members
Show profile · Link to this post
Thanks Antonio; very clever
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, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2021-12-01, 18:20:23 (UTC +00:00)