Skip to content

How to access parameter values for conditional refinements

Sven Vogel edited this page Oct 8, 2022 · 3 revisions

Similar to accessing parameters to set values, e.g. `

    # set values for alpha phase lattice parameters      
    editor.set_val(key='_cell_length_a', sobj='Zr-alpha', value='3.236')   
    editor.set_val(key='_cell_length_c', sobj='Zr-alpha', value='5.152')   
    # set the beta lattice parameter to a likely value for residual beta at ambient  
    editor.set_val(key='_cell_length_a', sobj='Zr-beta', value='3.57')`

one can also read parameter values in a MILK analysis script using code like this: `

    editor.get_val(key='_pd_phase_atom_')
    phase_frac = editor.value`

This stores the results of a parameter tree query similar to the one for setting parameter values in the variable 'editor.value', which can be subsequently stored in a different variable. To execute conditional refinements, code such as the following can be used: `

    for i, phase in enumerate(phases):
        if float(phase_frac[i]) > 0.2:
            editor.free(key='MicroStrain', sobj=phases[i])
            editor.free(key='CrystSize', sobj=phases[i])
            print("Phase fraction of phase <",i,"> is greater than 0.2, varying MicroStrain and CrystSize.")
        if float(phase_frac[i]) > 0.05:
            editor.free(key='_cell_length_', sobj=phases[i])
            print("Phase fraction of phase <",i,"> is greater than 0.05, varying lattice parameters.")`
Clone this wiki locally