Adding Cloudy -r or -p flags to pyCloudy

66 views
Skip to first unread message

Mairan Teodoro

unread,
Jan 27, 2016, 11:25:49 AM1/27/16
to pyCloudy
Hi, all!

I would like to know whether pyCloudy allows one to call cloudy.exe with the -r or -p flags or not.

I'm using pyCloudy to run full models (no grid) and everything is A-OK.

However, when I tried to use pyCloudy to run a grid model (varying hden and temperature), it creates the .in and Makefile correctly, but the .out file states this:

" Please use the style "/path/to/cloudy.exe -r input" when doing grid
or optimizer runs.  See http://trac.nublado.org/wiki/RunCode for more information.
 [Stop in cdMain at maincl.cpp:388, something went wrong]"

Note that Cloudy runs OK when I manually (without using pyCloudy) call it using the -r flag on the .in file created by pyCloudy.

Any help would be appreciated.

m.

Christophe Morisset

unread,
Jan 28, 2016, 2:54:15 PM1/28/16
to pyCloudy
Hi Mairan,

pyCloudy is not supposed to work with the grid options of Cloudy, as in this case all the results are found in unique files, one for each save command.
The way one can do grid of models using pyCloudy is to develop a script that will generate N input files and run Cloudy on each using the make facility (thus allowing to run various models at the same time).
Then one can read all the results of a grid in a list of CloudyModel objects and deal with them.

Hope it helps,
Christophe

Mairan Teodoro

unread,
Jan 28, 2016, 3:55:03 PM1/28/16
to pyCloudy
Hi, Christophe!

Thanks for the answer.

I've been using the approach you suggested for quite a while now. I've adopted this MO when I need to run 'full' models with many different parameters.

However, I just thought I could save myself some time if I could just run one single model and still be able to produce the entire grid I'm interested in (which is different from the analysis of 'full' model results).

Anyway, the way I worked this around was by adding the -r flag to the variable 'to_run' located at the end of the file 'cloudy_model.py'.

In summary, I have changed the original code from this:

-> to_run = 'cd {0} ; {1} {2}'.format(dir_, precom, cloudy_exe)

to this:

-> to_run = 'cd {0} ; {1} {2} -r {3}'.format(dir_, precom, cloudy_exe, model_name.split('/')[-1])

Also, I'm not using the Makefile when I run grids (calling 'run_cloudy' with use_make=False).

Now using pyCloudy to run Cloudy won't cause it to complain about the missing -r flag when running a model with the grid parameter.

m.
Reply all
Reply to author
Forward
0 new messages