[xcrysden] plot automatically DataGrid

Tone Kokalj tone.kokalj at ijs.si
Fri Jun 21 12:25:43 CEST 2013


On Thu, 2013-06-20 at 08:34 +0200, max_bert at web.de wrote:
> Hey Tone,
> 
> I have encountered a new problem during using my script. While I was
> plotting the complete set of wavefunctions of a molecule, it showed
> that the isovalue of "0.2" which I chose for my script isn't met by
> every state. Hence I get an error message like the one in the appendix.

This is a situation I never really thought about. When used
interactively the error is fine, as it signals to the user the
"out-of-bounds" problem and the actual [min,max] range is provided.

However, for scripts this is fatal. The proper way of handling this
issue would be to modify the code and turn this error into a warning.

For the time being you can catch this error to prevent abortion.
How to do that depends on how you have written the script. If you locate
the command in the script that actually caused the error (name it
"failed_command"), you can catch it as follows:

catch { failed_command }

I will suppose that you used the
scripting::scalarField3D::configure .... and
scripting::scalarField3D::render commands. If so then you can modify the
script as:

scripting::scalarField3D::configure ....here specify all the options...

if { [catch {scripting::scalarField3D::render}] } {
    set minvalue [xc_iso minvalue]
    set maxvalue [xc_iso maxvalue]

    set maxlevel [expr {abs($minvalue) < abs($maxvalue) ? abs($minvalue) : abs($maxvalue)}]

    # lets take the 20% of the maxvalue
    set level [expr 0.2*$maxlevel]	
   	
    scripting::scalarField3D::configure -isolevel $level
    scripting::scalarField3D::render 
}


Hope that will help!


Best regards,
-- 
Anton Kokalj
J. Stefan Institute, Jamova 39, 1000 Ljubljana, Slovenia 
(tel: +386-1-477-3523 // fax:+386-1-477-3822)

Please, if possible, avoid sending me Word or PowerPoint attachments.
See:  http://www.gnu.org/philosophy/no-word-attachments.html



More information about the XCrySDen mailing list