diff -rupN PLUTO4/Src/hdf5_io.c PLUTO_RADIATION_MOD/Src/hdf5_io.c
--- PLUTO4/Src/hdf5_io.c	2012-11-09 13:04:27.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/hdf5_io.c	2013-06-01 18:32:59.895214832 +0200
@@ -78,6 +78,7 @@ void WriteHDF5 (Output *output, Grid *gr
   char xmfext[8];
   int ierr, rank, nd, nv, ns, nc, ngh, ii, jj, kk;
   int n1p, n2p, n3p, nprec;
+  int nvar = output[0].nvar;
   Grid *wgrid[3];
   FILE *fxmf;
  
@@ -233,8 +234,9 @@ void WriteHDF5 (Output *output, Grid *gr
       write cell-centered data
    ------------------------------------ */
 
-  for (nv = 0; nv < NVAR; nv++) {
+  for (nv = 0; nv < nvar; nv++) {
     if (!output->dump_var[nv]) continue;
+    if (output->stag_var[nv] != -1) continue;
     if (output->type == DBL_H5_OUTPUT){
       dataset = H5Dcreate(group, output->var_name[nv], H5T_NATIVE_DOUBLE,
                           dataspace, H5P_DEFAULT);
@@ -499,8 +501,9 @@ void WriteHDF5 (Output *output, Grid *gr
     }
    #endif
     fprintf(fxmf, "     </Geometry>\n");
-    for (nv = 0; nv < NVAR; nv++) { /* Write cell-centered variables */
+    for (nv = 0; nv < nvar; nv++) { /* Write cell-centered variables */
      if (!output->dump_var[nv]) continue;
+     if (output->stag_var[nv] != -1) continue;
      fprintf(fxmf, "     <Attribute Name=\"%s\" AttributeType=\"Scalar\" Center=\"Cell\">\n",output->var_name[nv]);
     #if DIMENSIONS == 2
      fprintf(fxmf, "       <DataItem Dimensions=\"%d %d\" NumberType=\"Float\" Precision=\"%d\" Format=\"HDF\">\n", wgrid[0]->np_int_glob, wgrid[1]->np_int_glob, nprec);
@@ -566,6 +569,7 @@ void ReadHDF5 (Output *output, Grid *gri
 
   char filename[128];
   int ierr, rank, nd, nv, ns;
+  int nvar = output[0].nvar;
   Grid *wgrid[3];
 
 /* --------------------------------------------------------------
@@ -601,8 +605,9 @@ void ReadHDF5 (Output *output, Grid *gri
 
   group = H5Gopen(file_identifier, "vars");
 
-  for (nv = 0; nv < NVAR; nv++) {
+  for (nv = 0; nv < nvar; nv++) {
     if (!output->dump_var[nv]) continue; 
+    if (output->stag_var[nv] != -1) continue;
 
     dataset   = H5Dopen(group, output->var_name[nv]);
     dataspace = H5Dget_space(dataset);
diff -rupN PLUTO4/Src/Radiation/assert.h PLUTO_RADIATION_MOD/Src/Radiation/assert.h
--- PLUTO4/Src/Radiation/assert.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/assert.h	2013-06-01 18:33:00.222214818 +0200
@@ -0,0 +1,54 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef ASSERT_H
+#define ASSERT_H
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "backtrace.h"
+
+#define BACKTRACE_COMMAND PrintBacktrace()
+#define PRINT_COMMAND(condition) print("\nAssert\n\t(%s)==false \n\tfile: %s:%d function: %s\n",#condition,__FILE__, __LINE__,__FUNCTION__);
+
+#ifdef QUIT_PLUTO //check if pluto is used
+    #define EXIT_COMMAND(status) QUIT_PLUTO(status);
+    #ifdef PARALLEL
+        #undef PRINT_COMMAND
+        #define PRINT_COMMAND(condition) print("\nAssert: Process %d \n\t(%s)==false \n\tfile: %s:%d function: %s\n",prank,#condition,__FILE__, __LINE__,__FUNCTION__);
+    #endif
+#else
+    #define EXIT_COMMAND(status) exit(status);
+#endif
+
+#ifdef DEBUG
+    #define assert(condition)\
+        if(!(condition))\
+        {\
+            PRINT_COMMAND(condition);\
+            print("\n\n");\
+            BACKTRACE_COMMAND;\
+            EXIT_COMMAND(1);\
+        }
+#else
+    #define assert(condition)
+#endif
+
+#endif
diff -rupN PLUTO4/Src/Radiation/backtrace.c PLUTO_RADIATION_MOD/Src/Radiation/backtrace.c
--- PLUTO4/Src/Radiation/backtrace.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/backtrace.c	2013-06-01 18:33:00.212214819 +0200
@@ -0,0 +1,183 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "pluto.h"
+#include "backtrace.h"
+
+#include <unistd.h>     //for function access
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <execinfo.h>
+
+/**
+    Executes the command given by \a command and reads size bytes form is
+    output and stores it in \a output
+
+    \param[in]  command
+    \param[in]  size
+    \param[out] output
+
+    \returns    the number of read bytes
+*/
+int ExecuteCommand( char *command, char *output, unsigned int size )
+{
+    unsigned int blocksize = 128;
+    unsigned int read_size = 0, remaining_size = size - 1, total_read = 0;
+    char *current_buffer_start = output;
+
+    FILE *program = popen( command, "r" );
+    if( !program )
+    {
+        return 0;
+    }
+
+    while( !feof( program ) && !ferror( program ) )
+    {
+        if( remaining_size < blocksize )
+        {
+            blocksize = remaining_size;
+        }
+
+        read_size = fread( current_buffer_start, 1, blocksize, program );
+        remaining_size = remaining_size - read_size;
+        current_buffer_start = current_buffer_start + read_size;
+        total_read += read_size;
+    }
+    output[total_read] = '\0';
+    pclose( program );
+    return total_read;
+}
+
+/**
+    This function parses a string (line) returned by the function backtrace_symbols()
+    and prints the parsed components.
+
+    \param[in]  str
+*/
+void PrintBacktraceString( char *str )
+{
+    const int buffer_size = 1024;
+    int string_length = 0, i = 0;
+    char buffer[buffer_size];
+    char *empty_string = " ";
+
+    const unsigned int addr2line_buffer_size = 512;
+    unsigned int addr2line_size = 0;
+    char addr2line_buffer[addr2line_buffer_size];
+    char addr2line_command[addr2line_buffer_size];
+
+    char *program = NULL;
+    char *function = NULL;
+    char *function_offset = NULL;
+    char *return_adress = NULL;
+    char *file = empty_string;
+
+    if( str == NULL )
+    {
+        print( "\t%-30s %-50s %-8s %-16s %s\n", "file", "function name", "f. offset", "return adress", "programm" );
+        print( "\t---------------------------------------------------------------------------------------------------------------------\n" );
+        return;
+    }
+
+    string_length = strlen( str );
+
+    if( string_length < buffer_size )
+    {
+        memcpy( buffer, str, string_length );
+
+        program = buffer;
+        for( i = 0; i < string_length; ++i )
+        {
+            if( buffer[i] == '(' )
+            {
+                buffer[i] = '\0';
+                function = &buffer[i + 1];
+            }
+            else if( buffer[i] == '+' )
+            {
+                buffer[i] = '\0';
+                function_offset = &buffer[i + 1];
+            }
+            else if( buffer[i] == ')' )
+            {
+                buffer[i] = '\0';
+            }
+            else if( buffer[i] == '[' )
+            {
+                buffer[i] = '\0';
+                return_adress = &buffer[i + 1];
+            }
+            else if( buffer[i] == ']' )
+            {
+                buffer[i] = '\0';
+            }
+        }
+
+        if( program == NULL ) program = empty_string;
+        if( function == NULL ) function = empty_string;
+        if( function_offset == NULL ) function_offset = empty_string;
+        if( return_adress == NULL ) return_adress = empty_string;
+
+        snprintf( addr2line_command, addr2line_buffer_size, "addr2line -i -s -e %s %s", program, return_adress );
+        addr2line_size = ExecuteCommand( addr2line_command, addr2line_buffer, addr2line_buffer_size );
+        for( i = 0; i < addr2line_size; ++i )
+        {
+//          printf("%d %c\n",addr2line_buffer[i],addr2line_buffer[i]);
+            if( addr2line_buffer[i] == '\n' || addr2line_buffer[i] == '\r' )
+            {
+                addr2line_buffer[i] = '\0';
+            }
+        }
+        if( addr2line_size )
+        {
+            if( strcmp( addr2line_buffer, "??:0" ) != 0 )
+            {
+                file = addr2line_buffer;
+            }
+        }
+        print( "\t%-30s %-50s %-10s %-16s %s\n", file, function, function_offset, return_adress, program );
+    }
+    else
+    {
+        print( "%s\n", str );
+    }
+}
+
+/**
+    Prints the current functions on the stack
+*/
+void PrintBacktrace()
+{
+    const int buffer_size = 100;
+    void *buffer[buffer_size];
+    int nptrs = 0, i = 0;
+    char **strings;
+
+    nptrs = backtrace( buffer, buffer_size );
+    print( "Functions on stack\n" );
+    strings = backtrace_symbols( buffer, nptrs );
+    PrintBacktraceString( NULL );
+    for( i = 0; i < nptrs; i++ )
+    {
+        PrintBacktraceString( strings[i] );
+    }
+
+    free( strings );
+}
diff -rupN PLUTO4/Src/Radiation/backtrace.h PLUTO_RADIATION_MOD/Src/Radiation/backtrace.h
--- PLUTO4/Src/Radiation/backtrace.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/backtrace.h	2013-06-01 18:33:00.178214820 +0200
@@ -0,0 +1,26 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BACKTRACE_H
+#define BACKTRACE_H
+
+int ExecuteCommand( char *command, char *output, unsigned int size );
+void PrintBacktrace();
+
+#endif
diff -rupN PLUTO4/Src/Radiation/error.h PLUTO_RADIATION_MOD/Src/Radiation/error.h
--- PLUTO4/Src/Radiation/error.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/error.h	2013-06-01 18:33:00.184214820 +0200
@@ -0,0 +1,40 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef ERROR_H
+#define ERROR_H
+
+#ifdef QUIT_PLUTO
+    #define QUIT_COMMAND(exit_code) QUIT_PLUTO(exit_code)
+#else
+    #define QUIT_COMMAND(exit_code) exit(exit_code)
+#endif
+
+/**
+    Macro that checks if an error occurred while memory allocation by malloc, calloc,... .
+*/
+#define CHECK_ALLOCATED_MEMORY(pointer) if(pointer == NULL) {print("\nMemory allocation failed:\n\t process %d: in file %s:%d inside function %s\n",prank,__FILE__, __LINE__,__FUNCTION__); QUIT_COMMAND(1);}
+
+#define ERROR(args...)\
+    print("Error:\n  %-10s: %s \n  %-10s: %s:%d\n  %-10s: ","function",__PRETTY_FUNCTION__,"file",__FILE__,__LINE__,"message");\
+    print (args);\
+    print("\n");\
+    QUIT_COMMAND(1);
+
+#endif
diff -rupN PLUTO4/Src/Radiation/irradiation.c PLUTO_RADIATION_MOD/Src/Radiation/irradiation.c
--- PLUTO4/Src/Radiation/irradiation.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/irradiation.c	2013-06-01 18:33:00.231214818 +0200
@@ -0,0 +1,402 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "irradiation.h"
+#include "radiation.h"
+
+#if IRRADIATION == YES
+
+#if GEOMETRY != SPHERICAL
+    #error IRRADIATION needs spherical coordinates!
+#endif
+
+IrradiationData irradiation;
+
+/**
+    Initializes the irradiation submodule:
+
+    \param[in]  grid
+*/
+void IrradiationInit( Grid *grid )
+{
+    int n = 0, k, j, i;
+    irradiation.neighbour.receive_rank = -1;
+    irradiation.neighbour.send_rank = -1;
+
+    irradiation.S = ( double ** * )Array3D( NX3_TOT, NX2_TOT, NX1_TOT, sizeof( double ) );
+
+    irradiation.data_buffer = malloc( sizeof( double ) * ( NX2 * NX3 ) );
+    irradiation.optical_depth_offset = malloc( sizeof( double ) * ( NX2 * NX3 ) );
+
+    for( n = 0; n < NX2 * NX3; ++n )
+    {
+        irradiation.optical_depth_offset[n] = 0.;
+    }
+
+    IrradiationFindCommunicationNeighbours( grid );
+}
+
+/**
+    Frees all the allocated memory
+*/
+void IrradiationFinalise( void )
+{
+    FreeArray3D( ( void * ) irradiation.S );
+    free( irradiation.data_buffer );
+    free( irradiation.optical_depth_offset );
+}
+
+/**
+    In this function we iterate over all local domains and search for the neighbors of a specific processor with prank == \a current_rank.
+    The found neighbors are stored in \a cn as the \a cn->receive_rank and \a cn->send_rank.
+
+    \note
+    If \a cn->receive_rank or \a cn->send_rank is set to -1 this means there is no neighbor before or after the local domain of the processor with
+    prank == \a current_rank.
+
+    \param[in]  current_rank
+    \param[in]  domain_info_array
+    \param[in]  nproc
+    \param[out] cn
+
+*/
+void IrradiationFindCommunicationNeighbour( int current_rank, LocalDomainInfo *domain_info_array, int nproc, CommunicationNeighbour *cn )
+{
+    int n = 0;
+    LocalDomainInfo *cdi = &domain_info_array[current_rank];
+
+    cn->receive_rank = -1;
+    cn->send_rank = -1;
+
+    for( n = 0; n < nproc; ++n )
+    {
+        if( n != current_rank )
+        {
+            if( cdi->x1_begin - 1 == domain_info_array[n].x1_end && cdi->x2_begin == domain_info_array[n].x2_begin && cdi->x2_end == domain_info_array[n].x2_end && cdi->x3_begin == domain_info_array[n].x3_begin && cdi->x3_end == domain_info_array[n].x3_end )
+            {
+                cn->receive_rank = n;
+            }
+            else if( cdi->x1_end + 1 == domain_info_array[n].x1_begin && cdi->x2_begin == domain_info_array[n].x2_begin && cdi->x2_end == domain_info_array[n].x2_end && cdi->x3_begin == domain_info_array[n].x3_begin && cdi->x3_end == domain_info_array[n].x3_end )
+            {
+                cn->send_rank = n;
+            }
+        }
+    }
+}
+
+/**
+    This function computes the radial neighbors for each process.\n
+    As a simple example we assume a one dimensional domain starting at 0 and ending at 9. If we use 3 processors the local domain for the processor with prank == 0
+    starts at 0 and ends at 3 for prank == 1 it starts at 3 and ends at 6 and for the last processor with prank == 2 it starts at 6 and ends at 9. For this example
+    this function will find the following:\n
+    prank == 0: \n
+        irradiation.neighbour.receive_rank = -1 \n
+        irradiation.neighbour.send_rank = 1 \n
+    prank == 1: \n
+        irradiation.neighbour.receive_rank = 0 \n
+        irradiation.neighbour.send_rank = 2 \n
+    prank == 2: \n
+        irradiation.neighbour.receive_rank = 1 \n
+        irradiation.neighbour.send_rank = -1 \n
+    \n
+    This function is needed because for computing the energy brought by the radiation of the central star to a specific grid cell we need to compute the optical
+    depth \f$ \tau_{i,j,k} \f$.
+    \f[
+        \tau_{i,j,k} \approx \sum_{n=0}^{i}  \kappa_{R_{i,j,k}} \rho_{i,j,k} \Delta r_i
+    \f]
+    The optical depth at the grid cell \f$ r_i, \theta_j, \phi_k \f$ depends on the optical depth of the grid cell \f$ r_{i-1}, \theta_j, \phi_k \f$. In the case
+    that the simulation is done with only one core(processor) this is no problem. If we do the simulation in parallel the optical depth at a specific grid cell can
+    depend on the optical depth which is computed by a different processor. This is the reason that we need to find the neighbors in r direction on which the computation
+    of the optical depth depends on.
+
+    The neighbors are then stored in a structure so that we can do the communication without further checks!
+
+    \param[in]  grid
+*/
+void IrradiationFindCommunicationNeighbours( Grid *grid )
+{
+    int nproc = 0, n = 0;
+    LocalDomainInfo ldi;
+    LocalDomainInfo *domain_info_array = NULL;
+    LocalDomainInfo *item = NULL;
+    CommunicationNeighbour *neighbour_info_array = NULL;
+    MPI_Status status;
+
+    MPI_Comm_size( MPI_COMM_WORLD, &nproc );
+
+    ldi.x1_begin = grid[IDIR].beg;
+    ldi.x1_end = grid[IDIR].end;
+
+    ldi.x2_begin = grid[JDIR].beg;
+    ldi.x2_end = grid[JDIR].end;
+
+    ldi.x3_begin = grid[KDIR].beg;
+    ldi.x3_end = grid[KDIR].end;
+
+
+    if( prank == 0 )
+    {
+        domain_info_array = malloc( sizeof( LocalDomainInfo ) * nproc );
+        neighbour_info_array = malloc( sizeof( CommunicationNeighbour ) * nproc );
+    }
+
+    MPI_Gather( &ldi, sizeof( LocalDomainInfo ), MPI_CHAR, domain_info_array, sizeof( LocalDomainInfo ), MPI_CHAR, 0, MPI_COMM_WORLD );
+
+    if( prank == 0 )
+    {
+//      for(n = 0; n < nproc; ++n)
+//      {
+//          item = &domain_info_array[n];
+//          print("rank = %3d || x1b = %3d x1e = %3d | x2b = %3d x2e = %3d | x3b = %3d x3e = %3d \n",n,item->x1_begin,item->x1_end,item->x2_begin,item->x2_end,item->x3_begin,item->x3_end);
+//      }
+//      print("\n\n");
+
+        for( n = 0; n < nproc; ++n )
+        {
+            IrradiationFindCommunicationNeighbour( n, domain_info_array, nproc, &neighbour_info_array[n] );
+//          print("rank = %3d || receive_id = %3d send_id = %3d\n",n,neighbour_info_array[n].receive_rank,neighbour_info_array[n].send_rank);
+        }
+
+        for( n = 0; n < nproc; ++n )
+        {
+            if( n != 0 )
+            {
+                MPI_Send( &neighbour_info_array[n], sizeof( CommunicationNeighbour ), MPI_CHAR, n, 0, MPI_COMM_WORLD );
+            }
+        }
+
+        irradiation.neighbour.receive_rank = neighbour_info_array[0].receive_rank;
+        irradiation.neighbour.send_rank = neighbour_info_array[0].send_rank;
+
+        free( domain_info_array );
+        free( neighbour_info_array );
+    }
+    else
+    {
+        MPI_Recv( &irradiation.neighbour, sizeof( CommunicationNeighbour ), MPI_CHAR, 0, 0, MPI_COMM_WORLD, &status );
+    }
+}
+
+/**
+    In this function we compute the optical depth \f$ \tau_{i,j,k} \f$.
+    \f[
+        \tau_{i,j,k} \approx \sum_{n=0}^{i}  \kappa_{R_{i,j,k}} \rho_{i,j,k} \Delta r_i
+    \f]
+    for each local domain where we assume that the local domain is for each processor the total domain.
+    By doing this there is for each local domain an offset missing. In the case that the local domain
+    of a processor is the innermost domain the offset is zero else the offset is greater than zero.
+    \n
+    In three dimensions the offset depends on \f$ \theta \f$ and \f$ \phi \f$ so it is not a
+    single number but an array which represents an slice in the \f$ \theta \f$, \f$ \phi \f$
+    plain of the each local domain. The initial offsets are the \f$ \tau_{i,j,k} \f$ values with the
+    highest values of \f$ r \f$ in the innermost domain. The offsets are then send from the innermost
+    processor to its next radial neighbor. This neighbor receives the offset, adds to each offset
+    the corresponding \f$ \tau_{i,j,k} \f$ values with the highest value of \f$ r \f$ in its local domain
+    and sends it to the its radial neighbor and so on.
+
+    \note
+    The calculated optical depth is temporary stored in \a irradiation.S
+
+    \param[in]  grid
+    \param[in]  data
+
+*/
+void IrradiationCalculateOpticalDepthPerDomain( Grid *grid, Data *data )
+{
+    int k, j, i, n;
+    double optical_depth = 0.;
+    double cgs_temperature = 0.0;
+    double density = 0.0, cgs_density = 0.0;
+    MPI_Status status;
+
+    for( k = KBEG; k <= KEND; k++ )
+    {
+        for( j = JBEG; j <= JEND; j++ )
+        {
+            optical_depth = 0.0;
+            irradiation.S[k][j][IBEG] = optical_depth;
+            for( i = IBEG; i <= IEND; i++ )
+            {
+                cgs_temperature = GetTemperature( k, j, i, data ) * g_unitTemperature;
+                density = data->Vc[RHO][k][j][i];
+                cgs_density = density * g_unitDensity;
+
+                optical_depth += ( IrradiationOpacity( cgs_density, cgs_temperature ) * g_unitDensity * g_unitLength ) * density * grid[IDIR].dx[i];
+
+                irradiation.S[k][j][i + 1] = optical_depth;
+            }
+        }
+    }
+
+    #ifdef IRRADIATION_INERTIAL_OPTICAL_DEPTH_OFFSET
+        if( irradiation.neighbour.receive_rank == -1 && irradiation.neighbour.send_rank != -1 ) //no neighbor in between the star and the current domain
+        {
+            n = 0;
+            for( k = 0; k < KBEG; k++ )
+            {
+                for( j = 0; j < JBEG; j++ )
+                {
+                    optical_depth = 0.0;
+                    for( i = 0; i < IBEG; i++ )
+                    {
+                        cgs_temperature = GetTemperature( k, j, i, data ) * g_unitTemperature;
+                        density = data->Vc[RHO][k][j][i];
+                        cgs_density = density * g_unitDensity;
+
+                        optical_depth += ( IrradiationOpacity( cgs_density, cgs_temperature ) * g_unitDensity * g_unitLength ) * density * grid[IDIR].dx[i];
+                    }
+                    irradiation.optical_depth_offset[n] = optical_depth;
+                    n++;
+                }
+            }
+        }
+    #endif
+
+    if( irradiation.neighbour.receive_rank != irradiation.neighbour.send_rank ) //check if more than one process is in the communicator (nproc > 1)
+    {
+        if( irradiation.neighbour.receive_rank == -1 && irradiation.neighbour.send_rank != -1 ) //no neighbor in between the star and the current domain
+        {
+            n = 0;
+            i = IEND + 1;
+            for( k = KBEG; k <= KEND; k++ )
+            {
+                for( j = JBEG; j <= JEND; j++ )
+                {
+                    irradiation.data_buffer[n] = irradiation.S[k][j][i];
+                    #ifndef IRRADIATION_INERTIAL_OPTICAL_DEPTH_OFFSET
+                        irradiation.optical_depth_offset[n] = 0.;
+                    #endif
+                    n++;
+                }
+            }
+            MPI_Send( irradiation.data_buffer, sizeof( double ) * ( NX2 * NX3 ), MPI_CHAR, irradiation.neighbour.send_rank, 0, MPI_COMM_WORLD );
+        }
+        else
+        {
+            MPI_Recv( irradiation.optical_depth_offset , sizeof( double ) * ( NX2 * NX3 ), MPI_CHAR, irradiation.neighbour.receive_rank, 0, MPI_COMM_WORLD, &status );
+
+            n = 0;
+            i = IEND + 1;
+            for( k = KBEG; k <= KEND; k++ )
+            {
+                for( j = JBEG; j <= JEND; j++ )
+                {
+                    irradiation.data_buffer[n] = irradiation.optical_depth_offset[n] + irradiation.S[k][j][i];
+                    n++;
+                }
+            }
+
+            if( irradiation.neighbour.send_rank != -1 )
+            {
+                MPI_Send( irradiation.data_buffer, sizeof( double ) * ( NX2 * NX3 ), MPI_CHAR, irradiation.neighbour.send_rank, 0, MPI_COMM_WORLD );
+            }
+
+        }
+        MPI_Barrier( MPI_COMM_WORLD );
+    }
+}
+
+/**
+    This function calculates \f$ S \f$
+    \f[
+        S_{i,j,k} =  \frac{3 \sigma T_\star^4 R^2_\star \left( e^{-\tau_i} - e^{-\tau_{i+1}}\right) }{r_{i+1}^3 - r_i^3}
+    \f]
+
+
+    \f$ S \f$ is a term which is added to the right hand side of the equations of radiation transport. This equations then look like
+
+    \f[
+        \frac{\partial E}{\partial t}  = \nabla \overbrace{K\nabla E}^{-\vec{F}} + \kappa_P\rho c \left( a_R T^4 - E\right)
+    \f]
+    \f[
+        \frac{\partial \rho \epsilon}{\partial t} = -\kappa_P \rho c ( a_R T^4 - E) + S
+    \f]
+
+    \param[in]  grid
+    \param[in]  data
+
+**/
+void IrradiationCalculateS( Grid *grid, Data *data )
+{
+    int k, j, i, n;
+//  double optical_depth,density,temperature;
+    double optical_depth_i, optical_depth_ip1;
+
+    IrradiationCalculateOpticalDepthPerDomain( grid, data );
+
+    n = 0;
+    for( k = KBEG; k <= KEND; k++ )
+    {
+        for( j = JBEG; j <= JEND; j++ )
+        {
+            for( i = IBEG; i <= IEND; i++ )
+            {
+                optical_depth_i = irradiation.optical_depth_offset[n] + irradiation.S[k][j][i];
+                optical_depth_ip1 = irradiation.optical_depth_offset[n] + irradiation.S[k][j][i + 1];
+
+                irradiation.S[k][j][i] = ( 3.0 * irradiation.star.Ln * ( exp( -1.0 * optical_depth_i ) - exp( -1.0 * optical_depth_ip1 ) ) ) / ( POW3( grid[IDIR].xr[i] ) - POW3( grid[IDIR].xl[i] ) );
+            }
+            n++;
+        }
+    }
+}
+
+/**
+    Sets the radius and the temperature of the central star.
+
+    \note
+    The luminosity \f$ L \f$ is given by
+    \f[
+        L = 4 \pi R^2 \sigma T^4
+    \f]
+    with
+    \f[
+        \sigma = \frac{2\pi^5 k_B^4}{15h^3 c^2}
+    \f]
+    In the code we define \f$ Ln \f$ which is given by
+    \f[
+        Ln = \frac{L}{4 \pi}
+    \f]
+
+    \param[in]  R   the radius of the star in code units
+    \param[in]  T   the temperature of the star in code units (note normally UNIT_TEMPERATURE is set to 1 so code units mean Kelvin)
+
+**/
+void IrradiationSetStarProperties( double R, double T )
+{
+//  double code_h = CONST_h / (g_unitDensity * POW4(UNIT_LENGTH) * g_unitVelocity);
+//  double sigma = 2.0 * POW5(M_PI) * POW4(code_kB) / (15.0 * POW3(code_h) * POW2(code_c));
+
+    double sigma = ( 2.0 * POW5( CONST_PI ) * POW4( CONST_kB ) / ( 15.0 * POW3( CONST_h ) * POW2( CONST_c ) ) ) / ( g_unitDensity * POW3( g_unitVelocity ) );
+
+
+    irradiation.star.R = R;
+    irradiation.star.T = T;
+
+    irradiation.star.Ln = POW2( irradiation.star.R ) * sigma * POW4( irradiation.star.T );
+    irradiation.star.L = 4.0 * M_PI * irradiation.star.Ln;
+
+    irradiation.star.x = 0.;
+    irradiation.star.y = 0.;
+    irradiation.star.z = 0.;
+
+    irradiation.star.central = 1;
+}
+
+#endif //if IRRADIATION==YES
diff -rupN PLUTO4/Src/Radiation/irradiation.h PLUTO_RADIATION_MOD/Src/Radiation/irradiation.h
--- PLUTO4/Src/Radiation/irradiation.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/irradiation.h	2013-06-01 18:33:00.219214819 +0200
@@ -0,0 +1,81 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef IRRADIATION_H
+#define IRRADIATION_H
+
+#include "pluto.h"
+
+typedef struct LOCAL_DOMAIN_INFO
+{
+    int x1_begin;
+    int x1_end;
+
+    int x2_begin;
+    int x2_end;
+
+    int x3_begin;
+    int x3_end;
+
+} LocalDomainInfo;
+
+typedef struct COMMUNICATION_NEIGHBOUR
+{
+    int receive_rank;
+    int send_rank;
+} CommunicationNeighbour;
+
+typedef struct STAR_PROPERTIES
+{
+    double R;           /// Radius
+    double T;           /// Temperature of the star
+    double Ln;          /// \f$ Ln = R_\star^2 \sigma T_\star^4 \f$
+    double L;           /// \f$ L = 4 \pi R_\star^2 \sigma T_\star^4 \f$
+
+    double x, y, z;     /// the position of the star (in Cartesian coordinates)
+    int central;        ///if central == 1 then the star is in the center of the coordinate system (only important in spherical coordinates)
+} StarProperties;
+
+typedef struct IRRADIATION_DATA
+{
+    CommunicationNeighbour neighbour;
+    double **   *S;
+    double *data_buffer;
+    double *optical_depth_offset;
+
+    StarProperties star;
+
+} IrradiationData;
+
+
+extern IrradiationData irradiation;
+
+void IrradiationInit( Grid *grid );
+void IrradiationFinalise( void );
+
+void IrradiationFindCommunicationNeighbours( Grid *grid );
+void IrradiationCalculateS( Grid *grid, Data *data );
+
+void IrradiationSetStarProperties( double R, double T );
+
+void IrradiationFindCommunicationNeighbour( int current_rank, LocalDomainInfo *domain_info_array, int nproc, CommunicationNeighbour *cn );
+void IrradiationCalculateOpticalDepthPerDomain( Grid *grid, Data *data );
+
+double IrradiationOpacity( double density, double temperature );
+#endif
diff -rupN PLUTO4/Src/Radiation/LICENSE PLUTO_RADIATION_MOD/Src/Radiation/LICENSE
--- PLUTO4/Src/Radiation/LICENSE	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/LICENSE	2013-06-01 18:33:00.191214820 +0200
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff -rupN PLUTO4/Src/Radiation/makefile PLUTO_RADIATION_MOD/Src/Radiation/makefile
--- PLUTO4/Src/Radiation/makefile	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/makefile	2013-06-01 18:33:00.189214820 +0200
@@ -0,0 +1,72 @@
+VPATH += $(SRC)/Radiation
+VPATH += $(SRC)/Radiation/SemenovOpacity
+
+HEADERS += radiation.h modify_pluto.h radiation_tools.h opacity.h irradiation.h assert.h error.h
+
+OBJ += radiation.o
+OBJ += radiation_tools.o
+OBJ += modify_pluto.o
+OBJ += opacity.o
+OBJ += irradiation.o
+OBJ := $(patsubst main.o,radiation_main.o,$(OBJ))
+
+#Semenov opacity
+HEADERS += generate_opacity.h semenov_opacity.h
+OBJ += generate_opacity.o
+OBJ += semenov_opacity.o
+CFLAGS += -DSEMENOV_OPACITY_PATH="\"$(SRC)/Radiation/SemenovOpacity/\""
+
+ifeq (,$(findstring backtrace.o,$(OBJ)))
+# Not found
+	HEADERS += backtrace.h
+	OBJ += backtrace.o
+endif
+
+#Check file definition.h for RADIATION_SOLVER. If it is set to yes all needed petsc files are compiles else wise not
+CHECK_PETSC_STRING := ${shell grep RADIATION\_SOLVER definitions.h}
+CHECK_PETSC_STRING := $(patsubst \#define,,$(CHECK_PETSC_STRING))
+CHECK_PETSC_STRING := $(patsubst RADIATION_SOLVER,,$(CHECK_PETSC_STRING))
+CHECK_PETSC_STRING := $(strip $(CHECK_PETSC_STRING))
+ifeq "$(CHECK_PETSC_STRING)" "PETSC_LIBRARY"
+	HEADERS += petsc_tools.h petsc_initialize_advanced.h petsc.h
+	OBJ += petsc_initialize_advanced.o
+	OBJ += petsc_tools.o
+	OBJ += petsc.o
+
+	include ${PETSC_DIR}/conf/variables
+	CFLAGS += ${PETSC_INCLUDE}
+	CFLAGS += ${PETSC_CC_INCLUDES}
+	LDFLAGS += ${PETSC_KSP_LIB}
+endif
+
+#Check file definition.h for PHYSICS HD or MHD.
+CHECK_PHYSICS_STRING := ${shell grep PHYSICS definitions.h}
+CHECK_PHYSICS_STRING := $(patsubst \#define,,$(CHECK_PHYSICS_STRING))
+CHECK_PHYSICS_STRING := $(patsubst PHYSICS,,$(CHECK_PHYSICS_STRING))
+CHECK_PHYSICS_STRING := $(strip $(CHECK_PHYSICS_STRING))
+ifeq "$(CHECK_PHYSICS_STRING)" "HD"
+	OBJ := $(patsubst rhs.o,radiation_hd_rhs.o,$(OBJ))
+endif
+ifeq "$(CHECK_PHYSICS_STRING)" "MHD"
+	OBJ := $(patsubst rhs.o,radiation_mhd_rhs.o,$(OBJ))
+endif
+
+CFLAGS += -Wall -Wno-unused-variable
+
+# ifdef DEBUG
+# 	CFLAGS += -DDEBUG
+#	CFLAGS := $(patsubst -O3,-g3 -O0,$(CFLAGS))
+# 	CFLAGS := $(patsubst -O3,-g3 -ggdb3 -O0,$(CFLAGS))
+# endif
+
+INCLUDE_DIRS+= -I$(SRC)/Radiation/
+
+print_flags:
+	@echo $(CFLAGS)
+	@echo $(LDFLAGS)
+	@echo $(OBJ)
+
+cleanall: clean
+	-@rm pluto
+	-@rm sysconf.out
+	-@rm *~
diff -rupN PLUTO4/Src/Radiation/modify_pluto.c PLUTO_RADIATION_MOD/Src/Radiation/modify_pluto.c
--- PLUTO4/Src/Radiation/modify_pluto.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/modify_pluto.c	2013-06-01 18:33:00.180214820 +0200
@@ -0,0 +1,66 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "radiation.h"
+#include "modify_pluto.h"
+
+#include "string.h"
+
+/**
+    This function modifies the element \a output[i] of the struct Input in that way that pluto can save
+    the the content of \a array to the disc in the same way as the common PLUTO variables.
+
+    \note For more information look at the file set_output.c and initialize.c
+
+    \param[in]  input
+    \param[in]  var_name    the short name of the variable stored int \a array (this is used in the files like dbl.out,...)
+    \param[in]  array
+*/
+void AppendArrayToPlutoFileOutput( Input *input, char *var_name, double *** array )
+{
+    int n = 0;
+    int nvar = input->output[0].nvar, current_pos = nvar;
+
+
+    for( n = 0; n < MAX_OUTPUT_TYPES; n++ )
+    {
+        input->output[n].nvar = nvar + 1;
+
+        strcpy( input->output[n].var_name[current_pos], var_name );
+        input->output[n].V[current_pos] = array;
+        input->output[n].stag_var[current_pos] = -1;
+//      input->output[n].mode[current_pos] = input->output[n].mode[0];
+
+        switch( input->output->type )
+        {
+            case DBL_OUTPUT:
+            case FLT_OUTPUT:
+            case VTK_OUTPUT:
+            case TAB_OUTPUT:
+            case DBL_H5_OUTPUT:
+            case FLT_H5_OUTPUT:
+                input->output[n].dump_var[current_pos] = YES;
+                break;
+
+            default:
+                input->output[n].dump_var[current_pos] = NO;
+                break;
+        }
+    }
+}
diff -rupN PLUTO4/Src/Radiation/modify_pluto.h PLUTO_RADIATION_MOD/Src/Radiation/modify_pluto.h
--- PLUTO4/Src/Radiation/modify_pluto.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/modify_pluto.h	2013-06-01 18:33:00.238214818 +0200
@@ -0,0 +1,25 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef MODIFY_PLUTO_H
+#define MODIFY_PLUTO_H
+
+void AppendArrayToPlutoFileOutput( Input *input, char *var_name, double *** array );
+
+#endif
diff -rupN PLUTO4/Src/Radiation/opacity.c PLUTO_RADIATION_MOD/Src/Radiation/opacity.c
--- PLUTO4/Src/Radiation/opacity.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/opacity.c	2013-06-01 18:33:00.236214818 +0200
@@ -0,0 +1,263 @@
+/**
+Copyright (C) 2011-2013 Tobias Müller (ported form Fortran routines of Wilhelm Kley).
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <math.h>
+#include "opacity.h"
+
+/**
+    Opacities after Lin & Papaloizou (1985)
+
+    Doug's Opacities for Ice, grains, slightly modified
+
+    \param[in] density      density in cgs units
+    \param[in] temperature  temperature in cgs units
+    \returns opacity in cgs units
+*/
+double RosselandOpacityLinPapaloizou1985( double density, double temperature )
+{
+    /*if (density < 1e-10)
+        density = 1e-10;*/
+
+    const double power1 = 4.44444444e-2;
+    const double power2 = 2.381e-2;
+    const double power3 = 2.267e-1;
+
+    const double t234 = 1.6e3;
+    const double t456 = 5.7e3;
+    const double t678 = 2.28e6;
+
+    /* coefficients for opacity laws 1, 2, and 3 in cgs units */
+    const double ak1 = 2.e-4;
+    const double ak2 = 2.e16;
+    const double ak3 = 5.e-3;
+
+    /* coefficients for opacity laws 3, 4, 5, 6, 7, and 8 in T_4 units */
+    const double bk3 = 50.;
+    const double bk4 = 2.e-2;
+    const double bk5 = 2.e4;
+    const double bk6 = 1.e4;
+    const double bk7 = 1.5e10;
+    const double bk8 = 0.348;
+
+    /* test T against (T_23 * T_34 * T_34)**0.333333333 */
+    if( temperature > t234 * pow( density, power1 ) )
+    {
+        /* to avoid overflow */
+        double ts4 = 1.e-4 * temperature;
+        double density13 = pow( density, 1.0 / 3.0 );
+        double density23 = density13 * density13;
+        double ts42 = ts4 * ts4;
+        double ts44 = ts42 * ts42;
+        double ts48 = ts44 * ts44;
+
+        /* test T against (T_45 * T_56)**0.5 */
+        if( temperature > t456 * pow( density, power2 ) )
+        {
+            if( ( temperature < t678 * pow( density, power3 ) ) || ( density <= 1e-10 ) )
+            {
+                /* disjoint opacity laws for 5, 6, and 7 */
+                double o5 = bk5 * density23 * ts42 * ts4;
+                double o6 = bk6 * density13 * ts48 * ts42;
+                double o7 = bk7 * density / ( ts42 * sqrt( ts4 ) );
+
+                /* parameters used for smoothing */
+                double o6an = o6 * o6;
+                double o7an = o7 * o7;
+
+                /* smoothed and continuous opacity law for regions 5, 6, and 7 */
+                return pow( pow( o6an * o7an / ( o6an + o7an ), 2 ) + pow( o5 / ( 1.0 + pow( ts4 / ( 1.1 * pow( density, 0.04762 ) ), 10.0 ) ), 4.0 ), 0.25 );
+            }
+            else
+            {
+                /* disjoint opacity laws for 7 and 8 */
+                double o7 = bk7 * density / ( ts42 * sqrt( ts4 ) );
+                double o8 = bk8;
+
+                /* parameters used for smoothing */
+                double o7an = o7 * o7;
+                double o8an = o8 * o8;
+
+                /* smoothed and continuous opacity law for regions 7 and 8 */
+                return pow( o7an * o7an + o8an * o8an, 0.25 );
+
+                /* no scattering */
+                //return bk7*density/(ts42*sqrt(ts4));
+            }
+        }
+        else
+        {
+            /*  disjoint opacity laws for 3, 4, and 5 */
+            double o3 = bk3 * ts4;
+            double o4 = bk4 * density23 / ( ts48 * ts4 );
+            double o5 = bk5 * density23 * ts42 * ts4;
+            /* parameters used for smoothing */
+            double o4an = o4 * o4 * o4 * o4;
+            double o3an = o3 * o3 * o3;
+
+            /* smoothed and continuous opacity law for regions 3, 4, and 5 */
+            return pow( ( o4an * o3an / ( o4an + o3an ) ) + pow( o5 / ( 1.0 + 6.561e-5 / ts48 ), 4 ), 0.25 );
+        }
+    }
+    else
+    {
+        /* different powers of temperature */
+        double t2 = temperature * temperature;
+        double t4 = t2 * t2;
+        double t8 = t4 * t4;
+        double t10 = t8 * t2;
+
+        /* disjoint opacity laws */
+        double o1 = ak1 * t2;
+        double o2 = ak2 * temperature / t8;
+        double o3 = ak3 * temperature;
+
+        /* parameters used for smoothing */
+        double o1an = o1 * o1;
+        double o2an = o2 * o2;
+
+        /* smoothed and continuous opacity law for regions 1, 2, and 3 */
+        return pow( pow( o1an * o2an / ( o1an + o2an ), 2 ) + pow( o3 / ( 1 + 1.e22 / t10 ), 4 ), 0.25 );
+    }
+}
+
+/**
+    Opacities after Bell & Lin (1994)
+
+    OPACITIES UP TO 1-1,000,000 K
+    The opacity table is divided into eight regions:
+    region 1 is dominated by ice grains
+    region 2 is where ice grains melts
+    region 3 is dominated by metal grains
+    region 4 is where metal grains melts
+    region 5 is dominated by molecules
+    region 6 is dominated by H-
+    region 7 is dominated by Kramer's law
+    region 8 is dominated by electron scattering
+
+    The opacity for these eight regions are obtained from fitting Bodemheimer's table to power laws of T and rho.
+    A smooth function is introduced to bring about the transition between each region
+
+    \param density      density in cgs units
+    \param temperature  temperature in cgs units
+    \returns opacity in cgs units
+*/
+double RosselandOpacityBellLin1994( double density, double temperature )
+{
+    const double power1 = 2.8369e-2;
+    const double power2 = 1.1464e-2;
+    const double power3 = 2.2667e-1;
+
+    const double t234 = 1.46e3;
+    const double t456 = 4.51e3;
+    const double t678 = 2.37e6;
+
+    /* coefficients for opacity laws 1, 2, and 3 in cgs units */
+    const double ak1 = 2.e-4;
+    const double ak2 = 2.e16;
+    const double ak3 = 0.1e0;
+
+    /* coefficients for opacity laws 3, 4, 5, 6, 7, and 8 in T_4 units */
+    const double bk3 = 10.;
+    const double bk4 = 2.e-15;
+    const double bk5 = 1e4;
+    const double bk6 = 1e4;
+    const double bk7 = 1.5e10;
+    const double bk8 = 0.348;
+
+    if( temperature < 1 )
+        temperature = 10.0;
+
+    if( temperature > t234 * pow( density, power1 ) )
+    {
+        /* to avoid overflow */
+        double ts4 = 1.e-4 * temperature;
+        double density13 = pow( density, 1.0 / 3.0 );
+        double density23 = density13 * density13;
+        double ts42 = ts4 * ts4;
+        double ts44 = ts42 * ts42;
+        double ts48 = ts44 * ts44;
+
+        /* test T against (T_45 * T_56)**0.5 */
+        if( temperature > t456 * pow( density, power2 ) )
+        {
+            /* test T against (T67 * T78)**.5 */
+            if( ( temperature < t678 * pow( density, power3 ) ) || ( ( ( density <= 1e10 ) && ( temperature < 1e4 ) ) ) )
+            {
+                /* disjoint opacity laws for 5, 6, and 7 */
+                double o5 = bk5 * density23 * ts42 * ts4;
+                double o6 = bk6 * density13 * ts48 * ts42;
+                double o7 = bk7 * density / ( ts42 * sqrt( ts4 ) );
+
+                /* parameters used for smoothing */
+                double o6an = o6 * o6;
+                double o7an = o7 * o7;
+
+                /* smoothed and continuous opacity law for regions 5, 6, and 7 */
+                return pow( pow( ( o6an * o7an / ( o6an + o7an ) ), 2 ) + pow( ( o5 / ( 1 + pow( ( ts4 / ( 1.1 * pow( density, 0.04762 ) ) ), 10 ) ) ), 4 ) , 0.25 );
+            }
+            else
+            {
+                /* disjoint opacity laws for 7 and 8 */
+                double o7 = bk7 * density / ( ts42 * sqrt( ts4 ) );
+                double o8 = bk8;
+
+                /* parameters used for smoothing */
+                double o7an = o7 * o7;
+                double o8an = o8 * o8;
+
+                /* smoothed and continuous opacity law for regions 7 and 8 */
+                return pow( o7an * o7an + o8an * o8an, 0.25 );
+            }
+        }
+        else
+        {
+            /* disjoint opacity laws for 3, 4, and 5 */
+            double o3 = bk3 * sqrt( ts4 );
+            double o4 = bk4 * density / ( ts48 * ts48 * ts48 );
+            double o5 = bk5 * density23 * ts42 * ts4;
+
+            /* parameters used for smoothing */
+            double o4an = pow( o4, 4 );
+            double o3an = pow( o3, 4 );
+
+            /* smoothed and continuous opacity law for regions 3, 4, and 5 */
+            return pow( ( o4an * o3an / ( o4an + o3an ) ) + pow( o5 / ( 1 + 6.561e-5 / ts48 * 1e2 * density23 ), 4 ), 0.25 );
+        }
+    }
+    else
+    {
+        /* different powers of temperature */
+        double t2 = temperature * temperature;
+        double t4 = t2 * t2;
+        double t8 = t4 * t4;
+        double t10 = t8 * t2;
+
+        /* disjoint opacity laws */
+        double o1 = ak1 * t2;
+        double o2 = ak2 * temperature / t8;
+        double o3 = ak3 * sqrt( temperature );
+
+        /* parameters used for smoothing */
+        double o1an = o1 * o1;
+        double o2an = o2 * o2;
+
+        /* smoothed and continuous opacity law for regions 1, 2, and 3 */
+        return pow( pow( o1an * o2an / ( o1an + o2an ), 2 ) + pow( o3 / ( 1 + 1.e22 / t10 ), 4 ), 0.25 );
+    }
+}
diff -rupN PLUTO4/Src/Radiation/opacity.h PLUTO_RADIATION_MOD/Src/Radiation/opacity.h
--- PLUTO4/Src/Radiation/opacity.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/opacity.h	2013-06-01 18:33:00.186214820 +0200
@@ -0,0 +1,26 @@
+/**
+Copyright (C) 2011-2013 Tobias Müller (ported form Fortran routines of Wilhelm Kley).
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef OPACITY_H
+#define OPACITY_H
+
+double RosselandOpacityLinPapaloizou1985( double density, double temperature );
+double RosselandOpacityBellLin1994( double density, double temperature );
+
+#endif
diff -rupN PLUTO4/Src/Radiation/petsc.c PLUTO_RADIATION_MOD/Src/Radiation/petsc.c
--- PLUTO4/Src/Radiation/petsc.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc.c	2013-06-01 18:33:00.242214818 +0200
@@ -0,0 +1,946 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2012-2013 Moritz Stoll (shearing box boundary conditions)
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+#include <execinfo.h>
+#include <signal.h>
+#include <stdlib.h>
+
+#include "radiation.h"
+#include "petsc.h"
+#include "petsc_tools.h"
+
+#include "modify_pluto.h"
+#include "radiation_tools.h"
+#include "opacity.h"
+#include "assert.h"
+#include "petsc_initialize_advanced.h"
+
+Mat RadiationMatrix;
+Vec RadiationSolution, RadiationRightHandSide;
+KSP ksp;
+
+/**
+    This function computes in the MPI topology (created with MPI_Cart_create) for each direction
+    and each node in this direction, the number of grid cells.
+
+
+    \param[in]  grid
+    \param[in]  topology_grid_size  number of cells (nodes) in each direction of the cartesian mpi topology grid
+    \param[in]  topology_dims       number of dimensions of the cartesian mpi topology grid created with MPI_Cart_create
+    \param[in]  comm                mpi communicator
+
+    \param[out] topology_grid
+*/
+void GenerateTopologyGrid( Grid *grid, NeighbourGridItem **topology_grid, int *topology_grid_size, int topology_dims , MPI_Comm comm )
+{
+    int n = 0, size = 0, nproc = 1, rank = 0, position = 0, dir = 0;
+    int domain_size[6];
+    int *domain_size_received = NULL;
+
+    MPI_Comm_rank( comm, &rank );
+
+    domain_size[0] = grid[IDIR].rank_coord;
+    domain_size[1] = NX1;
+
+    domain_size[2] = grid[JDIR].rank_coord;
+    domain_size[3] = NX2;
+
+    domain_size[4] = grid[KDIR].rank_coord;
+    domain_size[5] = NX3;
+
+    if( topology_dims != DIMENSIONS )
+    {
+        print( "MPI Topology with the wrong number of dimmensions.\n" );
+        QUIT_PLUTO( 1 );
+    }
+
+    size = 0;
+    for( n = 0; n < topology_dims; n++ )
+    {
+        size += topology_grid_size[n];
+    }
+
+    if( rank == 0 )
+    {
+        MPI_Comm_size( comm, &nproc );
+        domain_size_received = malloc( 6 * nproc * sizeof( int ) );
+        CHECK_ALLOCATED_MEMORY( domain_size_received );
+    }
+    MPI_Gather( domain_size, 6, MPI_INT, domain_size_received, 6, MPI_INT, 0, comm );
+
+    if( rank == 0 )
+    {
+        for( n = 0; n < nproc * 6; n += 6 )
+        {
+            topology_grid[IDIR][domain_size_received[n]].np = domain_size_received[n + 1];
+        }
+
+        for( n = 2; n < nproc * 6; n += 6 )
+        {
+            topology_grid[JDIR][domain_size_received[n]].np = domain_size_received[n + 1];
+        }
+
+        for( n = 4; n < nproc * 6; n += 6 )
+        {
+            topology_grid[KDIR][domain_size_received[n]].np = domain_size_received[n + 1];
+        }
+        free( domain_size_received );
+    }
+    MPI_Bcast( topology_grid[0], sizeof( NeighbourGridItem ) * size, MPI_CHAR, 0, comm );
+
+    //Setting up the rest of the topology_grid
+    for( dir = 0; dir < 3; ++dir )
+    {
+        position = grid[dir].gbeg;
+        for( n = 0; n < topology_grid_size[dir]; ++n )
+        {
+            topology_grid[dir][n].beg = position;
+            topology_grid[dir][n].end = topology_grid[dir][n].beg + topology_grid[dir][n].np - 1;
+
+            position = topology_grid[dir][n].end + 1;
+        }
+    }
+}
+
+/**
+    This function returns the rank mapping form communicator \a comm1 to \a comm2
+    \note
+        The \a mapping array must have a size \a s of MPI_Comm_size(comm1,&s),MPI_Comm_size(comm2,&s).
+        The \a mapping array must be allocated for all processes.
+
+    \param[in]  comm1
+    \param[in]  comm2
+    \param[out] mapping
+*/
+void GetRankMapping( MPI_Comm comm1, MPI_Comm comm2, int *mapping )
+{
+    int n = 0;
+    int nproc1 = 0, nproc2 = 0;
+    int rank1 = 0, rank2 = 0;
+    int send_buffer[2];
+    int *receive_buffer = NULL;
+
+    MPI_Comm_size( comm1, &nproc1 );
+    MPI_Comm_size( comm2, &nproc2 );
+
+    if( nproc1 != nproc2 )
+    {
+        print( "The communicators must have the same size!!" );
+        QUIT_PLUTO( 1 );
+    }
+
+    MPI_Comm_rank( comm1, &rank1 );
+    MPI_Comm_rank( comm2, &rank2 );
+
+    send_buffer[0] = rank1;
+    send_buffer[1] = rank2;
+
+    if( rank1 == 0 )
+    {
+        receive_buffer = malloc( sizeof( int ) * nproc1 * 2 );
+        CHECK_ALLOCATED_MEMORY( receive_buffer );
+    }
+
+    MPI_Gather( send_buffer, 2, MPI_INT, receive_buffer, 2, MPI_INT, 0, comm1 );
+
+    if( rank1 == 0 )
+    {
+        for( n = 0; n < nproc1 * 2; n = n + 2 )
+        {
+            mapping[receive_buffer[n]] = receive_buffer[n + 1];
+        }
+        free( receive_buffer );
+    }
+
+    MPI_Bcast( mapping, nproc1, MPI_INT, 0, comm1 );
+}
+
+/**
+    Helper function for \ref PetscOffsetTestCase.
+
+    \param[in]  nproc
+    \param[in]  topology_grid
+    \param[in]  topology_grid_size
+    \param[in]  topology_dims
+    \param[in]  comm_petsc
+    \param[in]  comm_topology
+    \param[out] offset_array
+*/
+void CalculateOffsets( int nproc, NeighbourGridItem **topology_grid, int *topology_grid_size, int topology_dims, int *offset_array, MPI_Comm comm_petsc, MPI_Comm comm_topology )
+{
+    int offset = 0, petsc_rank = 0, pluto_rank = 0;
+    int *coords = NULL;
+    int *rank_mapping = NULL;
+
+    rank_mapping = malloc( sizeof( int ) * nproc );
+    CHECK_ALLOCATED_MEMORY( rank_mapping );
+    GetRankMapping( comm_petsc, comm_topology, rank_mapping );
+
+    coords = malloc( sizeof( int ) * topology_dims );
+    CHECK_ALLOCATED_MEMORY( coords );
+
+    for( petsc_rank = 0; petsc_rank < nproc; ++petsc_rank )
+    {
+        MPI_Cart_coords( comm_topology, petsc_rank, topology_dims, coords );
+        pluto_rank = rank_mapping[petsc_rank];
+
+        offset_array[pluto_rank] = offset;
+        offset +=  topology_grid[IDIR][coords[0]].np * topology_grid[JDIR][coords[1]].np * topology_grid[KDIR][coords[2]].np;
+    }
+
+    free( rank_mapping );
+    free( coords );
+}
+
+/**
+    This function checks if the offset is computed correctly
+
+    \param[in]  grid
+*/
+void PetscOffsetTestCase( Grid *grid )
+{
+    MPI_Comm comm_topology;
+    int rank, coords[3], nproc, topology_dims;
+    int i = 0, j = 0, k = 0, pos = 0, current_offset = 0, tmp = 0;
+
+    AL_Get_cart_comm( SZ, &comm_topology );
+    MPI_Cartdim_get( comm_topology, &topology_dims );
+    MPI_Comm_size( comm_topology, &nproc );
+
+    for( rank = 0; rank < nproc; ++rank )
+    {
+        MPI_Cart_coords( comm_topology, rank, topology_dims, coords );
+
+        current_offset = radiation_data.offset_array[rank];
+        assert( current_offset == PetscGetVectorPosition( radiation_data.topology_grid[KDIR][coords[KDIR]].beg, radiation_data.topology_grid[JDIR][coords[JDIR]].beg, radiation_data.topology_grid[IDIR][coords[IDIR]].beg, grid ) );
+        tmp = current_offset;
+        for( k = radiation_data.topology_grid[KDIR][coords[KDIR]].beg; k <= radiation_data.topology_grid[KDIR][coords[KDIR]].end; ++k )
+        {
+            for( j = radiation_data.topology_grid[JDIR][coords[JDIR]].beg; j <= radiation_data.topology_grid[JDIR][coords[JDIR]].end; ++j )
+            {
+                for( i = radiation_data.topology_grid[IDIR][coords[IDIR]].beg; i <= radiation_data.topology_grid[IDIR][coords[IDIR]].end; ++i )
+                {
+                    pos = PetscGetVectorPosition( k, j, i, grid );
+                    assert( pos == tmp );
+                    tmp = tmp + 1;
+                }
+            }
+        }
+    }
+}
+/**
+    Computes the offset needed to make the correct mapping from the local domain to the PETSc matrix done by the function
+    \ref PetscGetVectorPosition.
+
+    \param[in] grid
+*/
+void PetscCalculateVectorOffset( Grid *grid )
+{
+    MPI_Comm comm_topology;
+    int topology_dims, size = 0, n = 0, position = 0, nproc = 0, dir = 0;
+    int *periods, *coords;
+
+    AL_Get_cart_comm( SZ, &comm_topology );
+    MPI_Comm_size( comm_topology, &nproc );
+
+    //BEGIN obtaining the topology_grid_size
+    MPI_Cartdim_get( comm_topology, &topology_dims );
+    radiation_data.topology_grid_size = malloc( topology_dims * sizeof( int ) );
+    CHECK_ALLOCATED_MEMORY( radiation_data.topology_grid_size );
+    periods = malloc( topology_dims * sizeof( int ) );
+    coords =  malloc( topology_dims * sizeof( int ) );
+    MPI_Cart_get( comm_topology, topology_dims, radiation_data.topology_grid_size, periods, coords );
+    //END
+
+    //BEGIN allocating and setting up the topology grid
+    radiation_data.topology_grid =  malloc( sizeof( NeighbourGridItem * ) * topology_dims );
+    CHECK_ALLOCATED_MEMORY( radiation_data.topology_grid );
+    size = 0;
+    for( n = 0; n < topology_dims; n++ )
+    {
+        size += radiation_data.topology_grid_size[n];
+    }
+    radiation_data.topology_grid[0] = malloc( sizeof( NeighbourGridItem ) * size );
+    CHECK_ALLOCATED_MEMORY( radiation_data.topology_grid[0] );
+    position = 0;
+    for( n = 1; n < topology_dims; n++ )
+    {
+        position += radiation_data.topology_grid_size[n - 1];
+        radiation_data.topology_grid[n] = &radiation_data.topology_grid[0][position];
+    }
+    GenerateTopologyGrid( grid, radiation_data.topology_grid, radiation_data.topology_grid_size, topology_dims, comm_topology );
+    //END
+
+    //BEGIN consistency check
+    if( grid[IDIR].np_int != radiation_data.topology_grid[IDIR][coords[0]].np || grid[JDIR].np_int != radiation_data.topology_grid[JDIR][coords[1]].np || grid[KDIR].np_int != radiation_data.topology_grid[KDIR][coords[2]].np )
+    {
+        print( "Function GenerateTopologyGrid failed on rank=%d\n", prank );
+        QUIT_PLUTO( 1 );
+    }
+    //END
+
+    //BEGIN allocating and setting up the offset array
+    radiation_data.offset_array =  malloc( sizeof( int ) * nproc );
+    CHECK_ALLOCATED_MEMORY( radiation_data.offset_array );
+
+    CalculateOffsets( nproc, radiation_data.topology_grid, radiation_data.topology_grid_size, topology_dims, radiation_data.offset_array, PETSC_COMM_WORLD, comm_topology );
+    //END
+
+    for( dir = 0; dir < 3; ++dir )
+    {
+        radiation_data.num_low_part[dir] = grid[dir].np_int_glob % radiation_data.topology_grid_size[dir];
+        radiation_data.np_high_part[dir] = grid[dir].np_int_glob / radiation_data.topology_grid_size[dir];
+        radiation_data.np_low_part[dir] = radiation_data.num_low_part[dir] == 0 ? radiation_data.np_high_part[dir] : radiation_data.np_high_part[dir] + 1;
+    }
+    AL_Get_cart_comm( SZ, &radiation_data.comm_topology );
+
+#ifdef DEBUG
+    PetscOffsetTestCase( grid );
+    PetscComputeToplology1DPositionTestCase();
+#endif
+
+//  #ifdef DEBUG
+//  if(prank == 0)
+//  {
+//      for(position = 0; position < 3; ++position)
+//      {
+//          for(n = 0; n < radiation_data.topology_grid_size[position]; ++n)
+//          {
+//              print("%5d  ", radiation_data.topology_grid[position][n].np);
+//          }
+//          print("\n");
+//      }
+//
+//      print("\n\n");
+//
+//      for(position = 0; position < nproc; ++position)
+//      {
+//          print("%5d  ", radiation_data.offset_array[position]);
+//      }
+//      print("\n");
+//
+//  }
+//  QUIT_PLUTO(1);
+//  #endif
+
+    free( periods );
+    free( coords );
+}
+
+/**
+    This function checks if function \ref ComputeToplology1DPositionthe correct.
+
+    \param[in]  grid
+*/
+int PetscComputeToplology1DPositionTestCase()
+{
+    int topology_1D_size = 1, domain_np = 1, position = 0, position_check = 0;
+    int coordinate_check = 0, coordinate = 0;
+    int copy_np_low_part, copy_np_high_part, copy_num_low_part;
+    int n = 0;
+
+    copy_np_low_part = radiation_data.np_low_part[0];
+    copy_np_high_part = radiation_data.np_high_part[0];
+    copy_num_low_part = radiation_data.num_low_part[0];
+
+
+    for( topology_1D_size = 1; topology_1D_size < 50; ++topology_1D_size )
+    {
+        for( domain_np = topology_1D_size; domain_np < 1000; ++domain_np )
+        {
+            radiation_data.num_low_part[0] = domain_np % topology_1D_size;
+            radiation_data.np_high_part[0] = domain_np / topology_1D_size;
+            radiation_data.np_low_part[0] = radiation_data.num_low_part[0] == 0 ? radiation_data.np_high_part[0] : radiation_data.np_high_part[0] + 1;
+
+            for( position = 0; position < domain_np; ++position )
+            {
+                coordinate = ComputeToplology1DPosition( 0, position );
+
+                position_check = 0;
+                coordinate_check = 0;
+                for( n = 0; n < topology_1D_size; ++n )
+                {
+                    if( coordinate_check < radiation_data.num_low_part[0] )
+                    {
+                        position_check += radiation_data.np_low_part[0];
+                    }
+                    else
+                    {
+                        position_check += radiation_data.np_high_part[0];
+                    }
+
+                    if( position < position_check )
+                    {
+                        break;
+                    }
+                    coordinate_check++;
+                }
+
+                assert( coordinate == coordinate_check );
+            }
+        }
+    }
+
+    radiation_data.np_low_part[0] = copy_np_low_part;
+    radiation_data.np_high_part[0] = copy_np_high_part;
+    radiation_data.num_low_part[0] = copy_num_low_part;
+}
+
+/**
+    This function computes the position inside the MPI topology for a specific direction from
+    the global position of a grid cell.
+
+    \param[in] dir          coordinate direction dir=IDIR,JDIR or KDIR
+    \param[in] position     global position of a grid cell in direction \a dir
+
+    \returns the position inside the topology
+*/
+int ComputeToplology1DPosition( int dir, int position )
+{
+    int c_low = 0, c_high = 0;
+
+    c_low = position / radiation_data.np_low_part[dir];
+
+    if( c_low >= radiation_data.num_low_part[dir] )
+    {
+        c_low = radiation_data.num_low_part[dir];
+        c_high = ( position - ( radiation_data.np_low_part[dir] * c_low ) ) / radiation_data.np_high_part[dir];
+    }
+    return abs( c_low + c_high );
+}
+
+/**
+    In this function we map the index (k,j,i) of the active cells to a continuing number.This is
+    useful if we want to store the active cells of the global 3D grid in a 1D array. Here it is
+    used to calculate the positions inside PETSc's vectors and matrices to set the entries there.
+
+    \note
+    This function can only return valid results if \a k, \a j, \a i are valid cells and no global
+    ghost cells. If The function is called with an index set which points to such a ghost cell
+    then the position 0 is returned.
+
+    \warning
+    This function is complicated because of the parallelization. In the case that the computation
+    is not parallel then this function can be reduced to:
+
+    return k * grid[JDIR].np_int_glob * grid[IDIR].np_int_glob + j * grid[IDIR].np_int_glob + i;
+
+    \param[in]  k   global index k
+    \param[in]  j   global index j
+    \param[in]  i   global index i
+    \param[in]  grid
+
+    \returns    the mapped position (i,j,k) -> position
+*/
+int PetscGetVectorPosition( int k, int j, int i, Grid *grid )
+{
+    int topology_coord[3];
+    int rank = 0, offset = 0, position = 0;
+
+    topology_coord[0] = ComputeToplology1DPosition( IDIR, i - grid[IDIR].gbeg );
+    topology_coord[1] = ComputeToplology1DPosition( JDIR, j - grid[JDIR].gbeg );
+    topology_coord[2] = ComputeToplology1DPosition( KDIR, k - grid[KDIR].gbeg );
+
+    if( topology_coord[0] >= radiation_data.topology_grid_size[0] || topology_coord[1] >= radiation_data.topology_grid_size[1] || topology_coord[2] >= radiation_data.topology_grid_size[2] )
+    {
+        return -2;
+    }
+
+    MPI_Cart_rank( radiation_data.comm_topology, topology_coord, &rank );
+
+    offset = radiation_data.offset_array[rank];
+
+    int li = i - radiation_data.topology_grid[IDIR][topology_coord[0]].beg;
+    int lj = j - radiation_data.topology_grid[JDIR][topology_coord[1]].beg;
+    int lk = k - radiation_data.topology_grid[KDIR][topology_coord[2]].beg;
+
+    int in = radiation_data.topology_grid[IDIR][topology_coord[0]].np;
+    int jn = radiation_data.topology_grid[JDIR][topology_coord[1]].np;
+    int kn = radiation_data.topology_grid[KDIR][topology_coord[2]].np;
+
+    position = offset + lk * jn * in + lj * in + li;
+
+    assert( position - offset  < in * jn * kn );
+    return position;
+}
+
+/**
+    Maps the local index local_k,local_j,local_i to the global index global_k,global_j,global_i.
+
+    \param[in]  local_k
+    \param[in]  local_j
+    \param[in]  local_i
+    \param[in]  grid
+
+    \param[out] global_k
+    \param[out] global_j
+    \param[out] global_i
+*/
+void PetscMapLocalToGlobalIndex( int local_k, int local_j, int local_i, Grid *grid, int *global_k, int *global_j, int *global_i )
+{
+    *global_k = local_k - KBEG + grid[KDIR].beg;
+    *global_j = local_j - JBEG + grid[JDIR].beg;
+    *global_i = local_i - IBEG + grid[IDIR].beg;
+}
+
+/**
+    Generates the matrix and right hand side vector of the system of equations to solve.
+
+    \note
+        dir = KDIR,JDIR,IDIR \n
+        grid[dir].gbeg is the first active cell in the global array \n
+        grid[dir].gend is the last active cell in the global array \n
+
+    \param[in]  grid
+    \param[in]  d
+    \param[out] A
+    \param[out] b
+*/
+void PetscGenerateSystemOfEquations( Mat A, Vec b, Grid *grid, Data *d )
+{
+    int local_k = 0, local_j = 0, local_i = 0;
+    int global_k = 0, global_j = 0, global_i = 0;
+
+    int n = 0;
+
+    double coefficient[7], coefficientB = 0.;
+    int column_position_coefficient[7], row = 0;
+
+#ifdef SHEARINGBOX
+    double t = g_time;
+    double scrh;
+    int Delta_j;
+
+    double sb_Ly;
+    double Lx;
+    double sb_vy;
+    int sheared_j;
+
+    Lx = grid[IDIR].xr_glob[grid[IDIR].gend] - grid[IDIR].xl_glob[grid[IDIR].gbeg];
+    sb_Ly = grid[JDIR].xr_glob[grid[JDIR].gend] - grid[JDIR].xl_glob[grid[JDIR].gbeg];
+    sb_vy = fabs( 2.0 * sb_A * Lx );
+
+    scrh    = ( fmod( sb_vy * t, sb_Ly ) ) / grid[JDIR].dx[JBEG];
+    Delta_j = ( int )scrh;
+#endif
+
+//  coefficient[0]  -> if there is no boundary affected this variable is coefficient_U1
+//  ...
+//  coefficient[6]  -> if there is no boundary affected this variable is coefficient_U7
+
+//  column_position_coefficient[0] -> column position of coefficient[0] in the matrix
+//  ...
+//  column_position_coefficient[6] -> column position of coefficient[6] in the matrix
+//  column_position_coefficientB   -> not needed: vector has no columns
+
+//  MatZeroEntries(A);  //is needed because use matrix insert mode ADD_VALUES on second run of generateSystemOfEquations
+//  VecZeroEntries(b);  // same argument as line above
+//  PetscCacheReset();
+
+    DOM_LOOP( local_k, local_j, local_i )
+    {
+        PetscMapLocalToGlobalIndex( local_k, local_j, local_i, grid, &global_k, &global_j, &global_i );
+
+        row = PetscGetVectorPosition( global_k, global_j, global_i, grid );
+
+        assert( row < grid[KDIR].np_int_glob * grid[JDIR].np_int_glob * grid[IDIR].np_int_glob );
+        assert( row >= 0 );
+
+//      coefficient[0] = ComputeCoefficientU1(local_k,local_j,local_i,d,grid);
+//      column_position_coefficient[0] = row;
+
+        coefficient[1] = ComputeCoefficientU2( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[1] = PetscGetVectorPosition( global_k - 1, global_j, global_i, grid ); //it is possible that this function will return a wrong result because global_k - 1 can be a ghost cell an so the returned position is not correct. This doesn't matter because in this case the boundary condition which is set later will correct this. This is the same for the following calls to the function getVectorPosition.
+
+        coefficient[2] = ComputeCoefficientU3( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[2] = PetscGetVectorPosition( global_k + 1, global_j, global_i, grid );
+
+        coefficient[3] = ComputeCoefficientU4( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[3] = PetscGetVectorPosition( global_k, global_j - 1, global_i, grid );
+
+        coefficient[4] = ComputeCoefficientU5( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[4] = PetscGetVectorPosition( global_k, global_j + 1, global_i, grid );
+
+        coefficient[5] = ComputeCoefficientU6( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[5] = PetscGetVectorPosition( global_k, global_j, global_i - 1, grid );
+
+        coefficient[6] = ComputeCoefficientU7( local_k, local_j, local_i, d, grid );
+        column_position_coefficient[6] = PetscGetVectorPosition( global_k, global_j, global_i + 1, grid );
+
+        coefficient[0] = ComputeCoefficientU1Advanced( local_k, local_j, local_i, d, grid, coefficient[1], coefficient[2], coefficient[3], coefficient[4], coefficient[5], coefficient[6] );
+        column_position_coefficient[0] = row;
+
+        coefficientB = ComputeCoefficientB( local_k, local_j, local_i, d, grid );
+
+        if( global_k - 1 < grid[KDIR].gbeg ) //check if global_k - 1 is a global ghost cell
+        {
+            switch( radiation_data.boundary_conditions[KDIR].bc_beg )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[1] = PetscGetVectorPosition( grid[KDIR].gend, global_j, global_i, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[1];
+                    column_position_coefficient[1] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[1] * radiation_data.boundary_conditions[KDIR].beg_fixedvalue;
+                    column_position_coefficient[1] = -1;
+                    break;
+            }
+        }
+        else if( global_k + 1 > grid[KDIR].gend ) //check if global_k + 1 is a global ghost cell
+        {
+            switch( radiation_data.boundary_conditions[KDIR].bc_end )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[2] = PetscGetVectorPosition( grid[KDIR].gbeg, global_j, global_i, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[2];
+                    column_position_coefficient[2] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[2] * radiation_data.boundary_conditions[KDIR].end_fixedvalue;
+                    column_position_coefficient[2] = -1;
+                    break;
+            }
+        }
+
+        if( global_j - 1 < grid[JDIR].gbeg )
+        {
+            switch( radiation_data.boundary_conditions[JDIR].bc_beg )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[3] = PetscGetVectorPosition( global_k, grid[JDIR].gend, global_i, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[3];
+                    column_position_coefficient[3] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[3] * radiation_data.boundary_conditions[JDIR].beg_fixedvalue;
+                    column_position_coefficient[3] = -1;
+                    break;
+            }
+        }
+        else if( global_j + 1 > grid[JDIR].gend )
+        {
+            switch( radiation_data.boundary_conditions[JDIR].bc_end )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[4] = PetscGetVectorPosition( global_k, grid[JDIR].gbeg, global_i, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[4];
+                    column_position_coefficient[4] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[4] * radiation_data.boundary_conditions[JDIR].end_fixedvalue;
+                    column_position_coefficient[4] = -1;
+                    break;
+            }
+        }
+
+        if( global_i - 1 < grid[IDIR].gbeg )
+        {
+            switch( radiation_data.boundary_conditions[IDIR].bc_beg )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[5] = PetscGetVectorPosition( global_k, global_j, grid[IDIR].gend, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[5];
+                    column_position_coefficient[5] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[5] * radiation_data.boundary_conditions[IDIR].beg_fixedvalue;
+                    column_position_coefficient[5] = -1;
+                    break;
+                    
+                #ifdef SHEARINGBOX
+                    case RADIATION_BC_SHEARINGBOX:
+                        sheared_j = ( global_j - Delta_j );
+                        if( sheared_j < grid[JDIR].gbeg ) sheared_j += ( grid[JDIR].gend - grid[JDIR].gbeg + 1 );
+                        if( sheared_j > grid[JDIR].gend ) sheared_j -= ( grid[JDIR].gend - grid[JDIR].gbeg + 1 );
+                        column_position_coefficient[5] = PetscGetVectorPosition( global_k, sheared_j, grid[IDIR].gend, grid );
+                        break;
+                #endif
+            }
+        }
+        else if( global_i + 1 > grid[IDIR].gend )
+        {
+            switch( radiation_data.boundary_conditions[IDIR].bc_end )
+            {
+                case RADIATION_BC_PERIODIC:
+                    column_position_coefficient[6] = PetscGetVectorPosition( global_k, global_j, grid[IDIR].gbeg, grid );
+                    break;
+
+                case RADIATION_BC_SYMMETRIC:
+                case RADIATION_BC_REFLECTIVE:
+                case RADIATION_BC_OUTFLOW:
+                    coefficient[0] = coefficient[0] + coefficient[6];
+                    column_position_coefficient[6] = -1;
+                    break;
+
+                case RADIATION_BC_FIXEDVALUE:
+                    coefficientB = coefficientB - coefficient[6] * radiation_data.boundary_conditions[IDIR].end_fixedvalue;
+                    column_position_coefficient[6] = -1;
+                    break;
+                    
+                #ifdef SHEARINGBOX
+                    case RADIATION_BC_SHEARINGBOX:
+                        sheared_j = ( global_j + Delta_j );
+                        if( sheared_j < grid[JDIR].gbeg ) sheared_j += ( grid[JDIR].gend - grid[JDIR].gbeg + 1 );
+                        if( sheared_j > grid[JDIR].gend ) sheared_j -= ( grid[JDIR].gend - grid[JDIR].gbeg + 1 );
+                        column_position_coefficient[6] = PetscGetVectorPosition( global_k, sheared_j, grid[IDIR].gbeg, grid );
+                        break;
+                #endif
+            }
+        }
+
+        #ifdef DEBUG
+            int local_rows_start = 0, local_rows_end = 0;
+            MatGetOwnershipRange( RadiationMatrix, &local_rows_start, &local_rows_end );
+            if( !( local_rows_start <= row && row <= local_rows_end ) )
+            {
+                printf( "prank=%3d: Current row=%6d is not stored local.\n", prank, row );
+            }
+        #endif
+
+        for( n = 0; n < 7; ++n )
+        {
+            if( column_position_coefficient[n] != -1 )
+            {
+                assert( column_position_coefficient[n] < grid[KDIR].np_int_glob * grid[JDIR].np_int_glob * grid[IDIR].np_int_glob );
+                assert( column_position_coefficient[n] >= 0 );
+                MatSetValue( A, row, column_position_coefficient[n], coefficient[n], INSERT_VALUES ); //FIXME use local access functions
+            }
+        }
+        VecSetValue( b, row, coefficientB, INSERT_VALUES ); //FIXME use local access functions
+    }
+    MatAssemblyBegin( A, MAT_FINAL_ASSEMBLY );
+    MatAssemblyEnd( A, MAT_FINAL_ASSEMBLY );
+
+    VecAssemblyBegin( b );
+    VecAssemblyEnd( b );
+}
+
+/**
+    Computes the next time step by using the PETSc library
+
+    \param[in]  grid
+    \param[in]  data
+
+    \returns the number of used iterations
+*/
+int PetscImplicitTimestep( Grid *grid, Data *data )
+{
+    KSPConvergedReason converged_reason;
+    int iterations = 0;
+    PetscErrorCode ierr;
+
+    #ifdef SHEARINGBOX
+        static int do_once = 1;
+        static int *rows;
+        static int num_rows = 0;
+        int row_start = 0, row_end = 0, i = 0;
+
+        if( do_once )
+        {
+            do_once = 0;
+            ierr = MatGetOwnershipRange( RadiationMatrix, &row_start, &row_end );
+            num_rows = ( row_end - row_start );
+            rows = malloc( sizeof( int ) * num_rows );
+            CHECK_ALLOCATED_MEMORY( rows );
+
+            row_list[0] = row_start;
+            for( i = 1; i < num_rows; ++i )
+            {
+                rows[i] = rows[i - 1] + 1;
+            }
+        }
+
+        ierr = MatZeroRowsLocal( RadiationMatrix, num_rows, rows, 0.0, 0, 0 ); CHKERR( ierr );
+        ierr = KSPSetOperators( ksp, RadiationMatrix, RadiationMatrix, DIFFERENT_NONZERO_PATTERN ); CHKERR( ierr );
+    #endif
+
+
+    PetscGenerateSystemOfEquations( RadiationMatrix, RadiationRightHandSide, grid, data );
+
+//  char buffer[512];
+//  sprintf(buffer,"matrix.%04ld.mat",NSTEP);
+//  writeMatrixToFile(buffer,RadiationMatrix);
+
+    ierr = KSPSetOperators( ksp, RadiationMatrix, RadiationMatrix, SAME_NONZERO_PATTERN ); CHKERR( ierr );
+    ierr = KSPSolve( ksp, RadiationRightHandSide, RadiationSolution ); CHKERR( ierr );
+
+    ierr = KSPGetConvergedReason( ksp, &converged_reason ); CHKERR( ierr );
+
+    //for more details look at http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/KSP/KSPConvergedReason.html
+    if( converged_reason < 0 )
+    {
+        print( "Iterative solver not converged\n" );
+        QUIT_PLUTO( 1 );
+    }
+    else
+    {
+        ierr = KSPGetIterationNumber( ksp, &iterations ); CHKERR( ierr );
+    }
+
+    PetscCollectData( RadiationSolution, radiation_data.Erad );
+
+    RadiationBoundaryCondition( grid, data );
+
+    UpdatePlutoPressure( grid, data );
+    return iterations;
+}
+
+/**
+    Collects the data from the PETSc vector \a b (The result from the matrix solver which
+    means the new radiation energy density) and writes it in the array \a Erad.
+*/
+void PetscCollectData( Vec b, double *** Erad )
+{
+    PetscScalar *local_array = NULL;
+    int n = 0, local_k = 0, local_j = 0, local_i = 0;
+
+    PetscErrorCode ierr;
+
+    ierr = VecGetArray( b, &local_array ); CHKERR( ierr );
+
+    n = 0;
+    DOM_LOOP( local_k, local_j, local_i )
+    {
+        Erad[local_k][local_j][local_i] = local_array[n];
+        n++;
+    }
+    ierr = VecRestoreArray( b, &local_array ); CHKERR( ierr );
+}
+
+/**
+    Initializes all the PETSc library and all necessary things needed for the solver based on PETSc,
+
+    \param[in] argc the number of command line arguments given to PLUTO
+    \param[in] argv the command line arguments given to PLUTO
+    \param[in] input
+    \param[in] grid
+    \param[in] data
+*/
+void PetscInit( int argc, char **argv, Input *input, Grid *grid, Data *data )
+{
+    PetscErrorCode ierr;
+    int nproc = 0;
+    int mat_global_rows = grid[KDIR].np_int_glob * grid[JDIR].np_int_glob * grid[IDIR].np_int_glob, mat_global_columns = mat_global_rows;
+    int mat_local_rows = grid[KDIR].np_int * grid[JDIR].np_int * grid[IDIR].np_int, mat_local_columns = mat_global_columns;
+
+    if( prank == 0 )
+    {
+        print( "\n> Radiation Solver Settings\n" );
+        print( " %-25s %s\n", "SOLVER:", "PETSc" );
+
+        print( " %-25s %5.3e\n", "absolute-tolerance:", radiation_data.absolute_tolerance );
+        print( " %-25s %5.3e\n", "relative-tolerance:" , radiation_data.relative_tolerance );
+        print( " %-25s %d\n", "max-iterations:", radiation_data.max_iterations );
+    }
+
+    MPI_Comm_size( MPI_COMM_WORLD, &nproc );
+    //PetscInitialize(&argc,&argv,(char *)0,(char *)0);
+    PetscInitializeAdvanced( argc, argv );
+
+    PetscCalculateVectorOffset( grid );
+
+    ierr = MatCreate( PETSC_COMM_WORLD, &RadiationMatrix ); CHKERR( ierr );
+    ierr = MatSetType( RadiationMatrix, MATMPIAIJ ); CHKERR( ierr );
+    ierr = MatSetSizes( RadiationMatrix, mat_local_rows, mat_local_rows, mat_global_rows, mat_global_columns ); CHKERR( ierr );
+//  ierr = MatSetSizes(RadiationMatrix,mat_local_rows,PETSC_DECIDE,mat_global_rows,mat_global_columns); CHKERR(ierr);
+//  ierr = MatSetSizes(RadiationMatrix,PETSC_DECIDE,PETSC_DECIDE,mat_global_rows,mat_global_columns); CHKERR(ierr);
+//      ierr = MatSetFromOptions(RadiationMatrix);CHKERR(ierr); //Note since PETSc version above 3.1 MatSetFromOptions is only working if it is called bevore the function MatSetType
+
+    /*
+        If there is a reaseon to not use \a PetscMatrixMemoryPreallocation then it is necessary to call
+
+        ierr = MatSetUp(RadiationMatrix); CHKERR(ierr);
+
+        Note: without preallocation the first generation of the matrix is more than 100 times slower than
+        with \a PetscMatrixMemoryPreallocation
+    */
+//  ierr = MatSetUp(RadiationMatrix); CHKERR(ierr);
+    ierr = MatMPIAIJSetPreallocation( RadiationMatrix, 8, PETSC_NULL, 8, PETSC_NULL ); CHKERR( ierr );
+
+    ierr = MatGetVecs( RadiationMatrix, &RadiationSolution, PETSC_NULL ); CHKERR( ierr );
+    ierr = VecDuplicate( RadiationSolution, &RadiationRightHandSide ); CHKERR( ierr );
+
+    ierr = KSPCreate( PETSC_COMM_WORLD, &ksp ); CHKERR( ierr );
+    #ifdef SHEARINGBOX
+        ierr = KSPSetOperators( ksp, RadiationMatrix, RadiationMatrix, DIFFERENT_NONZERO_PATTERN ); CHKERR( ierr );
+    #else
+        ierr = KSPSetOperators( ksp, RadiationMatrix, RadiationMatrix, SAME_NONZERO_PATTERN ); CHKERR( ierr );
+    #endif
+    ierr = KSPSetTolerances( ksp, radiation_data.relative_tolerance, radiation_data.absolute_tolerance, PETSC_DEFAULT, radiation_data.max_iterations ); CHKERR( ierr );
+    ierr = KSPSetInitialGuessNonzero( ksp, PETSC_TRUE ); CHKERR( ierr );
+    ierr = KSPSetFromOptions( ksp ); CHKERR( ierr );
+}
+
+/**
+    Frees all memory used by PETSc and also calls PetscFinalize()
+*/
+void PetscCleanup()
+{
+    #if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR > 1
+        KSPDestroy( &ksp );
+        MatDestroy( &RadiationMatrix );
+        VecDestroy( &RadiationRightHandSide );
+        VecDestroy( &RadiationSolution );
+    #else
+        KSPDestroy( ksp );
+        MatDestroy( RadiationMatrix );
+        VecDestroy( RadiationRightHandSide );
+        VecDestroy( RadiationSolution );
+    #endif
+
+    free( radiation_data.topology_grid[0] );
+    free( radiation_data.topology_grid );
+    free( radiation_data.topology_grid_size );
+    free( radiation_data.offset_array );
+
+    PetscFinalize();
+}
diff -rupN PLUTO4/Src/Radiation/petsc.h PLUTO_RADIATION_MOD/Src/Radiation/petsc.h
--- PLUTO4/Src/Radiation/petsc.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc.h	2013-06-01 18:33:00.227214818 +0200
@@ -0,0 +1,59 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2012-2013 Moritz Stoll (shearing box boundary conditions)
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DD_PETSC_H
+#define DD_PETSC_H
+
+#include "petscksp.h"
+
+/**
+    Macro to check the return value of the PETSc functions. If an error is occurred then PetscError is called
+*/
+#if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR > 1
+    #define CHKERR(n)    if (PetscUnlikely(n)) {PetscError(PETSC_COMM_WORLD,__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");QUIT_PLUTO(1);}
+#else
+    #define CHKERR(n)    if (PetscUnlikely(n)) {PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");QUIT_PLUTO(1);}
+#endif
+
+typedef struct NEIGHBOUR_GRID_ITEM
+{
+    int beg;    /**< Global start index for the local array. */
+    int end;    /**< Global start index for the local array. */
+    int np;     /**< Total number of points in the local domain (boundaries excluded). */
+} NeighbourGridItem;
+
+
+void PetscCollectData( Vec b, double *** Erad );
+void PetscCalculateVectorOffset( Grid *grid );
+int PetscGetProcessIdByMatrixRow( int row, int row_count, int nproc );
+void PetscMatrixFunctionsCheck( Mat A, int nproc );
+int PetscGetLocalMatrixRowCountByProcessId( int rank, int row_count, int nproc );
+void PetscMatrixMemoryPreallocation( Mat A, Grid *grid );
+int PetscGetVectorPosition( int k, int j, int i, Grid *grid );
+void PetscMapLocalToGlobalIndex( int local_k, int local_j, int local_i, Grid *grid, int *global_k, int *global_j, int *global_i );
+
+void PetscGenerateSystemOfEquations( Mat A, Vec b, Grid *grid, Data *d );
+
+int PetscImplicitTimestep( Grid *grid, Data *data );
+
+void PetscInit( int argc, char **argv, Input *input, Grid *grid, Data *data );
+void PetscCleanup();
+
+#endif
diff -rupN PLUTO4/Src/Radiation/petsc_initialize_advanced.c PLUTO_RADIATION_MOD/Src/Radiation/petsc_initialize_advanced.c
--- PLUTO4/Src/Radiation/petsc_initialize_advanced.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc_initialize_advanced.c	2013-06-01 18:33:00.234214818 +0200
@@ -0,0 +1,240 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "petsc_initialize_advanced.h"
+#include "pluto.h"
+/**
+    Reads the file pluto.ini from the path \a filepath
+
+    \param[in]  filepath
+    \param[out] line_count_     the number of stored lines
+    \param[out] lines           all none empty lines of file file path
+*/
+void ReadPlutoConfigFile( char *filepath, int *line_count, char *** lines )
+{
+    char buffer[1024];
+    FILE *file = NULL;
+    int n = 0;
+
+    *lines = NULL;
+    file = fopen( filepath, "r" );
+    if( file == NULL )
+    {
+        printf( " ! Error: file %s not found\n", filepath );
+        QUIT_PLUTO( 1 );
+    }
+    *line_count = 0;
+
+    while( fgets( buffer, 1024, file ) != NULL )
+    {
+        strtok( buffer, "\n" );
+        /*for(n = 0; n < 1024; ++n)
+        {
+            if(buffer[n] == '\n')
+            {
+                buffer[n] = '\0';
+            }
+
+        }*/
+
+        if( strlen( buffer ) > 0 )
+        {
+            *lines = realloc( *lines, sizeof( char ** ) * ( *line_count + 1 ) );
+            ( *lines )[*line_count] = malloc( sizeof( char ) * strlen( buffer ) + 1 );
+            strcpy( ( *lines )[*line_count], buffer );
+            ( *line_count )++;
+        }
+    }
+    fclose( file );
+}
+
+/**
+    Frees the 2D array \a array.
+
+    \param[in]  array
+    \param[in]  size
+*/
+void Free2DArray( void **array, int size )
+{
+    int n = 0;
+
+    for( n = 0; n < size; ++n )
+    {
+        free( array[n] );
+        array[n] = NULL;
+    }
+    free( array );
+    array = NULL;
+}
+
+/**
+    Searches in each line of \a lines for the occurrence of \a label and sets result to
+    this line without \a label.
+
+    \note
+    No memory is allocated for \a result. This means if the 2D array \a lines is freed \a result
+    becomes invalid.
+
+    \param[in]  label
+    \param[in]  line_count
+    \param[in]  lines
+    \param[out] result
+*/
+void FindLine( const char *label, int line_count, char **lines, char **result )
+{
+    const char  delimiters[] = " \t\r\f";
+    char buffer[1024], *str = NULL;
+    int n = 0, start_pos = 0;
+
+    for( n = 0; n < line_count; ++n )
+    {
+        snprintf( buffer, 1024, "%s", lines[n] );
+        str = strtok( buffer, delimiters );
+
+        if( str != NULL && strcmp( str, label ) == 0 )
+        {
+            str = strtok( NULL, delimiters );
+            start_pos = str - buffer;
+
+            snprintf( buffer, 1024, "%s", lines[n] );
+
+            *result = &lines[n][start_pos];
+            return;
+        }
+    }
+    *result = NULL;
+}
+
+/**
+    Extracts the option "-i" for the PLUTO command line. This is done to obtain the path
+    to the file pluto.ini if the standard is not used.
+
+    \param[in]  argc    PLUTO argc
+    \param[in]  argv    PLUTO argv
+    \param[out] inifile
+*/
+void ExtractConfigPathFromCommandLine( int argc, char **argv, char *inifile )
+{
+    int n = 0, found = 0;
+
+    for( n = 0; n < argc; ++n )
+    {
+        if( strcmp( argv[n], "-i" ) == 0 )
+        {
+            sprintf( inifile, "%s", argv[n + 1] );
+            found = 1;
+            break;
+        }
+    }
+
+    if( !found )
+    {
+        sprintf( inifile, "%s", "pluto.ini" );
+    }
+
+    return;
+}
+
+/**
+    Generates an argc and argv pseudo command line for PETSc which contains the options from
+    the entry "petsc-options" in the pluto.ini file.
+
+    \param[out] argc
+    \param[out] argv
+    \param[in]  petsc_options
+*/
+void GeneratePetscCommandLineOptions( int *argc, char *** argv, char *petsc_options )
+{
+    int n = 0;
+    char *str = NULL;
+    char buffer[1024];
+    const char delimiters[] = " ";
+    const char first_entry[] = "./pluto";
+    snprintf( buffer, 1024, "%s", petsc_options );
+    *argv = NULL;
+    *argc = 0;
+
+    *argv = realloc( *argv, sizeof( char ** ) * ( *argc + 1 ) );
+    ( *argv )[*argc] = malloc( sizeof( char ) * strlen( first_entry ) + 1 );
+    strcpy( ( *argv )[*argc], first_entry );
+    ( *argc )++;
+
+    str = strtok( buffer, delimiters );
+    while( str != NULL )
+    {
+        *argv = realloc( *argv, sizeof( char ** ) * ( *argc + 1 ) );
+        ( *argv )[*argc] = malloc( sizeof( char ) * strlen( str ) + 1 );
+        strcpy( ( *argv )[*argc], str );
+        str = strtok( NULL, delimiters );
+        ( *argc )++;
+    }
+}
+
+/**
+    Calls PetscInitialize with the options specified in pluto.ini with the label petsc-options
+
+    \param[in]  pluto_argc
+    \param[in]  pluto_argv
+*/
+void PetscInitializeAdvanced( int pluto_argc, char **pluto_argv )
+{
+    int line_count = 0;
+    char **lines = NULL;
+    char *str;
+    char inifile[1024], petsc_options[1024];
+
+    int petsc_argc;
+    char **petsc_argv = NULL;
+
+    memset( petsc_options, 0, 1024 );
+    memset( inifile, 0, 1024 );
+
+    if( prank == 0 )
+    {
+        if( ParQuery( "petsc-options" ) )
+        {
+            ExtractConfigPathFromCommandLine( pluto_argc, pluto_argv, inifile );
+
+            ReadPlutoConfigFile( inifile, &line_count, &lines );
+            FindLine( "petsc-options", line_count, lines, &str );
+            if( str )
+            {
+                snprintf( petsc_options, 1024, "%s", str );
+            }
+            Free2DArray( lines, line_count );
+        }
+    }
+
+    MPI_Bcast( petsc_options, 1024, MPI_CHAR, 0, MPI_COMM_WORLD );
+
+    GeneratePetscCommandLineOptions( &petsc_argc, &petsc_argv, petsc_options );
+
+    if( petsc_argc > 1 )
+    {
+        print( "\n> Used PETSc options\n" );
+        for( line_count = 1; line_count < petsc_argc; ++line_count )
+        {
+            print( " %s\n", petsc_argv[line_count] );
+        }
+    }
+
+    PetscInitialize( &petsc_argc, &petsc_argv, ( char * )0, ( char * )0 );
+    Free2DArray( petsc_argv, petsc_argc );
+}
+
diff -rupN PLUTO4/Src/Radiation/petsc_initialize_advanced.h PLUTO_RADIATION_MOD/Src/Radiation/petsc_initialize_advanced.h
--- PLUTO4/Src/Radiation/petsc_initialize_advanced.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc_initialize_advanced.h	2013-06-01 18:33:00.214214819 +0200
@@ -0,0 +1,27 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PETSC_INITIALIZE_ADVANCED_H
+#define PETSC_INITIALIZE_ADVANCED_H
+
+#include "petscksp.h"
+
+void PetscInitializeAdvanced( int pluto_argc, char **pluto_argv );
+
+#endif
diff -rupN PLUTO4/Src/Radiation/petsc_tools.c PLUTO_RADIATION_MOD/Src/Radiation/petsc_tools.c
--- PLUTO4/Src/Radiation/petsc_tools.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc_tools.c	2013-06-01 18:33:00.176214820 +0200
@@ -0,0 +1,74 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "radiation.h"
+#include "petsc.h"
+#include "petsc_tools.h"
+
+/**
+    Writes the PETSc matrix \a A to the file given by \a filename. The matrix is stored binary
+
+    \note For reading the stored matrix look at $PLUTO_DIR/Src/Radiation/tests/petsc/read_petsc_data.py
+
+    \param[in]  A
+    \param[in]  filename
+*/
+int PetscWriteMatrixToFile( char *filename, Mat A )
+{
+    PetscViewer viewer;
+    PetscErrorCode ierr;
+
+//  ierr = PetscViewerCreate(PETSC_COMM_WORLD, &viewer);CHKERR(ierr);
+
+    ierr = PetscViewerBinaryOpen( PETSC_COMM_WORLD, filename, FILE_MODE_WRITE, &viewer ); CHKERR( ierr );
+    ierr = MatView( A, viewer ); CHKERR( ierr );
+    #if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR > 1
+        ierr = PetscViewerDestroy( &viewer ); CHKERR( ierr );
+    #else
+        ierr = PetscViewerDestroy( viewer ); CHKERR( ierr );
+    #endif
+
+    return 0;
+}
+
+/**
+    Writes the PETSc vector b to the file given by filename. The vector is stored binary
+
+    \note For reading the stored vector look at $PLUTO_DIR/Src/Radiation/tests/petsc/read_petsc_data.py
+
+    \param[in]  b
+    \param[in]  filename
+*/
+int PetscWriteVectorToFile( char *filename, Vec b )
+{
+    PetscViewer viewer;
+    PetscErrorCode ierr;
+
+//  ierr = PetscViewerCreate(PETSC_COMM_WORLD, &viewer);CHKERR(ierr);
+
+    ierr = PetscViewerBinaryOpen( PETSC_COMM_WORLD, filename, FILE_MODE_WRITE, &viewer ); CHKERR( ierr );
+    ierr = VecView( b, viewer ); CHKERR( ierr );
+    #if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR > 1
+        ierr = PetscViewerDestroy( &viewer ); CHKERR( ierr );
+    #else
+        ierr = PetscViewerDestroy( viewer ); CHKERR( ierr );
+    #endif
+
+    return 0;
+}
diff -rupN PLUTO4/Src/Radiation/petsc_tools.h PLUTO_RADIATION_MOD/Src/Radiation/petsc_tools.h
--- PLUTO4/Src/Radiation/petsc_tools.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/petsc_tools.h	2013-06-01 18:33:00.183214820 +0200
@@ -0,0 +1,26 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PETSC_TOOLS_H
+#define PETSC_TOOLS_H
+
+int PetscWriteMatrixToFile( char *filename, Mat A );
+int PetscWriteVectorToFile( char *filename, Vec b );
+
+#endif
diff -rupN PLUTO4/Src/Radiation/radiation.c PLUTO_RADIATION_MOD/Src/Radiation/radiation.c
--- PLUTO4/Src/Radiation/radiation.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation.c	2013-06-01 18:33:00.187214820 +0200
@@ -0,0 +1,2422 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2013 Moritz Stoll (shearing box boundary conditions)
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+#include <execinfo.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <limits.h>
+#define __USE_ISOC99
+#include <math.h>
+
+#ifndef __USE_ISOC99
+    /*
+        This defined enables some macros in math.h it is needed only on some machines.
+        We need it here for the macro isnormal(x)
+    */
+    #define __USE_ISOC99
+#endif
+#include <math.h>
+
+#include "radiation.h"
+#include "modify_pluto.h"
+#include "radiation_tools.h"
+#include "opacity.h"
+#include "assert.h"
+
+#if RADIATION_SOLVER == PETSC_LIBRARY
+    #include "petsc.h"
+#endif
+
+#if IRRADIATION == YES
+    #include "irradiation.h"
+#endif
+
+#include "SemenovOpacity/semenov_opacity.h"
+
+#if DIMENSIONS != 3
+    #error Dimension must be set to 3 if you want to use the radiation module!
+#endif
+
+#ifndef PARALLEL
+    #error The radiation module must be compuled with a makefile where PARALLEL=TRUE is set like Linux.mpicc.defs
+#endif
+
+RadiationData radiation_data = {.code_c = 1.0, .code_mH = 1.0, .code_amu = 1.0, .code_aR = 1.0, .code_kB = 1.0, .mu = 0.6, .Erad = NULL, .default_init_Erad = 1};
+
+double g_unitTemperature = 1.;  /**<Transformation between temperature in code units and temperature in kelvin \note is set in \ref RadiationInit()*/
+
+/**
+    With this function it is possible to change the initial behavior of Erad. If \a b is 1 then \ref RadiationSetInitialErad is called in function
+    \ref RadiationInit else not. This function is only needed if Erad is set by the user or if Erad is loaded from a file.
+
+    \param[in] b
+*/
+void RadiationSetEradInitBehaviour( int b )
+{
+    radiation_data.default_init_Erad = b;
+}
+
+/**
+    Sets \f$ \mu \f$ for the computation
+
+    \param[in] mu
+*/
+void RadiationSetMu( double mu )
+{
+    radiation_data.mu = mu;
+}
+
+/**
+    Prints out the current set boundary conditions
+*/
+void PrintBoundaryConditions()
+{
+    int i = 0;
+    char *boundary_string[] = {"invalid", "periodic", "symmetric", "reflective", "outflow", "fixedvalue", "shearingbox"};
+
+    if( prank == 0 )
+    {
+        print( "> Radiation boundary conditions\n" );
+        for( i = 0; i < 3; ++i )
+        {
+            print( " X%i boundary: [beg ... end]  %10s ... %10s\n", i + 1, boundary_string[radiation_data.boundary_conditions[i].bc_beg], boundary_string[radiation_data.boundary_conditions[i].bc_end] );
+            if( radiation_data.boundary_conditions[i].bc_beg == RADIATION_BC_FIXEDVALUE )
+            {
+                print( "    begin fixedvalue=%10.3e fixedvalueT=%10.3f\n", radiation_data.boundary_conditions[i].beg_fixedvalue * ( g_unitDensity * POW2( g_unitVelocity ) ), pow( radiation_data.boundary_conditions[i].beg_fixedvalue / radiation_data.code_aR, 1. / 4. )*g_unitTemperature );
+            }
+
+            if( radiation_data.boundary_conditions[i].bc_end == RADIATION_BC_FIXEDVALUE )
+            {
+                print( "    end fixedvalue=%10.3e fixedvalueT=%10.3f\n", radiation_data.boundary_conditions[i].end_fixedvalue * ( g_unitDensity * POW2( g_unitVelocity ) ), pow( radiation_data.boundary_conditions[i].end_fixedvalue / radiation_data.code_aR, 1. / 4. )*g_unitTemperature );
+            }
+        }
+    }
+}
+
+/**
+    Print some units and constants which can be used for conversion the code units back to
+    cgs-units in post processing tools.
+
+    \note Some of the units are printed out by PLUTO but we print it again with higher precision
+*/
+void RadiationPrintUnits()
+{
+    if( prank == 0 )
+    {
+        print( "\n> Normalisation Units for postprocessing\n" );
+        print( " %-25s %-15.10e %s\n", "[g_unitDensity]:", g_unitDensity, "(gr/cm^3)" );
+        print( " %-25s %-15.10e %s\n", "[g_unitVelocity]:", g_unitVelocity, "(cm/s)" );
+        print( " %-25s %-15.10e %s\n", "[g_unitLength]:", g_unitLength, "(cm)" );
+        print( " %-25s %-15.10e %s\n", "[g_unitTemperature]:", g_unitTemperature, "(K)" );
+
+        print( "\n> Constants needed for postprocessing\n" );
+        print( " %-25s %-15.10e %s\n", "[mu]:", radiation_data.mu, "" );
+        print( " %-25s %-15.10e %s\n", "[gamma]:", g_gamma, "" );
+        print( "\n" );
+
+//      print(" %-25s %-15.10e %s\n","[CONST_amu]:",CONST_amu,"(gr)");
+
+//      print("code_c=%15.10e CONST_c=%15.10e\n",radiation_data.code_c,CONST_c);
+//      print("code_aR=%15.10e CONST_aR=%15.10e\n",radiation_data.code_aR,CONST_aR);
+//      print("code_kB=%15.10e CONST_kB=%15.10e\n",radiation_data.code_kB,CONST_kB);
+//      print("code_mH=%15.10e CONST_mH=%15.10e\n",radiation_data.code_mH,CONST_mH);
+    }
+}
+
+/**
+    Function to handle segmentation faults. This means if setup the function is called
+    if a segmentation fault occurs.
+*/
+void SegfaultHandleFunction( int sig )
+{
+    const int buffer_size = 30;
+    void *buffer[buffer_size];
+    int size = 0;
+
+    size = backtrace( buffer, buffer_size );
+    fprintf( stderr, "Error: signal %d:\n", sig );
+    backtrace_symbols_fd( buffer, size, 2 ); //prints the functions to file descriptor 2 (stderr)
+    exit( 1 );
+}
+
+/**
+    Calculates the new temperature \f$ T_{i,j,k}^{n+1} \f$ by using the radiation energy
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+    \param[in]  data
+
+    \returns
+        In the case that irradiation and/or artificial dissipation is used this function returns
+        \f[
+            T_{i,j,k}^{n+1} = \frac{{\kappa_P}_{i,j,k}^n c \left(3 a_R (T_{i,j,k}^n)^4  + E_{i,j,k}^{n+1}\right)\Delta t + \frac{W^n_{i,j,k} \Delta t}{\rho^n_{i,j,k}} + c_V T_{i,j,k}^n}{c_V + 4 {\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^3 \Delta t}
+        \f]
+        where \f$ W^n_{i,j,k} \f$ is either \f$ S^n_{i,j,k} \f$ in the case of irradiation or \f$ D^n_{i,j,k} \f$ in the case of artificial dissipation. If irradiation and artificial dissipation is used together then \f$ W^n_{i,j,k} \f$ is the summ of both \f$ W^n_{i,j,k} = S^n_{i,j,k}+D^n_{i,j,k}\f$.\n
+        else
+        \f[
+            T_{i,j,k}^{n+1} = \frac{{\kappa_P}_{i,j,k}^n c \left(3 a_R (T_{i,j,k}^n)^4  + E_{i,j,k}^{n+1}\right)\Delta t + c_V T_{i,j,k}^n}{c_V + 4 {\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^3 \Delta t}
+        \f]
+        \f$ E_{i,j,k}^{n+1} \f$ labels the radiation energy at the time step n+1
+
+*/
+double ComputeNewTemperature( int k, int j, int i, Grid *grid, Data *data )
+{
+    #if IRRADIATION == YES || ARTIFICIAL_DISSIPATION == YES
+        double plank_opacity = ComputePlanckOpacity( k, j, i, data, grid );
+        double temperature = GetTemperature( k, j, i, data );
+        double c_V = ComputeSpecificHeatCapacity( k, j, i, data );
+        double rho = data->Vc[RHO][k][j][i];
+
+        double W = 0.0;
+        #if IRRADIATION == YES
+            W = irradiation.S[k][j][i];
+        #endif
+
+        #if ARTIFICIAL_DISSIPATION == YES
+            W += ComputeArtificialDissipation( k, j, i, data, grid );
+        #endif
+
+        return ( plank_opacity * radiation_data.code_c * ( 3. * radiation_data.code_aR * POW4( temperature ) + radiation_data.Erad[k][j][i] ) * g_dt + ( W * g_dt ) / rho + c_V * temperature ) / ( c_V + 4. * plank_opacity * radiation_data.code_c * radiation_data.code_aR * POW3( temperature ) * g_dt );
+    #else
+        double plank_opacity = ComputePlanckOpacity( k, j, i, data, grid );
+        double temperature = GetTemperature( k, j, i, data );
+        double c_V = ComputeSpecificHeatCapacity( k, j, i, data );
+        return ( plank_opacity * radiation_data.code_c * ( 3. * radiation_data.code_aR * POW4( temperature ) + radiation_data.Erad[k][j][i] ) * g_dt + c_V * temperature ) / ( c_V + 4. * plank_opacity * radiation_data.code_c * radiation_data.code_aR * POW3( temperature ) * g_dt );
+    #endif
+}
+
+/**
+    Updates the pressure in PLUTO after the implicit radiation step
+
+    The temperature is given by \f$ T = \frac{p}{\rho} \frac{\mu m_u}{k_B}\f$ where \f$ \mu m_u \f$ the mass
+    of one gas molecule, so we get for the pressure \f$ p = T \rho \frac{k_B}{\mu m_u} \f$.
+
+
+    \note It is not necessary to call function \a AL_Exchange_dim because it was called for the array Erad before, so the ghost cell for Erad are set correctly
+
+    \param[in]  grid
+    \param[in]  data
+    \param[out] data
+*/
+void UpdatePlutoPressure( Grid *grid, Data *data )
+{
+    int k = 0, j = 0, i = 0;
+    double *** pr = data->Vc[PRS];
+    double *** rho = data->Vc[RHO];
+    double temperature = 0.;
+
+    TOT_LOOP( k, j, i )
+    {
+        temperature = ComputeNewTemperature( k, j, i, grid, data );
+        pr[k][j][i] = ( temperature * rho[k][j][i] * radiation_data.code_kB ) / ( radiation_data.mu * radiation_data.code_amu );
+    }
+}
+
+/**
+    Sets the initial values for the radiation energy to \f$ E_r = a_R T^4 \f$ the energy of a black body at the temperature \a T.
+
+    \param[in]  grid
+    \param[in]  data
+    \param[out] data
+*/
+void RadiationSetInitialEradBlackBody( Grid *grid, Data *data )
+{
+    int k, j, i;
+
+    double temperature = 0.;
+
+    TOT_LOOP( k, j, i )
+    {
+        temperature = GetTemperature( k, j, i, data );
+        radiation_data.Erad[k][j][i] = radiation_data.code_aR * POW4( temperature );
+    }
+}
+
+/**
+    Sets the fixed value boundary conditions
+
+    \param[in]  q   is a pointer to the array containing the variable. For example data->Vc[RHO]
+    \param[in]  side
+    \param[out] q
+*/
+void FixedValueBoundaryCondition( double ***q, RBox *box, int side )
+{
+    int k, j, i;
+    switch( side )
+    {
+        case X1_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[IDIR].beg_fixedvalue;
+            }
+            break;
+
+        case X1_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[IDIR].end_fixedvalue;
+            }
+            break;
+
+        case X2_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[JDIR].beg_fixedvalue;
+            }
+            break;
+
+        case X2_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[JDIR].end_fixedvalue;
+            }
+            break;
+
+        case X3_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[KDIR].beg_fixedvalue;
+            }
+            break;
+
+        case X3_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = radiation_data.boundary_conditions[KDIR].end_fixedvalue;
+            }
+            break;
+    }
+}
+
+/**
+    Sets the reflective value boundary conditions
+
+    \param[in]  q   is a pointer to the array containing the variable. For example data->Vc[RHO]
+    \param[in]  side
+    \param[out] q
+*/
+void ReflectiveBoundaryCondition( double ***q, RBox *box, int side )
+{
+    int k, j, i;
+    switch( side )
+    {
+        case X1_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j][2 * IBEG - i - 1];
+            }
+            break;
+
+        case X1_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j][2 * IEND - i + 1];
+            }
+            break;
+
+        case X2_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][2 * JBEG - j - 1][i];
+            }
+            break;
+
+        case X2_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][2 * JEND - j + 1][i];
+            }
+            break;
+
+        case X3_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[2 * KBEG - k - 1][j][i];
+            }
+            break;
+
+        case X3_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[2 * KEND - k + 1][j][i];
+            }
+            break;
+    }
+}
+
+/**
+    Sets the periodic value boundary conditions
+
+    \param[in]  q   is a pointer to the array containing the variable. For example data->Vc[RHO]
+    \param[in]  side
+    \param[out] q
+*/
+void PeriodicBoundaryCondition( double ***q, RBox *box, int side )
+{
+    int k, j, i;
+    switch( side )
+    {
+        case X1_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j][i + NX1];
+            }
+            break;
+
+        case X1_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j][i - NX1];
+            }
+            break;
+
+        case X2_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j + NX2][i];
+            }
+            break;
+
+        case X2_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k][j - NX2][i];
+            }
+            break;
+
+        case X3_BEG:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k + NX3][j][i];
+            }
+            break;
+
+        case X3_END:
+            BOX_LOOP( box, k, j, i )
+            {
+                q[k][j][i] = q[k - NX3][j][i];
+            }
+            break;
+    }
+}
+
+/**
+    Sets the boundary conditions for the radiation energy.
+
+    Exchange boundaries between neighbor processes, for this purpose the function \ref AL_Exchange_dim is used.
+
+    \note For more information look at boundary.c and $PLUTO_DIR/Lib/ArrayLib/src/al_exchange_dim.c
+
+    \param[in]  grid
+    \param[in]  data
+    \param[out] data
+*/
+void RadiationBoundaryCondition( Grid *grid, Data *data )
+{
+    int parallel_dimension[3] = {0, 0, 0};
+    int physical_boundary[6];
+    int side[6] = {X1_BEG, X1_END, X2_BEG, X2_END, X3_BEG, X3_END};
+    int is = 0;
+    static int do_once = 1;
+    static RBox center[8], x1face[8], x2face[8], x3face[8];
+
+    if( do_once )
+    {
+        SetRBox( center, x1face, x2face, x3face );
+        do_once = 0;
+    }
+
+    //check how many processes are available in each direction
+    parallel_dimension[0] = grid[IDIR].nproc > 1;
+    parallel_dimension[1] = grid[JDIR].nproc > 1;
+    parallel_dimension[2] = grid[KDIR].nproc > 1;
+
+    //exchange data between processes
+    AL_Exchange_dim( ( char * )radiation_data.Erad[0][0], parallel_dimension, SZ ); //SZ seems to be a descriptor for ArrayLib
+
+    physical_boundary[0] = grid[IDIR].lbound > 0 ? radiation_data.boundary_conditions[IDIR].bc_beg : RADIATION_BC_NO_BOUNDARY;
+    physical_boundary[1] = grid[IDIR].rbound > 0 ? radiation_data.boundary_conditions[IDIR].bc_end : RADIATION_BC_NO_BOUNDARY;
+
+    physical_boundary[2] = grid[JDIR].lbound > 0 ? radiation_data.boundary_conditions[JDIR].bc_beg : RADIATION_BC_NO_BOUNDARY;
+    physical_boundary[3] = grid[JDIR].rbound > 0 ? radiation_data.boundary_conditions[JDIR].bc_end : RADIATION_BC_NO_BOUNDARY;
+
+    physical_boundary[4] = grid[KDIR].lbound > 0 ? radiation_data.boundary_conditions[KDIR].bc_beg : RADIATION_BC_NO_BOUNDARY;
+    physical_boundary[5] = grid[KDIR].rbound > 0 ? radiation_data.boundary_conditions[KDIR].bc_end : RADIATION_BC_NO_BOUNDARY;
+
+    for( is = 0; is < 6; ++is )
+    {
+        switch( physical_boundary[is] )
+        {
+            case RADIATION_BC_NO_BOUNDARY:
+                continue;
+                break;
+
+            case RADIATION_BC_PERIODIC:
+                /*
+                    PERIODIC_BOUND is only called if there's one processor in this direction.
+
+                    If there is more than one processor in this direction the periodic boundaries
+                    are set by the Array library (by the function AL_Exchange_dim called above)
+                */
+                if( parallel_dimension[is / 2] == 0 )
+                {
+                    PeriodicBoundaryCondition( radiation_data.Erad, center + is, side[is] );
+                }
+
+                break;
+
+            case RADIATION_BC_SYMMETRIC:
+            case RADIATION_BC_REFLECTIVE:
+            case RADIATION_BC_OUTFLOW:
+                ReflectiveBoundaryCondition( radiation_data.Erad, center + is, side[is] );
+                break;
+
+            case RADIATION_BC_FIXEDVALUE:
+                FixedValueBoundaryCondition( radiation_data.Erad, center + is, side[is] );
+                break;
+            #ifdef SHEARINGBOX
+                case RADIATION_BC_SHEARINGBOX:
+                {
+                    RBox box;
+                    if( side[is] == X1_BEG )
+                    {
+                        box.ib = 0; box.ie = IBEG - 1;
+                        box.jb = 0; box.je = NX2_TOT - 1;
+                        box.kb = 0; box.ke = NX3_TOT - 1;
+                    }
+
+                    if( side[is] == X1_END )
+                    {
+                        box.ib = IEND + 1; box.ie = NX1_TOT - 1;
+                        box.jb = 0; box.je = NX2_TOT - 1;
+                        box.kb = 0; box.ke = NX3_TOT - 1;
+                    }
+
+                    if( parallel_dimension[is / 2] == 0 )
+                    {
+                        PeriodicBoundaryCondition( radiation_data.Erad, center + is, side[is] );
+                    }
+
+                    SB_SetBoundaryVar( radiation_data.Erad, &box, side[is] , g_time , grid );
+                }
+                break;
+            #endif
+
+        }
+    }
+}
+
+/**
+    In this function we read the informations for the boundary conditions out of the
+    file pluto.ini and create a global array which provides this information per direction.
+
+    A example section for the boundary conditions in the file pluto.ini look like:
+    \verbatim
+    [Radiation-Boundary]
+    rX1-beg        fixedvalue 1e-8
+    rX1-end        fixedvalueT 50.7
+    rX2-beg        reflective
+    rX2-end        symmetric
+    rX3-beg        periodic
+    rX3-end        periodic
+    \endverbatim
+
+    We implemented four different boundary conditions for now periodic,symmetric,reflective
+    and fixedvalue. If you specify the boundary condition fixedvalue you have to set the radiation energy
+    like "rX1-beg fixedvalue 1e-8" if the value is 1e-8. There is also the keyword fixedvalueE which is the
+    same as fixedvalue. If you want to set the radiation energy corresponding to a temperature you can use
+    fixedvalueT in the same way as fixedvalue. In this case the temperature is converged to the radiation
+    energy by the formula \f$ E = a_R T^4 \f$ (\f$ E \f$ = the radiation energy).
+
+    \note
+        For a scalar reflective and symmetric are the same boundary condition (this is the case here)   \n
+        For informations about \ref ParGet see \ref parse_file.c and setup.c
+
+    \param[in] grid
+*/
+void SetupBoundaryConditions( Grid *grid )
+{
+    char option[256];
+    char *result;
+    int pos = 0, dir = 0, begin = 0;
+
+    if( prank == 0 )
+    {
+        for( pos = 0; pos < 6; pos++ )
+        {
+            if( pos < 3 )
+            {
+                sprintf( option, "rX%d-beg", pos + 1 );
+                dir = pos;
+                begin = 1;
+                radiation_data.boundary_conditions[dir].beg_fixedvalue = 0.; //set it to a defined value for the case that it is not used
+            }
+            else
+            {
+                sprintf( option, "rX%d-end", pos - 2 );
+                dir = pos - 3;
+                begin = 0;
+                radiation_data.boundary_conditions[dir].end_fixedvalue = 0.; //set it to a defined value for the case that it is not used
+            }
+
+            result = ParGet( option, 1 );
+            if( !result )
+            {
+                printf( "Option %s not found in pluto.ini\n", option );
+                QUIT_PLUTO( 1 );
+            }
+
+//          printf("%s %s\n",option,result);
+
+            if( strcmp( result, "periodic" ) == 0 )
+            {
+                if( begin )
+                {
+                    radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_PERIODIC;
+                }
+                else
+                {
+                    radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_PERIODIC;
+                }
+            }
+            else if( strcmp( result, "symmetric" ) == 0 )
+            {
+                if( begin )
+                {
+                    radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_SYMMETRIC;
+                }
+                else
+                {
+                    radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_SYMMETRIC;
+                }
+
+            }
+            else if( strcmp( result, "reflective" ) == 0 )
+            {
+                if( begin )
+                {
+                    radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_REFLECTIVE;
+                }
+                else
+                {
+                    radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_REFLECTIVE;
+                }
+            }
+            else if( strcmp( result, "outflow" ) == 0 )
+            {
+                if( begin )
+                {
+                    radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_OUTFLOW;
+                }
+                else
+                {
+                    radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_OUTFLOW;
+                }
+            }
+            else if( strcmp( result, "shearingbox" ) == 0 )
+            {
+                if( begin )
+                {
+                    radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_SHEARINGBOX;
+                }
+                else
+                {
+                    radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_SHEARINGBOX;
+                }
+            }
+            else if( strcmp( result, "fixedvalueE" ) == 0 || strcmp( result, "fixedvalue" ) == 0 )
+            {
+                if( ParGet( option, 2 ) )
+                {
+                    if( begin )
+                    {
+                        radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_FIXEDVALUE;
+                        radiation_data.boundary_conditions[dir].beg_fixedvalue = atof( ParGet( option, 2 ) ) / ( g_unitDensity * POW2( g_unitVelocity ) );
+                    }
+                    else
+                    {
+                        radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_FIXEDVALUE;
+                        radiation_data.boundary_conditions[dir].end_fixedvalue = atof( ParGet( option, 2 ) ) / ( g_unitDensity * POW2( g_unitVelocity ) );
+                    }
+                }
+                else
+                {
+                    printf( "No value specified for option \"%s fixedvalue <value>\" \n", option );
+                    QUIT_PLUTO( 1 );
+                }
+            }
+            else if( strcmp( result, "fixedvalueT" ) == 0 )
+            {
+                if( ParGet( option, 2 ) )
+                {
+                    if( begin )
+                    {
+                        radiation_data.boundary_conditions[dir].bc_beg = RADIATION_BC_FIXEDVALUE;
+                        radiation_data.boundary_conditions[dir].beg_fixedvalue =  radiation_data.code_aR * POW4( atof( ParGet( option, 2 ) ) / g_unitTemperature );
+                    }
+                    else
+                    {
+                        radiation_data.boundary_conditions[dir].bc_end = RADIATION_BC_FIXEDVALUE;
+                        radiation_data.boundary_conditions[dir].end_fixedvalue = radiation_data.code_aR * POW4( atof( ParGet( option, 2 ) ) / g_unitTemperature );
+                    }
+                }
+                else
+                {
+                    printf( "No value specified for option \"%s fixedvalue <value>\" \n", option );
+                    QUIT_PLUTO( 1 );
+                }
+            }
+            else
+            {
+                printf( "Unknown value for option %s in pluto.ini\n", option );
+                QUIT_PLUTO( 1 );
+            }
+
+//          result = ParGet(option,1);
+//          printf("%s \t %s\n",option,result);
+        }
+    }
+
+    MPI_Bcast( radiation_data.boundary_conditions, 3 * sizeof( BoundaryConditionInfo ), MPI_CHAR, 0, MPI_COMM_WORLD );
+
+//  for(pos = 0; pos < 3; pos++)
+//  {
+//      printf("Processor %d \t pos = %d \t bc_beg = %d \t bc_end = %d\n",prank,pos,radiation_data.boundary_conditions[pos].bc_beg,radiation_data.boundary_conditions[pos].bc_end);
+//      printf("Processor %d \t pos = %d \t beg_fixedvalue = %e \t end_fixedvalue = %e\n",prank,pos,radiation_data.boundary_conditions[pos].beg_fixedvalue,prank,radiation_data.boundary_conditions[pos].end_fixedvalue);
+//  }
+    CheckBoundaryConditions( grid );
+}
+
+/**
+    Checks if the boundary conditions are consistent with the boundary conditions used by
+    the HD,... module in PLUTO
+
+    \param[in] grid
+*/
+void CheckBoundaryConditions( Grid *grid )
+{
+    int direction = 0;
+    int bad = 0;
+
+    for( direction = 0; direction < 3; ++direction ) //iterates over IDIR,JDIR,KDIR
+    {
+        if( grid[direction].lbound != 0 )
+        {
+            if( radiation_data.boundary_conditions[direction].bc_beg == RADIATION_BC_PERIODIC && grid[direction].lbound != PERIODIC )
+            {
+                print( "rX%i-beg set to periodic boundary conditions in radiation module but X%i-beg set to different boundary condition! This is not possible!!!\n", direction + 1, direction + 1 );
+                bad = 1;
+            }
+        }
+
+        if( grid[direction].rbound != 0 )
+        {
+            if( radiation_data.boundary_conditions[direction].bc_end == RADIATION_BC_PERIODIC && grid[direction].rbound != PERIODIC )
+            {
+                print( "rX%i-end set to periodic boundary conditions in radiation module but X%i-end set to different boundary condition! This is not possible!!!\n", direction + 1, direction + 1 );
+                bad = 1;
+            }
+        }
+    }
+
+    if( bad )
+    {
+        print( "boundary condition problem\n" );
+        QUIT_PLUTO( 1 );
+    }
+}
+
+/**
+    Allocates memory for the array Erad and appends the array to the output system of PLUTO.
+
+    \param[in]  input
+*/
+void RadiationAllocateMemory( Input *input )
+{
+    radiation_data.Erad = ( double ** * )Array3D( NX3_TOT, NX2_TOT, NX1_TOT, sizeof( double ) );
+    CHECK_ALLOCATED_MEMORY( radiation_data.Erad );
+
+    AppendArrayToPlutoFileOutput( input, "Er", radiation_data.Erad );
+}
+
+/**
+    Initializes the radiation transport module:
+
+    \note
+        RESTART should work by the default mechanism that PLUTO supplies
+
+    \param[in]  argc    PLUTO argc
+    \param[in]  argv    PLUTO argv
+    \param[in]  input
+    \param[in]  grid
+    \param[in]  data
+    \param[in]  restart
+
+*/
+void RadiationInit( int argc, char **argv, Input *input, Grid *grid, Data *data, int restart )
+{
+    int set_fpe_signal_handler = 0;
+
+    //initialization of some constants in code units
+    radiation_data.code_c = CONST_c / g_unitVelocity;
+    radiation_data.code_mH = CONST_mH / ( g_unitDensity * POW3( g_unitLength ) );
+    radiation_data.code_amu = CONST_amu / ( g_unitDensity * POW3( g_unitLength ) );
+    radiation_data.code_aR = CONST_aR / ( ( g_unitDensity * POW2( g_unitVelocity ) ) / POW4( g_unitTemperature ) );
+    radiation_data.code_kB = CONST_kB / ( ( g_unitDensity * POW3( g_unitLength ) * POW2( g_unitVelocity ) ) / g_unitTemperature );
+
+    int mat_nrows = grid[KDIR].np_int_glob * grid[JDIR].np_int_glob * grid[IDIR].np_int_glob, nproc = 0;
+
+    if( radiation_data.Erad == NULL )
+    {
+        RadiationAllocateMemory( input );
+    }
+
+//  signal(SIGSEGV, segfault_handle);
+
+    SetupBoundaryConditions( grid );
+
+    if( radiation_data.default_init_Erad )
+    {
+        if( restart == 0 )
+        {
+            RadiationSetInitialErad( grid, data );
+        }
+    }
+    RadiationBoundaryCondition( grid, data );
+
+    if( prank == 0 )
+    {
+        print( "\n> Radiation Settings\n" );
+        #if RADIATION_FLUXLIMITER == FLUXLIMITER_MINERBO
+            print( " %-25s %s\n", "FLUXLIMITER:", "FLUXLIMITER_MINERBO" );
+        #elif RADIATION_FLUXLIMITER == FLUXLIMITER_KLEY
+            print( " %-25s %s\n", "FLUXLIMITER:", "FLUXLIMITER_KLEY" );
+        #elif RADIATION_FLUXLIMITER == FLUXLIMITER_LEVERMORE_POMRANING
+            print( " %-25s %s\n", "FLUXLIMITER:", "FLUXLIMITER_LEVERMORE_POMRANING" );
+        #elif RADIATION_FLUXLIMITER == FLUXLIMITER_CONST
+            print( " %-25s %s\n", "FLUXLIMITER:", "FLUXLIMITER_CONST" );
+        #endif
+
+        #if RADIATION_PRESSURE == YES
+            print( " %-25s %s\n", "RADIATION_PRESSURE:", "YES" );
+        #else
+            print( " %-25s %s\n", "RADIATION_PRESSURE:", "NO" );
+        #endif
+
+        #if IRRADIATION == YES
+            print( " %-25s %s\n", "IRRADIATION:", "YES" );
+        #else
+            print( " %-25s %s\n", "IRRADIATION:", "NO" );
+        #endif
+
+        #if ARTIFICIAL_DISSIPATION == YES
+            print( " %-25s %s\n", "ARTIFICIAL_DISSIPATION:", "YES" );
+        #endif
+
+        print( "\n" );
+
+        print( " %-25s %dx%d\n", "Radiation matrix size:", mat_nrows, mat_nrows );
+    }
+
+    RadiationPrintUnits();
+    PrintBoundaryConditions();
+
+    if( prank == 0 )
+    {
+        if( ParQuery( "max-iterations" ) )
+        {
+            radiation_data.max_iterations = atoi( ParGet( "max-iterations", 1 ) );
+        }
+        else
+        {
+            radiation_data.max_iterations = 10000;
+        }
+
+        if( ParQuery( "absolute-tolerance" ) ) //this is only used for PETSc
+        {
+            radiation_data.absolute_tolerance = atof( ParGet( "absolute-tolerance", 1 ) );
+        }
+        else
+        {
+            radiation_data.absolute_tolerance = 1e-50;
+        }
+
+        if( ParQuery( "relative-tolerance" ) )
+        {
+            radiation_data.relative_tolerance = atof( ParGet( "relative-tolerance", 1 ) );
+        }
+        else
+        {
+            radiation_data.relative_tolerance = 1e-5;
+        }
+
+        MPI_Bcast( &radiation_data.max_iterations, 1, MPI_INT, 0, MPI_COMM_WORLD );
+        MPI_Bcast( &radiation_data.absolute_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+        MPI_Bcast( &radiation_data.relative_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+    }
+    else
+    {
+        MPI_Bcast( &radiation_data.max_iterations, 1, MPI_INT, 0, MPI_COMM_WORLD );
+        MPI_Bcast( &radiation_data.absolute_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+        MPI_Bcast( &radiation_data.relative_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+    }
+
+
+    #if RADIATION_SOLVER == PETSC_LIBRARY
+        PetscInit( argc, argv, input, grid, data );
+    #elif RADIATION_SOLVER == SOLVER_SOR
+        SuccessiveOverrelaxationInit();
+    #endif
+
+    if( ParQuery( "fpe-signal-haldler" ) )
+    {
+        if( strcmp( ParGet( "fpe-signal-haldler", 1 ), "enable" ) == 0 )
+        {
+            set_fpe_signal_handler = 1;
+        }
+    }
+
+    MPI_Bcast( &set_fpe_signal_handler, 1, MPI_INT, 0, MPI_COMM_WORLD );
+    if( set_fpe_signal_handler )
+    {
+        RegisterFpeSignalHandler();
+    }
+
+    #if IRRADIATION == YES
+        IrradiationInit( grid );
+    #endif
+
+    RadiationOpacityInit();
+
+    ShowDomainDecompositionAdvanced( grid );
+}
+
+/**
+    Cleans up the radiation transport module, frees all allocated memory and calls \ref PetscCleanup()
+*/
+void RadiationCleanup()
+{
+    FreeArray3D( ( void * ) radiation_data.Erad );
+    radiation_data.Erad = NULL;
+
+    #if RADIATION_SOLVER == PETSC_LIBRARY
+        PetscCleanup();
+    #elif RADIATION_SOLVER == SOLVER_SOR
+        SuccessiveOverrelaxationFinalise();
+    #endif
+
+    #if IRRADIATION == YES
+        IrradiationFinalise();
+    #endif
+
+    SemenovOpacityFinalise();
+}
+
+/**
+    Computes the next time step
+
+    \param[in]  grid
+    \param[in]  data
+    \param[in]  input for attribute log_freq
+
+*/
+void RadiationImplicitTimestep( Grid *grid, Data *data, Input *input )
+{
+    int iterations = 0;
+    static int min_used_iterations = INT_MAX;
+    static int max_used_iterations = 0;
+    static int sum_used_iterations = 0;
+
+    #ifdef RADIATION_CUSTOM_IMPLICITE_TEMESTEP_BEGIN
+        RadiationCustomImplicitTimestepBegin( grid, data );
+    #endif
+
+    #if IRRADIATION == YES
+        IrradiationCalculateS( grid, data );
+    #endif
+
+    #ifndef RADIATION_DISABLE_MATRIXSOLVER
+        #if RADIATION_SOLVER == PETSC_LIBRARY
+            iterations = PetscImplicitTimestep( grid, data );
+        #elif RADIATION_SOLVER == SOLVER_SOR
+            iterations = SuccessiveOverrelaxationImplicitTimestep( grid, data );
+        #endif
+    #else
+            iterations = 0;
+    #endif
+
+    #ifdef DEBUG
+        int k = 0, j = 0, i = 0;
+        TOT_LOOP( k, j, i )
+        {
+            assert( radiation_data.Erad[k][j][i] >= 0. );
+            if( radiation_data.Erad[k][j][i] < 0. )
+            {
+                print( "ERROR" );
+            }
+        }
+    #endif
+
+    if( prank == 0 )
+    {
+        if( min_used_iterations > iterations ) min_used_iterations = iterations;
+        if( max_used_iterations < iterations ) max_used_iterations = iterations;
+        sum_used_iterations += iterations;
+
+        if( input->log_freq == 1 )
+        {
+            print( "Iterations used for radiation: %d\n", iterations );
+        }
+        else if( g_stepNumber % input->log_freq == 0 )
+        {
+            print( "Iterations used for radiation: min=%5d max=%5d average=%5d\n", min_used_iterations, max_used_iterations, sum_used_iterations / input->log_freq );
+            min_used_iterations = INT_MAX;
+            max_used_iterations = 0;
+            sum_used_iterations = 0;
+        }
+    }
+
+//  if(prank == 0 && g_stepNumber % input->log_freq == 0)
+//  {
+//      print("Iterations used: %d\n",iterations);
+//  }
+
+    #ifdef RADIATION_CUSTOM_IMPLICITE_TEMESTEP_END
+        RadiationCustomImplicitTimestepEnd( grid, data, iterations );
+    #endif
+}
+
+/**
+    Computes the next time step by using the SOR (successive over relaxation) algorithm
+
+    \param[in]  grid
+    \param[in]  data
+*/
+int SuccessiveOverrelaxationImplicitTimestep( Grid *grid, Data *data )
+{
+    int iterations = 0;
+
+    if( ( iterations = SuccessiveOverrelaxation( grid, data, radiation_data.relative_tolerance, radiation_data.absolute_tolerance, radiation_data.max_iterations ) ) == -1 )
+    {
+        print( "Iterative solver not converged\n" );
+        QUIT_PLUTO( 1 );
+    }
+    UpdatePlutoPressure( grid, data );
+    return iterations;
+}
+
+/**
+    Allocates all memory needed by the SOR solver
+
+    \note needed for the function \ref SuccessiveOverrelaxation
+*/
+void SuccessiveOverrelaxationInit()
+{
+    int i = 0;
+    #if RADIATION_SOLVER == SOLVER_SOR
+        //Allocate memory for SOLVER SOR
+
+        if( prank == 0 )
+        {
+            print( ">Radiation Solver Settings\n" );
+            print( " %-25s %s\n", "SOLVER:", "SOR" );
+            #if RADIATION_SOR_OMEGA_MODE == SOR_ADAPTIVE_OMEGA
+                print( " %-25s %s\n", "SOR_OMEGA_MODE:", "SOR_ADAPTIVE_OMEGA" );
+            #elif RADIATION_SOR_OMEGA_MODE == SOR_FIXED_OMEGA
+                print( " %-25s %s\n", "SOR_OMEGA_MODE:", "SOR_FIXED_OMEGA" );
+            #endif
+
+            #if RADIATION_SOR_NORM == NORM_RELATIVE_L2
+                print( " %-25s %s\n", "NORM:", "NORM_RELATIVE_L2" );
+            #elif RADIATION_SOR_NORM == NORM_RELATIVE_MAX
+                print( " %-25s %s\n", "NORM:", "NORM_RELATIVE_MAX" );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_L2
+                print( " %-25s %s\n", "NORM:", "NORM_RESIDUAL_L2" );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_MAX
+                print( " %-25s %s\n", "NORM:", "NORM_RESIDUAL_MAX" );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_L2
+                print( " %-25s %s\n", "NORM:", "NORM_RESIDUAL_RELATIVE_L2" );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_MAX
+                print( " %-25s %s\n", "NORM:", "NORM_RESIDUAL_RELATIVE_MAX" );
+            #elif RADIATION_SOR_NORM == NORM_PETSC
+                print( " %-25s %s\n", "NORM:", "NORM_PETSC" );
+            #endif
+
+            print( " %-25s %5.3e\n", "absolute-tolerance:", radiation_data.absolute_tolerance );
+            print( " %-25s %5.3e\n", "relative-tolerance:" , radiation_data.relative_tolerance );
+            print( " %-25s %d\n", "max-iterations:", radiation_data.max_iterations );
+            print( "\n" );
+        }
+
+        radiation_data.sor_coefficients = ( double ** ** )Array4D( 8, NX3_TOT, NX2_TOT, NX1_TOT, sizeof( double ) );
+        CHECK_ALLOCATED_MEMORY( radiation_data.sor_coefficients );
+    #endif
+}
+
+/**
+    Frees the memory allocated by function \ref SuccessiveOverrelaxationInit
+
+    \note needed for the function \ref SuccessiveOverrelaxation
+*/
+void SuccessiveOverrelaxationFinalise()
+{
+    #if RADIATION_SOLVER == SOLVER_SOR
+        FreeArray4D( ( void ** ** )radiation_data.sor_coefficients );
+        radiation_data.sor_coefficients = NULL;
+    #endif
+}
+
+/**
+    Computes the new omega for the successive over relaxation \ref SuccessiveOverrelaxation. This function is used
+    if RADIATION_SOR_OMEGA_MODE is set to SOR_ADAPTIVE_OMEGA otherwise omega is set to a constant value. Omega
+    is computed by using the averaged number of iteration used by the function \ref SuccessiveOverrelaxation. It is
+    averaged over \a averageing_timesteps time steps and omega is increased or decreased by the value of \a increase.
+    The omega is only updated every \a averageing_timesteps time steps.
+
+    \param[in]  omega
+    \param[in]  iterations
+    \param[in]  increase
+    \param[in]  averageing_timesteps
+
+    \returns the computed omega
+*/
+double ComputeAdaptiveOmega( double omega, int iterations, double increase, int averageing_timesteps )
+{
+    static double current_max_iterations = 0;
+    static double current_average_iteratios = 0;
+    static double last_average_iterations = 0.;
+    static double direction = 1.0;
+    double diff = 0.0;
+
+    current_average_iteratios += ( double )iterations;
+    current_max_iterations = MAX( current_max_iterations, ( double )iterations );
+
+    if( g_stepNumber % averageing_timesteps == 0 )
+    {
+        current_average_iteratios = current_average_iteratios / ( ( double )averageing_timesteps );
+
+        if( current_max_iterations > current_average_iteratios * 3.0 )
+        {
+            current_average_iteratios = current_max_iterations;
+        }
+
+        diff = current_average_iteratios - last_average_iterations;
+
+        if( diff > 0. )
+        {
+            omega = omega + ( -1.0 * direction ) * increase /* boost*/;
+            direction = -1.0 * direction;
+        }
+        else if( diff < 0. )
+        {
+            omega = omega + direction * increase /* boost*/;
+        }
+
+        omega = omega < 0.1 ? 0.1 : omega;
+        omega = omega > 1.95 ? 1.95 : omega;
+
+//      if(prank == 0 && g_stepNumber % 100 == 0)
+//      {
+//              print("current_average_iteratios=%10.15e last_average_iterations=%10.15e direction=%10.15e omega=%10.15e diff=%10.15e\n",current_average_iteratios,last_average_iterations,direction,omega,diff);
+//      }
+
+        last_average_iterations = current_average_iteratios;
+        current_max_iterations = 0.;
+        current_average_iteratios = 0.;
+
+        return omega;
+    }
+    else
+    {
+        return omega;
+    }
+}
+
+/**
+    Computes the new radiation energy density by using the iterative matrix solver
+    SOR (successive over relaxation).
+
+    Features:\n
+        Adaptive change of \a omega during the simulation: To activate set RADIATION_SOR_OMEGA_MODE = SOR_ADAPTIVE_OMEGA
+        Different variants to compute the norm for the stop criterion: NORM_RELATIVE_L2, NORM_RELATIVE_MAX, (NORM_RESIDUAL_L2, NORM_RESIDUAL_MAX)
+
+    \note
+        If adaptive omega calculation is used (RADIATION_SOR_OMEGA_MODE is set to SOR_ADAPTIVE_OMEGA) we do not finally stop if max_iterations is reached or if norm_change < 1e-20.
+        Instead we change omega to an different value and try to solve it again.
+
+
+    Stop criterion:\n
+        The computation is stopped if norm <= rtol or then then iterations > \a max_iterations. \n \n
+
+        The norm \f$ n \f$ can be computed in different ways:\n
+        if RADIATION_SOR_NORM == NORM_RELATIVE_L2
+        \f[
+            n = \frac{\left\| \vec{x}^{(k)} - \vec{x}^{(k-1)}\right\|}{\left\| \vec{x}^{(k)}\right\|}
+        \f]
+        if RADIATION_SOR_NORM == NORM_RELATIVE_MAX
+        \f[
+            n = \frac{\left\| \vec{x}^{(k)} - \vec{x}^{(k-1)}\right\|_{\infty}}{\left\| \vec{x}^{(k)}\right\|_{\infty}}
+        \f]
+        if RADIATION_SOR_NORM == NORM_RESIDUAL_L2
+        \f[
+            n = \frac{\left\| \vec{r}^{(k)}\right\|}{\left\| \vec{b}^{(k)}\right\|}
+        \f]
+        if RADIATION_SOR_NORM == NORM_RESIDUAL_MAX
+        \f[
+            n = \frac{\left\| \vec{r}^{(k)}\right\|_{\infty}}{\left\| \vec{b}^{(k)}\right\|_{\infty}}
+        \f]
+        if RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_L2
+        \f[
+            n = \frac{\left\| \vec{r}^{(k)}\right\|}{\left\| \vec{r}^{(0)}\right\|}
+        \f]
+        if RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_MAX
+        \f[
+            n = \frac{\left\| \vec{r}^{(k)}\right\|_{\infty}}{\left\| \vec{r}^{(0)}\right\|_{\infty}}
+        \f]
+        if RADIATION_SOR_NORM == NORM_PETSC
+        The iteration stops if the expression
+        \f[
+            \left\| \vec{r}^{(k)} \right\| < \max(rtol \cdot \left\| \vec{b} \right\|, atol)
+        \f]
+        is true. The relative tolerance is rtol and the absolute tolerance atol.
+
+        In the above formulas is \f$ \vec{x}^{(k)} \f$ the solution vector (the radiation energy density) at the k-th iteration of the matrix equation \f$ A \vec{x} =\vec{b} \f$ and
+        \f$ \vec{r}^{(k)} \f$ is the residual at the k-th iteration which is given by the expression \f$ \vec{r}^{(k)} = \vec{b} - A \vec{x}^{(k)}\f$. The norm \f$ \left\| \vec{x}\right\| \f$
+        is computed with the formula
+        \f[
+            \left\| \vec{x}\right\| = \sqrt{\sum_i x_i^2}
+        \f]
+        and \f$ \left\| \vec{x}\right\|_{\infty} \f$ by
+        \f[
+            \left\| \vec{x}\right\|_{\infty} = \max_{i} x_i
+        \f]
+
+    \param[in]  grid
+    \param[in]  data
+    \param[in]  rtol            relative tolerance
+    \param[in]  atol            absolute tolerance
+    \param[in]  max_iterations
+    \param[out] data
+*/
+int SuccessiveOverrelaxation( Grid *grid, Data *data, double rtol, double atol, int max_iterations )
+{
+    #if RADIATION_SOLVER == SOLVER_SOR
+        int i = 0, j = 0, k = 0;
+        double *** Erad = radiation_data.Erad;
+        double norm = 0., norm_change = 0., tmp = 0.;
+        static double omega = 1.;
+        int iterations = 0;
+
+        #if RADIATION_SOR_OMEGA_MODE == SOR_ADAPTIVE_OMEGA
+            int outer_iterations = 0;
+        #endif
+
+        double norm_tmp[2];
+        norm_tmp[0] = 0.0;
+        norm_tmp[1] = 0.0;
+
+        DOM_LOOP( k, j, i )
+        {
+    //      radiation_data.sor_coefficients[0][k][j][i] = ComputeCoefficientU1(k,j,i,data,grid);
+            radiation_data.sor_coefficients[1][k][j][i] = ComputeCoefficientU2( k, j, i, data, grid );
+            radiation_data.sor_coefficients[2][k][j][i] = ComputeCoefficientU3( k, j, i, data, grid );
+            radiation_data.sor_coefficients[3][k][j][i] = ComputeCoefficientU4( k, j, i, data, grid );
+            radiation_data.sor_coefficients[4][k][j][i] = ComputeCoefficientU5( k, j, i, data, grid );
+            radiation_data.sor_coefficients[5][k][j][i] = ComputeCoefficientU6( k, j, i, data, grid );
+            radiation_data.sor_coefficients[6][k][j][i] = ComputeCoefficientU7( k, j, i, data, grid );
+            radiation_data.sor_coefficients[7][k][j][i] = ComputeCoefficientB( k, j, i, data, grid );
+
+            radiation_data.sor_coefficients[0][k][j][i] = ComputeCoefficientU1Advanced( k, j, i, data, grid, radiation_data.sor_coefficients[1][k][j][i], radiation_data.sor_coefficients[2][k][j][i], radiation_data.sor_coefficients[3][k][j][i], radiation_data.sor_coefficients[4][k][j][i], radiation_data.sor_coefficients[5][k][j][i], radiation_data.sor_coefficients[6][k][j][i] );
+
+
+            #if RADIATION_SOR_NORM == NORM_RESIDUAL_L2 || RADIATION_SOR_NORM == NORM_PETSC
+                    norm_tmp[1] += POW2( radiation_data.sor_coefficients[7][k][j][i] );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_MAX
+                    norm_tmp[1] = fabs( MAX( norm_tmp[1], radiation_data.sor_coefficients[7][k][j][i] ) );
+            #endif
+        }
+        #if RADIATION_SOR_NORM == NORM_RESIDUAL_L2 || RADIATION_SOR_NORM == NORM_PETSC
+            MPI_Allreduce( &norm_tmp[1], &tmp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
+            norm_tmp[1] = sqrt( tmp );
+        #elif RADIATION_SOR_NORM == NORM_RESIDUAL_MAX
+            MPI_Allreduce( &norm_tmp[1], &tmp, 1, MPI_MAX, MPI_MAX, MPI_COMM_WORLD );
+            norm_tmp[1] = tmp;
+        #endif
+
+        #if RADIATION_SOR_OMEGA_MODE == SOR_ADAPTIVE_OMEGA
+            do
+            {
+                if( outer_iterations == 1 )
+                {
+                    omega = 1.0;
+                }
+                else if( outer_iterations == 2 )
+                {
+                    omega = 0.9;
+                }
+                else if( outer_iterations > 2 )
+                {
+                    break;
+                }
+
+                outer_iterations++;
+        #endif
+        norm = 2.0 * rtol;
+        norm_change = norm;
+        iterations = 0;
+
+        #if RADIATION_SOR_NORM == NORM_PETSC
+            norm = 10.0 * rtol * norm_tmp[1];
+            while( norm > MAX( rtol * norm_tmp[1], atol ) && norm_change > 1e-20 && max_iterations > iterations )
+        #else
+            while( norm > rtol && norm_change > 1e-20 && max_iterations > iterations )
+        #endif
+        {
+            RadiationBoundaryCondition( grid, data );
+            norm_change = norm;
+            norm = 0;
+            norm_tmp[0] = 0.0;
+            #if RADIATION_SOR_NORM != NORM_RESIDUAL_L2 && RADIATION_SOR_NORM != NORM_RESIDUAL_MAX && RADIATION_SOR_NORM != NORM_RESIDUAL_RELATIVE_L2 && RADIATION_SOR_NORM != NORM_RESIDUAL_RELATIVE_MAX && RADIATION_SOR_NORM != NORM_PETSC
+                norm_tmp[1] = 0.0;
+            #endif
+
+            DOM_LOOP( k, j, i )
+            {
+                #if RADIATION_SOR_NORM == NORM_RELATIVE_MAX || RADIATION_SOR_NORM == NORM_RELATIVE_L2
+                    tmp = Erad[k][j][i];
+                #endif
+
+                Erad[k][j][i] = ( 1. - omega ) * Erad[k][j][i] - ( omega / radiation_data.sor_coefficients[0][k][j][i] ) * ( radiation_data.sor_coefficients[1][k][j][i] * Erad[k - 1][j][i] + radiation_data.sor_coefficients[2][k][j][i] * Erad[k + 1][j][i] + radiation_data.sor_coefficients[3][k][j][i] * Erad[k][j - 1][i] + radiation_data.sor_coefficients[4][k][j][i] * Erad[k][j + 1][i] + radiation_data.sor_coefficients[5][k][j][i] * Erad[k][j][i - 1] + radiation_data.sor_coefficients[6][k][j][i] * Erad[k][j][i + 1] - radiation_data.sor_coefficients[7][k][j][i] );
+
+                #if RADIATION_SOR_NORM == NORM_RELATIVE_L2
+                    norm_tmp[0] += POW2( tmp - Erad[k][j][i] ) / POW2( tmp );
+                #elif RADIATION_SOR_NORM == NORM_RELATIVE_MAX
+                    norm_tmp[0] = fabs( MAX( norm_tmp[0], POW2( tmp - Erad[k][j][i] ) ) );
+                    norm_tmp[1] = fabs( MAX( norm_tmp[1], POW2( tmp ) ) );
+                #endif
+            }
+
+            #if RADIATION_SOR_NORM == NORM_RESIDUAL_MAX || RADIATION_SOR_NORM == NORM_RESIDUAL_L2 || RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_MAX || RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_L2 || RADIATION_SOR_NORM == NORM_PETSC
+                norm_tmp[0] = 0.0;
+                DOM_LOOP( k, j, i )
+                {
+                    ///\f$ \vec{r}^{k} = \vec{b} - A \vec{x}^{k} \f$
+                    tmp = radiation_data.sor_coefficients[7][k][j][i] - ( radiation_data.sor_coefficients[0][k][j][i] * Erad[k][j][i] + radiation_data.sor_coefficients[1][k][j][i] * Erad[k - 1][j][i] + radiation_data.sor_coefficients[2][k][j][i] * Erad[k + 1][j][i] + radiation_data.sor_coefficients[3][k][j][i] * Erad[k][j - 1][i] + radiation_data.sor_coefficients[4][k][j][i] * Erad[k][j + 1][i] + radiation_data.sor_coefficients[5][k][j][i] * Erad[k][j][i - 1] + radiation_data.sor_coefficients[6][k][j][i] * Erad[k][j][i + 1] );
+                    #if RADIATION_SOR_NORM == NORM_RESIDUAL_L2 || RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_L2 || RADIATION_SOR_NORM == NORM_PETSC
+                        norm_tmp[0] += POW2( tmp );
+                    #elif RADIATION_SOR_NORM == NORM_RESIDUAL_MAX || RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_MAX
+                        norm_tmp[0] = fabs( MAX( norm_tmp[0], tmp ) );
+                    #endif
+                }
+            #endif
+
+                ///\note the distribution of norm asures that each processor makes the same number of iterations so it is not necessary to distribute the number of iterations
+            #if RADIATION_SOR_NORM == NORM_RELATIVE_L2
+                MPI_Allreduce( &norm_tmp[0], &norm, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
+                norm = sqrt( norm );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_L2
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
+                norm_tmp[0] = tmp;
+                if( iterations == 0 )
+                {
+                    norm_tmp[1] = norm_tmp[0];
+                    norm = 4.0 * rtol;
+                }
+                else
+                {
+                    norm = sqrt( norm_tmp[0] ) / sqrt( norm_tmp[1] );
+                }
+            #elif RADIATION_SOR_NORM == NORM_PETSC
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
+                norm = norm_tmp[0] = sqrt( tmp );
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_L2
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
+                norm_tmp[0] = tmp;
+                norm = sqrt( norm_tmp[0] ) / norm_tmp[1];
+            #elif RADIATION_SOR_NORM == NORM_RELATIVE_MAX
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
+                norm_tmp[0] = tmp;
+                MPI_Allreduce( &norm_tmp[1], &tmp, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
+                norm_tmp[1] = tmp;
+                norm = norm_tmp[0] / norm_tmp[1];
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_RELATIVE_MAX
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
+                norm_tmp[0] = tmp;
+                norm = norm_tmp[0] / norm_tmp[1];
+                if( iterations == 0 )
+                {
+                    norm_tmp[1] = norm_tmp[0];
+                    norm = 4.0 * rtol;
+                }
+                else
+                {
+                    norm = norm_tmp[0] / norm_tmp[1];
+                }
+            #elif RADIATION_SOR_NORM == NORM_RESIDUAL_MAX
+                MPI_Allreduce( &norm_tmp[0], &tmp, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
+                norm_tmp[0] = tmp;
+                norm = norm_tmp[0] / norm_tmp[1];
+            #endif
+
+            if( !isnormal( norm ) ) return -1;
+            if( !isnormal( norm_change ) ) return -1;
+
+            norm_change = fabs( norm - norm_change );
+//             if(prank == 0)
+//             {
+//                 print("SOR iteration=%5d norm=%15.10e rtol=%15.10e\n",iterations,norm,rtol);
+//             }
+
+            iterations++;
+        }
+        #if RADIATION_SOR_OMEGA_MODE == SOR_ADAPTIVE_OMEGA
+            }
+            while( norm_change <= 1e-20 && max_iterations <= iterations );
+        #endif
+
+        if( max_iterations == iterations || norm_change < 1e-20 )
+        {
+            if( max_iterations == iterations ) print( "Maximum number of iterations reached!\n" );
+            return -1;
+        }
+
+        #if RADIATION_SOR_OMEGA_MODE == SOR_ADAPTIVE_OMEGA
+//             omega = ComputeAdaptiveOmega(omega,iterations - 1, 0.005, 20);
+            omega = ComputeAdaptiveOmega( omega, iterations - 1, 0.0005, 100 );
+        #endif
+
+        RadiationBoundaryCondition( grid, data );
+        return iterations - 1;
+    #else
+        return -1;
+    #endif
+}
+
+/**
+    Calculates the flux limiter
+
+    \param[in] R
+
+    \returns
+        if RADIATION_FLUXLIMITER is set to FLUXLIMITER_MINERBO then
+        \f[
+        \lambda(R) = \left\{
+            \begin{array}{l l}
+                \frac{2}{3 + \sqrt{9+12 R^2}} & \quad 0 \leq R \leq \frac{3}{2}\\
+                \frac{1}{1+R+\sqrt{1+2R}} & \quad \frac{3}{2} < R \leq \infty\\
+            \end{array} \right.\\
+        \f]
+        is returned \n
+        if RADIATION_FLUXLIMITER is set to FLUXLIMITER_KLEY then
+        \f[
+        \lambda(R) = \left\{
+            \begin{array}{l l}
+                \frac{2}{3 + \sqrt{9+10 R^2}} & \quad 0 \leq R \leq 2\\
+                \frac{10}{10 R+ 9 + \sqrt{180 R + 81}} & \quad 2 < R \leq \infty\\
+            \end{array} \right.\\
+        \f]
+        is returned \n
+        if RADIATION_FLUXLIMITER is set to FLUXLIMITER_LEVERMORE_POMRANING then
+        \f[
+        \lambda(R) = \frac{1}{R} \left( \coth R - \frac{1}{R}\right)
+        \f]
+        is returned \n
+        if RADIATION_FLUXLIMITER is set to FLUXLIMITER_CONST then
+        \f[
+        \frac{1}{3}
+        \f]
+        is returned
+
+*/
+double Fluxlimiter( double R )
+{
+    assert( R >= 0. );
+
+    #if RADIATION_FLUXLIMITER == FLUXLIMITER_MINERBO
+
+        if( R <= 3. / 2. ) // 0 <= R <= 3./2.
+        {
+            return 2. / ( 3. + sqrt( 9. + 12. * R * R ) );
+        }
+        else // 3./2. < R <= /infty
+        {
+            return 1. / ( 1. + R + sqrt( 1. + 2. * R ) );
+        }
+    #elif RADIATION_FLUXLIMITER == FLUXLIMITER_KLEY
+    //from dissertation kley
+        if( R <= 2. ) // 0 <= R <= 2.
+        {
+            return 2. / ( 3. + sqrt( 9. + 10. * R * R ) );
+        }
+        else // 2. < R <= /infty
+        {
+            return 10. / ( 10.* R + 9. + sqrt( 180. * R + 81. ) );
+        }
+    #elif RADIATION_FLUXLIMITER == FLUXLIMITER_LEVERMORE_POMRANING
+        return ( 1. / R ) * ( cosh( R ) / sinh( R ) - ( 1. / R ) );
+    #elif RADIATION_FLUXLIMITER == FLUXLIMITER_CONST
+        return 1. / 3.;
+    #else
+        #error RADIATION_FLUXLIMITER not set!
+    #endif
+}
+
+/**
+    Computes the intermediate value of a given variable.
+
+    \par Shift
+        Here the meaning of the parameter shift is explained. In the following we expect that \a variable is RHO (\f$ \rho \f$) \n
+        if shift == \ref NO_SHIFT
+            \f[
+                \rho_{i,j,k}
+            \f]
+        is returned \n
+        if shift == \ref IDIR_pOH
+            \f[
+                \rho_{i+\frac{1}{2},j,k} \approx \frac{\rho_{i,j,k} + \rho_{i+1,j,k}}{2}
+            \f]
+        is returned \n
+        if shift == \ref IDIR_mOH
+            \f[
+                \rho_{i-\frac{1}{2},j,k} \approx \frac{\rho_{i-1,j,k} + \rho_{i,j,k}}{2}
+            \f]
+        is returned \n
+        if shift == \ref JDIR_pOH
+            \f[
+                \rho_{i,j+\frac{1}{2},k} \approx \frac{\rho_{i,j,k} + \rho_{i,j+1,k}}{2}
+            \f]
+        is returned \n
+        if shift == \ref JDIR_mOH
+            \f[
+                \rho_{i,j-\frac{1}{2},k} \approx \frac{\rho_{i,j-1,k} + \rho_{i,j,k}}{2}
+            \f]
+        is returned \n
+        if shift == \ref KDIR_pOH
+            \f[
+                \rho_{i,j,k+\frac{1}{2}} \approx \frac{\rho_{i,j,k} + \rho_{i,j,k+1}}{2}
+            \f]
+        is returned \n
+        if shift == \ref KDIR_mOH
+            \f[
+                \rho_{i,j,k-\frac{1}{2}} \approx \frac{\rho_{i,j,k-1} + \rho_{i,j,k}}{2}
+            \f]
+        is returned
+
+    \note If you change the way of averaging in this function then you hav also modify it in function \ref ComputeIntermediateValueWithFunction()
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift   is explained above
+    \param[in]  quantity    array for which the intermediate value is computed
+
+    \returns        intermediate value
+*/
+double ComputeIntermediateValue( int k, int j, int i, int shift, double ***quantity )
+{
+    switch( shift )
+    {
+        case NO_SHIFT:
+            return quantity[k][j][i];
+            break;
+
+        case IDIR_pOH:
+            return ( quantity[k][j][i] + quantity[k][j][i + 1] ) / 2.;
+            break;
+
+        case IDIR_mOH:
+            return ( quantity[k][j][i - 1] + quantity[k][j][i] ) / 2.;
+            break;
+
+        case JDIR_pOH:
+            return ( quantity[k][j][i] + quantity[k][j + 1][i] ) / 2.;
+            break;
+
+        case JDIR_mOH:
+            return ( quantity[k][j - 1][i] + quantity[k][j][i] ) / 2.;
+            break;
+
+        case KDIR_pOH:
+            return ( quantity[k][j][i] + quantity[k + 1][j][i] ) / 2.;
+            break;
+
+        case KDIR_mOH:
+            return ( quantity[k - 1][j][i] + quantity[k][j][i] ) / 2.;
+            break;
+
+        default:
+            print( "Unexpected value of shift\n" );
+            QUIT_PLUTO( 1 );
+            break;
+    }
+    return 0.0; //should never be reached
+}
+
+/**
+    Computes the intermediate value of a variable generated by function \a getVariable. For further details see \ref ComputeIntermediateValue
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift
+    \param[in]  data
+    \param[in]  getVariable function pointer to access variables like the temperature which is computed from the density and the pressure
+    \returns        intermediate value
+*/
+double ComputeIntermediateValueWithFunction( int k, int j, int i, int shift, Data *data, double( getVariable )( int, int, int, Data * ) )
+{
+    switch( shift )
+    {
+        case NO_SHIFT:
+            return getVariable( k, j, i, data );
+            break;
+
+        case IDIR_pOH:
+            return ( getVariable( k, j, i, data ) + getVariable( k, j, i + 1, data ) ) / 2.;
+            break;
+
+        case IDIR_mOH:
+            return ( getVariable( k, j, i - 1, data ) + getVariable( k, j, i, data ) ) / 2.;
+            break;
+
+        case JDIR_pOH:
+            return ( getVariable( k, j, i, data ) + getVariable( k, j + 1, i, data ) ) / 2.;
+            break;
+
+        case JDIR_mOH:
+            return ( getVariable( k, j - 1, i, data ) + getVariable( k, j, i, data ) ) / 2.;
+            break;
+
+        case KDIR_pOH:
+            return ( getVariable( k, j, i, data ) + getVariable( k + 1, j, i, data ) ) / 2.;
+            break;
+
+        case KDIR_mOH:
+            return ( getVariable( k - 1, j, i, data ) + getVariable( k, j, i, data ) ) / 2.;
+            break;
+
+        default:
+            print( "Unexpected value of shift\n" );
+            QUIT_PLUTO( 1 );
+            break;
+    }
+    return 0.0; //sould never be reached
+}
+
+/**
+    This function calculates \f$ R = \frac{\left|\nabla E \right|}{\kappa_R E} \f$ at different positions
+    depending on the value of \a shift:
+
+    shift == NO_SHIFT
+        \f[ R_{i,j,k} = \frac{\left|(\nabla E)_{i,j,k} \right|}{{\kappa_R}_{i,j,k} \rho_{i,j,k} E_{i,j,k}} \f]
+    shift == IDIR_pOH
+        \f[ R_{i+\frac{1}{2},j,k} = \frac{\left|(\nabla E)_{i+\frac{1}{2},j,k} \right|}{{\kappa_R}_{i+\frac{1}{2},j,k} \rho_{i+\frac{1}{2},j,k} E_{i+\frac{1}{2},j,k}} \f]
+    shift == IDIR_mOH
+        \f[ R_{i-\frac{1}{2},j,k} = \frac{\left|(\nabla E)_{i-\frac{1}{2},j,k} \right|}{{\kappa_R}_{i-\frac{1}{2},j,k} \rho_{i-\frac{1}{2},j,k} E_{i-\frac{1}{2},j,k}} \f]
+
+    and analog for shift == JDIR_pOH,JDIR_mOH,KDIR_pOH,KDIR_mOH
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift is explained above
+    \param[in]  d
+    \param[in]  grid
+
+    \returns \f$ R = \frac{\left|\nabla E \right|}{\kappa_R \rho E} \f$ if shift == NO_SHIFT else wise \f$ R \f$ accordingly to the value of shift see above
+*/
+double FluxlimiterR( int k, int j, int i, int shift, Data *d, Grid *grid )
+{
+    double abs_grad_Erad = 0.;
+    double numerator_x1 = 0., numerator_x2 = 0., numerator_x3 = 0., denominator = 0.;
+
+    switch( shift )
+    {
+        case NO_SHIFT:
+            numerator_x1 = ComputeIntermediateValue( k, j, i, IDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, IDIR_mOH, radiation_data.Erad );
+            numerator_x2 = ComputeIntermediateValue( k, j, i, JDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, JDIR_mOH, radiation_data.Erad );
+            numerator_x3 = ComputeIntermediateValue( k, j, i, KDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, KDIR_mOH, radiation_data.Erad );
+            break;
+
+        case IDIR_pOH:
+            numerator_x1 = radiation_data.Erad[k][j][i + 1] - radiation_data.Erad[k][j][i];
+            numerator_x2 = ComputeIntermediateValue( k, j, i, JDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, JDIR_mOH, radiation_data.Erad );
+            numerator_x3 = ComputeIntermediateValue( k, j, i, KDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, KDIR_mOH, radiation_data.Erad );
+            break;
+
+        case IDIR_mOH:
+            numerator_x1 = radiation_data.Erad[k][j][i] - radiation_data.Erad[k][j][i - 1];
+            numerator_x2 = ComputeIntermediateValue( k, j, i, JDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, JDIR_mOH, radiation_data.Erad );
+            numerator_x3 = ComputeIntermediateValue( k, j, i, KDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, KDIR_mOH, radiation_data.Erad );
+            break;
+
+        case JDIR_pOH:
+            numerator_x1 = ComputeIntermediateValue( k, j, i, IDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, IDIR_mOH, radiation_data.Erad );
+            numerator_x2 = radiation_data.Erad[k][j + 1][i] - radiation_data.Erad[k][j][i];
+            numerator_x3 = ComputeIntermediateValue( k, j, i, KDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, KDIR_mOH, radiation_data.Erad );
+            break;
+
+        case JDIR_mOH:
+            numerator_x1 = ComputeIntermediateValue( k, j, i, IDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, IDIR_mOH, radiation_data.Erad );
+            numerator_x2 = radiation_data.Erad[k][j][i] - radiation_data.Erad[k][j - 1][i];
+            numerator_x3 = ComputeIntermediateValue( k, j, i, KDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, KDIR_mOH, radiation_data.Erad );
+            break;
+
+        case KDIR_pOH:
+            numerator_x1 = ComputeIntermediateValue( k, j, i, IDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, IDIR_mOH, radiation_data.Erad );
+            numerator_x2 = ComputeIntermediateValue( k, j, i, JDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, JDIR_mOH, radiation_data.Erad );
+            numerator_x3 = radiation_data.Erad[k + 1][j][i] - radiation_data.Erad[k][j][i];
+            break;
+
+        case KDIR_mOH:
+            numerator_x1 = ComputeIntermediateValue( k, j, i, IDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, IDIR_mOH, radiation_data.Erad );
+            numerator_x2 = ComputeIntermediateValue( k, j, i, JDIR_pOH, radiation_data.Erad ) - ComputeIntermediateValue( k, j, i, JDIR_mOH, radiation_data.Erad );
+            numerator_x3 = radiation_data.Erad[k][j][i] - radiation_data.Erad[k - 1][j][i];
+            break;
+
+        default:
+            print( "Unexpected value of shift\n" );
+            QUIT_PLUTO( 1 );
+            break;
+    }
+
+    #if (GEOMETRY == CARTESIAN)
+        abs_grad_Erad = sqrt(
+                            POW2( numerator_x1 / ( grid[IDIR].dx[i] ) )
+                            + POW2( numerator_x2 / ( grid[JDIR].dx[j] ) )
+                            + POW2( numerator_x3 / ( grid[KDIR].dx[k] ) )
+                        );
+    #elif (GEOMETRY == POLAR)
+        abs_grad_Erad = sqrt(
+                            POW2( numerator_x1 / ( grid[IDIR].dx[i] ) )
+                            + POW2( numerator_x2 / ( grid[JDIR].dx[j] * grid[IDIR].x[i] ) )
+                            + POW2( numerator_x3 / ( grid[KDIR].dx[k] ) )
+                        );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        abs_grad_Erad = sqrt(
+                            POW2( numerator_x1 / ( grid[IDIR].dx[i] ) )
+                            + POW2( numerator_x2 / ( grid[JDIR].dx[j] * grid[IDIR].x[i] ) )
+                            + POW2( numerator_x3 / ( grid[KDIR].dx[k] * grid[IDIR].x[i] * sin( grid[JDIR].x[j] ) ) )
+                        );
+    #endif
+
+    #ifdef DEBUG
+        double rho_im = ComputeIntermediateValue( k, j, i, shift, d->Vc[RHO] );
+        double E_im = ComputeIntermediateValue( k, j, i, shift, radiation_data.Erad );
+        assert( E_im > 0. );
+        denominator = ComputeRosselandOpacity( k, j, i, shift, d, grid ) * rho_im * E_im;
+    #else
+        #if RADIATION_SMALL_NUMBERS_FIX == YES
+            denominator = ComputeRosselandOpacity( k, j, i, shift, d, grid ) * ComputeIntermediateValue( k, j, i, shift, d->Vc[RHO] ) * ComputeIntermediateValue( k, j, i, shift, radiation_data.Erad ) + RADIATION_SMALL_NUMBERS_FIX_VALUE;
+        #else
+            denominator = ComputeRosselandOpacity( k, j, i, shift, d, grid ) * ComputeIntermediateValue( k, j, i, shift, d->Vc[RHO] ) * ComputeIntermediateValue( k, j, i, shift, radiation_data.Erad );
+        #endif
+    #endif
+
+    assert( ( abs_grad_Erad / denominator ) >= 0. );
+
+    return abs_grad_Erad / denominator;
+}
+
+/**
+    Returns the Rosseland mean opacity in code units. The cgs-units of the opacity is \f$ [\kappa_R] = \frac{cm^2}{g}\f$
+
+    \note For informations about the parameter \a shift look at function \ref ComputeIntermediateValue
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift
+    \param[in]  d
+    \param[in]  grid
+
+    \returns Rosseland mean opacity in code units
+
+*/
+double ComputeRosselandOpacity( int k, int j, int i, int shift, Data *d, Grid *grid )
+{
+    double cgs_density = ComputeIntermediateValue( k, j, i, shift, d->Vc[RHO] ) * g_unitDensity;                /**<density in cgs units */
+    double cgs_temperature = ComputeIntermediateValueWithFunction( k, j, i, shift, d, GetTemperature ) * g_unitTemperature; /**<temperature in cgs units */
+    double result;
+
+    assert( cgs_density > 0. );
+    assert( cgs_temperature > 0. );
+
+    result = RadiationRosselandOpacity( cgs_density, cgs_temperature ) * g_unitDensity * g_unitLength;
+
+    assert( result > 0. );
+    return result;
+}
+
+/**
+    Returns the Planck opacity in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns Planck opacity in code units
+*/
+double ComputePlanckOpacity( int k, int j, int i, Data *d, Grid *grid )
+{
+    double cgs_density = ComputeIntermediateValue( k, j, i, NO_SHIFT, d->Vc[RHO] ) * g_unitDensity;                     /**<density in cgs units */
+    double cgs_temperature = ComputeIntermediateValueWithFunction( k, j, i, NO_SHIFT, d, GetTemperature ) * g_unitTemperature; /**<temperature in cgs units */
+    double result;
+
+    assert( cgs_density > 0. );
+    assert( cgs_temperature > 0. );
+
+    result = RadiationPlanckOpacity( cgs_density, cgs_temperature ) * g_unitDensity * g_unitLength;
+
+    assert( result > 0. );
+    return result;
+}
+
+/**
+    Returns the acceleration caused by the radiation.
+    \f[
+        \vec{a}_R = - \frac{\lambda}{\rho} \nabla E
+    \f]
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+    \param[in]  v
+    \param[out] a
+
+    \returns \f$ D_{i,j,k} \f$
+*/
+void ComputeRadiationAcceleration( int k, int j, int i, Grid *grid, double *v, double *a )
+{
+    double grad_E[3];
+    double abs_grad_E = 0., denominator = 0, R = 0, factor = 0.;
+    double cgs_gas_temperature = 0., cgs_density = 0.;
+    double ***E = radiation_data.Erad;
+
+    grad_E[IDIR] = ( ( E[k][j][i] + E[k][j][i + 1] ) / 2.0 ) - ( ( E[k][j][i - 1] + E[k][j][i] ) / 2.0 );
+    grad_E[JDIR] = ( ( E[k][j][i] + E[k][j + 1][i] ) / 2.0 ) - ( ( E[k][j - 1][i] + E[k][j][i] ) / 2.0 );
+    grad_E[KDIR] = ( ( E[k][j][i] + E[k + 1][j][i] ) / 2.0 ) - ( ( E[k - 1][j][i] + E[k][j][i] ) / 2.0 );
+
+    #if (GEOMETRY == CARTESIAN)
+        grad_E[IDIR] /= grid[IDIR].dx[i];
+        grad_E[JDIR] /= grid[JDIR].dx[j];
+        grad_E[KDIR] /= grid[KDIR].dx[k];
+    #elif (GEOMETRY == POLAR)
+        grad_E[IDIR] /= grid[IDIR].dx[i];
+        grad_E[JDIR] /= ( grid[JDIR].dx[j] * grid[IDIR].x[i] );
+        grad_E[KDIR] /= grid[KDIR].dx[k];
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        grad_E[IDIR] /= grid[IDIR].dx[i];
+        grad_E[JDIR] /= ( grid[JDIR].dx[j] * grid[IDIR].x[i] );
+        grad_E[KDIR] /= ( grid[KDIR].dx[k] * grid[IDIR].x[i] * sin( grid[JDIR].x[j] ) );
+    #endif
+
+    abs_grad_E = sqrt( POW2( grad_E[IDIR] ) + POW2( grad_E[JDIR] ) + POW2( grad_E[KDIR] ) );
+
+    cgs_gas_temperature = ( ( ( v[PRS] * radiation_data.mu * CONST_amu ) / ( v[RHO] * CONST_kB ) ) * POW2( g_unitVelocity ) );
+    cgs_density = v[RHO] * g_unitDensity;
+
+    #if RADIATION_SMALL_NUMBERS_FIX == YES
+        R = abs_grad_E / ( ( RadiationRosselandOpacity( cgs_density, cgs_gas_temperature ) * g_unitDensity * g_unitLength ) * v[RHO] * E[k][j][i] + RADIATION_SMALL_NUMBERS_FIX_VALUE );
+    #else
+        R = abs_grad_E / ( ( RadiationRosselandOpacity( cgs_density, cgs_gas_temperature ) * g_unitDensity * g_unitLength ) * v[RHO] * E[k][j][i] );
+    #endif
+
+    factor = -1.0 * ( Fluxlimiter( R ) / v[RHO] );
+    a[IDIR] = factor * grad_E[IDIR];
+    a[JDIR] = factor * grad_E[JDIR];
+    a[KDIR] = factor * grad_E[KDIR];
+}
+
+/**
+    Returns the artificial dissipation. In general the artificial dissipation \f$ D_{i,j,k} \f$ is computed with the equation
+    \f[
+    D_{i,j,k} = r_i^2 \underbrace{\rho_{i,j,k} \nu}_{\eta_{i,j,k}} \left(\frac{\partial \Omega_{i,j,k}}{\partial r_i}\right)^2
+    \f]
+    where \f$ \nu \f$ is the kinematic viscosity and \f$ \Omega_{i,j,k} \f$ the angular velocity.
+    There are now two options to compute \f$ D_{i,j,k} \f$. One option is to use as angular velocity the keplerian angular
+    velocity
+    \f[
+        \Omega_{i,j,k} = \sqrt{\frac{G (m_\odot + m_p)}{r^3}}
+    \f]
+    with which we get:
+    \f[
+    D_{i,j,k} = \frac{9}{4} \rho_{i,j,k} \nu \frac{G (m_\odot + m_p)}{r_i^3}
+    \f]
+    \n
+    Or in the other case which we are using here. We use for the angular velocity \f$ \Omega_{i,j,k} = \frac{u}{r} \f$ where \f$ u = v_\phi \f$ and
+    compute the derivation numerically. By using
+    \f[
+    \frac{\partial u}{\partial r} \approx \frac{u(r+\Delta r) - u(r-\Delta r)}{2 \Delta r}
+    \f]
+
+    \f[
+    \frac{\partial \Omega_{i,j,k}}{\partial r_i} = \frac{\partial u_{i,j,k}}{\partial r_i} r^{-1} - u_{i,j,k}(r_i) r^{-2}
+    \f]
+    we get
+    \f[
+    D_{i,j,k} = r_i^2 \rho_{i,j,k} \nu \left(\frac{u_{i+1,j,k} - u_{i-1,j,k}}{2 \Delta r} r_i^{-1} - u_{i,j,k} r_i^{-2}\right)^2
+    \f]
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift
+    \param[in]  d
+    \param[in]  grid
+
+    \returns \f$ D_{i,j,k} \f$
+*/
+double ComputeArtificialDissipation( int k, int j, int i, Data *data, Grid *grid )
+{
+    #if ARTIFICIAL_DISSIPATION == YES
+        #if GEOMETRY == SPHERICAL
+            double r = grid[IDIR].x[i], r1 = 1.0 / r, r2 = r1 * r1, dr = grid[IDIR].dx[i];
+            double dOmega;
+
+            dOmega = ( ( data->Vc[VZ][k][j][i + 1] - data->Vc[VZ][k][j][i - 1] ) / ( 2.0 * dr ) ) * r1 - data->Vc[VZ][k][j][i] * r2;
+
+            //BEGIN calculation of the viscosity
+            double eta1_visc = 0.0, eta2_visc = 0.0;
+            int n = 0;
+            double tmp[NVAR];
+
+            for( n = 0; n < NVAR; ++n ) tmp[n] = data->Vc[n][k][j][i];
+            eta_visc_func( tmp, grid[IDIR].x[i], grid[JDIR].x[j], grid[KDIR].x[k], &eta1_visc, &eta2_visc );
+            //END
+
+            return POW2( r ) * eta1_visc * POW2( dOmega );
+        #endif
+    #endif
+    return 0.0;
+}
+
+/**
+    Returns the coefficient K^n_{i,j,k} in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  shift
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+        K^n_{i,j,k} = \frac{c \lambda}{\kappa_R \rho}
+        \f]
+        where \f$ \lambda \f$ = fluxlimiter() and \f$ \kappa_R \f$ = ComputeRosselandOpacity()
+*/
+double ComputeCoefficientK( int k, int j, int i, int shift, Data *d, Grid *grid )
+{
+    return ( radiation_data.code_c * Fluxlimiter( FluxlimiterR( k, j, i, shift, d, grid ) ) ) / ( ComputeRosselandOpacity( k, j, i, shift, d, grid ) * ComputeIntermediateValue( k, j, i, shift, d->Vc[RHO] ) );
+}
+
+/**
+    Computes the geometry coefficient \f$ G^r_{x_1} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^r_{x_1} = \frac{1}{x_{i+\frac{1}{2}} - x_{i-\frac{1}{2}}}
+        \f]
+        if geometry is polar
+        \f[
+            G^r_{x_1} = \frac{2r_{i+\frac{1}{2} }}{r_{i+\frac{1}{2} }^2 - r_{i-\frac{1}{2} }^2}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_1} = \frac{r_{i+\frac{1}{2} }^2 \left(\cos \theta_{j-\frac{1}{2}}-\cos \theta_{j+\frac{1}{2}}\right) \Delta \phi_k }{V_{i,j,k}}
+        \f]
+*/
+double ComputeGeometryCoefficientGrx1( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[IDIR].xr[i] - grid[IDIR].xl[i] );
+    #elif (GEOMETRY == POLAR)
+        return ( 2. * grid[IDIR].xr[i] ) / ( POW2( grid[IDIR].xr[i] ) - POW2( grid[IDIR].xl[i] ) );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( POW2( grid[IDIR].xr[i] ) * ( cos( grid[JDIR].xl[j] ) - cos( grid[JDIR].xr[j] ) ) * grid[KDIR].dx[k] ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+    #endif
+}
+
+/**
+    Computes the geometry coefficient \f$ G^l_{x_1} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^l_{x_1} = G^r_{x_1} = \frac{1}{x_{i+\frac{1}{2}} - x_{i-\frac{1}{2}}}
+        \f]
+        if geomentry is polar
+        \f[
+            G^l_{x_1} = \frac{2r_{i-\frac{1}{2} }}{r_{i+\frac{1}{2} }^2 - r_{i-\frac{1}{2} }^2}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_1} = \frac{r_{i-\frac{1}{2} }^2 \left(\cos \theta_{j-\frac{1}{2}}-\cos \theta_{j+\frac{1}{2}}\right)  \Delta \phi_k }{V_{i,j,k}}
+        \f]
+*/
+double ComputeGeometryCoefficientGlx1( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[IDIR].xr[i] - grid[IDIR].xl[i] );
+    #elif (GEOMETRY == POLAR)
+        return ( 2. * grid[IDIR].xl[i] ) / ( POW2( grid[IDIR].xr[i] ) - POW2( grid[IDIR].xl[i] ) );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( POW2( grid[IDIR].xl[i] ) * ( cos( grid[JDIR].xl[j] ) - cos( grid[JDIR].xr[j] ) ) * grid[KDIR].dx[k] ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+    #endif
+}
+
+/**
+    Computes the geometry coefficient \f$ G^r_{x_2} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^r_{x_2} = \frac{1}{y_{j+\frac{1}{2}} - y_{j-\frac{1}{2}}}
+        \f]
+        if geometry is polar
+        \f[
+            G^r_{x_2} = \frac{2}{r_i^2 \Delta \phi_j}
+        \f]
+        the old one was
+        \f[
+            G^r_{x_2} = \frac{\log r_{i+\frac{1}{2} } - \log r_{i-\frac{1}{2} }}{\frac{1}{2}\left(r_{i+\frac{1}{2} }^2 - r_{i-\frac{1}{2} }^2\right) \left(\phi_{j+\frac{1}{2} } + \phi_{j-\frac{1}{2} }\right)}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_2} = \frac{\Delta r_i \Delta \phi_k \sin \theta_{j + \frac{1}{2}}}{V_{i,j,k}}
+        \f]
+*/
+double ComputeGeometryCoefficientGrx2( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[JDIR].xr[j] - grid[JDIR].xl[j] );
+    #elif (GEOMETRY == POLAR)
+    //  return 2.0 / (grid[IDIR].x[i] * grid[JDIR].dx[j]);
+        return ( log( grid[IDIR].xr[i] ) - log( grid[IDIR].xl[i] ) ) / ( 0.5 * ( POW2( grid[IDIR].xr[i] ) - POW2( grid[IDIR].xl[i] ) ) * ( grid[JDIR].xr[j] - grid[JDIR].xl[j] ) );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( grid[IDIR].dx[i] * grid[KDIR].dx[k] * sin( grid[JDIR].xr[j] ) ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+    #endif
+}
+
+/**
+    Computes the geometry coefficient \f$ G^l_{x_2} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^l_{x_2} = G^r_{x_2} = \frac{1}{y_{j+\frac{1}{2}} - y_{j-\frac{1}{2}}}
+        \f]
+        if geometry is polar
+        \f[
+            G^r_{x_2} = \frac{2}{r_i^2 \Delta \phi_j}
+        \f]
+        the old one was
+        \f[
+            G^r_{x_2} = \frac{\log r_{i+\frac{1}{2} } - \log r_{i-\frac{1}{2} }}{\frac{1}{2}\left(r_{i+\frac{1}{2} }^2 - r_{i-\frac{1}{2} }^2\right) \left(\phi_{j+\frac{1}{2} } + \phi_{j-\frac{1}{2} }\right)}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_2} = \frac{\Delta r_i \Delta \phi_k \sin \theta_{j - \frac{1}{2}}}{V_{i,j,k}}
+        \f]
+*/
+double ComputeGeometryCoefficientGlx2( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[JDIR].xr[j] - grid[JDIR].xl[j] );
+    #elif (GEOMETRY == POLAR)
+    //  return 2.0 / (grid[IDIR].x[i] * grid[JDIR].dx[j]);
+        return ( log( grid[IDIR].xr[i] ) - log( grid[IDIR].xl[i] ) ) / ( 0.5 * ( POW2( grid[IDIR].xr[i] ) - POW2( grid[IDIR].xl[i] ) ) * ( grid[JDIR].xr[j] - grid[JDIR].xl[j] ) );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( grid[IDIR].dx[i] * grid[KDIR].dx[k] * sin( grid[JDIR].xl[j] ) ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+    #endif
+}
+
+/**
+    Computes the geometry coefficient \f$ G^r_{x_3} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^r_{x_3} = \frac{1}{z_{k+\frac{1}{2}} - z_{k-\frac{1}{2}}}
+        \f]
+        if geometry is polar
+        \f[
+            G^r_{x_3} = \frac{1}{z_{k+\frac{1}{2} } - z_{k-\frac{1}{2} }}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_3} = \frac{\Delta r_i}{V_{i,j,k}} \frac{\theta_{j+\frac{1}{2}}-\theta_{j-\frac{1}{2}}}{\sin \theta_j}
+        \f]
+        the old one was
+        \f[
+            G^r_{x_3} = \frac{\Delta r_i}{V_{i,j,k}} \left(\log\left(\tan\frac{\theta_{j+\frac{1}{2} }}{2}\right)-\log\left(\tan\frac{\theta_{j-\frac{1}{2} }}{2}\right)\right)
+        \f]
+*/
+double ComputeGeometryCoefficientGrx3( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[KDIR].xr[k] - grid[KDIR].xl[k] );
+    #elif (GEOMETRY == POLAR)
+        return 1. / ( grid[KDIR].xr[k] - grid[KDIR].xl[k] );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( grid[IDIR].dx[i] * ( grid[JDIR].xr[j] - grid[JDIR].xl[j] ) ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+//         return (grid[IDIR].dx[i] * (log(tan(0.5*grid[JDIR].xr[j])) - log(tan(0.5*grid[JDIR].xl[j])))) / (/*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k]);
+    #endif
+}
+
+/**
+    Computes the geometry coefficient \f$ G^l_{x_3} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  grid
+
+    \returns
+        if geometry is cartesian
+        \f[
+            G^l_{x_3} = G^r_{x_3} = \frac{1}{z_{k+\frac{1}{2}} - z_{k-\frac{1}{2}}}
+        \f]
+        if geometry is polar
+        \f[
+            G^l_{x_3} = G^r_{x_3} = \frac{1}{z_{k+\frac{1}{2} } - z_{k-\frac{1}{2} }}
+        \f]
+        if geometry is spherical
+        \f[
+            G^r_{x_3} = \frac{\Delta r_i}{V_{i,j,k}} \frac{\theta_{j+\frac{1}{2}}-\theta_{j-\frac{1}{2}}}{\sin \theta_j}
+        \f]
+        the old one was
+        \f[
+            G^r_{x_3} = \frac{\Delta r_i}{V_{i,j,k}} \left(\log\left(\tan\frac{\theta_{j+\frac{1}{2} }}{2}\right)-\log\left(\tan\frac{\theta_{j-\frac{1}{2} }}{2}\right)\right)
+        \f]
+*/
+double ComputeGeometryCoefficientGlx3( int k, int j, int i, Grid *grid )
+{
+    #if (GEOMETRY == CARTESIAN)
+        return 1. / ( grid[KDIR].xr[k] - grid[KDIR].xl[k] );
+    #elif (GEOMETRY == POLAR)
+        return 1. / ( grid[KDIR].xr[k] - grid[KDIR].xl[k] );
+    #elif (GEOMETRY == CYLINDRICAL)
+        #ERROR CYLINDRICAL not implemented so far
+    #elif (GEOMETRY == SPHERICAL)
+        return ( grid[IDIR].dx[i] * ( grid[JDIR].xr[j] - grid[JDIR].xl[j] ) ) / ( /*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k] );
+    //  return (grid[IDIR].dx[i] * (log(tan(0.5*grid[JDIR].xr[j])) - log(tan(0.5*grid[JDIR].xl[j])))) / (/*V_{ijk}*/grid[IDIR].dV[i] * grid[JDIR].dV[j] * grid[KDIR].dV[k]);
+    #endif
+}
+
+/**
+    Computes the coefficient \f$ U^1_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^1_{i,j,k} = 1 -U^7_{i,j,k} - U^6_{i,j,k} - U^5_{i,j,k} - U^4_{i,j,k} - U^3_{i,j,k} - U^2_{i,j,k} + \frac{\rho_{i,j,k}^n {\kappa_P^n}_{i,j,k} c \Delta t c_V}{c_V + 4 a_R (T_{i,j,k}^n)^3 {\kappa_P^n}_{i,j,k} c \Delta t}
+        \f]
+
+*/
+double ComputeCoefficientU1( int k, int j, int i, Data *d, Grid *grid )
+{
+    double plank_opacity = ComputePlanckOpacity( k, j, i, d, grid );
+    double temperature = GetTemperature( k, j, i, d );
+    double c_V = ComputeSpecificHeatCapacity( k, j, i, d );
+
+    double tmp = plank_opacity * radiation_data.code_c * g_dt;
+    double summand = ( d->Vc[RHO][k][j][i] * tmp * c_V ) / ( c_V + 4.0 * radiation_data.code_aR * POW3( temperature ) * tmp );
+    return 1. - ComputeCoefficientU7( k, j, i, d, grid ) - ComputeCoefficientU6( k, j, i, d, grid ) - ComputeCoefficientU5( k, j, i, d, grid ) - ComputeCoefficientU4( k, j, i, d, grid ) - ComputeCoefficientU3( k, j, i, d, grid ) - ComputeCoefficientU2( k, j, i, d, grid ) + summand;
+}
+
+/**
+    \copydoc ComputeCoefficientU1
+*/
+double ComputeCoefficientU1Advanced( int k, int j, int i, Data *d, Grid *grid, double U2, double U3, double U4, double U5, double U6, double U7 )
+{
+    double plank_opacity = ComputePlanckOpacity( k, j, i, d, grid );
+    double temperature = GetTemperature( k, j, i, d );
+    double c_V = ComputeSpecificHeatCapacity( k, j, i, d );
+
+    double tmp = plank_opacity * radiation_data.code_c * g_dt;
+    double summand = ( d->Vc[RHO][k][j][i] * tmp * c_V ) / ( c_V + 4.0 * radiation_data.code_aR * POW3( temperature ) * tmp );
+    return 1. - U7 - U6 - U5 - U4 - U3 - U2 + summand;
+}
+
+/**
+    Computes the coefficient \f$ U^2_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^2_{i,j,k} = - \frac{G^l_{x_3} K_{i,j,k-\frac{1}{2}}^n \Delta t}{\Delta {x_3}_{k-\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU2( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[KDIR].x[k] - grid[KDIR].x[k - 1] );
+    return ( -1. * ComputeGeometryCoefficientGlx3( k, j, i, grid ) * ComputeCoefficientK( k, j, i, KDIR_mOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Computes the coefficient \f$ U^3_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^3_{i,j,k} = - \frac{G^r_{x_3} K_{i,j,k+\frac{1}{2}}^n \Delta t}{\Delta {x_3}_{k+\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU3( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[KDIR].x[k + 1] - grid[KDIR].x[k] );
+    return ( -1. * ComputeGeometryCoefficientGrx3( k, j, i, grid ) * ComputeCoefficientK( k, j, i, KDIR_pOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Computes the coefficient \f$ U^4_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^4_{i,j,k} = - \frac{G^l_{x_2} K_{i,j-\frac{1}{2},k}^n \Delta t}{\Delta {x_2}_{j-\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU4( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[JDIR].x[j] - grid[JDIR].x[j - 1] );
+    return ( -1. * ComputeGeometryCoefficientGlx2( k, j, i, grid ) * ComputeCoefficientK( k, j, i, JDIR_mOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Computes the coefficient \f$ U^5_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^5_{i,j,k} = - \frac{G^r_{x_2} K_{i,j+\frac{1}{2},k}^n \Delta t}{\Delta {x_2}_{j+\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU5( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[JDIR].x[j + 1] - grid[JDIR].x[j] );
+    return ( -1. * ComputeGeometryCoefficientGrx2( k, j, i, grid ) * ComputeCoefficientK( k, j, i, JDIR_pOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Computes the coefficient \f$ U^6_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^6_{i,j,k} = - \frac{G^l_{x_1} K_{i-\frac{1}{2},j,k}^n \Delta t}{\Delta {x_1}_{i-\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU6( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[IDIR].x[i] - grid[IDIR].x[i - 1] );
+    return ( -1. * ComputeGeometryCoefficientGlx1( k, j, i, grid ) * ComputeCoefficientK( k, j, i, IDIR_mOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Computes the coefficient \f$ U^7_{i,j,k} \f$ in code units
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        \f[
+            U^7_{i,j,k} = - \frac{G^r_{x_1} K_{i+\frac{1}{2},j,k}^n \Delta t}{\Delta {x_1}_{i+\frac{1}{2}}}
+        \f]
+*/
+double ComputeCoefficientU7( int k, int j, int i, Data *d, Grid *grid )
+{
+    double dx = fabs( grid[IDIR].x[i + 1] - grid[IDIR].x[i] );
+    return ( -1. * ComputeGeometryCoefficientGrx1( k, j, i, grid ) * ComputeCoefficientK( k, j, i, IDIR_pOH, d, grid ) * g_dt ) / ( dx );
+}
+
+/**
+    Returns the right hand side of the equation \f$ B_{i,j,k} \f$ in code units.
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+    \param[in]  grid
+
+    \returns
+        In the case that irradiation and/or artificial dissipation is used this function returnes
+        \f[
+            B_{i,j,k} = \frac{{\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^3 \Delta t}{c_V + {4\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^3 \Delta t} \left(4 W_{i,j,k}^n \Delta t +\rho_{i,j,k}^n T_{i,j,k}^n c_V\right)+ E_{i,j,k}^n
+        \f]
+        where \f$ W^n_{i,j,k} \f$ is either \f$ S^n_{i,j,k} \f$ in the case of irradiation or \f$ D^n_{i,j,k} \f$ in the case of artificial dissipation. If irradiation and artificial dissipation is used together then \f$ W^n_{i,j,k} \f$ is the summ of both \f$ W^n_{i,j,k} = S^n_{i,j,k}+D^n_{i,j,k}\f$.\n
+        else
+        \f[
+            B_{i,j,k} = \frac{\rho_{i,j,k}^n {\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^4 \Delta t c_V}{c_V + 4 {\kappa_P}_{i,j,k}^n c a_R (T_{i,j,k}^n)^3 \Delta t} + E_{i,j,k}^n
+        \f]
+*/
+double ComputeCoefficientB( int k, int j, int i, Data *d, Grid *grid )
+{
+    #if IRRADIATION == YES || ARTIFICIAL_DISSIPATION == YES
+        double plank_opacity = ComputePlanckOpacity( k, j, i, d, grid );
+        double temperature = GetTemperature( k, j, i, d );
+        double rho = d->Vc[RHO][k][j][i];
+        double c_V = ComputeSpecificHeatCapacity( k, j, i, d );
+        double tmp = plank_opacity * radiation_data.code_c * radiation_data.code_aR * POW3( temperature ) * g_dt;
+        double W = 0.0;
+
+        #if IRRADIATION == YES
+            W = irradiation.S[k][j][i];
+        #endif
+
+        #if ARTIFICIAL_DISSIPATION == YES
+            W += ComputeArtificialDissipation( k, j, i, d, grid );
+        #endif
+
+        return ( tmp / ( c_V + 4.0 * tmp ) ) * ( 4.0 * W * g_dt + rho * temperature * c_V ) + radiation_data.Erad[k][j][i];
+    #else
+        double plank_opacity = ComputePlanckOpacity( k, j, i, d, grid );
+        double temperature = GetTemperature( k, j, i, d );
+        double rho = d->Vc[RHO][k][j][i];
+        double c_V = ComputeSpecificHeatCapacity( k, j, i, d );
+
+        double tmp = plank_opacity * radiation_data.code_c * radiation_data.code_aR * POW3( temperature ) * g_dt;
+        return ( ( rho * temperature * tmp * c_V ) / ( c_V + 4.0 * tmp ) ) + radiation_data.Erad[k][j][i];
+    #endif
+}
+/**
+    Calculates the actual temperature \f$ T_{i,j,k}^n \f$ in code units
+
+    \f[
+        T_{i,j,k}^n = \frac{p}{\rho} \frac{\mu m_u}{k_B}
+    \f]
+
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+
+    \returns    \f$ T_{i,j,k}^n \f$
+
+*/
+double GetTemperature( int k, int j, int i, Data *d )
+{
+    double temperature_cgs = ( ( d->Vc[PRS][k][j][i] * radiation_data.mu * CONST_amu ) / ( d->Vc[RHO][k][j][i] * CONST_kB ) ) * POW2( g_unitVelocity ); //temperature in Kelvin
+    return temperature_cgs / g_unitTemperature;
+}
+
+/**
+    Returns the specific heat capacity \f$ c_V \f$ in code units
+
+    \note
+        The heat capacity is given by \f$ C_V=\rho c_V \f$
+
+    \param[in]  k
+    \param[in]  j
+    \param[in]  i
+    \param[in]  d
+
+    \returns
+        \f[
+            c_V = \frac{k_B}{(\gamma - 1) \mu m_H}
+        \f]
+ */
+double ComputeSpecificHeatCapacity( int k, int j, int i, Data *d )
+{
+    return ( radiation_data.code_kB ) / ( ( g_gamma - 1. ) * radiation_data.mu * radiation_data.code_mH );
+}
diff -rupN PLUTO4/Src/Radiation/radiation.h PLUTO_RADIATION_MOD/Src/Radiation/radiation.h
--- PLUTO4/Src/Radiation/radiation.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation.h	2013-06-01 18:33:00.181214820 +0200
@@ -0,0 +1,271 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2013 Moritz Stoll (shearing box boundary conditions)
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef RADIATION_H
+#define RADIATION_H
+
+#include <al.h>
+#include "radiation_tools.h"
+#include "opacity.h"
+#include "pluto.h"
+
+#include "error.h"
+
+#ifndef PLUTO4
+    #define ParGet(a,b) PAR_GET(a,b)
+    #define ParQuery(a) PAR_QUERY(a)
+#endif
+
+#ifndef ARTIFICIAL_DISSIPATION
+    #define ARTIFICIAL_DISSIPATION NO
+#endif
+
+//to remove some warnings
+int AL_Exchange_dim( char *buf, int *dims, int sz_ptr );
+
+/**
+    \note
+    (index of the last element means length(data->Vc) - 1 = NVAR + 1 - 1 = NVAR)
+*/
+#define ERAD (NVAR)
+
+#define POW2(val)   ((val) * (val))
+#define POW3(val)   ((val) * (val) * (val))
+#define POW4(val)   ((val) * (val) * (val) * (val))
+#define POW5(val)   ((val) * (val) * (val) * (val) * (val))
+#define POW6(val)   ((val) * (val) * (val) * (val) * (val) * (val))
+#define POW7(val)   ((val) * (val) * (val) * (val) * (val) * (val) * (val))
+
+#ifndef RADIATION_SMALL_NUMBERS_FIX
+    #define RADIATION_SMALL_NUMBERS_FIX NO
+#endif
+
+#ifndef RADIATION_SMALL_NUMBERS_FIX_VALUE
+    #define RADIATION_SMALL_NUMBERS_FIX_VALUE 1e-20
+#endif
+
+extern double g_unitTemperature;
+#define CONST_aR ((8. * POW5(CONST_PI) * POW4(CONST_kB)) / (15. * POW3(CONST_c) * POW3(CONST_h)) )
+
+#define NO_SHIFT                        0  /**<Use position i,j,k depending on usage */
+#define IDIR_pOH                        1  /**<Use position \f$ i+\frac{1}{2}\f$*/
+#define IDIR_mOH                        2  /**<Use position \f$ i-\frac{1}{2}\f$*/
+#define JDIR_pOH                        3  /**<Use position \f$ j+\frac{1}{2}\f$*/
+#define JDIR_mOH                        4  /**<Use position \f$ j-\frac{1}{2}\f$*/
+#define KDIR_pOH                        5  /**<Use position \f$ k+\frac{1}{2}\f$*/
+#define KDIR_mOH                        6  /**<Use position \f$ k-\frac{1}{2}\f$*/
+
+#define RADIATION_BC_NO_BOUNDARY        0   /**<Definition for invalid boundary condition*/
+#define RADIATION_BC_PERIODIC           1   /**<periodic boundary condition*/
+#define RADIATION_BC_SYMMETRIC          2   /**<symmetric boundary condition*/
+#define RADIATION_BC_REFLECTIVE         3   /**<reflecting boundary condition*/
+#define RADIATION_BC_OUTFLOW            4   /**<outflow boundary condition*/
+#define RADIATION_BC_FIXEDVALUE         5   /**<fixedvalue boundary condition*/
+#define RADIATION_BC_SHEARINGBOX        6   /**<shearing Box boundary condition*/
+
+#define SOR_FIXED_OMEGA                 0   /**<Definitions for the computation of omega in the function \ref SuccessiveOverrelaxation*/
+#define SOR_ADAPTIVE_OMEGA              1
+
+#ifndef RADIATION_SOR_OMEGA_MODE
+    #define RADIATION_SOR_OMEGA_MODE    SOR_FIXED_OMEGA
+#endif
+
+#define FLUXLIMITER_MINERBO             0
+#define FLUXLIMITER_KLEY                1
+#define FLUXLIMITER_LEVERMORE_POMRANING 2
+#define FLUXLIMITER_CONST               3
+
+#define PETSC_LIBRARY                   0
+#define SOLVER_SOR                      1
+
+#define NORM_RELATIVE_L2                0   /**<Definitions for the norm computation in the function \ref SuccessiveOverrelaxation*/
+#define NORM_RELATIVE_MAX               1
+#define NORM_RESIDUAL_L2                2
+#define NORM_RESIDUAL_MAX               3
+#define NORM_RESIDUAL_RELATIVE_L2       4
+#define NORM_RESIDUAL_RELATIVE_MAX      5
+#define NORM_PETSC                      6
+
+#ifndef RADIATION_SOR_NORM
+    #define RADIATION_SOR_NORM NORM_RESIDUAL_L2
+#endif
+
+#if RADIATION_SOLVER == PETSC_LIBRARY
+    #include "petsc.h"
+#endif
+
+typedef struct BOUNDARY_CONDITION_INFO
+{
+    int bc_beg;         /**<boundary condition (RADIATION_BC_PERIODIC,RADIATION_BC_SYMMETRIC,RADIATION_BC_REFLECTIVE,RADIATION_BC_FIXEDVALUE) at the start (low index)*/
+    int bc_end;         /**<same as bc_beg but at the end (high index)*/
+
+    double beg_fixedvalue;  /**storage for the value used by the boundary condition RADIATION_BC_FIXEDVALUE */
+    double end_fixedvalue;  /**same as beg_fixedvalue*/
+} BoundaryConditionInfo;
+
+#define RADIATION_REGISTER_FUNCTION_INIT                    1   /**<If this option is used in function \ref RadiationRegisterCustomFunction then the function is called in \ref RadiationInit*/
+#define RADIATION_REGISTER_FUNCTION_TIMESTEP_BEGIN          2   /**<If this option is used in function \ref RadiationRegisterCustomFunction then the function is called at the begining of function \ref RadiationImplicitTimestep*/
+#define RADIATION_REGISTER_FUNCTION_TIMESTEP_END            3   /**<If this option is used in function \ref RadiationRegisterCustomFunction then the function is called at the end of function \ref RadiationImplicitTimestep*/
+#define RADIATION_REGISTER_FUNCTION_UPDATE_PRESSURE_BEGIN   4   /**<If this option is used in function \ref RadiationRegisterCustomFunction then the function is called at the begining of function \ref UpdatePlutoPressure*/
+#define RADIATION_REGISTER_FUNCTION_UPDATE_PRESSURE_END     5   /**<If this option is used in function \ref RadiationRegisterCustomFunction then the function is called at the end of function \ref UpdatePlutoPressure*/
+
+typedef struct SOR_ADAPTIVE_OMEGA_DATA
+{
+    double omega;
+    double direction;
+    int iterations;
+} SorAdaptiveOmegaData;
+
+typedef struct RADIATION_DATA
+{
+    double mu;                  /**<mean molecular wight \f$ \mu \f$ which is dimensionless \note the function MEAN_MOLECULAR_WEIGHT() is only used for cooling in PLUTO \note set this in the problem init file init.c*/
+    double code_c;              /**<light speed in code units \note is set in RADIATION_INIT()*/
+    double code_amu;            /**<atomic mass unit in code units \note is set in RADIATION_INIT()*/
+    double code_mH;             /**<Hydrogen atom mass in code units \note is set in RADIATION_INIT()*/
+    double code_aR;             /**<\f$ a_R \f$ in code units \note is set in RADIATION_INIT()*/
+    double code_kB;             /**<Boltzmann constant in code units \note is set in RADIATION_INIT()*/
+
+    int default_init_Erad;      /** If \a radiation_default_init_Erad is 1 then \ref SetInitialValues is called in function \ref RadiationInit else not*/
+
+    double ** *Erad;            /**pointer to the array of Erad to free the memory in the function RADIATION_FINALISE()**/
+
+    BoundaryConditionInfo boundary_conditions[3];
+
+    double absolute_tolerance;  ///used by petsc and the sor solver
+    double relative_tolerance;  ///used by petsc and the sor solver
+    int max_iterations;         ///used by petsc and the sor solver
+
+    #if RADIATION_SOLVER == SOLVER_SOR
+        double ****sor_coefficients;
+    #endif
+
+    #if RADIATION_SOLVER == PETSC_LIBRARY
+        NeighbourGridItem **topology_grid;
+        int *topology_grid_size;
+        int *offset_array;
+
+        /*
+            The following arrays are used in the function ComputeToplology1DPosition.
+
+            np stands here for the local number of points in the local domain
+            (boundaries excluded) of a processor,
+
+            dir = IDIR,JDIR,KDIR
+
+            np_high_part[dir] = grid[dir].np_int_glob / topology_grid_size[dir]
+            num_low_part[dir] = grid[dir].np_int_glob % topology_grid_size[dir]
+
+            In the case that grid[dir].np_int_glob devidable by topology_grid_size without
+            an rest np_low_part[dir] is equal to np_high_part[dir] else
+            np_low_part[dir] = np_high_part[dir] + 1
+        */
+        int np_low_part[3];
+        int np_high_part[3];
+        int num_low_part[3];
+
+        MPI_Comm comm_topology;
+    #endif
+
+} RadiationData;
+extern RadiationData radiation_data;
+
+void RadiationSetEradInitBehaviour( int b );
+void RadiationSetMu( double mu );
+void RadiationSetInitialErad( Grid *grid, Data *data );
+void RadiationSetInitialEradBlackBody( Grid *grid, Data *data );
+
+void PrintBoundaryConditions();
+void RadiationPrintUnits();
+void SegfaultHandleFunction( int sig );
+
+double ComputeNewTemperature( int k, int j, int i, Grid *grid, Data *data );
+void UpdatePlutoPressure( Grid *grid, Data *data );
+
+void FixedValueBoundaryCondition( double ***q, RBox *box, int side );
+void ReflectiveBoundaryCondition( double ***q, RBox *box, int side );
+void PeriodicBoundaryCondition( double ***q, RBox *box, int side );
+void RadiationBoundaryCondition( Grid *grid, Data *data );
+void SetupBoundaryConditions( Grid *grid );
+void CheckBoundaryConditions( Grid *grid );
+
+void RadiationInit( int argc, char **argv, Input *input, Grid *grid, Data *data, int restart );
+void RadiationAllocateMemory( Input *input );
+
+void RadiationCleanup();
+
+void RadiationImplicitTimestep( Grid *grid, Data *data, Input *input );
+
+int SuccessiveOverrelaxationImplicitTimestep( Grid *grid, Data *data );
+
+void SuccessiveOverrelaxationInit();
+void SuccessiveOverrelaxationFinalise();
+double ComputeAdaptiveOmega( double omega, int iterations, double increase, int averageing_timesteps );
+int SuccessiveOverrelaxation( Grid *grid, Data *data, double rtol, double atol, int max_iterations );
+
+double ComputeIntermediateValue( int k, int j, int i, int shift, double ***quantity );
+double ComputeIntermediateValueWithFunction( int k, int j, int i, int shift, Data *data, double( getVariable )( int, int, int, Data * ) );
+
+double Fluxlimiter( double R );
+double FluxlimiterR( int k, int j, int i, int shift, Data *d, Grid *grid );
+
+void RadiationOpacityInit();
+double RadiationRosselandOpacity( double density, double temperature );
+double RadiationPlanckOpacity( double density, double temperature );
+
+double ComputeRosselandOpacity( int k, int j, int i, int shift, Data *d, Grid *grid );
+double ComputePlanckOpacity( int k, int j, int i, Data *d, Grid *grid );
+// double RosselandOpacity(double density, double temperature);
+// double PlanckOpacity(double density, double temperature);
+
+void ComputeRadiationAcceleration( int k, int j, int i, Grid *grid, double *v, double *a );
+
+double ComputeArtificialDissipation( int k, int j, int i, Data *data, Grid *grid );
+double ComputeCoefficientK( int k, int j, int i, int shift, Data *d, Grid *grid );
+
+double ComputeGeometryCoefficientGrx1( int k, int j, int i, Grid *grid );
+double ComputeGeometryCoefficientGlx1( int k, int j, int i, Grid *grid );
+double ComputeGeometryCoefficientGrx2( int k, int j, int i, Grid *grid );
+double ComputeGeometryCoefficientGlx2( int k, int j, int i, Grid *grid );
+double ComputeGeometryCoefficientGrx3( int k, int j, int i, Grid *grid );
+double ComputeGeometryCoefficientGlx3( int k, int j, int i, Grid *grid );
+
+double ComputeCoefficientU1( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU1Advanced( int k, int j, int i, Data *d, Grid *grid, double U2, double U3, double U4, double U5, double U6, double U7 );
+
+double ComputeCoefficientU2( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU3( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU4( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU5( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU6( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientU7( int k, int j, int i, Data *d, Grid *grid );
+double ComputeCoefficientB( int k, int j, int i, Data *d, Grid *grid );
+
+double GetTemperature( int k, int j, int i, Data *d );
+
+double ComputeSpecificHeatCapacity( int k, int j, int i, Data *d );
+
+#ifdef RADIATION_CUSTOM_IMPLICITE_TEMESTEP_BEGIN
+    void RadiationCustomImplicitTimestepBegin( Grid *grid, Data *data );
+#endif
+#ifdef RADIATION_CUSTOM_IMPLICITE_TEMESTEP_END
+    void RadiationCustomImplicitTimestepEnd( Grid *grid, Data *data, int iterations );
+#endif
+
+#endif
diff -rupN PLUTO4/Src/Radiation/radiation_hd_rhs.c PLUTO_RADIATION_MOD/Src/Radiation/radiation_hd_rhs.c
--- PLUTO4/Src/Radiation/radiation_hd_rhs.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation_hd_rhs.c	2013-06-01 18:33:00.229214818 +0200
@@ -0,0 +1,1454 @@
+/* ///////////////////////////////////////////////////////////////////// */
+/*! 
+  \file  
+  \brief Compute the right hand side of the conservative 
+         HD/MHD equations.
+
+  This function constructs the one-dimensional right hand side of 
+  the conservative MHD or HD equations in the direction given by g_dir 
+  in different geometries.
+  The right hand side is computed as a two-point flux difference 
+  term plus a source term:
+  
+  \f[ \mathrm{RHS}_i = 
+      \frac{dt}{dV_i}\Big(A_{i+1/2}F_{i+1/2} - A_{i-1/2}F_{i-1/2}\Big)  
+      + dt S_i  \f]
+ 
+   where 
+ 
+   - \f$ A_{i\pm 1/2} \f$ : interface areas
+   - \f$ dV_i         \f$ : cell volume
+   - \f$ F_{i\pm 1/2} \f$ : interface fluxes
+   - \f$ dt           \f$ : time step
+   - \f$ S_i          \f$ : source term including geometrical terms and 
+                            body forces.
+  
+  See also \ref RHS_page
+  The right hand side is assembled through the following steps:
+ 
+   - If either one of FARGO, ROTATION or gravitational potential is 
+      used, fluxes are combined to enforce conservation of total angular
+      momentum and/or energy, see TotalFlux()
+   - initialize rhs with flux differences
+   - add geometrical source terms
+   - enforce conservation of total angular  momentum and/or energy;
+   - add gravity        
+
+  \author A. Mignone (mignone@ph.unito.it)
+  \date   Aug 16, 2012
+*/
+/* ///////////////////////////////////////////////////////////////////// */
+#include "pluto.h"
+
+#ifdef RADIATION
+ #include "radiation.h"
+#endif
+
+static void TotalFlux (const State_1D *, double *, int, int, Grid *);
+
+#ifdef CH_SPACEDIM   /*  implies Chombo is being used  */
+ #define USE_PR_GRADIENT  YES   
+#else
+ #ifdef FINITE_DIFFERENCE 
+  #define USE_PR_GRADIENT  NO   /* -- default for Finite Difference schemes -- */
+ #else
+  #define USE_PR_GRADIENT  YES   /* -- default, do not change!! -- */
+ #endif
+#endif
+
+#if defined FARGO && !defined SHEARINGBOX
+ #define IF_FARGO(a)  a
+#else 
+ #define IF_FARGO(a)  
+#endif
+
+#if ROTATING_FRAME == YES
+ #define IF_ROTATION(a)  a
+#else 
+ #define IF_ROTATION(a)  
+#endif
+
+#if EOS == IDEAL
+ #define IDEAL_EOS 1
+#else
+ #define IDEAL_EOS 0
+#endif
+
+#if PHYSICS == MHD
+#if BACKGROUND_FIELD == YES
+ #define TotBB(v, b0, a, b) (v[a]*(v[b] + b0[b]) + b0[a]*v[b])
+#else
+ #define TotBB(v, b0, a, b) (v[a]*v[b])
+#endif
+#endif
+
+/* *********************************************************************** */
+void RightHandSide (const State_1D *state, Time_Step *Dts, 
+              int beg, int end, double dt, Grid *grid)
+/*! 
+ *
+ * \param [in,out]  state  pointer to State_1D structure
+ * \param [in]      Dts    pointer to time step structure
+ * \param [in]      beg    initial index of computation
+ * \param [in]      end    final   index of computation
+ * \param [in]      dt     time increment
+ * \param [in]      grid  pointer to Grid structure
+ *
+ * \return This function has no return value.
+ * \note    --
+ * \todo    --
+ ************************************************************************* */
+{
+  int  i, nv;
+  double dtdx, dtdV, scrh;
+  double *x1, *x1p, *dx1;
+  double *x2, *x2p, *dx2;
+  double *x3, *x3p, *dx3;
+  double **vh, **vp, **vm;
+  double **flux, **rhs, *p;
+  double cl;
+  double **Bg0, **wA, w, wp, vphi, gPhi_c;
+  double g[3];
+  static double **fA, *gPhi;
+
+  #if GEOMETRY != CARTESIAN
+   if (fA == NULL) fA = ARRAY_2D(NMAX_POINT, NVAR, double);
+  #endif
+  #ifdef FARGO
+   wA = FARGO_GetVelocity();
+  #endif
+
+  if (gPhi == NULL) gPhi = ARRAY_1D(NMAX_POINT, double);
+
+  #if (defined SHEARINGBOX) && (defined FARGO) && (EOS == IDEAL)
+   print1 ("! ShearingBox+Fargo+Ideal EoS not properly implemented\n");
+   QUIT_PLUTO(1);
+  #endif
+
+/* --------------------------------------------------
+             Compute passive scalar fluxes
+   -------------------------------------------------- */
+
+  #if NSCL > 0
+   AdvectFlux (state, beg - 1, end, grid);
+  #endif
+
+  #if (PHYSICS == MHD) && (BACKGROUND_FIELD == YES)
+   Bg0 = GetBackgroundField (beg, end, CELL_CENTER, grid);
+  #endif
+
+/* --------------------------
+      pointer shortcuts
+   -------------------------- */
+
+  rhs  = state->rhs;
+  flux = state->flux;
+  p    = state->press;
+  vh   = state->vh;
+  vp   = state->vp;
+  vm   = state->vm;
+  
+  x1 = grid[IDIR].x; x1p = grid[IDIR].xr; dx1 = grid[IDIR].dx;
+  x2 = grid[JDIR].x; x2p = grid[JDIR].xr; dx2 = grid[JDIR].dx;
+  x3 = grid[KDIR].x; x3p = grid[KDIR].xr; dx3 = grid[KDIR].dx;
+
+/* ------------------------------------------------
+     Add pressure to normal component of 
+     momentum flux if necessary.
+   ------------------------------------------------ */
+
+  #if USE_PR_GRADIENT == NO
+   for (i = beg - 1; i <= end; i++) flux[i][MXn] += p[i];
+  #endif
+
+/* -------------------------------------------------
+    compute gravitational potential and add 
+    contribution to energy flux.
+   ------------------------------------------------- */
+
+  #if (defined FARGO && !defined SHEARINGBOX) ||\
+      (ROTATING_FRAME == YES) || (BODY_FORCE & POTENTIAL)
+   TotalFlux(state, gPhi, beg-1, end, grid);
+  #endif
+
+#if GEOMETRY == CARTESIAN
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in CARTESIAN geometry.
+    
+   *********************************************************** */
+{
+  double x, y, z, *vc;
+
+  if (g_dir == IDIR){
+
+  /* ****************************************************
+      Cartesian x-direction,
+
+       - initialize rhs with flux differences (I1)
+       - enforce conservation of total angular
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    y = x2[*g_j];
+    z = x3[*g_k];
+    for (i = beg; i <= end; i++) {
+      x    = x1[i];
+      dtdx = dt/dx1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX1] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) 
+       w = wA[*g_k][i];
+       rhs[i][MX2] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG] -= w*(rhs[i][MX2] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][MX1] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][MX1] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX1] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+
+      #ifdef SHEARINGBOX
+       rhs[i][MX1] += dt*2.0*vc[RHO]*vc[VX2]*sb_Omega;
+      #endif
+
+    }
+  } else if (g_dir == JDIR){
+
+  /* ****************************************************
+      Cartesian y-direction,
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    x = x1[*g_i];
+    z = x3[*g_k];
+    for (i = beg; i <= end; i++) {
+      y    = x2[i];
+      dtdx = dt/dx2[i];
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX2] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][MX2] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][MX2] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX2] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+
+      #ifdef SHEARINGBOX
+       rhs[i][MX2] -= dt*2.0*vc[RHO]*vc[VX1]*sb_Omega;
+      #endif
+    }
+
+  }else if (g_dir == KDIR){
+
+  /* ****************************************************
+      Cartesian z-direction,
+
+       - initialize rhs with flux differences (K1)
+       - enforce conservation of total angular
+         momentum and/or energy               (K3)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    x = x1[*g_i];
+    y = x2[*g_j];
+    for (i = beg; i <= end; i++) {
+      z    = x3[i];
+      dtdx = dt/dx3[i];
+
+    /* -----------------------------------------------
+       K1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX3] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       K3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) 
+       w = wA[i][*g_i];
+       rhs[i][MX2] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG] -= w*(rhs[i][MX2] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       K4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]);
+       rhs[i][MX3] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, *g_i, grid, vc, g);
+       rhs[i][MX3] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX3] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+#elif GEOMETRY == CYLINDRICAL
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in CYLINDRICAL geometry.
+    
+   *********************************************************** */
+{
+  double R, z, phi, R_1; 
+
+  if (g_dir == IDIR) {  
+    double vc[NVAR];
+
+  /* ****************************************************
+      Cylindrical radial direction:
+      multiply fluxes times interface area
+     **************************************************** */
+
+    z   = x2[*g_j];
+    phi = 0.0;
+    for (i = beg - 1; i <= end; i++){ 
+      R = grid[IDIR].A[i];
+
+      fA[i][RHO] = flux[i][RHO]*R;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*R;     ,
+             fA[i][iMZ]   = flux[i][iMZ]*R;     ,
+             fA[i][iMPHI] = flux[i][iMPHI]*R*R;)       
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*R;  ,
+              fA[i][iBZ]   = flux[i][iBZ]*R;  ,
+              fA[i][iBPHI] = flux[i][iBPHI]*R;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*R;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*R;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*R;
+    }
+
+  /* ****************************************************
+      Cylindrical radial direction,
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++){ 
+      R    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      R_1  = 1.0/R;
+
+    /* ---------------------------------------------------------------
+       I1. initialize rhs with flux difference
+
+           Note: when there's no explicit resistivity, we use the 
+                 formulation with source terms since it seems to have 
+                 better stability properties.
+       ---------------------------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(rhs[i][iMR]   = - dtdV*(fA[i][iMR]   - fA[i-1][iMR]);  ,
+             rhs[i][iMZ]   = - dtdV*(fA[i][iMZ]   - fA[i-1][iMZ]);  ,
+             rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*fabs(R_1);)
+      #if USE_PR_GRADIENT == YES
+       rhs[i][iMR] -= dtdx*(p[i] - p[i-1]);  
+      #endif
+      #if PHYSICS == MHD
+
+       #if (RESISTIVE_MHD == NO) || (RESISTIVE_MHD == SUPER_TIME_STEPPING)
+        EXPAND(rhs[i][iBR]   = - dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+               rhs[i][iBZ]   = - dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);  ,
+               rhs[i][iBPHI] = - dtdV*(fA[i][iBPHI] - fA[i-1][iBPHI]);)
+       #else
+        EXPAND(rhs[i][iBR]   = - dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+               rhs[i][iBZ]   = - dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);  ,
+               rhs[i][iBPHI] = - dtdx*(flux[i][iBPHI] - flux[i-1][iBPHI]);)
+       #endif
+
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = - dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = - dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+
+      for (nv = NFLX; nv < NVAR; nv++) {
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms
+       ---------------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]); 
+/* for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+
+      #if COMPONENTS == 3
+       vphi = vc[iVPHI];
+       #if ROTATING_FRAME == YES
+        w     = g_OmegaZ*R;
+        vphi += w;
+       #endif
+
+       #if PHYSICS == HD
+        rhs[i][iMR] += dt*vc[RHO]*vphi*vphi*R_1;
+       #elif PHYSICS == MHD
+        rhs[i][iMR] += dt*(vc[RHO]*vphi*vphi - TotBB(vc, Bg0, iBPHI, iBPHI))*R_1;
+        #if (RESISTIVE_MHD == NO) || (RESISTIVE_MHD == SUPER_TIME_STEPPING)
+         rhs[i][iBPHI] -= dt*(vphi*vc[iBR] - vc[iBPHI]*vc[iVR])*R_1;
+         #if BACKGROUND_FIELD == YES
+          rhs[i][iBPHI] -= dt*(vphi*Bg0[i][iBR] - Bg0[i][iBPHI]*vc[iVR])*R_1;
+         #endif
+        #endif
+       #endif /* PHYSICS == MHD */
+      #endif  /* COMPONENTS == 3 */
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if ROTATING_FRAME == YES
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]  -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, z, phi);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+     
+  } else if (g_dir == JDIR) { 
+    double *vc;
+
+  /* ****************************************************
+      Cylindrical vertical direction:
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    R   = x1[*g_i];
+    phi = 0.0;
+    for (i = beg; i <= end; i++){ 
+      z    = x2[i];   
+      dtdx = dt/dx2[i];
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][iMZ] += - dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMZ] += -dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if EOS == IDEAL
+        gPhi_c      = BodyForcePotential(R, z, phi);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+
+#elif GEOMETRY == POLAR
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in POLAR geometry.
+    
+   *********************************************************** */
+{
+  double R, phi, z; 
+  double R_1;
+   
+  if (g_dir == IDIR) { 
+    double vc[NVAR];
+
+  /* ****************************************************
+      Polar radial direction:
+      multiply fluxes times interface area
+     **************************************************** */
+
+    phi = x2[*g_j];
+    z   = x3[*g_k];
+    for (i = beg - 1; i <= end; i++) { 
+      R = grid[IDIR].A[i];
+
+      fA[i][RHO] = flux[i][RHO]*R;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*R;      ,
+             fA[i][iMPHI] = flux[i][iMPHI]*R*R;  ,
+             fA[i][iMZ]   = flux[i][iMZ]*R;)       
+      #if PHYSICS == MHD 
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*R;    ,
+              fA[i][iBPHI] = flux[i][iBPHI];    ,
+              fA[i][iBZ]   = flux[i][iBZ]*R;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*R;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*R;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*R;
+    }
+
+  /* ****************************************************
+      Polar radial direction,
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - enforce conservation of total angular
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++) {
+      R    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      R_1  = grid[IDIR].r_1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(rhs[i][iMR]   = - dtdV*(fA[i][iMR]   - fA[i-1][iMR])
+                             - dtdx*(p[i] - p[i-1]);                      ,      
+             rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*R_1;  ,
+             rhs[i][iMZ]   = - dtdV*(fA[i][iMZ]   - fA[i-1][iMZ]);)
+      #if PHYSICS == MHD 
+       EXPAND(rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);    ,
+              rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI]);  ,
+              rhs[i][iBZ]   = -dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);)
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = -dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) {
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms
+       ---------------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]); 
+/* for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+      vphi = vc[iVPHI];
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0;
+       IF_FARGO   (w += wA[*g_k][i];)
+       IF_ROTATION(w += g_OmegaZ*R;)
+       vphi += w;
+      #endif
+      #if PHYSICS == HD
+       rhs[i][iMR] += dt*vc[RHO]*vphi*vphi*R_1;
+      #elif PHYSICS == MHD
+       rhs[i][iMR] += dt*(  vc[RHO]*vphi*vphi 
+                          - TotBB(vc, Bg0[i], iBPHI, iBPHI))*R_1;
+      #endif
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+      
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+     
+  } else if (g_dir == JDIR) {
+    double *vc;
+
+  /* ****************************************************
+      Polar azimuthal direction:
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    R = x1[*g_i];
+    z = x3[*g_k];
+    scrh = dt/R;
+    for (i = beg; i <= end; i++){ 
+      phi  = x2[i];
+      dtdx = scrh/dx2[i];
+
+    /* ------------------------------------------------
+       J1. Compute equations rhs for phi-contributions
+       ------------------------------------------------ */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      rhs[i][iMPHI] -= dtdx*(p[i] - p[i-1]);
+
+    /* -------------------------------------------------------
+       J4. Include gravity
+       ------------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMPHI] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+
+  } else if (g_dir == KDIR) { 
+    double *vc;
+
+  /* ****************************************************
+      Polar vertical direction:
+
+       - initialize rhs with flux differences (K1)
+       - enforce conservation of total angular
+         momentum and/or energy               (K3)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    R   = x1[*g_i];
+    phi = x2[*g_j];
+    for (i = beg; i <= end; i++){ 
+      z    = x3[i];
+      dtdx = dt/dx3[i];
+
+    /* -----------------------------------------------
+       K1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      rhs[i][iMZ] -= dtdx*(p[i] - p[i-1]);
+
+    /* ------------------------------------------------------
+       K3. modify rhs to enforce conservation (FARGO only)
+           (solid body rotations are not included the
+            velocity depends on the cylindrical radius only)
+       ------------------------------------------------------ */
+
+      #ifdef FARGO 
+       w = wA[i][*g_i];
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]  -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);       
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       K4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]); 
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, *g_i, grid, vc, g);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMZ] += -dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if EOS == IDEAL
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif                                     
+    }
+  }
+}
+#elif GEOMETRY == SPHERICAL
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in SPHERICAL geometry.
+    
+   *********************************************************** */
+{
+  double r, th, phi;
+  double r2, r3, r_1;
+  double s, s2, ct, s_1;
+
+  if (g_dir == IDIR) { 
+    double Sm, vc[NVAR];
+
+  /* ****************************************************
+      Spherical radial direction: 
+      multiply fluxes by interface area 
+     **************************************************** */
+
+    th  = x2[*g_j]; s = sin(th);
+    phi = x3[*g_k];
+    for (i = beg - 1; i <= end; i++){
+      r  = x1p[i];
+      r2 = r*r; 
+      r3 = r2*r;
+
+      fA[i][RHO] = flux[i][RHO]*r2;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*r2;   ,
+             fA[i][iMTH]  = flux[i][iMTH]*r2;  ,
+             fA[i][iMPHI] = flux[i][iMPHI]*r3;)
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*r2;   ,
+              fA[i][iBTH]  = flux[i][iBTH]*r;  ,
+              fA[i][iBPHI] = flux[i][iBPHI]*r;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*r2;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*r2;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*r2;
+    } 
+
+  /* ****************************************************
+      Spherical radial direction:
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - enforce conservation of total angular 
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++) { 
+      r    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      r_1  = grid[IDIR].r_1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(
+        rhs[i][iMR]   = - dtdV*(fA[i][iMR] - fA[i-1][iMR])
+                        - dtdx*(p[i] - p[i-1]);                    ,
+        rhs[i][iMTH]  = -dtdV*(fA[i][iMTH]  - fA[i-1][iMTH]);      ,
+        rhs[i][iMPHI] = -dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*r_1; 
+      )
+      #if PHYSICS == MHD
+       EXPAND(                                                     
+         rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);       ,
+         rhs[i][iBTH]  = -dtdx*(fA[i][iBTH]  - fA[i-1][iBTH])*r_1;  ,
+         rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI])*r_1;
+       )
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = -dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+
+      for (nv = NFLX; nv < NVAR; nv++){
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms 
+       ---------------------------------------------------- */
+  
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]);
+/*  for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+
+      vphi = SELECT(0.0, 0.0, vc[iVPHI]);
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0;
+       IF_FARGO   (w += wA[*g_j][i];)
+       IF_ROTATION(w += g_OmegaZ*r*s;)
+       vphi += w;
+      #endif
+      Sm = vc[RHO]*(EXPAND(  0.0, + vc[iVTH]*vc[iVTH], + vphi*vphi));
+      #if PHYSICS == MHD
+       Sm += EXPAND(  0.0, - TotBB(vc, Bg0[i], iBTH, iBTH), 
+                           - TotBB(vc, Bg0[i], iBPHI,iBPHI));
+      #endif
+      rhs[i][iMR] += dt*Sm*r_1;
+
+    /* ----------------------------------------------------
+       I3. modify rhs to enforce conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]); 
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir]; 
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif                                     
+    }
+
+  } else if (g_dir == JDIR) {
+
+    double Sm, *vc;
+
+  /* ****************************************************
+      Spherical meridional direction:
+      multiply fluxes by zone-interface area
+     **************************************************** */
+
+    r   = x1[*g_i];
+    phi = x3[*g_k];
+    for (i = beg - 1; i <= end; i++){ 
+      s  = grid[JDIR].A[i];
+      s2 = s*s;
+
+      fA[i][RHO] = flux[i][RHO]*s;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*s;   ,
+             fA[i][iMTH]  = flux[i][iMTH]*s;  ,
+             fA[i][iMPHI] = flux[i][iMPHI]*s2;) 
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*s;   ,
+              fA[i][iBTH]  = flux[i][iBTH]*s;  ,
+              fA[i][iBPHI] = flux[i][iBPHI];)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*s;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*s;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*s;
+    }
+
+  /* ****************************************************
+      Spherical meridional direction:
+
+       - initialize rhs with flux differences (J1)
+       - add source terms                     (J2)
+       - enforce conservation of total angular
+         momentum and/or energy               (J3)
+       - add gravity                          (J4)
+     **************************************************** */
+    
+    r_1 = grid[IDIR].r_1[*g_i];
+    for (i = beg; i <= end; i++){
+      th   = x2[i];
+      dtdV = dt/grid[JDIR].dV[i]*r_1;
+      dtdx = dt/dx2[i]*r_1;      
+      s    = sin(th);
+      s_1  = 1.0/s;   
+      ct   = grid[JDIR].ct[i];         /* = cot(theta)  */
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(
+        rhs[i][iMR]   = - dtdV*(fA[i][iMR] - fA[i-1][iMR]);  , 
+        rhs[i][iMTH]  = - dtdV*(fA[i][iMTH] - fA[i-1][iMTH])
+                        - dtdx*(p[i] - p[i-1]);              , 
+        rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*fabs(s_1);
+      )       
+      #if PHYSICS == MHD
+       EXPAND(                                                     
+         rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+         rhs[i][iBTH]  = -dtdV*(fA[i][iBTH]  - fA[i-1][iBTH]);  ,
+         rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI]);
+       )
+       #ifdef GLM_MHD
+        rhs[i][iBTH]    = -dtdx*(flux[i][iBTH] - flux[i-1][iBTH]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++){
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       J2. Add source terms
+       ---------------------------------------------------- */
+       
+      vc = vh[i];
+      
+      vphi = SELECT(0.0, 0.0, vc[iVPHI]);
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0; 
+       IF_FARGO   (w += wA[i][*g_i];)
+       IF_ROTATION(w += g_OmegaZ*r*s;)
+       vphi += w;
+      #endif
+      Sm = vc[RHO]*(EXPAND(  0.0, - vc[iVTH]*vc[iVR], + ct*vphi*vphi));
+      #if PHYSICS == MHD
+       Sm += EXPAND(0.0, +    TotBB(vc, Bg0[i], iBTH, iBR), 
+                         - ct*TotBB(vc, Bg0[i], iBPHI, iBPHI));
+      #endif
+      rhs[i][iMTH] += dt*Sm*r_1;
+
+    /* ----------------------------------------------------
+       J3. modify rhs to enforce conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMTH] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMTH] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMTH] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+
+  } else if (g_dir == KDIR) {
+
+    double Sm, *vc;
+
+  /* ****************************************************
+      Spherical azimuthal direction:
+
+       - initialize rhs with flux differences (K1)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    r  = x1[*g_i];
+    th = x2[*g_j];
+    s    = sin(th);
+    scrh = dt/(r*s);
+    for (i = beg; i <= end; i++) {
+      phi  = x3[i];
+      dtdx = scrh/dx3[i];
+
+    /* ------------------------------------------------
+       K1.  initialize rhs with flux difference
+       ------------------------------------------------ */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }       
+      rhs[i][iMPHI] -= dtdx*(p[i] - p[i-1]); 
+
+    /* -------------------------------------------------------
+       K4. Include gravity
+       ------------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, *g_i, grid, vc, g);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMPHI] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+#endif  /* GEOMETRY == SPHERICAL */
+
+/* ---------------------------------------------------------------
+    Source terms coming from tensor discretazion of parabolic
+    terms in curvilinear coordinates (only for viscosity)
+  ---------------------------------------------------------------- */
+
+  #if GEOMETRY != CARTESIAN
+   #if VISCOSITY == EXPLICIT
+    for (i = beg; i <= end; i++) {
+      EXPAND(rhs[i][MX1] += dt*state->par_src[i][MX1];  ,
+             rhs[i][MX2] += dt*state->par_src[i][MX2];  ,
+             rhs[i][MX3] += dt*state->par_src[i][MX3];)
+    }
+   #endif
+  #endif
+
+/* --------------------------------------------------
+              Powell's source terms
+   -------------------------------------------------- */
+
+  #if PHYSICS == MHD 
+   #if MHD_FORMULATION == EIGHT_WAVES
+    for (i = beg; i <= end; i++) {
+      EXPAND(rhs[i][MX1] += dt*state->src[i][MX1];  ,
+             rhs[i][MX2] += dt*state->src[i][MX2];  ,
+             rhs[i][MX3] += dt*state->src[i][MX3];)
+
+      EXPAND(rhs[i][BX1] += dt*state->src[i][BX1];  ,
+             rhs[i][BX2] += dt*state->src[i][BX2];  ,
+             rhs[i][BX3] += dt*state->src[i][BX3];)
+      #if IDEAL_EOS
+       rhs[i][ENG] += dt*state->src[i][ENG];
+      #endif
+    }
+   #endif
+  #endif
+
+/* -------------------------------------------------
+            Extended GLM source terms
+   ------------------------------------------------- */
+
+  #ifdef GLM_MHD
+  #if   EGLM == YES
+   EGLM_Source (state, dt, beg, end, grid);
+  #endif
+  #endif
+
+/* -----------------------------------------------
+      Entropy equation source terms 
+   ----------------------------------------------- */
+
+  #if RESISTIVE_MHD == EXPLICIT
+   #if (ENTROPY_SWITCH == YES) && (EOS != ISOTHERMAL && EOS != BAROTROPIC)
+    for (i = beg; i <= end; i++) {
+      rhs[i][ENTR] += dt*state->src[i][ENTR];
+    }
+   #endif
+  #endif
+
+/* --------------------------------------------------
+    Reset right hand side in internal boundary zones
+   -------------------------------------------------- */
+   
+  #if INTERNAL_BOUNDARY == YES
+   InternalBoundaryReset(state, Dts, beg, end, grid);
+  #endif
+  
+/* --------------------------------------------------
+           Time step determination
+   -------------------------------------------------- */
+
+#if !GET_MAX_DT
+return;
+#endif
+
+  cl = 0.0;
+  for (i = beg-1; i <= end; i++) {
+    scrh = Dts->cmax[i]*grid[g_dir].inv_dxi[i];
+    cl = MAX(cl, scrh);   
+  }
+  #if GEOMETRY == POLAR || GEOMETRY == SPHERICAL
+   if (g_dir == JDIR) {
+     cl /= fabs(grid[IDIR].xgc[*g_i]);
+   }
+   #if GEOMETRY == SPHERICAL
+    if (g_dir == KDIR){
+      cl /= fabs(grid[IDIR].xgc[*g_i])*sin(grid[JDIR].xgc[*g_j]);
+    }
+   #endif
+  #endif
+  Dts->inv_dta = MAX(cl, Dts->inv_dta);  
+}
+
+/* ********************************************************************* */
+void TotalFlux (const State_1D *state, double *gPhi,
+                int beg, int end, Grid *grid)
+/*!
+ *  Compute the total flux in order to enforce conservation of 
+ *  angular momentum and energy in presence of FARGO source 
+ *  terms, rotation or gravitational potential.
+ *
+ * \param [in]     state pointer to State_1D structure;
+ * \param [in,out] gPhi  1D array defining the gravitational potential;
+ * \param [in]     beg    initial index of computation; 
+ * \param [in]     end    final   index of computation;
+ * \param [in]     grid  pointer to Grid structure;
+ *********************************************************************** */
+#ifndef iMPHI
+ #define iMPHI MY  /* -- for Cartesian coordinates -- */
+#endif
+{
+  int i;
+  double wp, R;
+  double **flux, *vp;
+  double *x1,  *x2,  *x3;
+  double *x1p, *x2p, *x3p;
+  #ifdef FARGO
+   double **wA;
+   wA = FARGO_GetVelocity();
+  #endif
+
+  flux = state->flux;
+  x1  = grid[IDIR].x;  x1p = grid[IDIR].xr;
+  x2  = grid[JDIR].x;  x2p = grid[JDIR].xr;
+  x3  = grid[KDIR].x;  x3p = grid[KDIR].xr;
+
+  if (g_dir == IDIR){ 
+    for (i = beg; i <= end; i++){
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO or Rotation 
+        Note: ShearingBox terms are not included here but
+              only within the BodyForce function.
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) || (ROTATING_FRAME == YES)
+       wp = 0.0;
+       #if GEOMETRY == SPHERICAL
+        IF_FARGO(wp = 0.5*(wA[*g_j][i] + wA[*g_j][i+1]);)
+        R = x1p[i]*sin(x2[*g_j]);  /* -- cylindrical radius -- */
+       #else
+        IF_FARGO(wp = 0.5*(wA[*g_k][i] + wA[*g_k][i+1]);)
+        R = x1p[i];                   /* -- cylindrical radius -- */
+       #endif
+       IF_ROTATION(wp += g_OmegaZ*R;)
+       #if IDEAL_EOS
+        flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+       #endif
+       flux[i][iMPHI] += wp*flux[i][RHO];
+      #endif
+
+    /* -- gravitational potential -- */
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1p[i], x2[*g_j], x3[*g_k]);
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];                          
+       #endif
+      #endif
+    }
+  }else if (g_dir == JDIR){
+    for (i = beg; i <= end; i++){ 
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO and Rotation 
+       ---------------------------------------------------- */
+
+      #if GEOMETRY == SPHERICAL
+       #if defined FARGO || (ROTATING_FRAME == YES)
+        wp = 0.0;
+        R  = x1[*g_i]*sin(x2p[i]);
+        IF_FARGO   (wp += 0.5*(wA[i][*g_i] + wA[i+1][*g_i]);)
+        IF_ROTATION(wp += g_OmegaZ*R;)
+        #if EOS != ISOTHERMAL && EOS != BAROTROPIC
+         flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+        #endif
+        flux[i][iMPHI] += wp*flux[i][RHO];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1[*g_i], x2p[i], x3[*g_k]);
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];
+       #endif
+      #endif      
+
+    }
+  }else if (g_dir == KDIR){
+    R = x1[*g_i];
+    for (i = beg; i <= end; i++) {
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO
+        (polar/carteisian geometries only)
+       ---------------------------------------------------- */
+
+      #if (GEOMETRY != SPHERICAL) && (defined FARGO) && (!defined SHEARINGBOX)
+       wp = 0.5*(wA[i][*g_i] + wA[i+1][*g_i]);
+       #if EOS == IDEAL
+        flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+       #endif
+       flux[i][iMPHI] += wp*flux[i][RHO];
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1[*g_i], x2[*g_j], x3p[i]); 
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];                          
+       #endif
+      #endif
+    }
+  }
+}
+#undef TotBB
+#undef IF_FARGO
+#undef IF_ROTATION
+#undef IDEAL_EOS
diff -rupN PLUTO4/Src/Radiation/radiation_main.c PLUTO_RADIATION_MOD/Src/Radiation/radiation_main.c
--- PLUTO4/Src/Radiation/radiation_main.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation_main.c	2013-06-01 18:33:00.240214818 +0200
@@ -0,0 +1,914 @@
+/* ///////////////////////////////////////////////////////////////////// */
+/*! 
+  \file  
+  \brief PLUTO main function.
+ 
+  The file main.c contains the PLUTO main function and several other 
+  top-level routines.
+  main() provides basic code initialization, handles the the principal 
+  integration loop and calls the output driver write_data.c.
+  Other useful functions contained in this file are Integrate() which does
+  the actual integration, GetNextTimeStep() responsible for computing the
+  next time step based on the information available at the last time
+  level.
+  
+  We use two slightly different integration loops depending on whether
+  asnchrounous I/O has to be performed (macro USE_ASYNC_IO).
+  If the macro USE_ASYNC_IO is not defined, the standard 
+  integration loop consists of the following steps:
+ 
+   - Check for last step & adjust dt if necessary
+   - Dump log information, n, t(n), dt(n), MAX_MACH(n-1), etc..
+   - Check output/analysis:  t(n) < tout < t(n)+dt(n)
+   - write to disk/call analysis using {U(n), t(n), dt(n)}
+   - Advance solution using dt(n): U(n) --> U(n+1)
+   - Increment t(n+1) = t(n) + dt(n)
+   - [MPI] Show dominant time step (n)
+   - [MPI] Get next time step dt(n+1)
+   - [MPI] reduction operations (n)
+   - Increment n --> n+1
+ 
+  Otherwise, using Asynchrounous I/O:
+ 
+   - Check for last step & adjust dt
+   - check for output/analysis:   t(n) < tout < t(n+1)
+     - Write data/call analysis using {U(n), t(n), dt(n)}
+   - [MPI] Show dominant time step (n-1)
+   - [MPI] reduction operations (n-1)
+   - [AIO]: finish writing
+   - Dump log information, n, t(n), dt(n), MAX_MACH(n-1), etc..
+   - Advance solution using dt(n), U(n) --> U(n+1)
+   - Increment t(n+1) = t(n) + dt(n)
+   - [MPI] Get next time step dt(n)
+   - Increment n --> n+1
+
+  \author A. Mignone (mignone@ph.unito.it)
+  \date   Aug 16, 2012
+*/
+/* ///////////////////////////////////////////////////////////////////// */
+#include "pluto.h"
+#include "globals.h"
+
+#ifdef RADIATION
+  #include "radiation.h"
+#endif
+
+#ifdef MEASURE_TIME
+  #include <sys/time.h>
+  
+  void MEASURE_TIME_BEGIN(struct timeval* tv)
+  {
+    gettimeofday(tv, NULL);
+  }
+
+  double MEASURE_TIME_END(struct timeval*t_beg,struct timeval* t_end)
+  {
+    double elapsed_time = 0.;
+    gettimeofday(t_end, NULL);
+    elapsed_time = (t_end->tv_sec - t_beg->tv_sec) * 1000.0 + (t_end->tv_usec - t_beg->tv_usec) / 1000.0; //time in ms
+    return elapsed_time;
+  }
+  
+  void SHOW_MEASURED_TIME(double hydro, double radiation)
+  {
+    double total_time = hydro + radiation;
+    print("hydro: %5.2f [%5.2f%] radiation: %5.2f [%5.2f]\n", hydro, (hydro/total_time)*100.,radiation,(radiation/total_time)*100.);
+  }
+#endif
+
+#define SHOW_TIME_STEPS  NO   /* -- show time steps due to advection,
+                                     diffusion and cooling */
+
+static double GetNextTimeStep (Time_Step *, struct INPUT *, Grid *);
+static char *TOTAL_TIME (double dt);
+static int Integrate (Data *, Riemann_Solver *, Time_Step *, Grid *);
+static void CheckForOutput (Data *, Input *, Grid *);
+static void CheckForAnalysis (Data *, Input *, Grid *);
+
+/* ********************************************************************* */
+int main (int argc, char *argv[])
+/*!
+ * Start PLUTO, initialize functions, define data structures and 
+ * handle the main integration loop.
+ *
+ * \param [in] argc Argument counts.
+ * \param [in] argv Array of pointers to the strings.
+ * \return This function return 0 on normal exit.
+ *
+ *********************************************************************** */
+{
+  int    nv, idim, err;
+  char   first_step=1, last_step = 0;
+  double scrh;
+  Data   data;
+  time_t  tbeg, tend;
+  Riemann_Solver *Solver;
+  Grid      grd[3];
+  Time_Step Dts;
+  Cmd_Line cmd_line;
+  Input  ini;
+  Output *output;
+  #ifdef MEASURE_TIME
+    struct timeval measure_time_begin, measure_time_end;
+    double hydro_used_time = 0., radiation_used_time = 0.;
+  #endif
+/*
+  print1 ("sizeof (CMD_LINE)   = %d\n", sizeof(Cmd_Line));
+  print1 ("sizeof (DATA)       = %d\n", sizeof(Data));
+  print1 ("sizeof (STATE_1D)   = %d\n", sizeof(State_1D));
+  print1 ("sizeof (GRID)       = %d\n", sizeof(Grid));
+  print1 ("sizeof (TIME_STEP)  = %d\n", sizeof(Time_Step));
+  print1 ("sizeof (OUTPUT)     = %d\n", sizeof(Output));
+  print1 ("sizeof (INPUT)      = %d\n", sizeof(Input));
+  print1 ("sizeof (RUNTIME)    = %d\n", sizeof(Runtime));
+  print1 ("sizeof (RGB)        = %d\n", sizeof(RGB));
+  print1 ("sizeof (IMAGE)      = %d\n", sizeof(Image));
+  print1 ("sizeof (FLOAT_VECT) = %d\n", sizeof(Float_Vect));
+  print1 ("sizeof (INDEX)      = %d\n", sizeof(Index));
+  print1 ("sizeof (RBOX)       = %d\n", sizeof(RBox));
+  QUIT_PLUTO(1);
+*/
+  #ifdef PARALLEL
+   AL_Init (&argc, &argv);
+   MPI_Comm_rank (MPI_COMM_WORLD, &prank);
+  #endif
+
+  Initialize (argc, argv, &data, &ini, grd, &cmd_line);
+
+/* -- initialize members of Time_Step structure -- */
+
+  Dts.cmax     = ARRAY_1D(NMAX_POINT, double);
+  Dts.inv_dta  = 0.0;
+  Dts.inv_dtp  = 0.0;
+  Dts.dt_cool  = 1.e38;
+  Dts.cfl      = ini.cfl;
+  Dts.cfl_par  = ini.cfl_par;
+  Dts.rmax_par = ini.rmax_par;
+  Dts.Nsts     = Dts.Nrkc = 0;
+  
+  Solver = SetSolver (ini.solv_type);
+  
+  time (&tbeg);
+  g_stepNumber = 0;
+  
+  #ifdef RADIATION
+   RadiationInit(argc,argv,&ini,grd,&data,cmd_line.restart != NO);
+  #endif
+
+/* --------------------------------------------------------
+    Check if restart is necessary. 
+    If not, write initial condition to disk.
+   ------------------------------------------------------- */
+   
+  if (cmd_line.restart == YES) {
+    Restart (&ini, cmd_line.nrestart, DBL_OUTPUT, grd);
+  }else if (cmd_line.h5restart == YES){
+    Restart (&ini, cmd_line.nrestart, DBL_H5_OUTPUT, grd);
+  }else if (cmd_line.write){
+    CheckForOutput (&data, &ini, grd);
+    CheckForAnalysis (&data, &ini, grd);
+    #ifdef USE_ASYNC_IO
+     Async_EndWriteData (&ini);
+    #endif
+  }
+
+  print1 ("> Starting computation... \n\n");
+
+/* =====================================================================
+          M A I N      L O O P      S T A R T S      H E R E
+   ===================================================================== */
+
+#ifndef USE_ASYNC_IO  /* -- Standard loop, don't use Asynchrouns I/O -- */
+
+  while (!last_step){
+
+  /* ------------------------------------------------------
+      Check if this is the last integration step:
+      - final tstop has been reached: adjust time step 
+      - or max number of steps has been reached
+     ------------------------------------------------------ */
+
+    if ((g_time + g_dt) >= ini.tstop*(1.0 - 1.e-8)) {
+      g_dt   = (ini.tstop - g_time);
+      last_step = 1;
+    }
+    if (g_stepNumber == cmd_line.maxsteps && cmd_line.maxsteps > 0) {
+      last_step = 1;
+    }
+
+  /* ------------------------------------------------------
+                Dump log information
+     ------------------------------------------------------ */
+
+    if (g_stepNumber%ini.log_freq == 0) {
+      print1 ("step:%d ; t = %10.4e ; dt = %10.4e ; %d %% ; [%f, %d",
+               g_stepNumber, g_time, g_dt, (int)(100.0*g_time/ini.tstop), 
+               g_maxMach, g_maxRiemannIter);
+      #if (PARABOLIC_FLUX & SUPER_TIME_STEPPING)
+       print1 (", Nsts = %d",Dts.Nsts);
+      #endif
+      #if (PARABOLIC_FLUX & RK_CHEBYSHEV)
+       print1 (", Nrkc = %d",Dts.Nrkc);
+      #endif
+      print1 ("]\n");      
+    }
+
+  /* ------------------------------------------------------
+       check if it's time to write or perform analysis
+     ------------------------------------------------------ */
+
+    if (!first_step && !last_step && cmd_line.write) {
+      CheckForOutput  (&data, &ini, grd);
+      CheckForAnalysis(&data, &ini, grd);
+    }
+
+  /* ------------------------------------------------------
+      Advance solution array by a single time step
+      g_dt = dt(n)
+     ------------------------------------------------------ */
+    #ifndef DISABLE_HYDRODYNAMICS
+      #ifdef MEASURE_TIME
+        MEASURE_TIME_BEGIN(&measure_time_begin);
+      #endif
+
+      if (cmd_line.jet != -1) SetJetDomain (&data, cmd_line.jet, ini.log_freq, grd); 
+      err = Integrate (&data, Solver, &Dts, grd);
+      if (cmd_line.jet != -1) UnsetJetDomain (&data, cmd_line.jet, grd);
+
+      #ifdef MEASURE_TIME
+        hydro_used_time += MEASURE_TIME_END(&measure_time_begin,&measure_time_end);
+      #endif
+    #endif
+
+    #ifdef RADIATION
+      #ifdef MEASURE_TIME
+        MEASURE_TIME_BEGIN(&measure_time_begin);
+      #endif
+
+      RadiationImplicitTimestep(grd,&data,&ini);
+
+      #ifdef MEASURE_TIME
+        radiation_used_time += MEASURE_TIME_END(&measure_time_begin,&measure_time_end);
+      #endif
+    #endif
+
+    #ifdef MEASURE_TIME
+      SHOW_MEASURED_TIME(hydro_used_time,radiation_used_time);
+    #endif
+
+  /* ------------------------------------------------------
+       Integration didn't go through. Step must
+       be redone from previously saved solution.
+     ------------------------------------------------------ */
+/*
+    if (err != 0){
+      print1 ("! Step failed. Re-trying\n");
+      zones with problems must be tagged with MINMOD_FLAG and HLL_FLAG
+      time step should be halved
+      GET_SOL(&data);
+    }
+*/
+
+  /* ------------------------------------------------------
+      Increment time, t(n+1) = t(n) + dt(n)
+     ------------------------------------------------------ */
+
+    g_time += g_dt;
+
+  /* ------------------------------------------------------
+      Show the time step ratios between the actual g_dt
+      and the advection, diffusion and cooling time scales.
+     ------------------------------------------------------ */
+
+    #if SHOW_TIME_STEPS == YES
+     if (g_stepNumber%ini.log_freq == 0) {
+       double cg, dta, dtp, dtc;
+       dta = 1.0/Dts.inv_dta;
+       dtp = 0.5/Dts.inv_dtp;
+       dtc = Dts.dt_cool;
+       #ifdef PARALLEL
+        MPI_Allreduce (&dta, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dta = cg;
+
+        MPI_Allreduce (&dtp, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dtp = cg;
+
+        MPI_Allreduce (&dtc, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dtc = cg;
+       #endif
+       print1 ("[dt/dt(adv) = %10.4e, dt/dt(par) = %10.4e, dt/dt(cool) = %10.4e]\n",
+                g_dt/dta, g_dt/dtp, g_dt/dtc);
+     }
+    #endif
+
+  /* ------------------------------------------------------
+                Get next time step dt(n+1)
+     ------------------------------------------------------ */
+
+    #ifndef DISABLE_HYDRODYNAMICS
+      g_dt = GetNextTimeStep(&Dts, &ini, grd);
+    #endif
+
+  /* ------------------------------------------------------
+          Global MPI reduction operations
+     ------------------------------------------------------ */
+  
+    #ifdef PARALLEL
+     MPI_Allreduce (&g_maxMach, &scrh, 1, 
+                    MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
+     g_maxMach = scrh;
+
+     MPI_Allreduce (&g_maxRiemannIter, &nv, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
+     g_maxRiemannIter = nv;
+    #endif
+
+    g_stepNumber++;
+    
+    first_step = 0;
+  }
+
+#else /* Use Asynchrounous I/O */
+
+  while (!last_step){
+
+  /* ------------------------------------------------------
+      Check if this is the last integration step:
+      - final tstop has been reached: adjust time step 
+      - or max number of steps has been reached
+     ------------------------------------------------------ */
+
+    if ((g_time + g_dt) >= ini.tstop*(1.0 - 1.e-8)) {
+      g_dt   = (ini.tstop - g_time);
+      last_step = 1;
+    }
+    if (g_stepNumber == cmd_line.maxsteps && cmd_line.maxsteps > 0) {
+      last_step = 1;
+    }
+
+  /* ------------------------------------------------------
+       check if it's time to write or perform analysis
+     ------------------------------------------------------ */
+
+    if (!first_step && !last_step && cmd_line.write) {
+      CheckForOutput  (&data, &ini, grd);
+      CheckForAnalysis(&data, &ini, grd);
+    }
+
+  /* ------------------------------------------------------
+      Show the time step ratios between the actual g_dt
+      and the advection, diffusion and cooling time scales.
+     ------------------------------------------------------ */
+
+    #if SHOW_TIME_STEPS == YES
+     if (!first_step && g_stepNumber%ini.log_freq == 0) {
+       double cg, dta, dtp, dtc;
+       dta = 1.0/Dts.inv_dta;
+       dtp = 0.5/Dts.inv_dtp;
+       dtc = Dts.dt_cool;
+       #ifdef PARALLEL
+        MPI_Allreduce (&dta, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dta = cg;
+
+        MPI_Allreduce (&dtp, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dtp = cg;
+
+        MPI_Allreduce (&dtc, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+        dtc = cg;
+       #endif
+       print1 ("\t[dt/dta = %10.4e, dt/dtp = %10.4e, dt/dtc = %10.4e \n",
+                g_dt/dta, g_dt/dtp, g_dt/dtc);
+     }
+    #endif
+
+  /* ------------------------------------------------------
+          Global MPI reduction operations
+     ------------------------------------------------------ */
+  
+    #ifdef PARALLEL
+     MPI_Allreduce (&g_maxMach, &scrh, 1, 
+                    MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
+     g_maxMach = scrh;
+
+     MPI_Allreduce (&g_maxRiemannIter, &nv, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
+     g_maxRiemannIter = nv;
+    #endif
+
+  /* ------------------------------------------------------
+             Finish writing using Async I/O
+     ------------------------------------------------------ */
+
+    #ifdef USE_ASYNC_IO
+     Async_EndWriteData (&ini);
+    #endif
+
+  /* ------------------------------------------------------
+                Dump log information
+     ------------------------------------------------------ */
+
+    if (g_stepNumber%ini.log_freq == 0) {
+      print1 ("step:%d ; t = %10.4e ; dt = %10.4e ; %d %% ; [%f, %d",
+               g_stepNumber, g_time, g_dt, (int)(100.0*g_time/ini.tstop), 
+               g_maxMach, g_maxRiemannIter);
+      #if (PARABOLIC_FLUX & SUPER_TIME_STEPPING)
+       print1 (", Nsts = %d",Dts.Nsts);
+      #endif
+      #if (PARABOLIC_FLUX & RK_CHEBYSHEV)
+       print1 (", Nrkc = %d",Dts.Nrkc);
+      #endif
+      print1 ("]\n");      
+    }
+    
+  /* ------------------------------------------------------
+      Advance solution array by a single time step
+      g_dt = dt(n)
+     ------------------------------------------------------ */
+
+    #ifndef DISABLE_HYDRODYNAMICS
+      #ifdef MEASURE_TIME
+        MEASURE_TIME_BEGIN(&measure_time_begin);
+      #endif
+
+      if (cmd_line.jet != -1) SetJetDomain (&data, cmd_line.jet, grd); 
+      err = Integrate (&data, Solver, &Dts, grd);
+      if (cmd_line.jet != -1) UnsetJetDomain (&data, cmd_line.jet, grd);
+
+     #ifdef MEASURE_TIME
+        hydro_used_time += MEASURE_TIME_END(&measure_time_begin,&measure_time_end);
+      #endif
+    #endif
+      
+    #ifdef RADIATION
+      #ifdef MEASURE_TIME
+        MEASURE_TIME_BEGIN(&measure_time_begin);
+      #endif
+
+      RadiationImplicitTimestep(grd,&data,&ini);
+
+      #ifdef MEASURE_TIME
+        radiation_used_time += MEASURE_TIME_END(&measure_time_begin,&measure_time_end);
+      #endif
+    #endif
+
+    #ifdef MEASURE_TIME
+      SHOW_MEASURED_TIME(hydro_used_time,radiation_used_time);
+    #endif
+
+  /* ------------------------------------------------------
+       Integration didn't go through. Step must
+       be redone from previously saved solution.
+     ------------------------------------------------------ */
+/*
+    if (err != 0){
+      print1 ("! Step failed. Re-trying\n");
+      zones with problems must be tagged with MINMOD_FLAG and HLL_FLAG
+      time step should be halved
+      GET_SOL(&data);
+    }
+*/
+
+  /* ------------------------------------------------------
+      Increment time, t(n+1) = t(n) + dt(n)
+     ------------------------------------------------------ */
+
+    g_time += g_dt;
+
+  /* ------------------------------------------------------
+                Get next time step dt(n+1)
+     ------------------------------------------------------ */
+  
+    #ifndef DISABLE_HYDRODYNAMICS
+      g_dt = GetNextTimeStep(&Dts, &ini, grd);
+    #endif
+
+    g_stepNumber++;
+    
+    first_step = 0;
+  }
+#endif /* USE_ASYNC_IO */
+
+/* =====================================================================
+          M A I N       L O O P      E N D S       H E R E 
+   ===================================================================== */
+
+  if (cmd_line.write){
+    CheckForOutput (&data, &ini, grd);
+    CheckForAnalysis (&data, &ini, grd);
+    #ifdef USE_ASYNC_IO
+     Async_EndWriteData (&ini);
+    #endif
+  }
+
+  #ifdef PARALLEL
+   MPI_Barrier (MPI_COMM_WORLD);
+   print1  ("\n> Total allocated memory  %6.2f Mb (proc #%d)\n",
+             (float)g_usedMem/1.e6,prank);
+   MPI_Barrier (MPI_COMM_WORLD);
+  #else
+   print1  ("\n> Total allocated memory  %6.2f Mb\n",(float)g_usedMem/1.e6);
+  #endif
+
+  time(&tend);
+  g_dt = difftime(tend, tbeg);
+  print1("> Elapsed time             %s\n", TOTAL_TIME (g_dt));
+  print1("> Average time/step       %10.2e  (sec)  \n", 
+          difftime(tend,tbeg)/(double)g_stepNumber);
+  print1("> Local time                %s",asctime(localtime(&tend)));
+  print1("> Done\n");
+
+  FreeArray4D ((void *) data.Vc);
+  #ifdef PARALLEL
+   MPI_Barrier (MPI_COMM_WORLD);
+   #ifdef RADIATION
+     RadiationCleanup();
+   #endif
+   AL_Finalize ();
+  #endif
+
+  return (0);
+}
+#undef SHOW_TIME_STEPS
+/* ******************************************************************** */
+int Integrate (Data *d, Riemann_Solver *Solver, Time_Step *Dts, Grid *grid)
+/*!
+ * Advance equations by a single time-step.
+
+ * \param  d      pointer to PLUTO Data structure;
+ * \param  Solver pointer to a Riemann solver function;
+ * \param  Dts    pointer to time Step structure;
+ * \param  grid   pointer to grid structure.
+ * 
+ * \return An integer giving success / failure (development).
+ * 
+ ********************************************************************** */
+{
+  int idim, err = 0;
+
+  g_maxMach = 0.0;
+  g_maxRiemannIter = 0;
+
+/* -------------------------------------------------------
+    Initialize max propagation speed in Dedner's approach
+   ------------------------------------------------------- */
+
+  #ifdef GLM_MHD  /* -- initialize glm_ch -- */
+   GLM_Init (d, Dts, grid);   
+   GLM_Source (d->Vc, 0.5*g_dt, grid);
+  #endif
+
+  /* ---------------------------------------------
+        perform Strang Splitting on direction 
+        (if necessary) and sources 
+     --------------------------------------------- */
+
+  FlagReset (d);
+
+#ifdef ADD_CYLSOURCE
+ CONS_CYLSOLVE(d->Vc, 0.5*g_dt, grid);
+#endif
+
+  #ifdef FARGO
+   FARGO_ComputeVelocity(d, grid);
+  #endif
+  if ((g_stepNumber%2) == 0){
+
+    #if DIMENSIONAL_SPLITTING == YES
+     for (g_dir = 0; g_dir < DIMENSIONS; g_dir++){
+       if (Sweep (d, Solver, Dts, grid) != 0) return (1);
+     }
+    #else
+     if (Unsplit (d, Solver, Dts, grid) != 0) return(1);
+    #endif
+    SplitSource (d, g_dt, Dts, grid);
+  }else{
+    SplitSource (d, g_dt, Dts, grid);
+    #if DIMENSIONAL_SPLITTING == YES
+     for (g_dir = DIMENSIONS - 1; g_dir >= 0; g_dir--){
+       if (Sweep (d, Solver, Dts, grid) != 0) return (1);
+     }
+    #else
+     if (Unsplit (d, Solver, Dts, grid) != 0) return(1);
+    #endif
+  }       
+
+
+#ifdef ADD_CYLSOURCE
+ CONS_CYLSOLVE(d->Vc, 0.5*g_dt, grid);
+#endif
+
+  #ifdef GLM_MHD  /* -- GLM source for dt/2 -- */
+   GLM_Source (d->Vc, 0.5*g_dt, grid);
+  #endif
+
+  return (0); /* -- ok, step achieved -- */
+}
+
+/* ******************************************************************** */
+char *TOTAL_TIME (double dt)
+/*
+ * 
+ * PURPOSE
+ *
+ *   convert a floating-point variable (dt, in seconds) to a string 
+ *   displaying days:hours:minutes:seconds
+ *   
+ ********************************************************************** */
+{
+  static char c[128];
+  int days, hours, mins, secs;
+
+  days  = (int) (dt/86400.0);
+  hours = (int) ((dt - 86400.0*days)/3600.0);
+  mins  = (int) ((dt - 86400.0*days - 3600.0*hours)/60.);
+  secs  = (int) (dt - 86400.0*days - 3600.0*hours - 60.0*mins);
+
+  sprintf (c, " %dd:%dh:%dm:%ds", days,hours, mins, secs);
+  return (c);
+}
+
+/* ********************************************************************* */
+double GetNextTimeStep (Time_Step *Dts, struct INPUT *ini, Grid *grid)
+/*!
+ * Compute and return the time step for the next time level
+ * using the information from the previous integration
+ * (Dts->inv_dta and Dts->inv_dp).
+ *
+ * \param [in] Dts pointer to the Time_Step structure
+ * \param [in] ini pointer to the Input structure
+ * \param [in] grid pointer to array of Grid structures
+ *
+ * \return The time step for next time level
+ *
+ *********************************************************************** */
+{
+  int idim;
+  double dt_adv, dt_cool;
+  double dtnext, dtnext_glob;
+  double dxmin, dtp_dta;
+  double dt_par;
+
+  #if    (DIMENSIONS == 1 && INCLUDE_SPLIT_SOURCE == NO) \
+      || (DIMENSIONAL_SPLITTING == NO && INCLUDE_SPLIT_SOURCE == NO) 
+
+  #else
+
+  /*  ------------------------------------------------
+       For Strang splitting to be 2nd order accurate,  
+       change dt only every 2 time steps                 
+      ------------------------------------------------ */
+ 
+   if (g_stepNumber%2 == 0) return (g_dt);
+
+  #endif
+
+/* ----------------------------------
+        Compute time step
+   ---------------------------------- */
+
+  #if (PARABOLIC_FLUX & EXPLICIT)
+   dt_adv  = 1.0/(Dts->inv_dta + 2.0*Dts->inv_dtp);
+  #else
+   dt_adv  = 1.0/Dts->inv_dta;
+  #endif
+  dt_adv *= ini->cfl;
+  dtnext  = dt_adv;
+
+/* --------------------------------------
+        Min cell length
+   -------------------------------------- */
+
+  dxmin = grid[IDIR].dl_min;
+  for (idim = 1; idim < DIMENSIONS; idim++){
+    dxmin = MIN(dxmin, grid[idim].dl_min);
+  }
+
+/* -------------------------------------------
+    Maximum propagation speed for the local
+    processor. Global glm_ch will be computed
+    later in GLM_Init.
+   ------------------------------------------- */
+
+  #ifdef GLM_MHD
+   glm_ch = ini->cfl*dxmin/dtnext;
+  #endif
+
+/* ------------------------------------------------
+    with STS, the ratio between advection (full) 
+    and parabolic time steps should not exceed a
+    given threshold (200).
+   ------------------------------------------------ */
+      
+  #if (PARABOLIC_FLUX & SUPER_TIME_STEPPING)
+   dt_par  = ini->cfl_par/(2.0*Dts->inv_dtp);
+   dtnext *= MIN(1.0, ini->rmax_par/(dt_adv/dt_par));
+  #endif
+
+  #if (PARABOLIC_FLUX & RK_CHEBYSHEV)
+   dt_par  = ini->cfl_par/(2.0*Dts->inv_dtp);
+   dtnext *= MIN(1.0, ini->rmax_par/(dt_adv/dt_par));
+  #endif
+
+/* ----------------------------------
+      Compute Cooling time step
+   ---------------------------------- */
+
+  #if COOLING != NO
+   dtnext = MIN(dtnext, Dts->dt_cool);
+  #endif
+
+   
+/* --------------------------------------------------------------
+    allow time step to vary at most by a factor ini->cfl_max_var
+   -------------------------------------------------------------- */
+
+  dtnext = MIN(dtnext, ini->cfl_max_var*g_dt);
+
+/* -----------------------------------------------------
+      Get min time step among ALL processors
+   ----------------------------------------------------- */
+
+  #ifdef PARALLEL
+   MPI_Allreduce (&dtnext, &dtnext_glob, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+   dtnext = dtnext_glob;
+  #endif
+
+/* -----------------------------------------------------
+          quit if dt gets too small 
+   ----------------------------------------------------- */
+
+  if (dtnext < ini->first_dt*1.e-9){
+    print1 ("! dt is too small (%12.6e)!\n", dtnext);
+    print1 ("! Cannot continue\n");
+    QUIT_PLUTO(1);
+  }
+
+/* -----------------------------------------------------
+          Reset time step coefficients
+   ----------------------------------------------------- */
+
+  DIM_LOOP(idim) Dts->cmax[idim] = 0.0;
+  Dts->inv_dta = 0.0;
+  Dts->inv_dtp = 0.0;
+  Dts->dt_cool = 1.e38;
+
+/* ------------------------------------------------------
+     Issue a warning if first_dt has been overestimaed
+   ------------------------------------------------------ */
+
+  if (g_stepNumber <= 1 && (ini->first_dt > dtnext/ini->cfl)){
+    print1 ("! initial dt exceeds stability limit\n");
+  }
+
+  return(dtnext);
+}
+
+/* ********************************************************************* */
+void CheckForOutput (Data *d, Input *ini, Grid *grid)
+/*!
+ *  Check if file output has to be performed.
+ *  
+ *********************************************************************** */
+{
+  static int first_call = 1;
+  int  n, check_dt, check_dn, check_dclock;
+  int  restart_update, last_step;
+  double t, tnext;
+  Output *output;
+  static time_t clock_beg[MAX_OUTPUT_TYPES], clock_end;
+  static double tbeg[MAX_OUTPUT_TYPES], tend;
+  double dclock;
+
+  restart_update = 0;
+  t     = g_time;
+  tnext = t + g_dt;
+  
+  last_step = (fabs(t-ini->tstop) < 1.e-12 ? 1:0);
+
+/* -- on first execution initialize
+      current beginning time for all output types -- */
+
+  if (first_call){
+    #ifdef PARALLEL
+     if (prank == 0){
+       double tstart;
+       tstart = MPI_Wtime();
+       for (n = 0; n < MAX_OUTPUT_TYPES; n++) tbeg[n] = tstart;
+     }
+     MPI_Bcast(tbeg, MAX_OUTPUT_TYPES, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+    #else
+     for (n = 0; n < MAX_OUTPUT_TYPES; n++) time(clock_beg + n);
+    #endif
+  } 
+
+/* -- get current time -- */
+
+  #ifdef PARALLEL  
+   if (prank == 0) tend = MPI_Wtime();
+   MPI_Bcast(&tend, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+  #else
+   time(&clock_end);
+  #endif
+  
+/* -------------------------------------------------------
+          start main loop on outputs
+   ------------------------------------------------------- */
+   
+  for (n = 0; n < MAX_OUTPUT_TYPES; n++){
+    output = ini->output + n;    
+    check_dt = check_dn = check_dclock = 0; 
+
+  /* -- check time interval in code units (dt) -- */
+
+    if (output->dt > 0.0){
+      check_dt = (int) (tnext/output->dt) - (int)(t/output->dt);
+      check_dt = check_dt || g_stepNumber == 0 || last_step;
+    }   
+
+  /* -- check time interval in number of steps (dn) -- */
+
+    if (output->dn > 0){
+      check_dn = (g_stepNumber%output->dn) == 0;
+      check_dn = check_dn || g_stepNumber == 0 || last_step;
+    }
+
+  /* -- check time interval in clock time (dclock) -- */
+
+    if (output->dclock > 0.0){
+      #ifdef PARALLEL
+       dclock = tend - tbeg[n];
+      #else
+       dclock = difftime(clock_end, clock_beg[n]);
+      #endif
+      if (dclock >= output->dclock) {
+        check_dclock = 1;
+        #ifdef PARALLEL
+         tbeg[n] = tend;
+        #else
+         time(clock_beg + n);
+        #endif
+      }else{ 
+        check_dclock = 0;
+      }
+      check_dclock = check_dclock || g_stepNumber == 0 || last_step;
+    }
+
+  /* -- if any of the previous is true dump data to disk -- */
+
+    if (check_dt || check_dn || check_dclock) { 
+
+      #ifdef USE_ASYNC_IO
+       if (!strcmp(output->mode,"single_file_async")){
+         Async_BegWriteData (d, output, grid);
+       }else{
+         WriteData(d, output, grid);
+       }
+      #else     
+       WriteData(d, output, grid);
+      #endif   
+
+    /* ----------------------------------------------------------
+        save the file number of the dbl and dbl.h5 output format
+        for writing restart.out once we exit the loop.
+       ---------------------------------------------------------- */
+
+      if ((output->type == DBL_OUTPUT) ||
+          (output->type == DBL_H5_OUTPUT)) restart_update = 1;
+    }
+  }
+
+/* -------------------------------------------------------
+    Dump restart information if required 
+
+    Note that if both dbl and dbl.h5 formats are used,
+    bookkeeping is done using dbl format.
+   ------------------------------------------------------- */
+
+  if (restart_update) RestartDump (ini);
+
+  first_call = 0;
+}
+
+/* ******************************************************************** */
+void CheckForAnalysis (Data *d, Input *ini, Grid *grid)
+/*
+ *
+ * PURPOSE 
+ *
+ *   Check if Analysis needs to be called
+ *
+ ********************************************************************** */
+{
+  int check_dt, check_dn;
+  double t, tnext;
+
+  t     = g_time;
+  tnext = t + g_dt;
+  check_dt = (int) (tnext/ini->anl_dt) - (int)(t/ini->anl_dt);
+  check_dt = check_dt || g_stepNumber == 0 || fabs(t - ini->tstop) < 1.e-9; 
+  check_dt = check_dt && (ini->anl_dt > 0.0);
+
+  check_dn = (g_stepNumber%ini->anl_dn) == 0;
+  check_dn = check_dn && (ini->anl_dn > 0);
+
+  if (check_dt || check_dn) Analysis (d, grid);
+}
+
diff -rupN PLUTO4/Src/Radiation/radiation_mhd_rhs.c PLUTO_RADIATION_MOD/Src/Radiation/radiation_mhd_rhs.c
--- PLUTO4/Src/Radiation/radiation_mhd_rhs.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation_mhd_rhs.c	2013-06-01 18:33:00.245214817 +0200
@@ -0,0 +1,1454 @@
+/* ///////////////////////////////////////////////////////////////////// */
+/*! 
+  \file  
+  \brief Compute the right hand side of the conservative 
+         HD/MHD equations.
+
+  This function constructs the one-dimensional right hand side of 
+  the conservative MHD or HD equations in the direction given by g_dir 
+  in different geometries.
+  The right hand side is computed as a two-point flux difference 
+  term plus a source term:
+  
+  \f[ \mathrm{RHS}_i = 
+      \frac{dt}{dV_i}\Big(A_{i+1/2}F_{i+1/2} - A_{i-1/2}F_{i-1/2}\Big)  
+      + dt S_i  \f]
+ 
+   where 
+ 
+   - \f$ A_{i\pm 1/2} \f$ : interface areas
+   - \f$ dV_i         \f$ : cell volume
+   - \f$ F_{i\pm 1/2} \f$ : interface fluxes
+   - \f$ dt           \f$ : time step
+   - \f$ S_i          \f$ : source term including geometrical terms and 
+                            body forces.
+  
+  See also \ref RHS_page
+  The right hand side is assembled through the following steps:
+ 
+   - If either one of FARGO, ROTATION or gravitational potential is 
+      used, fluxes are combined to enforce conservation of total angular
+      momentum and/or energy, see TotalFlux()
+   - initialize rhs with flux differences
+   - add geometrical source terms
+   - enforce conservation of total angular  momentum and/or energy;
+   - add gravity        
+
+  \author A. Mignone (mignone@ph.unito.it)
+  \date   Aug 16, 2012
+*/
+/* ///////////////////////////////////////////////////////////////////// */
+#include "pluto.h"
+
+#ifdef RADIATION
+ #include "radiation.h"
+#endif
+
+static void TotalFlux (const State_1D *, double *, int, int, Grid *);
+
+#ifdef CH_SPACEDIM   /*  implies Chombo is being used  */
+ #define USE_PR_GRADIENT  YES   
+#else
+ #ifdef FINITE_DIFFERENCE 
+  #define USE_PR_GRADIENT  NO   /* -- default for Finite Difference schemes -- */
+ #else
+  #define USE_PR_GRADIENT  YES   /* -- default, do not change!! -- */
+ #endif
+#endif
+
+#if defined FARGO && !defined SHEARINGBOX
+ #define IF_FARGO(a)  a
+#else 
+ #define IF_FARGO(a)  
+#endif
+
+#if ROTATING_FRAME == YES
+ #define IF_ROTATION(a)  a
+#else 
+ #define IF_ROTATION(a)  
+#endif
+
+#if EOS == IDEAL
+ #define IDEAL_EOS 1
+#else
+ #define IDEAL_EOS 0
+#endif
+
+#if PHYSICS == MHD
+#if BACKGROUND_FIELD == YES
+ #define TotBB(v, b0, a, b) (v[a]*(v[b] + b0[b]) + b0[a]*v[b])
+#else
+ #define TotBB(v, b0, a, b) (v[a]*v[b])
+#endif
+#endif
+
+/* *********************************************************************** */
+void RightHandSide (const State_1D *state, Time_Step *Dts, 
+              int beg, int end, double dt, Grid *grid)
+/*! 
+ *
+ * \param [in,out]  state  pointer to State_1D structure
+ * \param [in]      Dts    pointer to time step structure
+ * \param [in]      beg    initial index of computation
+ * \param [in]      end    final   index of computation
+ * \param [in]      dt     time increment
+ * \param [in]      grid  pointer to Grid structure
+ *
+ * \return This function has no return value.
+ * \note    --
+ * \todo    --
+ ************************************************************************* */
+{
+  int  i, nv;
+  double dtdx, dtdV, scrh;
+  double *x1, *x1p, *dx1;
+  double *x2, *x2p, *dx2;
+  double *x3, *x3p, *dx3;
+  double **vh, **vp, **vm;
+  double **flux, **rhs, *p;
+  double cl;
+  double **Bg0, **wA, w, wp, vphi, gPhi_c;
+  double g[3];
+  static double **fA, *gPhi;
+
+  #if GEOMETRY != CARTESIAN
+   if (fA == NULL) fA = ARRAY_2D(NMAX_POINT, NVAR, double);
+  #endif
+  #ifdef FARGO
+   wA = FARGO_GetVelocity();
+  #endif
+
+  if (gPhi == NULL) gPhi = ARRAY_1D(NMAX_POINT, double);
+
+  #if (defined SHEARINGBOX) && (defined FARGO) && (EOS == IDEAL)
+   print1 ("! ShearingBox+Fargo+Ideal EoS not properly implemented\n");
+   QUIT_PLUTO(1);
+  #endif
+
+/* --------------------------------------------------
+             Compute passive scalar fluxes
+   -------------------------------------------------- */
+
+  #if NSCL > 0
+   AdvectFlux (state, beg - 1, end, grid);
+  #endif
+
+  #if (PHYSICS == MHD) && (BACKGROUND_FIELD == YES)
+   Bg0 = GetBackgroundField (beg, end, CELL_CENTER, grid);
+  #endif
+
+/* --------------------------
+      pointer shortcuts
+   -------------------------- */
+
+  rhs  = state->rhs;
+  flux = state->flux;
+  p    = state->press;
+  vh   = state->vh;
+  vp   = state->vp;
+  vm   = state->vm;
+  
+  x1 = grid[IDIR].x; x1p = grid[IDIR].xr; dx1 = grid[IDIR].dx;
+  x2 = grid[JDIR].x; x2p = grid[JDIR].xr; dx2 = grid[JDIR].dx;
+  x3 = grid[KDIR].x; x3p = grid[KDIR].xr; dx3 = grid[KDIR].dx;
+
+/* ------------------------------------------------
+     Add pressure to normal component of 
+     momentum flux if necessary.
+   ------------------------------------------------ */
+
+  #if USE_PR_GRADIENT == NO
+   for (i = beg - 1; i <= end; i++) flux[i][MXn] += p[i];
+  #endif
+
+/* -------------------------------------------------
+    compute gravitational potential and add 
+    contribution to energy flux.
+   ------------------------------------------------- */
+
+  #if (defined FARGO && !defined SHEARINGBOX) ||\
+      (ROTATING_FRAME == YES) || (BODY_FORCE & POTENTIAL)
+   TotalFlux(state, gPhi, beg-1, end, grid);
+  #endif
+
+#if GEOMETRY == CARTESIAN
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in CARTESIAN geometry.
+    
+   *********************************************************** */
+{
+  double x, y, z, *vc;
+
+  if (g_dir == IDIR){
+
+  /* ****************************************************
+      Cartesian x-direction,
+
+       - initialize rhs with flux differences (I1)
+       - enforce conservation of total angular
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    y = x2[*g_j];
+    z = x3[*g_k];
+    for (i = beg; i <= end; i++) {
+      x    = x1[i];
+      dtdx = dt/dx1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX1] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) 
+       w = wA[*g_k][i];
+       rhs[i][MX2] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG] -= w*(rhs[i][MX2] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][MX1] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][MX1] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX1] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+
+      #ifdef SHEARINGBOX
+       rhs[i][MX1] += dt*2.0*vc[RHO]*vc[VX2]*sb_Omega;
+      #endif
+
+    }
+  } else if (g_dir == JDIR){
+
+  /* ****************************************************
+      Cartesian y-direction,
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    x = x1[*g_i];
+    z = x3[*g_k];
+    for (i = beg; i <= end; i++) {
+      y    = x2[i];
+      dtdx = dt/dx2[i];
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX2] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][MX2] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][MX2] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX2] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+
+      #ifdef SHEARINGBOX
+       rhs[i][MX2] -= dt*2.0*vc[RHO]*vc[VX1]*sb_Omega;
+      #endif
+    }
+
+  }else if (g_dir == KDIR){
+
+  /* ****************************************************
+      Cartesian z-direction,
+
+       - initialize rhs with flux differences (K1)
+       - enforce conservation of total angular
+         momentum and/or energy               (K3)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    x = x1[*g_i];
+    y = x2[*g_j];
+    for (i = beg; i <= end; i++) {
+      z    = x3[i];
+      dtdx = dt/dx3[i];
+
+    /* -----------------------------------------------
+       K1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][MX3] -= dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       K3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) 
+       w = wA[i][*g_i];
+       rhs[i][MX2] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG] -= w*(rhs[i][MX2] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       K4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]);
+       rhs[i][MX3] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, *g_i, grid, vc, g);
+       rhs[i][MX3] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][MX3] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(x, y, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+#elif GEOMETRY == CYLINDRICAL
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in CYLINDRICAL geometry.
+    
+   *********************************************************** */
+{
+  double R, z, phi, R_1; 
+
+  if (g_dir == IDIR) {  
+    double vc[NVAR];
+
+  /* ****************************************************
+      Cylindrical radial direction:
+      multiply fluxes times interface area
+     **************************************************** */
+
+    z   = x2[*g_j];
+    phi = 0.0;
+    for (i = beg - 1; i <= end; i++){ 
+      R = grid[IDIR].A[i];
+
+      fA[i][RHO] = flux[i][RHO]*R;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*R;     ,
+             fA[i][iMZ]   = flux[i][iMZ]*R;     ,
+             fA[i][iMPHI] = flux[i][iMPHI]*R*R;)       
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*R;  ,
+              fA[i][iBZ]   = flux[i][iBZ]*R;  ,
+              fA[i][iBPHI] = flux[i][iBPHI]*R;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*R;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*R;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*R;
+    }
+
+  /* ****************************************************
+      Cylindrical radial direction,
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++){ 
+      R    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      R_1  = 1.0/R;
+
+    /* ---------------------------------------------------------------
+       I1. initialize rhs with flux difference
+
+           Note: when there's no explicit resistivity, we use the 
+                 formulation with source terms since it seems to have 
+                 better stability properties.
+       ---------------------------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(rhs[i][iMR]   = - dtdV*(fA[i][iMR]   - fA[i-1][iMR]);  ,
+             rhs[i][iMZ]   = - dtdV*(fA[i][iMZ]   - fA[i-1][iMZ]);  ,
+             rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*fabs(R_1);)
+      #if USE_PR_GRADIENT == YES
+       rhs[i][iMR] -= dtdx*(p[i] - p[i-1]);  
+      #endif
+      #if PHYSICS == MHD
+
+       #if (RESISTIVE_MHD == NO) || (RESISTIVE_MHD == SUPER_TIME_STEPPING)
+        EXPAND(rhs[i][iBR]   = - dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+               rhs[i][iBZ]   = - dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);  ,
+               rhs[i][iBPHI] = - dtdV*(fA[i][iBPHI] - fA[i-1][iBPHI]);)
+       #else
+        EXPAND(rhs[i][iBR]   = - dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+               rhs[i][iBZ]   = - dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);  ,
+               rhs[i][iBPHI] = - dtdx*(flux[i][iBPHI] - flux[i-1][iBPHI]);)
+       #endif
+
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = - dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = - dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+
+      for (nv = NFLX; nv < NVAR; nv++) {
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms
+       ---------------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]); 
+/* for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+
+      #if COMPONENTS == 3
+       vphi = vc[iVPHI];
+       #if ROTATING_FRAME == YES
+        w     = g_OmegaZ*R;
+        vphi += w;
+       #endif
+
+       #if PHYSICS == HD
+        rhs[i][iMR] += dt*vc[RHO]*vphi*vphi*R_1;
+       #elif PHYSICS == MHD
+        rhs[i][iMR] += dt*(vc[RHO]*vphi*vphi - TotBB(vc, Bg0, iBPHI, iBPHI))*R_1;
+        #if (RESISTIVE_MHD == NO) || (RESISTIVE_MHD == SUPER_TIME_STEPPING)
+         rhs[i][iBPHI] -= dt*(vphi*vc[iBR] - vc[iBPHI]*vc[iVR])*R_1;
+         #if BACKGROUND_FIELD == YES
+          rhs[i][iBPHI] -= dt*(vphi*Bg0[i][iBR] - Bg0[i][iBPHI]*vc[iVR])*R_1;
+         #endif
+        #endif
+       #endif /* PHYSICS == MHD */
+      #endif  /* COMPONENTS == 3 */
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if ROTATING_FRAME == YES
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]  -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, z, phi);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+     
+  } else if (g_dir == JDIR) { 
+    double *vc;
+
+  /* ****************************************************
+      Cylindrical vertical direction:
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    R   = x1[*g_i];
+    phi = 0.0;
+    for (i = beg; i <= end; i++){ 
+      z    = x2[i];   
+      dtdx = dt/dx2[i];
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      #if USE_PR_GRADIENT == YES
+       rhs[i][iMZ] += - dtdx*(p[i] - p[i-1]);
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMZ] += -dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if EOS == IDEAL
+        gPhi_c      = BodyForcePotential(R, z, phi);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+
+#elif GEOMETRY == POLAR
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in POLAR geometry.
+    
+   *********************************************************** */
+{
+  double R, phi, z; 
+  double R_1;
+   
+  if (g_dir == IDIR) { 
+    double vc[NVAR];
+
+  /* ****************************************************
+      Polar radial direction:
+      multiply fluxes times interface area
+     **************************************************** */
+
+    phi = x2[*g_j];
+    z   = x3[*g_k];
+    for (i = beg - 1; i <= end; i++) { 
+      R = grid[IDIR].A[i];
+
+      fA[i][RHO] = flux[i][RHO]*R;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*R;      ,
+             fA[i][iMPHI] = flux[i][iMPHI]*R*R;  ,
+             fA[i][iMZ]   = flux[i][iMZ]*R;)       
+      #if PHYSICS == MHD 
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*R;    ,
+              fA[i][iBPHI] = flux[i][iBPHI];    ,
+              fA[i][iBZ]   = flux[i][iBZ]*R;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*R;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*R;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*R;
+    }
+
+  /* ****************************************************
+      Polar radial direction,
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - enforce conservation of total angular
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++) {
+      R    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      R_1  = grid[IDIR].r_1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(rhs[i][iMR]   = - dtdV*(fA[i][iMR]   - fA[i-1][iMR])
+                             - dtdx*(p[i] - p[i-1]);                      ,      
+             rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*R_1;  ,
+             rhs[i][iMZ]   = - dtdV*(fA[i][iMZ]   - fA[i-1][iMZ]);)
+      #if PHYSICS == MHD 
+       EXPAND(rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);    ,
+              rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI]);  ,
+              rhs[i][iBZ]   = -dtdV*(fA[i][iBZ]   - fA[i-1][iBZ]);)
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = -dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) {
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms
+       ---------------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]); 
+/* for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+      vphi = vc[iVPHI];
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0;
+       IF_FARGO   (w += wA[*g_k][i];)
+       IF_ROTATION(w += g_OmegaZ*R;)
+       vphi += w;
+      #endif
+      #if PHYSICS == HD
+       rhs[i][iMR] += dt*vc[RHO]*vphi*vphi*R_1;
+      #elif PHYSICS == MHD
+       rhs[i][iMR] += dt*(  vc[RHO]*vphi*vphi 
+                          - TotBB(vc, Bg0[i], iBPHI, iBPHI))*R_1;
+      #endif
+
+    /* ----------------------------------------------------
+       I3. modify rhs to achieve conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+      
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+     
+  } else if (g_dir == JDIR) {
+    double *vc;
+
+  /* ****************************************************
+      Polar azimuthal direction:
+
+       - initialize rhs with flux differences (J1)
+       - add gravity                          (J4)
+     **************************************************** */
+
+    R = x1[*g_i];
+    z = x3[*g_k];
+    scrh = dt/R;
+    for (i = beg; i <= end; i++){ 
+      phi  = x2[i];
+      dtdx = scrh/dx2[i];
+
+    /* ------------------------------------------------
+       J1. Compute equations rhs for phi-contributions
+       ------------------------------------------------ */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      rhs[i][iMPHI] -= dtdx*(p[i] - p[i-1]);
+
+    /* -------------------------------------------------------
+       J4. Include gravity
+       ------------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMPHI] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+
+  } else if (g_dir == KDIR) { 
+    double *vc;
+
+  /* ****************************************************
+      Polar vertical direction:
+
+       - initialize rhs with flux differences (K1)
+       - enforce conservation of total angular
+         momentum and/or energy               (K3)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    R   = x1[*g_i];
+    phi = x2[*g_j];
+    for (i = beg; i <= end; i++){ 
+      z    = x3[i];
+      dtdx = dt/dx3[i];
+
+    /* -----------------------------------------------
+       K1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }
+      rhs[i][iMZ] -= dtdx*(p[i] - p[i-1]);
+
+    /* ------------------------------------------------------
+       K3. modify rhs to enforce conservation (FARGO only)
+           (solid body rotations are not included the
+            velocity depends on the cylindrical radius only)
+       ------------------------------------------------------ */
+
+      #ifdef FARGO 
+       w = wA[i][*g_i];
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]  -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);       
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       K4. Include gravity
+       ---------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]); 
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, *g_i, grid, vc, g);
+       rhs[i][iMZ] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMZ] += -dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if EOS == IDEAL
+        gPhi_c      = BodyForcePotential(R, phi, z);
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif                                     
+    }
+  }
+}
+#elif GEOMETRY == SPHERICAL
+
+/* ***********************************************************
+   
+        Compute right-hand side of the MHD/HD 
+        equations in SPHERICAL geometry.
+    
+   *********************************************************** */
+{
+  double r, th, phi;
+  double r2, r3, r_1;
+  double s, s2, ct, s_1;
+
+  if (g_dir == IDIR) { 
+    double Sm, vc[NVAR];
+
+  /* ****************************************************
+      Spherical radial direction: 
+      multiply fluxes by interface area 
+     **************************************************** */
+
+    th  = x2[*g_j]; s = sin(th);
+    phi = x3[*g_k];
+    for (i = beg - 1; i <= end; i++){
+      r  = x1p[i];
+      r2 = r*r; 
+      r3 = r2*r;
+
+      fA[i][RHO] = flux[i][RHO]*r2;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*r2;   ,
+             fA[i][iMTH]  = flux[i][iMTH]*r2;  ,
+             fA[i][iMPHI] = flux[i][iMPHI]*r3;)
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*r2;   ,
+              fA[i][iBTH]  = flux[i][iBTH]*r;  ,
+              fA[i][iBPHI] = flux[i][iBPHI]*r;)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*r2;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*r2;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*r2;
+    } 
+
+  /* ****************************************************
+      Spherical radial direction:
+
+       - initialize rhs with flux differences (I1)
+       - add source terms                     (I2)
+       - enforce conservation of total angular 
+         momentum and/or energy               (I3)
+       - add gravity                          (I4)
+     **************************************************** */
+
+    for (i = beg; i <= end; i++) { 
+      r    = x1[i];
+      dtdV = dt/grid[IDIR].dV[i];
+      dtdx = dt/dx1[i];
+      r_1  = grid[IDIR].r_1[i];
+
+    /* -----------------------------------------------
+       I1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(
+        rhs[i][iMR]   = - dtdV*(fA[i][iMR] - fA[i-1][iMR])
+                        - dtdx*(p[i] - p[i-1]);                    ,
+        rhs[i][iMTH]  = -dtdV*(fA[i][iMTH]  - fA[i-1][iMTH]);      ,
+        rhs[i][iMPHI] = -dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*r_1; 
+      )
+      #if PHYSICS == MHD
+       EXPAND(                                                     
+         rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);       ,
+         rhs[i][iBTH]  = -dtdx*(fA[i][iBTH]  - fA[i-1][iBTH])*r_1;  ,
+         rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI])*r_1;
+       )
+       #ifdef GLM_MHD
+        rhs[i][iBR]     = -dtdx*(flux[i][iBR]   - flux[i-1][iBR]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+
+      for (nv = NFLX; nv < NVAR; nv++){
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       I2. Add source terms 
+       ---------------------------------------------------- */
+  
+      for (nv = NVAR; nv--;  ) vc[nv] = 0.5*(vp[i][nv] + vm[i][nv]);
+/*  for (nv = NVAR; nv--;  ) vc[nv] = vh[i][nv]; */
+
+      vphi = SELECT(0.0, 0.0, vc[iVPHI]);
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0;
+       IF_FARGO   (w += wA[*g_j][i];)
+       IF_ROTATION(w += g_OmegaZ*r*s;)
+       vphi += w;
+      #endif
+      Sm = vc[RHO]*(EXPAND(  0.0, + vc[iVTH]*vc[iVTH], + vphi*vphi));
+      #if PHYSICS == MHD
+       Sm += EXPAND(  0.0, - TotBB(vc, Bg0[i], iBTH, iBTH), 
+                           - TotBB(vc, Bg0[i], iBPHI,iBPHI));
+      #endif
+      rhs[i][iMR] += dt*Sm*r_1;
+
+    /* ----------------------------------------------------
+       I3. modify rhs to enforce conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       I4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[i], x2[*g_j], x3[*g_k]); 
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir]; 
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, *g_j, i, grid, vc, g);
+       rhs[i][iMR] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMR] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif                                     
+    }
+
+  } else if (g_dir == JDIR) {
+
+    double Sm, *vc;
+
+  /* ****************************************************
+      Spherical meridional direction:
+      multiply fluxes by zone-interface area
+     **************************************************** */
+
+    r   = x1[*g_i];
+    phi = x3[*g_k];
+    for (i = beg - 1; i <= end; i++){ 
+      s  = grid[JDIR].A[i];
+      s2 = s*s;
+
+      fA[i][RHO] = flux[i][RHO]*s;
+      EXPAND(fA[i][iMR]   = flux[i][iMR]*s;   ,
+             fA[i][iMTH]  = flux[i][iMTH]*s;  ,
+             fA[i][iMPHI] = flux[i][iMPHI]*s2;) 
+      #if PHYSICS == MHD
+       EXPAND(fA[i][iBR]   = flux[i][iBR]*s;   ,
+              fA[i][iBTH]  = flux[i][iBTH]*s;  ,
+              fA[i][iBPHI] = flux[i][iBPHI];)
+      #endif
+      #if IDEAL_EOS
+       fA[i][ENG] = flux[i][ENG]*s;
+      #endif
+      #ifdef GLM_MHD
+       fA[i][PSI_GLM] = flux[i][PSI_GLM]*s;
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++) fA[i][nv] = flux[i][nv]*s;
+    }
+
+  /* ****************************************************
+      Spherical meridional direction:
+
+       - initialize rhs with flux differences (J1)
+       - add source terms                     (J2)
+       - enforce conservation of total angular
+         momentum and/or energy               (J3)
+       - add gravity                          (J4)
+     **************************************************** */
+    
+    r_1 = grid[IDIR].r_1[*g_i];
+    for (i = beg; i <= end; i++){
+      th   = x2[i];
+      dtdV = dt/grid[JDIR].dV[i]*r_1;
+      dtdx = dt/dx2[i]*r_1;      
+      s    = sin(th);
+      s_1  = 1.0/s;   
+      ct   = grid[JDIR].ct[i];         /* = cot(theta)  */
+
+    /* -----------------------------------------------
+       J1. initialize rhs with flux difference
+       ----------------------------------------------- */
+
+      rhs[i][RHO] = -dtdV*(fA[i][RHO] - fA[i-1][RHO]);
+      EXPAND(
+        rhs[i][iMR]   = - dtdV*(fA[i][iMR] - fA[i-1][iMR]);  , 
+        rhs[i][iMTH]  = - dtdV*(fA[i][iMTH] - fA[i-1][iMTH])
+                        - dtdx*(p[i] - p[i-1]);              , 
+        rhs[i][iMPHI] = - dtdV*(fA[i][iMPHI] - fA[i-1][iMPHI])*fabs(s_1);
+      )       
+      #if PHYSICS == MHD
+       EXPAND(                                                     
+         rhs[i][iBR]   = -dtdV*(fA[i][iBR]   - fA[i-1][iBR]);  ,
+         rhs[i][iBTH]  = -dtdV*(fA[i][iBTH]  - fA[i-1][iBTH]);  ,
+         rhs[i][iBPHI] = -dtdx*(fA[i][iBPHI] - fA[i-1][iBPHI]);
+       )
+       #ifdef GLM_MHD
+        rhs[i][iBTH]    = -dtdx*(flux[i][iBTH] - flux[i-1][iBTH]);
+        rhs[i][PSI_GLM] = -dtdV*(fA[i][PSI_GLM] - fA[i-1][PSI_GLM]);
+       #endif
+      #endif
+      #if IDEAL_EOS
+       rhs[i][ENG] = -dtdV*(fA[i][ENG] - fA[i-1][ENG]);
+      #endif
+      for (nv = NFLX; nv < NVAR; nv++){
+        rhs[i][nv] = -dtdV*(fA[i][nv] - fA[i-1][nv]);
+      }
+
+    /* ----------------------------------------------------
+       J2. Add source terms
+       ---------------------------------------------------- */
+       
+      vc = vh[i];
+      
+      vphi = SELECT(0.0, 0.0, vc[iVPHI]);
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       w = 0.0; 
+       IF_FARGO   (w += wA[i][*g_i];)
+       IF_ROTATION(w += g_OmegaZ*r*s;)
+       vphi += w;
+      #endif
+      Sm = vc[RHO]*(EXPAND(  0.0, - vc[iVTH]*vc[iVR], + ct*vphi*vphi));
+      #if PHYSICS == MHD
+       Sm += EXPAND(0.0, +    TotBB(vc, Bg0[i], iBTH, iBR), 
+                         - ct*TotBB(vc, Bg0[i], iBPHI, iBPHI));
+      #endif
+      rhs[i][iMTH] += dt*Sm*r_1;
+
+    /* ----------------------------------------------------
+       J3. modify rhs to enforce conservation
+       ---------------------------------------------------- */
+
+      #if (defined FARGO) || (ROTATING_FRAME == YES)
+       rhs[i][iMPHI] -= w*rhs[i][RHO];
+       #if IDEAL_EOS
+        rhs[i][ENG]   -= w*(rhs[i][iMPHI] + 0.5*w*rhs[i][RHO]);
+       #endif
+      #endif
+
+    /* ----------------------------------------------------
+       J4. Include gravity
+       ---------------------------------------------------- */
+
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[i], x3[*g_k]);
+       rhs[i][iMTH] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(*g_k, i, *g_i, grid, vc, g);
+       rhs[i][iMTH] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMTH] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+
+  } else if (g_dir == KDIR) {
+
+    double Sm, *vc;
+
+  /* ****************************************************
+      Spherical azimuthal direction:
+
+       - initialize rhs with flux differences (K1)
+       - add gravity                          (K4)
+     **************************************************** */
+
+    r  = x1[*g_i];
+    th = x2[*g_j];
+    s    = sin(th);
+    scrh = dt/(r*s);
+    for (i = beg; i <= end; i++) {
+      phi  = x3[i];
+      dtdx = scrh/dx3[i];
+
+    /* ------------------------------------------------
+       K1.  initialize rhs with flux difference
+       ------------------------------------------------ */
+
+      for (nv = NVAR; nv--;  ) {
+        rhs[i][nv] = -dtdx*(flux[i][nv] - flux[i-1][nv]);
+      }       
+      rhs[i][iMPHI] -= dtdx*(p[i] - p[i-1]); 
+
+    /* -------------------------------------------------------
+       K4. Include gravity
+       ------------------------------------------------------- */
+
+      vc = vh[i];
+      #if (BODY_FORCE & VECTOR)
+       BodyForceVector(vc, g, x1[*g_i], x2[*g_j], x3[i]);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if RADIATION_PRESSURE == YES
+       ComputeRadiationAcceleration(i, *g_j, g_i, grid, vc, g);
+       rhs[i][iMPHI] += dt*vc[RHO]*g[g_dir];
+       #if IDEAL_EOS
+        rhs[i][ENG] += dt*0.5*(flux[i][RHO] + flux[i-1][RHO])*g[g_dir];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       rhs[i][iMPHI] -= dtdx*vc[RHO]*(gPhi[i] - gPhi[i-1]);
+       #if IDEAL_EOS
+        gPhi_c      = BodyForcePotential(r, th, phi); 
+        rhs[i][ENG] -= gPhi_c*rhs[i][RHO];
+       #endif
+      #endif
+    }
+  }
+}
+#endif  /* GEOMETRY == SPHERICAL */
+
+/* ---------------------------------------------------------------
+    Source terms coming from tensor discretazion of parabolic
+    terms in curvilinear coordinates (only for viscosity)
+  ---------------------------------------------------------------- */
+
+  #if GEOMETRY != CARTESIAN
+   #if VISCOSITY == EXPLICIT
+    for (i = beg; i <= end; i++) {
+      EXPAND(rhs[i][MX1] += dt*state->par_src[i][MX1];  ,
+             rhs[i][MX2] += dt*state->par_src[i][MX2];  ,
+             rhs[i][MX3] += dt*state->par_src[i][MX3];)
+    }
+   #endif
+  #endif
+
+/* --------------------------------------------------
+              Powell's source terms
+   -------------------------------------------------- */
+
+  #if PHYSICS == MHD 
+   #if MHD_FORMULATION == EIGHT_WAVES
+    for (i = beg; i <= end; i++) {
+      EXPAND(rhs[i][MX1] += dt*state->src[i][MX1];  ,
+             rhs[i][MX2] += dt*state->src[i][MX2];  ,
+             rhs[i][MX3] += dt*state->src[i][MX3];)
+
+      EXPAND(rhs[i][BX1] += dt*state->src[i][BX1];  ,
+             rhs[i][BX2] += dt*state->src[i][BX2];  ,
+             rhs[i][BX3] += dt*state->src[i][BX3];)
+      #if IDEAL_EOS
+       rhs[i][ENG] += dt*state->src[i][ENG];
+      #endif
+    }
+   #endif
+  #endif
+
+/* -------------------------------------------------
+            Extended GLM source terms
+   ------------------------------------------------- */
+
+  #ifdef GLM_MHD
+  #if   EGLM == YES
+   EGLM_Source (state, dt, beg, end, grid);
+  #endif
+  #endif
+
+/* -----------------------------------------------
+      Entropy equation source terms 
+   ----------------------------------------------- */
+
+  #if RESISTIVE_MHD == EXPLICIT
+   #if (ENTROPY_SWITCH == YES) && (EOS != ISOTHERMAL && EOS != BAROTROPIC)
+    for (i = beg; i <= end; i++) {
+      rhs[i][ENTR] += dt*state->src[i][ENTR];
+    }
+   #endif
+  #endif
+
+/* --------------------------------------------------
+    Reset right hand side in internal boundary zones
+   -------------------------------------------------- */
+   
+  #if INTERNAL_BOUNDARY == YES
+   InternalBoundaryReset(state, Dts, beg, end, grid);
+  #endif
+  
+/* --------------------------------------------------
+           Time step determination
+   -------------------------------------------------- */
+
+#if !GET_MAX_DT
+return;
+#endif
+
+  cl = 0.0;
+  for (i = beg-1; i <= end; i++) {
+    scrh = Dts->cmax[i]*grid[g_dir].inv_dxi[i];
+    cl = MAX(cl, scrh);   
+  }
+  #if GEOMETRY == POLAR || GEOMETRY == SPHERICAL
+   if (g_dir == JDIR) {
+     cl /= fabs(grid[IDIR].xgc[*g_i]);
+   }
+   #if GEOMETRY == SPHERICAL
+    if (g_dir == KDIR){
+      cl /= fabs(grid[IDIR].xgc[*g_i])*sin(grid[JDIR].xgc[*g_j]);
+    }
+   #endif
+  #endif
+  Dts->inv_dta = MAX(cl, Dts->inv_dta);  
+}
+
+/* ********************************************************************* */
+void TotalFlux (const State_1D *state, double *gPhi,
+                int beg, int end, Grid *grid)
+/*!
+ *  Compute the total flux in order to enforce conservation of 
+ *  angular momentum and energy in presence of FARGO source 
+ *  terms, rotation or gravitational potential.
+ *
+ * \param [in]     state pointer to State_1D structure;
+ * \param [in,out] gPhi  1D array defining the gravitational potential;
+ * \param [in]     beg    initial index of computation; 
+ * \param [in]     end    final   index of computation;
+ * \param [in]     grid  pointer to Grid structure;
+ *********************************************************************** */
+#ifndef iMPHI
+ #define iMPHI MY  /* -- for Cartesian coordinates -- */
+#endif
+{
+  int i;
+  double wp, R;
+  double **flux, *vp;
+  double *x1,  *x2,  *x3;
+  double *x1p, *x2p, *x3p;
+  #ifdef FARGO
+   double **wA;
+   wA = FARGO_GetVelocity();
+  #endif
+
+  flux = state->flux;
+  x1  = grid[IDIR].x;  x1p = grid[IDIR].xr;
+  x2  = grid[JDIR].x;  x2p = grid[JDIR].xr;
+  x3  = grid[KDIR].x;  x3p = grid[KDIR].xr;
+
+  if (g_dir == IDIR){ 
+    for (i = beg; i <= end; i++){
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO or Rotation 
+        Note: ShearingBox terms are not included here but
+              only within the BodyForce function.
+       ---------------------------------------------------- */
+
+      #if (defined FARGO && !defined SHEARINGBOX) || (ROTATING_FRAME == YES)
+       wp = 0.0;
+       #if GEOMETRY == SPHERICAL
+        IF_FARGO(wp = 0.5*(wA[*g_j][i] + wA[*g_j][i+1]);)
+        R = x1p[i]*sin(x2[*g_j]);  /* -- cylindrical radius -- */
+       #else
+        IF_FARGO(wp = 0.5*(wA[*g_k][i] + wA[*g_k][i+1]);)
+        R = x1p[i];                   /* -- cylindrical radius -- */
+       #endif
+       IF_ROTATION(wp += g_OmegaZ*R;)
+       #if IDEAL_EOS
+        flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+       #endif
+       flux[i][iMPHI] += wp*flux[i][RHO];
+      #endif
+
+    /* -- gravitational potential -- */
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1p[i], x2[*g_j], x3[*g_k]);
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];                          
+       #endif
+      #endif
+    }
+  }else if (g_dir == JDIR){
+    for (i = beg; i <= end; i++){ 
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO and Rotation 
+       ---------------------------------------------------- */
+
+      #if GEOMETRY == SPHERICAL
+       #if defined FARGO || (ROTATING_FRAME == YES)
+        wp = 0.0;
+        R  = x1[*g_i]*sin(x2p[i]);
+        IF_FARGO   (wp += 0.5*(wA[i][*g_i] + wA[i+1][*g_i]);)
+        IF_ROTATION(wp += g_OmegaZ*R;)
+        #if EOS != ISOTHERMAL && EOS != BAROTROPIC
+         flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+        #endif
+        flux[i][iMPHI] += wp*flux[i][RHO];
+       #endif
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1[*g_i], x2p[i], x3[*g_k]);
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];
+       #endif
+      #endif      
+
+    }
+  }else if (g_dir == KDIR){
+    R = x1[*g_i];
+    for (i = beg; i <= end; i++) {
+
+    /* ----------------------------------------------------
+        include flux contributions from FARGO
+        (polar/carteisian geometries only)
+       ---------------------------------------------------- */
+
+      #if (GEOMETRY != SPHERICAL) && (defined FARGO) && (!defined SHEARINGBOX)
+       wp = 0.5*(wA[i][*g_i] + wA[i+1][*g_i]);
+       #if EOS == IDEAL
+        flux[i][ENG] += wp*(0.5*wp*flux[i][RHO] + flux[i][iMPHI]);
+       #endif
+       flux[i][iMPHI] += wp*flux[i][RHO];
+      #endif
+
+      #if (BODY_FORCE & POTENTIAL)
+       gPhi[i] = BodyForcePotential(x1[*g_i], x2[*g_j], x3p[i]); 
+       #if IDEAL_EOS
+        flux[i][ENG] += flux[i][RHO]*gPhi[i];                          
+       #endif
+      #endif
+    }
+  }
+}
+#undef TotBB
+#undef IF_FARGO
+#undef IF_ROTATION
+#undef IDEAL_EOS
diff -rupN PLUTO4/Src/Radiation/radiation_tools.c PLUTO_RADIATION_MOD/Src/Radiation/radiation_tools.c
--- PLUTO4/Src/Radiation/radiation_tools.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation_tools.c	2013-06-01 18:33:00.224214818 +0200
@@ -0,0 +1,306 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <execinfo.h>
+
+#include <signal.h>
+#include <fenv.h>       //for handling float point exceptions
+//to prevent an warning message
+int feenableexcept( int excepts );
+
+#include "radiation.h"
+#include "radiation_tools.h"
+
+/**
+    Shows the current used domain composition by PLUTO. This version is better
+    than the version provided by PLUTO because we show here for each process the
+    exact number of cells per direction. The PLUTO version shows only the
+    typical (the values from prank == 0) number of cells per direction.
+*/
+void ShowDomainDecompositionAdvanced( Grid *grid )
+{
+    int i = 0;
+    int domain_size[9];
+    int *domain_size_received = NULL;
+    int nproc = 1;          //default value is 1 for the single process case
+
+    domain_size[0] = NX1;
+    domain_size[1] = NX2;
+    domain_size[2] = NX3;
+
+    domain_size[3] = grid[IDIR].beg - grid[IDIR].gbeg;
+    domain_size[4] = grid[IDIR].end - grid[IDIR].gbeg;
+    domain_size[5] = grid[JDIR].beg - grid[JDIR].gbeg;
+    domain_size[6] = grid[JDIR].end - grid[JDIR].gbeg;
+    domain_size[7] = grid[KDIR].beg - grid[KDIR].gbeg;
+    domain_size[8] = grid[KDIR].end - grid[KDIR].gbeg;
+
+    domain_size_received = domain_size; //is set for the single process case
+
+    #ifdef PARALLEL
+        if( prank == 0 )
+        {
+            MPI_Comm_size( MPI_COMM_WORLD, &nproc );
+            domain_size_received = malloc( 9 * nproc * sizeof( int ) );
+            CHECK_ALLOCATED_MEMORY( domain_size_received );
+        }
+        MPI_Gather( domain_size, 9, MPI_INT, domain_size_received, 9, MPI_INT, 0, MPI_COMM_WORLD );
+
+        if( prank == 0 )
+        {
+    #endif
+        print( "\n> Domain decomposition [nproc=%d]\n", nproc );
+
+        for( i = 0; i < nproc; i++ )
+        {
+            //print(" process %4d: \t Nx1=%-6d Nx2=%-6d Nx3=%-6d %-4d,%-4d,%-4d <-> %-4d,%-4d,%-4d\n",i,domain_size_received[i*9],domain_size_received[i*9+1],domain_size_received[i*9+2],domain_size_received[i*9+3],domain_size_received[i*9+5],domain_size_received[i*9+7],domain_size_received[i*9+4],domain_size_received[i*9+6],domain_size_received[i*9+8]);
+            print( " process %4d: \t Nx1=%-6d Nx2=%-6d Nx3=%-6d\n", i, domain_size_received[i * 9], domain_size_received[i * 9 + 1], domain_size_received[i * 9 + 2] );
+        }
+        print( "\n" );
+
+    #ifdef PARALLEL
+            free( domain_size_received );
+        }
+    #endif
+}
+
+/**
+    Registers signal handler for float point exceptions
+*/
+void RegisterFpeSignalHandler()
+{
+    /* Can also be any of the value below:
+        FE_INEXACT inexact result
+        FE_DIVBYZERO division by zero
+        FE_UNDERFLOW result not representable due to underflow
+        FE_OVERFLOW result not representable due to overflow
+        FE_INVALID invalid operation
+        FE_ALL_EXCEPT bitwise OR of all supported exceptions
+    */
+    feenableexcept( FE_DIVBYZERO | FE_INVALID );
+    signal( SIGFPE, HandleFPESignals );
+}
+
+/**
+    Function that handles the float point exceptions
+*/
+void HandleFPESignals( int signal )
+{
+    print( "\n\nFloat point exception\n" );
+    PrintBacktrace();
+    QUIT_PLUTO( 1 );
+}
+
+/**
+    This function increases the time step by the factor \a timestep_increase_factor
+    if in average less than \a iterations_limit iterations are used by the solver.
+
+    \note This function is only used in some test cases to speed up the simulation.
+        It is only useful if \f$ \Delta t \f$ is not handled by PLUTO
+*/
+void RadiationIncreaseTimestepSimple( Grid *grid, Data *data, int iterations )
+{
+#define analyse_number 400
+    static int analyse_iterations_array[analyse_number];
+    static int array_pos = 0;
+    static int do_once = 1;
+#ifndef iterations_limit
+#define iterations_limit 5.
+#endif
+    const double timestep_increase_factor = 10.;
+
+//  #define iterations_limit 5.
+//  #define timestep_increase_factor 2.
+
+    int n = 0;
+    double average_iteration = 0.;
+
+    if( do_once )
+    {
+        do_once = 0;
+        for( n = 0; n < analyse_number; ++n )
+        {
+            analyse_iterations_array[n] = 1000;
+        }
+    }
+
+    array_pos = array_pos % analyse_number;
+
+    analyse_iterations_array[array_pos] = iterations;
+    array_pos++;
+
+    average_iteration = 0.;
+    for( n = 0; n < analyse_number; ++n )
+    {
+        average_iteration += ( double )analyse_iterations_array[n];
+    }
+    average_iteration = average_iteration / ( ( double )analyse_number );
+
+//  if(prank == 0)
+//  {
+//      print("average_iterations %2f\n",average_iteration);
+//  }
+
+    if( average_iteration < iterations_limit )
+    {
+        g_dt = g_dt * timestep_increase_factor;
+
+        for( n = 0; n < analyse_number; ++n )
+        {
+            analyse_iterations_array[n] = 1000;
+        }
+    }
+
+//  if(g_dt > 10e-2)
+//  {
+//      g_dt = 10e-2;
+//  }
+
+#undef analyse_number
+#undef iterations_limit
+}
+
+void RadiationCollectGlobal1DArray( const Data *data, Grid *grid, int quantity, double( *compute_value )( int, int, int, Data *, Grid * ), int dir, int i_glob, int j_glob, int k_glob, double **result, int *result_size, int root, MPI_Comm communicator )
+{
+    int local_array_start = grid[dir].beg - grid[dir].gbeg;
+    int local_array_end = grid[dir].end - grid[dir].gbeg + 1;
+    int local_array_size = local_array_end - local_array_start;
+    int domain_size = ( grid[dir].gend - grid[dir].gbeg + 1 );
+    int n = 0, i = 0, j = 0, k = 0, var = -1;
+    int nproc = 0;
+
+    double *local_buffer = NULL;
+
+    int *recvcnts = NULL;
+    int *displs = NULL;
+
+    *result_size = domain_size;
+
+
+    MPI_Comm_size( communicator, &nproc );
+
+    //ceck if local domain contains needed data
+    if( dir == IDIR )
+    {
+        if( ( j_glob < grid[JDIR].beg || j_glob > grid[JDIR].end ) || ( k_glob < grid[KDIR].beg || k_glob > grid[KDIR].end ) )
+        {
+            local_array_start = 0;
+            local_array_end = 0;
+            local_array_size = 0;
+        }
+    }
+    else if( dir == JDIR )
+    {
+        if( ( i_glob < grid[IDIR].beg || i_glob > grid[IDIR].end ) || ( k_glob < grid[KDIR].beg || k_glob > grid[KDIR].end ) )
+        {
+            local_array_start = 0;
+            local_array_end = 0;
+            local_array_size = 0;
+        }
+
+    }
+    else if( dir == KDIR )
+    {
+        if( ( i_glob < grid[IDIR].beg || i_glob > grid[IDIR].end ) || ( j_glob < grid[JDIR].beg || j_glob > grid[JDIR].end ) )
+        {
+            local_array_start = 0;
+            local_array_end = 0;
+            local_array_size = 0;
+        }
+    }
+
+    i = ( i_glob - grid[IDIR].beg ) + grid[IDIR].lbeg;
+    j = ( j_glob - grid[JDIR].beg ) + grid[JDIR].lbeg;
+    k = ( k_glob - grid[KDIR].beg ) + grid[KDIR].lbeg;
+
+    if( prank == 0 )
+    {
+        recvcnts = malloc( sizeof( int ) * nproc );
+        CHECK_ALLOCATED_MEMORY( recvcnts );
+        displs = malloc( sizeof( int ) * nproc );
+        CHECK_ALLOCATED_MEMORY( displs );
+
+        *result = malloc( sizeof( double ) * domain_size );
+        CHECK_ALLOCATED_MEMORY( displs );
+    }
+
+    MPI_Gather( &local_array_size, 1, MPI_INT, recvcnts, 1, MPI_INT, root, communicator );
+    MPI_Gather( &local_array_start, 1, MPI_INT, displs, 1, MPI_INT, root, communicator );
+
+    local_buffer = malloc( sizeof( double ) * local_array_size );
+
+    if( compute_value == NULL )
+    {
+        if( dir == IDIR )
+        {
+            for( i = grid[IDIR].lbeg; i <= grid[IDIR].lend; i++ )
+            {
+                local_buffer[i - grid[IDIR].lbeg] = data->Vc[quantity][k][j][i];
+            }
+        }
+        else if( dir == JDIR )
+        {
+            for( j = grid[JDIR].lbeg; j <= grid[JDIR].lend; j++ )
+            {
+                local_buffer[j - grid[JDIR].lbeg] = data->Vc[quantity][k][j][i];
+            }
+        }
+        else if( dir == KDIR )
+        {
+            for( k = grid[KDIR].lbeg; k <= grid[KDIR].lend; k++ )
+            {
+                local_buffer[k - grid[KDIR].lbeg] = data->Vc[quantity][k][j][i];
+            }
+        }
+    }
+    else
+    {
+        if( dir == IDIR )
+        {
+            for( i = grid[IDIR].lbeg; i <= grid[IDIR].lend; i++ )
+            {
+                local_buffer[i - grid[IDIR].lbeg] = ( *compute_value )( k, j, i, ( Data * )data, grid );
+            }
+        }
+        else if( dir == JDIR )
+        {
+            for( j = grid[JDIR].lbeg; j <= grid[JDIR].lend; j++ )
+            {
+                local_buffer[j - grid[JDIR].lbeg] = ( *compute_value )( k, j, i, ( Data * )data, grid );
+            }
+        }
+        else if( dir == KDIR )
+        {
+            for( k = grid[KDIR].lbeg; k <= grid[KDIR].lend; k++ )
+            {
+                local_buffer[k - grid[KDIR].lbeg] = ( *compute_value )( k, j, i, ( Data * )data, grid );
+            }
+        }
+    }
+
+    MPI_Gatherv( local_buffer, local_array_size, MPI_DOUBLE, *result, recvcnts, displs, MPI_DOUBLE, root, communicator );
+
+    free( local_buffer );
+    free( recvcnts );
+    free( displs );
+}
+
+
diff -rupN PLUTO4/Src/Radiation/radiation_tools.h PLUTO_RADIATION_MOD/Src/Radiation/radiation_tools.h
--- PLUTO4/Src/Radiation/radiation_tools.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/radiation_tools.h	2013-06-01 18:33:00.217214819 +0200
@@ -0,0 +1,35 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef RADIATION_TOOLS_H
+#define RADIATION_TOOLS_H
+
+#include "pluto.h"
+#include "error.h"
+#include "backtrace.h"
+
+void ShowDomainDecompositionAdvanced( Grid *grid );
+
+void RegisterFpeSignalHandler();
+void HandleFPESignals( int signal );
+
+void RadiationIncreaseTimestepSimple( Grid *grid, Data *data, int iterations );
+
+void RadiationCollectGlobal1DArray( const Data *data, Grid *grid, int quantity, double( *compute_value )( int, int, int, Data *, Grid * ), int dir, int i_glob, int j_glob, int k_glob, double **result, int *result_size, int root, MPI_Comm communicator );
+#endif
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/generate_opacity.c PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/generate_opacity.c
--- PLUTO4/Src/Radiation/SemenovOpacity/generate_opacity.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/generate_opacity.c	2013-06-01 18:33:00.200214819 +0200
@@ -0,0 +1,3003 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include "generate_opacity.h"
+
+/*
+    This file is originally from the website
+    http://www.mpia.de/homes/henning/Dust_opacities/Opacities/opacities.html
+
+    The original file opacity.f can be found in the zip archive
+    http://www.mpia.de/homes/henning/Dust_opacities/Opacities/Code/opacity.zip
+
+    The file opacity.f was converted from fortran to c by using the tool f2c. After the conversion
+    we manually removed the dependencies to the f2c library. The only function which was changed in its
+    functionality is the function main which is not needed in our context.
+*/
+
+/*
+program  opacity.f
+.........................................................................
+.  Version 1.0 (16/10/2002)
+.........................................................................
+.  Copyright (c) 2001-2002, Dmitry Semenov, AIU, Jena
+.  E-mail: dima@astro.uni-jena.de
+.........................................................................
+.  License: one can freely use, modify, or redistribute all parts of the
+.  code.
+.  [Please, inform me about all bugs which you will find in the code!]
+.........................................................................
+.  DESCRIPTION OF THE MODEL:
+.........................................................................
+.  Calculation of the Rosseland and Planck mean opacities of the gas
+.  and dust in the temperature range 5[K]<T<~10,000[K] and for gas
+.  density between ~2*10^-18 [g/cm^3] and ~2*10^-7[g/cm^3]. The solar
+.  composition of the elements is adopted from the compilations of
+.  Anders & Grevesse (1989, all but carbon) and Grevesse et al.
+.  (1991, carbon).
+.
+.  It is supposed that in the temperature range 0<T<~1500[K] (depending
+.  on the gas density) the opacity is dominated by dust grains, whereas
+.  for higher temperatures gas species are the only possible source of
+.  the opacity.
+.........................................................................
+.  I. DUST OPACITIES:
+.........................................................................
+.  Dust grains are supposed to consist of silicates, iron, troilite,
+.  organics, and ice (Pollack et al. 1994, Henning & Stognienko 1996).
+.  We applied a modified MRN size distribution as proposed by Pollack et
+.  al. (1985):
+.
+.  a~a^-q1, amin<a<amax1,
+.  a~a^-q2, amax1<a<amax2,
+.  where q1=3.5, q2=5.5, amin=0.005 mkm, amax1=1 mkm, amax2=5 mkm.
+.
+.  The silicates - amorphous olivine and pyroxene - are considered to be
+.  three various types, depending on their iron content. However, the
+.  absolute amount of solid metallic iron in the model is kept unchanged:
+.
+.  1) "iron-poor" silicates, Fe/(Fe+Mg)=0.0 ("high" Fe abundance),
+.  2) "iron-rich" silicates, Fe/(Fe+Mg)=0.4 ("low" Fe & FeS abundance),
+.  3) "normal" silicates,    Fe/(Fe+Mg)=0.3 ("normal" Fe abundance).
+.
+.  We modelled dust grains as aggregates or spherical particles with
+.  different distribution of the dust constituents:
+.
+.  a) Homogeneous dust particles, where each particle consists of the
+.     only one dust material:
+.     1) homogeneous compact spherical dust,
+.     2) homogeneous dust aggregates,
+.
+.  b) Composite particles, where each particle includes all dust
+.     materials according their mass fraction:
+.     3) composite dust aggregates,
+.     4) composite compact spherical dust,
+.     5) 5-layered compact spherical dust,
+.
+.  c) Porous composite particles, where each particle consists of all
+.     dust materials according their mass fraction + 50% of vacuum
+.     (by volume):
+.     6) porous composite spherical dust,
+.     7) porous 5-layered spherical dust.
+.
+.........................................................................
+.  II. GAS OPACITIES:
+.........................................................................
+.  For temperatures between roughly 1500 [K] and 10,000 [K], where all
+.  dust grains have evaporated, a new gas opacity table of the Berlin
+.  group (Ch. Helling and E. Sedlmayr) is used (Ch. Helling et al. 2000,
+.  Ch. Helling 2001, 2002, private communications). We wrote a special
+.  subroutine "eint" to interpolate these data for a chosen temperature
+.  and density.
+.
+.........................................................................
+.  III. DUST-TO-GAS TRANSITIONAL REGION (T~1500 K):
+.........................................................................
+.  For this region, our model may produce unreliable results as the
+.  interpolation between totally gas-dominated and dust-dominated
+.  opacities is elaborated. However, as it has been shown by many
+.  authors, this approach is still quite accurate (eg. Lenzuni et al.
+.  1995). The reason is that the gas opacities are much, much lower
+.  (about few orders of magnitude) then the dust opacities. Given that
+.  evaporation of the last refractory dust materials occurs under quite
+.  restricted temperature range (~200 K), one can simply make the
+.  interpolation between purely gas-dominated and dust-dominated
+.  opacities for such temperatures without introducing significant errors.
+.
+.........................................................................
+.  IV.REFERENCES:
+.........................................................................
+.  1) Anders, E., Grevesse, N. (1989), Geochim. Cosmochim. Acta, 53, 19
+.  2) Grevesse, N., Lambert, D.L., Sauval et al. (1991), A&A, 242, 488
+.  3) Helling, Ch., Winters, J., Sedlmayr, E. (2000), A&A, 358, 651
+.  4) Henning, Th., Stognienko, R. (1996), A&A, 311, 291
+.  5) Lenzuni, P., Gail, H.-P., Henning, Th. (1995), ApJ, 447, 848
+.  6) Pollack, J., McKay, C.P., Christofferson, B.M. (1985), Icarus, 64,
+.     471
+.  7) Pollack, J., Hollenbach, D., Beckwith, S. et al. (1994), ApJ,
+.     421, 615
+.  8) Semenov, D., Henning, Th., Ilgner, M. et al. (2003), A&A, in
+.     preparation.
+..........................................................................
+.  DESCRIPTION OF THE CODE:
+..........................................................................
+.  The algorithm of the code is very simple. We found out that the
+.  Rosseland and Planck mean dust opacities can be accurately represented
+.  in the form of a polynom of the fifth degree in every temperature
+.  region. We considered 5 different temperature regions:
+.    1. All dust components are present: 5 K<T<~100 K,
+.    2. All dust components but water ice are present: ~100 K<T<275 K,
+.    3. Silicates, iron, troilite, and refractory organics are present:
+.       275 K<T<425 K,
+.    4. Silicates, iron and troilite are present: 425 K<T<680 K,
+.    5. Silicates and iron are present: 680 K<T<~1500 K.C
+.  In our model, we added a weak dependence of evaporation temperatures
+.  of ice, silicates, and iron on the gas density.
+.
+.  The code uses these pre-computed polynomial coefficients for all
+.  possible dust models. Unfortunately, it is not possible to apply the
+.  same method for the gas-dominated opacities. In this case,
+.  interpolation is utilised, which is numerically costy.
+.
+.  The polynomial fit coefficients are stored within the code in
+.  subroutines "xxx_y_z", where names "xxx", "y", and "z" are the
+.  following:
+.  1) "xxx" means mineraint composition of the silicates, i.e.,
+.     "nrm" ("normal" silicates, see above), "ips" ("iron-poor"
+.     silicates), and "irs" ("iron-rich" silicates);
+.  2) "y" means the distribution of dust materials within the particles,
+.     i.e., "c" (composite), "p" (porous composite), and "h"
+.     (homogeneous),
+.  3) "z" means the shape of the particles, i.e., "a" (aggregates),
+.     "s" (spheres), "5" (5-layered spheres)
+.
+.  In total, 7x3=21 various dust models can be considered.
+.
+.  The gas-dominated opacities are stored in two external files
+.  "kR_h2001.dat" (Rosseland) and "kP_h2001.dat" (Planck). The code
+.  makes two-order interpolation within these data, when it is necessary
+.  to compute gas opacities, with routine "eint".
+.
+.  The main subroutine is "COP" ("Calculation of OPacities"). For a
+.  chosen dust model, the opacity kind and given gas temperature and
+.  density values, it returns the opacity value.
+.
+.  In the header of any subroutine excessive information about
+.  input/output parameters and its purpose are given.
+.
+..........................................................................
+.  INPUT:
+..........................................................................
+.  FILE: 'opacity.inp'
+.     'model': specify a silicate type,
+.            = 'nrm' - "normal" silicate dust model,    Fe/(Fe+Mg)=0.3,
+.            = 'ips' - "iron-poor" silicate dust model, Fe/(Fe+Mg)=0.0,
+.            = 'irs' - "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4,
+.       'top': specify a topology of the grains,
+.            = 'h' - homogeneous particles,
+.            = 'c' - composite particles,
+.            = 'p' - porous composite particles,
+.     'shape': specify a shape of the particles,
+.            = 's' - spherical dust,
+.            = 'a' - aggregate dust,
+.            = '5' - 5-layered spherical dust,
+.      'ross': choose a kind of opacity:
+.            = '.true.'  - Rosseland mean,
+.            = '.false.' - Planck mean,
+.       'rho': gas density,
+.        'NT': number of temperatures to be considered,
+.        'T0': initial temperature of the gas,
+.        'T1': last temperature of the gas
+.
+..........................................................................
+.  OUTPUT:
+...........................................................................
+.  FILES: 'kR.out' - Rosseland mean,
+.         'kP.out' - Planck mean,
+.            'T': a set of temperatures,
+.        'aKext': a set of corresponding mean opacities (extinction)
+.
+...........................................................................
+.  SUBROUTINES (alphabetically):
+...........................................................................
+.    'bint' - quadratic interpolation routine to compute the evaporation
+.             temperatures for a given gas density value,
+.     'cop' - main routine to calculate opacity,
+.    'eint' - quadractic interpolation/extrapolation routine for
+.             gas-dominated opacity calculations,
+.     'gop' - gas-dominated opacity calculation,
+.  'init_d' - a routine to initialise dust model parameters,
+.  'init_g' - the same as 'init_d' but for gas opacities,
+.
+...........................................................................
+*/
+
+#ifdef TEST_SEMINOV_OPACITY_SEPERATE
+
+int main( int argc, char **argv )
+{
+    double *OpacTable_Planck, *OpacTable_Ross;
+
+    /* PARAMETERS DEFINING THE OPACITY TABLES ---------------------------------- */
+    int nt      = 2048;              // Number of temperature points.
+    int nrho    = 2048;              // Number of density points.
+    double t0   = 1.000e+01;         // Initial temperature.
+    double t1   = 9.999e+03;         // Last temperature.
+    double rho0 = 1.000e-16;         // Initial density.
+    double rho1 = 9.999e-9;          // Last density.
+    char top[1]     = "h";               // 'c'/'p'/'h' dust topologies.
+    char model[3]   = "nrm";             // 'nrm'/'ips'/'irs' silicate types.
+    char shape[1]   = "s";               // 's'/'a'/'5' dust shapes.
+    /* ------------------------------------------------------------------------- */
+
+    int bytes_written;
+
+    /* Local variables */
+    double t,  ed[30]   /* was [5][6] */, eg[5041]  /*
+        was [71][71] */, dt, drho;
+    int it, irho;
+    double rho;
+    int ross;
+    double akext;
+
+    /* Allocate memory for opacity tables */
+    OpacTable_Ross = malloc( nt * nrho * sizeof( double ) );
+    OpacTable_Planck = malloc( nt * nrho * sizeof( double ) );
+
+    if( ( OpacTable_Ross == NULL ) || ( OpacTable_Planck == NULL ) )
+    {
+        printf( "Error allocating memory for opacity tables.\n" );
+        exit( 1 );
+    }
+
+
+    for( ross = 0; ross <= 1; ross++ )
+    {
+
+        /* Initialization of all necessary data for a chosen dust model: */
+        init_d( &ross, model, top, shape, ed, ( int )3, ( int )1, ( int )1 );
+        /* Initialization of data for the gas model: */
+        init_g( &ross, eg );
+
+        rho = rho0;
+        drho = exp( log( rho1 / rho0 ) / ( nrho - 1 ) );
+        for( irho = 1; irho <= nrho; ++irho )
+        {
+
+            t = t0;
+            dt = exp( log( t1 / t0 ) / ( nt - 1 ) );
+            for( it = 1; it <= nt; ++it )
+            {
+                /* ----------------------------------------------------------------------------- */
+                /* Calculation of Rosseland or Planck mean opacities using a chosen density,     */
+                /* temperature, silicate dust model, shape of the grains and their topology:     */
+                /* ----------------------------------------------------------------------------- */
+                cop( ed, eg, &rho, &t, &akext );
+
+                if( ross )
+                {
+                    OpacTable_Ross[nrho * ( irho - 1 ) + ( it - 1 )] = akext;
+                }
+                else
+                {
+                    OpacTable_Planck[nrho * ( irho - 1 ) + ( it - 1 )] = akext;
+                }
+
+                t *= dt;
+            }
+
+            rho *= drho;
+        }
+    }
+
+    /* Write opacity tables */
+    FILE *fOpacPlanck = fopen( "kP.dat", "w" );
+    bytes_written = fwrite( OpacTable_Planck, sizeof( double ), nt * nrho, fOpacPlanck );
+    printf( "Wrote Planck opacity table (%d bytes written).\n", bytes_written );
+    fclose( fOpacPlanck );
+
+    FILE *fOpacRoss = fopen( "kR.dat", "w" );
+    bytes_written = fwrite( OpacTable_Ross, sizeof( double ), nt * nrho, fOpacRoss );
+    printf( "Wrote Rosseland opacity table (%d bytes written).\n", bytes_written );
+    fclose( fOpacRoss );
+    return 0;
+}
+
+#endif
+
+/* ............................................................................. */
+/* Subroutine that initialize the polynomial fit coefficients for a chosen */
+/* opacity kind and dust model */
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/*   'ross': choose a kind of opacity: */
+/*         = '.true.'  - Rosseland mean, */
+/*         = '.false.' - Planck mean, */
+/*  'model': specify a silicate type, */
+/*         = 'nrm' - "normal" silicate dust model,    Fe/(Fe+Mg)=0.3, */
+/*         = 'ips' - "iron-poor" silicate dust model, Fe/(Fe+Mg)=0.0, */
+/*         = 'irs' - "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4, */
+/*    'top': specify a topology of the grains, */
+/*         = 'h' - homogeneous particles, */
+/*         = 'c' - composite particles, */
+/*         = 'p' - porous composite particles, */
+/*  'shape': specify a shape of the particles, */
+/*         = 's' - spherical dust, */
+/*         = 'a' - aggregate dust, */
+/*         = '5' - 5-layered spherical dust */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(I,J),I=1,5,J=1,6 -> opacity fit coefficients (extinction), */
+/*            where I describe a temperature region and J - position of */
+/*            a fit coefficient in the fit polynom. */
+
+/* ............................................................................. */
+int init_d( int *ross, char *model, char *top, char *shape, double *ed, int model_len, int top_len, int shape_len )
+{
+    /* Search among possible models: */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    if( strncmp( model, "nrm", 3 ) == 0 )
+    {
+        /* "normal" silicate models, */
+        if( *top == 'h' )
+        {
+            /* homogeneous */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                nrm_h_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                nrm_h_a( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'c' )
+        {
+            /* composite compact */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                nrm_c_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                nrm_c_a( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                nrm_c_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'p' )
+        {
+            /* porous composite */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                nrm_p_s( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                nrm_p_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else
+        {
+            printf( "Chosen dust model is not correct!\n" );
+            exit( 1 );
+        }
+    }
+    else if( strncmp( model, "ips", 3 ) == 0 )
+    {
+        /* "iron-poor" silicate models, */
+        if( *top == 'h' )
+        {
+            /* homogeneous */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                ips_h_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                ips_h_a( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'c' )
+        {
+            /* composite compact */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                ips_c_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                ips_c_a( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                ips_c_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'p' )
+        {
+            /* porous composite */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                ips_p_s( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                ips_p_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else
+        {
+            printf( "Chosen dust model is not correct!\n" );
+            exit( 1 );
+        }
+    }
+    else if( strncmp( model, "irs", 3 ) == 0 )
+    {
+        /* "iron-rich" silicate models, */
+        if( *top == 'h' )
+        {
+            /* homogeneous */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                irs_h_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                irs_h_a( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'c' )
+        {
+            /* composite compact */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                irs_c_s( ross, &ed[6] );
+            }
+            else if( *shape == 'a' )
+            {
+                /* aggregate particles, */
+                irs_c_a( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                irs_c_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else if( *top == 'p' )
+        {
+            /* porous composite */
+            if( *shape == 's' )
+            {
+                /* spherical particles, */
+                irs_p_s( ross, &ed[6] );
+            }
+            else if( *shape == '5' )
+            {
+                /* 5-layered spherical particles, */
+                irs_p_5( ross, &ed[6] );
+            }
+            else
+            {
+                printf( "Chosen dust model is not correct!\n" );
+                exit( 1 );
+            }
+        }
+        else
+        {
+            printf( "Chosen dust model is not correct!\n" );
+            exit( 1 );
+        }
+    }
+    else
+    {
+        printf( "Chosen dust model is not correct!\n" );
+        exit( 1 );
+    }
+    return 0;
+}
+
+/* ............................................................................. */
+/* Subroutine that initialize Rosseland or Planck mean gas opacity data. */
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/* 'ross': a kind of opacity, */
+/*       = '.true.'  - Rosseland opacity, */
+/*       = '.false.' - Planck opacity, */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/*   'eG': eG(71,71) - Rosseland or Planck mean gas opacity grids */
+/* ............................................................................. */
+int init_g( int *ross, double *eg )
+{
+    FILE *file = NULL;
+    int i, j, k, res;
+    double seq[5041];
+
+    if( *ross )
+    {
+        file = fopen( "kR_h2001.dat", "r" );
+    }
+    else
+    {
+        file = fopen( "kP_h2001.dat", "r" );
+    }
+
+    if( file == NULL )
+    {
+        printf( "Unable to open file!" );
+        exit( 1 );
+    }
+
+    res = fscanf( file, "%lf", &seq[0] ); //dummy read
+
+    for( k = 0; k < 5041; ++k )
+    {
+        res = fscanf( file, "%lf", &seq[k] );
+    }
+
+    /* Convert it to the input form: */
+    k = 0;
+    for( i = 0; i < 71; ++i )
+    {
+        for( j = 0; j < 71; ++j )
+        {
+            eg[i + j * 71] = seq[k];
+            ++k;
+        }
+    }
+    fclose( file );
+    return 0;
+}
+
+int init_g2( char *filepath, double *eg )
+{
+    FILE *file = NULL;
+    int i, j, k, res;
+    double seq[5041];
+
+    file = fopen( filepath, "r" );
+    if( file == NULL )
+    {
+        printf( "Unable to open file %s!", filepath );
+        exit( 1 );
+    }
+
+    res = fscanf( file, "%lf", &seq[0] ); //dummy read
+
+    for( k = 0; k < 5041; ++k )
+    {
+        res = fscanf( file, "%lf", &seq[k] );
+    }
+
+    /* Convert it to the input form: */
+    k = 0;
+    for( i = 0; i < 71; ++i )
+    {
+        for( j = 0; j < 71; ++j )
+        {
+            eg[i + j * 71] = seq[k];
+            ++k;
+        }
+    }
+    fclose( file );
+    return 0;
+}
+
+
+/* ............................................................................. */
+/* Unification of dust- and gas-dominated opacities */
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/*     'eD': eD(5,6) - dust opacity fit coefficients, */
+
+/*     'eG': eG(71,71) - gas opacity grid, */
+
+/* 'rho_in': chosen gas density, g/cm^3, */
+
+/*   'T_in': chosen gas temperature, K */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/*  'aKext': Rosseland or Planck mean opacities (extinction), cm^2/g */
+
+/* ............................................................................. */
+int cop( double *ed, double *eg, double *rho_in__, double *t_in__, double *akext )
+{
+    /* Initialized data */
+
+    double ro[8] = { 1e-18, 1e-16, 1e-14, 1e-12, 1e-10, 1e-8, 1e-6, 1e-4 };
+    double tt[32]   /* was [8][4] */ = { 109., 118., 129., 143., 159.,
+                                         180., 207., 244., 835., 908., 994., 1100., 1230., 1395., 1612., 1908., 902.,
+                                         980., 1049., 1129., 1222., 1331., 1462., 1621., 929., 997., 1076., 1168.,
+                                         1277., 1408., 1570., 1774.
+                                       };
+
+    /* System generated locals */
+    double d__1;
+
+    /* Local variables */
+    int i__, j;
+    double t[5], t1, t2, aa, bb, ff;
+    int kk;
+    double dt[5], pi, td;
+    int it;
+    double akrl;
+    double t_ev__[4], akrr, temp[8], tmin, tmax1, tmax2;
+    int smooth, c8 = 8;
+    double akg_ext__;
+
+    /* Global variable(s): */
+    /* Local variable(s): */
+    /* Data related to the evaporation temperatures of silicates, iron and ice: */
+    /* Parameter adjustments */
+    eg -= 72;
+    ed -= 6;
+
+    /* Function Body */
+    /*                                                    !'ro' */
+    /* Initialization of the output parameters: */
+    /* Water ice evaporat */
+    /* temperature, */
+    /* then metallic iron */
+
+    /* orthopyroxene */
+    /* and */
+    /* olivine */
+    /* depending on densi */
+    *akext = 0.;
+    if( *t_in__ < 1. )
+    {
+        return 0;
+    }
+    /* ............................................................................. */
+    /* Constant(s): */
+    /* ............................................................................. */
+    /* T must be more that few degrees [K] */
+    pi = atan( 1. ) * 4.;
+    /* ............................................................................. */
+    /* Interpolation of a matrix of evaporation temperatures for a given density */
+    /* 'rho_in': */
+    /* ............................................................................. */
+    /* Pi */
+    for( i__ = 1; i__ <= 4; ++i__ )
+    {
+        for( j = 1; j <= 8; ++j )
+        {
+            temp[j - 1] = tt[j + ( i__ << 3 ) - 9];
+        }
+        bint( rho_in__, &c8, ro, &t_ev__[i__ - 1], temp );
+    }
+    /* ............................................................................. */
+    /*  Set up the evaporation temperature array 'T(1:5)': */
+    /* ............................................................................. */
+    t[0] = t_ev__[0];
+    /* accretion disks: */
+    /* evaporation temperature of water ice, */
+    t[1] = 275.;
+    /* evaporation temperature of volatile organics, */
+    t[2] = 425.;
+    /* evaporation temperature of refractory organic */
+    t[3] = 680.;
+    /* evaporation temperature of troilite, */
+    tmax1 = fmax( t_ev__[1], t_ev__[2] );
+    tmax2 = fmax( t_ev__[2], t_ev__[3] );
+    tmin = fmin( tmax1, tmax2 );
+    t[4] = tmin;
+    /*                         !olivine, and orthopyroxene */
+    /* ............................................................................. */
+    /* Determination of a temperature regime where smoothing is necessary */
+    /* ............................................................................ */
+    /* average evaporation temperatures of iron, */
+    dt[0] = 5.;
+    /* an interval of T where ice is evaporating, */
+    dt[1] = 5.;
+    /* an interval of T where vol. organics is evaporat */
+    dt[2] = 15.;
+    /* an interval of T where ref. organics is evapora */
+    dt[3] = 5.;
+    /* an interval of T where troilite is evaporating, */
+    dt[4] = 100.;
+    /*                            !olivine are evaporating, */
+    /* ............................................................................. */
+    /* Determination of a temperature regime for a given temperature: */
+    /* ............................................................................. */
+    /* an wide interval of T where iron, pyroxe, and */
+    kk = 6;
+    /* default value -> gas-dominated opacity, */
+    if( *t_in__ <= t[0] + dt[0] )
+    {
+        kk = 1;
+    }
+    for( it = 2; it <= 5; ++it )
+    {
+        if( *t_in__ > t[it - 2] + dt[it - 2] && *t_in__ <= t[it - 1] + dt[it
+                - 1] )
+        {
+            kk = it;
+        }
+    }
+    /* ............................................................................. */
+    /* The gas-dominated opacity: */
+    /* ............................................................................. */
+    if( kk == 6 )
+    {
+        gop( &eg[72], rho_in__, t_in__, akext );
+        return 0;
+    }
+    /* ............................................................................. */
+    /* The dust-dominated opacity: */
+    /* ............................................................................. */
+    /* Switch to smoothing of the opacity if a temperature is near an */
+    /* evaporation temperature of a dust material: */
+    /* ............................................................................. */
+    smooth = 0;
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        if( ( d__1 = *t_in__ - t[i__ - 1], fabs( d__1 ) ) <= dt[i__ - 1] )
+        {
+            smooth = 1;
+        }
+    }
+    /* ----------------------------------------------------------------------------- */
+    /* If 'T_in' inside of (Tev-dT, Tev+dT) then start smoothing: */
+    /* ----------------------------------------------------------------------------- */
+    if( smooth )
+    {
+        t1 = t[kk - 1] - dt[kk - 1];
+        t2 = t[kk - 1] + dt[kk - 1];
+        td = *t_in__ - t[kk - 1];
+        /* ----------------------------------------------------------------------------- */
+        /* Calculation of a mean opacity (extinction): */
+        /* ----------------------------------------------------------------------------- */
+        akrl = ( ( ( ( ed[kk + 5] * t1 + ed[kk + 10] ) * t1 + ed[kk + 15] ) * t1 +
+                   ed[kk + 20] ) * t1 + ed[kk + 25] ) * t1 + ed[kk + 30];
+
+        if( kk == 5 )
+        {
+            gop( &eg[72], rho_in__, &t2, &akg_ext__ );
+            akrr = akg_ext__;
+        }
+        else
+        {
+            akrr = ( ( ( ( ed[kk + 6] * t2 + ed[kk + 11] ) * t2 + ed[kk + 16] ) *
+                       t2 + ed[kk + 21] ) * t2 + ed[kk + 26] ) * t2 + ed[kk + 31];
+        }
+
+        aa = ( akrl - akrr ) * .5;
+        bb = ( akrl + akrr ) * .5;
+        ff = pi / 2. / dt[kk - 1];
+        *akext = bb - aa * sin( ff * td );
+
+    }
+    else
+    {
+        /* ............................................................................. */
+        /*  Smoothing is not necessary, direct calculation by a fit polinom of */
+        /*  fifth degree: y=a*x^5+b*x^4+c*x^3+d*x^2+e*x+f */
+        /* ............................................................................. */
+        *akext = ( ( ( ( ed[kk + 5] * *t_in__ + ed[kk + 10] ) * *t_in__ + ed[kk +
+                       15] ) * *t_in__ + ed[kk + 20] ) * *t_in__ + ed[kk + 25] ) * *
+                 t_in__ + ed[kk + 30];
+    }
+    /* Exit: */
+    return 0;
+} /* cop */
+
+/* ............................................................................. */
+/* Gas-dominated opacities, ~1,500 K<T<10,000 K */
+/* ............................................................................. */
+/* The master grid of Rosseland and Planck mean gas opacities. */
+/* It has been calculated for me by Ch. Helling (2001): */
+/* chris@astro.physik.tu-berlin.de */
+
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/*     'eG': eG(71,71) - gas opacity grids, */
+
+/* 'rho_in': gas density, g/cm^3, */
+
+/*   'T_in': gas temperature, K */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/*     'aK': Rosseland or Planck mean opacities (extinction), cm^2/g */
+
+/* ............................................................................. */
+int gop( double *eg, double *rho_in__, double *t_in__, double *ak )
+{
+    /* Initialized data */
+
+    double t[71] = { 500., 521.86, 544.68, 568.5, 593.35, 619.3, 646.38,
+                     674.64, 704.14, 734.93, 767.06, 800.6, 835.61, 872.15, 910.28, 950.08,
+                     991.63, 1034.99, 1080.24, 1127.47, 1176.77, 1228.23, 1281.93, 1337.99,
+                     1396.49, 1457.55, 1521.28, 1587.8, 1657.23, 1729.69, 1805.32, 1884.26,
+                     1966.65, 2052.64, 2142.39, 2236.07, 2333.84, 2435.89, 2542.4, 2653.56,
+                     2769.59, 2890.69, 3017.09, 3149.01, 3286.7, 3430.41, 3580.41, 3736.96,
+                     3900.36, 4070.91, 4248.91, 4434.69, 4628.6, 4830.98, 5042.22, 5262.69,
+                     5492.8, 5732.98, 5983.65, 6245.29, 6518.36, 6803.38, 7100.86, 7411.34,
+                     7735.41, 8073.64, 8426.66, 8795.12, 9179.68, 9581.07, 1e4
+                   };
+    double rho[71] = { 2.364e-7, 1.646e-7, 1.147e-7, 7.985e-8, 5.56e-8,
+                       3.872e-8, 2.697e-8, 1.878e-8, 1.308e-8, 9.107e-9, 6.342e-9, 4.417e-9,
+                       3.076e-9, 2.142e-9, 1.492e-9, 1.039e-9, 7.234e-10, 5.038e-10, 3.508e-10,
+                       2.443e-10, 1.701e-10, 1.185e-10, 8.252e-11, 5.746e-11, 4.002e-11,
+                       2.787e-11, 1.941e-11, 1.352e-11, 9.412e-12, 6.554e-12, 4.565e-12,
+                       3.179e-12, 2.214e-12, 1.542e-12, 1.074e-12, 7.476e-13, 5.206e-13,
+                       3.626e-13, 2.525e-13, 1.758e-13, 1.225e-13, 8.528e-14, 5.939e-14,
+                       4.136e-14, 2.88e-14, 2.006e-14, 1.397e-14, 9.727e-15, 6.774e-15,
+                       4.717e-15, 3.285e-15, 2.288e-15, 1.593e-15, 1.109e-15, 7.726e-16,
+                       5.381e-16, 3.747e-16, 2.609e-16, 1.817e-16, 1.265e-16, 8.813e-17,
+                       6.137e-17, 4.274e-17, 2.976e-17, 2.073e-17, 1.443e-17, 1.005e-17, 7e-18,
+                       4.875e-18, 3.395e-18, 2.364e-18
+                     };
+
+    int iflag, c71 = 71;
+    double akext;
+
+    /* The temperature array for which the calculation have been performed: */
+    /* Parameter adjustments */
+    eg -= 72;
+
+    /* Function Body */
+    /* The density array for which the calculation have been performed: */
+
+    /* Initialization of output parameter(s): */
+    *ak = 0.;
+    iflag = 0;
+
+    /* Check if the input parameters "rho_in", "T_in" are inside */
+    /* the ranges: */
+    if( *rho_in__ > 1e-7 )
+    {
+        return 0;
+    }
+    if( *rho_in__ < 1e-19 )
+    {
+        return 0;
+    }
+    if( *t_in__ < 500.f )
+    {
+        return 0;
+    }
+    if( *t_in__ > 1e4 )
+    {
+        return 0;
+    }
+    /* The parameters are outside the ranges, send "stop" signal: */
+    if( iflag == 1 )
+    {
+        printf( "gop: input parameters outside the ranges::\n" );
+        printf( "rho_in = %lf T_in = %lf\n", *rho_in__, *t_in__ );
+        exit( 1 );
+    }
+    /* Calculate the opacity: */
+    eint( &c71, rho, &c71, t, &eg[72], rho_in__, t_in__, &akext );
+    /* Convert it to the linear scale: */
+    *ak = exp( akext * log( 10. ) );
+    /* Exit: */
+    return 0;
+} /* gop */
+
+/* ............................................................................. */
+/* Quadratic interpolation inside a given array of values. */
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/*  'xa': the value for which interpolation must be performed, */
+
+/*   'x': X(N) - arrayies of values, */
+
+/*  'ri': RI(N) - arrayies of values */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/* 'res': result of the interpolation */
+
+/* ............................................................................. */
+int bint( double *xa, int *n, double *x, double *res, double *ri )
+{
+    int i1, i2, hi, mid, low;
+
+    /* Parameter adjustments */
+    --ri;
+    --x;
+
+    /* Function Body */
+    if( *xa >= x[1] )
+    {
+        goto L5;
+    }
+    i2 = 2;
+    goto L99;
+L5:
+    if( *xa <= x[*n] )
+    {
+        goto L7;
+    }
+    i2 = *n;
+    goto L99;
+L7:
+    /* 2 SEARCH IN THE 'X(N)' */
+    low = 1;
+    hi = *n + 1;
+L10:
+    mid = ( hi + low ) / 2;
+    if( *xa <= x[mid] )
+    {
+        goto L20;
+    }
+    low = mid;
+    goto L90;
+L20:
+    hi = mid;
+    if( *xa >= x[mid - 1] )
+    {
+        goto L30;
+    }
+L90:
+    goto L10;
+L30:
+    i2 = mid;
+L99:
+    /* 3 QUAD. INTERPOLATION IN 'RI(N)' */
+    i1 = i2 - 1;
+    *res = ( ri[i2] - ri[i1] ) / ( x[i2] - x[i1] ) * ( *xa - x[i1] ) + ri[i1];
+    return 0;
+} /* bint */
+
+/* ............................................................................. */
+/* Quadratic interpolation inside a given array of values. */
+/* ............................................................................. */
+/* Input parameter(s): */
+/* ............................................................................. */
+
+/*  'N': dimension of first array X, */
+
+/*  'X': X(1:N) - array that contains first set of grid points, */
+
+/*  'M': dimension of second array Y, */
+
+/*  'Y': Y(1:M) - array that contains second set of grid points, */
+
+/*  'D': D(1:N,1:M) - two-dimensional table to be interpolated/extrapolated, */
+
+/* 'XP': first value for that interpolation/extrapolation will be */
+/*       performed, */
+
+/* 'YP': second value for that interpolation/extrapolation will be */
+/*       performed, */
+
+/* ............................................................................. */
+/* Output parameter(s): */
+/* ............................................................................. */
+
+/* 'DP': a result of interpolation/extrapolation */
+
+/* ............................................................................. */
+int eint( int *n, double *x, int *m, double *y, double *d__, double *xp, double *yp, double *dp )
+{
+    /* System generated locals */
+    int d_dim1, d_offset, i__1;
+
+    /* Local variables */
+    double a, b, c__;
+    int i__, ip;
+    double xtmp[71];
+
+    /* Global variable(s): */
+    /* Local variable(s): */
+    /* ATTENTION: n=71 now hardcoded (necessary to avoid error when using f2c). */
+    /* M.F. Thu Aug  9 13:26:36 EDT 2012 */
+    /*     DIMENSION xtmp(n) */
+    /* Parameter adjustments */
+    --x;
+    d_dim1 = *n;
+    d_offset = 1 + d_dim1;
+    d__ -= d_offset;
+    --y;
+
+    /* Function Body */
+    if( *n != 71 )
+    {
+        printf( "EINT: n should equal 71.\n" );
+        exit( 1 );
+    }
+    /* Search the nearest grid point to the 'YP': */
+    i__ = 1;
+    ip = 0;
+L10:
+    if( i__ > *m )
+    {
+        goto L20;
+    }
+    /* if 'YP' outside the range of 'Y' then exit, */
+    if( *yp <= y[i__] )
+    {
+        /* find the nearest knot, exit */
+        ip = i__ - 1;
+        goto L20;
+    }
+    ++i__;
+    goto L10;
+    /* increase a counter and search again, */
+L20:
+    /* If 'YP' outside the range of 'Y' then print an error message and stop: */
+    if( ip == 0 )
+    {
+        printf( "EINT: YP outside the range of Y\n" );
+        exit( 1 );
+    }
+    /* Create temporary array for that interpolation/extrapolation will be */
+    /* performed: */
+    i__1 = *n;
+    for( i__ = 1; i__ <= i__1; ++i__ )
+    {
+        xtmp[i__ - 1] = d__[i__ + ip * d_dim1] + ( d__[i__ + ( ip + 1 ) * d_dim1]
+                        - d__[i__ + ip * d_dim1] ) / ( y[ip + 1] - y[ip] ) * ( *yp - y[
+                                    ip] );
+    }
+    /* Search the nearest grid point to the 'XP': */
+    i__ = 1;
+    ip = 0;
+L30:
+    if( i__ > *n )
+    {
+        goto L40;
+    }
+    /* if 'XP' outside the range of 'X' then exit, */
+    if( *xp >= x[i__] )
+    {
+        /* find the nearest knot, exit */
+        ip = i__ - 1;
+        goto L40;
+    }
+    ++i__;
+    goto L30;
+    /* increase a counter and search again, */
+L40:
+    /* Interpolation of 'xtmp(1:N)' if 'XP' inside the range of 'X(1:N)': */
+    if( ip != 0 )
+    {
+        *dp = xtmp[ip - 1] + ( xtmp[ip] - xtmp[ip - 1] ) / ( x[ip + 1] - x[ip] ) *
+              ( *xp - x[ip] );
+    }
+    else
+    {
+        /* Extrapolation of 'xtmp(1:N)' for a given 'XP' and knots array 'X(1:N)' */
+        /* by the simplest quadratic fit: */
+        a = ( ( xtmp[*n - 1] - xtmp[*n - 2] ) / ( x[*n] - x[*n - 1] ) - ( xtmp[*n -
+                2] - xtmp[*n - 3] ) / ( x[*n - 1] - x[*n - 2] ) ) / ( x[*n] - x[*n
+                        - 2] );
+        b = ( xtmp[*n - 1] - xtmp[*n - 2] ) / ( x[*n] - x[*n - 1] ) - a * ( x[*n]
+                + x[*n - 1] );
+        c__ = xtmp[*n - 1] - a * x[*n] * x[*n] - b * x[*n];
+        *dp = a * *xp * *xp + b * *xp + c__;
+    }
+    /* Exit: */
+    return 0;
+} /* eint */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_h_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 3.19006401785413e-12,
+                                         -3.71333580736933e-12, 4.04997080931974e-13, 7.28005983960845e-14,
+                                         -9.16709776405312e-17, -3.89280273285906e-9, 5.8715126950896e-9,
+                                         -1.05506373600323e-9, -2.07587683535083e-10, 8.03836688553263e-13,
+                                         4.54088516995579e-7, -3.49287851393541e-6, 1.10792133181219e-6,
+                                         2.33773506650911e-7, -3.00202906476749e-9, 2.29132294521843e-4,
+                                         9.23001367150898e-4, -5.82601311634824e-4, -1.27355043519226e-4,
+                                         5.90717655258634e-6, -1.91588103585833e-4, -.0801305197566973,
+                                         .160197849829283, .0354301116460647, -.00260479348963077,
+                                         2.44153190819473e-4, 2.92517586013911, -12.5893536782728,
+                                         -1.92550086994197, 1.65244978116957
+                                       };
+    double ep[30]   /* was [5][6] */ = { -6.64969066656727e-11,
+                                         -3.71134628305626e-12, 2.33228177925061e-13, 1.15933380913977e-13,
+                                         -5.03398974713655e-16, 4.2737369456088e-8, 4.72321713029246e-9,
+                                         -6.8113840099694e-10, -3.4946755212609e-10, 4.17753047583439e-12,
+                                         -1.08371821805323e-5, -2.10704968520099e-6, 7.84339065020565e-7,
+                                         4.17313950448598e-7, -1.40583908595144e-8, .0013073258847462,
+                                         3.11604311624702e-4, -4.36299138970822e-4, -2.40971082612604e-4,
+                                         2.38329845360675e-5, -.00191556936842122, .0302186734201724,
+                                         .120954274022502, .0664915248499724, -.0166789974601131,
+                                         4.23062838413742e-4, -1.73587657890234, -6.38046050114383,
+                                         -3.45042341508906, 6.67823366719512
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"normal\" silicates; homogeneous spheres\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* nrm_h_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_h_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 1.68861023303854e-11,
+                                         -8.9850072680019e-12, 5.82530990776154e-13, -1.48326508937668e-13,
+                                         -4.30701986706985e-16, -1.20402290627887e-8, 1.28198928214142e-8,
+                                         -1.50953570991798e-9, 4.08108978612667e-10, 3.39564249503292e-12,
+                                         1.77953606574835e-6, -6.93522864221904e-6, 1.56218937076688e-6,
+                                         -4.51279568324355e-7, -1.07516953060505e-8, 2.12362579369808e-4,
+                                         .00168403875453076, -8.01998052899398e-4, 2.55292916286856e-4,
+                                         1.72441594083825e-5, 7.78492928244887e-4, -.147692895446187,
+                                         .207736375394269, -.0740119036963982, -.0125379874861012,
+                                         .0241868473745753, 5.29937764788582, -15.013888523115,
+                                         11.6718738764544, 8.51701322511245
+                                       };
+    double ep[30]   /* was [5][6] */ = { -4.92069777333529e-11,
+                                         -2.23226569654021e-12, 4.17660592123971e-13, 7.36941850981986e-14,
+                                         -9.33742153131707e-16, 3.51613326727785e-8, 2.34420258427756e-9,
+                                         -1.09660407626912e-9, -2.33461926078913e-10, 7.57125209044329e-12,
+                                         -1.04115039477478e-5, -5.49552382795955e-7, 1.15365821720713e-6,
+                                         2.91321994671026e-7, -2.48981597495535e-8, .00143929174351961,
+                                         -2.07570458861422e-4, -5.9765296278811e-4, -1.70963348654879e-4,
+                                         4.20975013057549e-5, -.00560836248243543, .114110901145235,
+                                         .15142548229089, .0431209143726505, -.0358197096572059,
+                                         .0347493611283224, -5.23802684273195, -6.72104055072077,
+                                         1.25341599902458, 17.9030725409353
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"normal\" silicates; homogeneous dust aggregates\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* nrm_h_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_c_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 7.20701447856184e-12,
+                                         -2.4907659681787e-12, 1.47047692292156e-13, -7.03016585961037e-14,
+                                         -2.70939930597314e-16, -5.035038549077e-9, 3.7708862230036e-9,
+                                         -3.87482891475618e-10, 2.02821751746324e-10, 2.10746431618766e-12,
+                                         2.26842045361197e-7, -2.19234912973936e-6, 4.04456534975749e-7,
+                                         -2.17017102230874e-7, -6.42207600441133e-9, 3.12806097218514e-4,
+                                         5.83335936413833e-4, -2.13826028150926e-4, 9.9001304033286e-5,
+                                         9.44843848093039e-6, 1.80058512896224e-4, -.0422661131364785,
+                                         .0755230656285519, -.00826824733591991, -.00371281327665396,
+                                         5.19867225867212e-4, 1.51792930161834, -5.77453341827436,
+                                         .0778024394658132, 1.84662967567162
+                                       };
+    double ep[30]   /* was [5][6] */ = { -4.76229927324027e-11,
+                                         -2.01419780917042e-12, 3.0017038055868e-13, 4.83186183366502e-14,
+                                         -6.01503795230963e-16, 3.23115304363536e-8, 2.43303301704539e-9,
+                                         -7.25143652779537e-10, -1.56443323825868e-10, 4.5775427780804e-12,
+                                         -8.98454373102764e-6, -9.74542613966394e-7, 6.81446617689516e-7,
+                                         2.23303922683611e-7, -1.37464170006e-8, .0011978903527625,
+                                         9.36919615518259e-5, -3.12657620965884e-4, -1.70154802757033e-4,
+                                         2.05252303643339e-5, 1.41738348367326e-4, .0429796005017331,
+                                         .0865739688529015, .0715076192965753, -.0127405068642357,
+                                         .0019193409307739, -1.93487570913044, -4.11421919689133,
+                                         -8.03761464382478, 5.66279740952716
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"normal\" silicates; composite dust aggregates\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* nrm_c_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_h_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 5.7601981357577e-12,
+                                         -4.99769242535922e-12, 5.12323092131981e-13, 2.18800655107819e-14,
+                                         -8.07771637816195e-17, -5.66838675003818e-9, 7.59080537623659e-9,
+                                         -1.29960038970606e-9, -5.84337549441558e-11, 6.9565630029198e-13,
+                                         8.30337800213717e-7, -4.35964811951971e-6, 1.32446896467955e-6,
+                                         5.80076458925913e-8, -2.66757554277098e-9, 2.04146163684104e-4,
+                                         .00112173944288055, -6.73319917371393e-4, -2.26453533385684e-5,
+                                         5.63354515903305e-6, -1.77447081534454e-4, -.10072601112787,
+                                         .176434307754734, .00326534361175135, -.00246214277093693,
+                                         2.11770185099498e-4, 3.6878091307137, -13.5596059076829,
+                                         1.69682934809634, 1.52636093726865
+                                       };
+    double ep[30]   /* was [5][6] */ = { -6.35517551097894e-11,
+                                         -3.99054808930408e-12, 4.23592172055043e-13, 1.03007824797934e-13,
+                                         -5.07440298515937e-16, 4.11226694501098e-8, 5.05310547896248e-9,
+                                         -1.10532072036976e-9, -3.14505673133739e-10, 4.30806156797121e-12,
+                                         -1.06062336214121e-5, -2.22408956189724e-6, 1.15791165287928e-6,
+                                         3.78718718884228e-7, -1.49005526499236e-8, .00130671183384587,
+                                         3.13929052700822e-4, -5.9691242367995e-4, -2.17573779858773e-4,
+                                         2.59836392325083e-5, -.0019618111469326, .0344865312784342,
+                                         .152941991504775, .0575577983185305, -.0184990920136232,
+                                         3.66050010135324e-4, -2.01187462059437, -8.58634798903256,
+                                         -2.02130563003175, 7.26442191429906
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; homogeneous spheres\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* irs_h_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_h_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 7.72639728356779e-12,
+                                         -5.39749898970236e-12, 6.60406670336159e-13, -2.33899135385353e-14,
+                                         -3.17922057748607e-16, -6.44080151348334e-9, 8.11505188904135e-9,
+                                         -1.61644832093921e-9, 7.06927420757404e-11, 2.41375714896697e-12,
+                                         7.97866868723018e-7, -4.57761180939179e-6, 1.58678357831901e-6,
+                                         -8.98412919246258e-8, -7.34197574322242e-9, 2.25883090984006e-4,
+                                         .00114345774728591, -7.76788395443505e-4, 6.21507631333035e-5,
+                                         1.11264442431855e-5, 7.25480550488905e-4, -.0978898757466869,
+                                         .193581659006369, -.0217355364350702, -.00628811292824788,
+                                         .0122051600622987, 3.51782822672046, -14.2469784180394,
+                                         4.55053117028592, 4.2703125052222
+                                       };
+    double ep[30]   /* was [5][6] */ = { -5.63594999938697e-11,
+                                         -3.56750876770514e-12, 4.46380347955089e-13, 6.25274066877062e-14,
+                                         -6.99946491795733e-16, 3.71451774259654e-8, 4.4624421523035e-9,
+                                         -1.14262235245685e-9, -2.01506580979103e-10, 5.67273543670362e-12,
+                                         -9.91789085614209e-6, -1.90441507450207e-6, 1.17745875827923e-6,
+                                         2.54218142577747e-7, -1.8556933234777e-8, .00127218972995149,
+                                         2.29778613121725e-4, -6.01246324800964e-4, -1.50393927880021e-4,
+                                         3.08276173039628e-5, -.0036189352939031, .0440416079300803,
+                                         .152170793836831, .0388871968614808, -.0243329166513556,
+                                         .0173619167582948, -2.31559089154565, -8.36542813568644,
+                                         .0450982708771335, 11.2607539943696
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; homogeneous dust aggregates\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* irs_h_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_c_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 1.69718972871675e-11,
+                                         -6.94375347617142e-12, 2.15423123300413e-12, -1.53228592726268e-14,
+                                         -1.90340462215016e-16, -1.21998488943724e-8, 1.0029623044894e-8,
+                                         -5.04005652039218e-9, 4.92876842625018e-11, 1.54287786660063e-12,
+                                         1.93536758125125e-6, -5.49498202994399e-6, 4.69679087503714e-6,
+                                         -6.73038576343371e-8, -4.97946233406153e-9, 1.66188782516588e-4,
+                                         .00135478657540836, -.00217615792442986, 5.02152454110172e-5,
+                                         7.85141889125417e-6, -3.81731756583378e-5, -.120651633250931,
+                                         .505806507849164, -.0180098161036177, -.00335902561018642,
+                                         2.76801205127708e-4, 4.35206756800406, -41.8745489893471,
+                                         3.99640879074968, 1.66403764989818
+                                       };
+    double ep[30]   /* was [5][6] */ = { -5.04975573012723e-11,
+                                         -2.84324563106125e-12, 2.50213657686044e-13, 9.05652406698726e-14,
+                                         -5.93836462006964e-16, 3.47295030021792e-8, 3.43435803167343e-9,
+                                         -7.26370420955544e-10, -2.77723357901886e-10, 4.6838348665875e-12,
+                                         -9.79492648574967e-6, -1.32874934767691e-6, 8.25426710793917e-7,
+                                         3.33848011897829e-7, -1.47239788122946e-8, .0013004022706089,
+                                         7.39284258260507e-5, -4.51586611989657e-4, -1.90725939425124e-4,
+                                         2.30940509311539e-5, -.00181306680219879, .0634803174529273,
+                                         .120127510474273, .0496177910255966, -.0157858987410152,
+                                         5.13261299896949e-4, -3.02044626872119, -5.54325826392903,
+                                         -1.20153037129148, 6.56777392849503
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; composite dust aggregates\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* irs_c_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_h_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 3.00658051669719e-12,
+                                         -1.97259390203938e-12, 1.6853302497342e-13, 6.04125759038766e-14,
+                                         -9.95717001478127e-17, -2.63154481829747e-9, 3.3639755865301e-9,
+                                         -5.02191662104894e-10, -1.80575722027018e-10, 8.34292133110325e-13,
+                                         4.92257291893745e-9, -2.13035111086644e-6, 5.9830807272656e-7,
+                                         2.15594092859513e-7, -2.91317607660158e-9, 2.62302100896287e-4,
+                                         5.8664326934511e-4, -3.54139964409472e-4, -1.27353304604103e-4,
+                                         5.30437772788307e-6, -1.21087027799125e-4, -.0446872071903881,
+                                         .111785864483419, .0397412595455471, -.00213405804655453,
+                                         4.48716952118912e-4, 1.60360533954925, -9.02203683840924,
+                                         -3.15688727136694, 1.61185826559431
+                                       };
+    double ep[30]   /* was [5][6] */ = { -7.62495034669013e-11,
+                                         -2.08817975056004e-12, 4.55478517863122e-14, 5.77110185903943e-14,
+                                         -3.57521081391269e-16, 4.8138140778987e-8, 2.77595756494202e-9,
+                                         -2.4295051425259e-10, -1.89643620784973e-10, 2.97294385961353e-12,
+                                         -1.16414113322383e-5, -1.28917595517889e-6, 3.80173868432801e-7,
+                                         2.47521007681076e-7, -1.00417000376078e-8, .00131102314677719,
+                                         1.89740387075683e-4, -2.56477546533858e-4, -1.57195774544663e-4,
+                                         1.7204727555092e-5, -.00180871641248512, .0293545307083072,
+                                         .0847456608016088, .0492650962434666, -.0119523016015378,
+                                         6.7524714237124e-4, -1.38141401076848, -4.50160901769459,
+                                         -2.99569196780794, 5.29996631480414
+                                       };
+
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; homogeneous spheres\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* ips_h_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  homogeneous aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_h_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 3.9876690691785e-11,
+                                         -2.1711905581049e-11, 1.82985315295776e-12, -8.05198016715616e-14,
+                                         -9.73535924542553e-16, -3.01219020238261e-8, 3.00228652654332e-8,
+                                         -4.41708307565184e-9, 1.79046803997717e-10, 7.52166814380431e-12,
+                                         5.77520635928109e-6, -1.57651765131816e-5, 4.27780234609545e-6,
+                                         -1.5626629350842e-7, -2.35802897829936e-8, 5.96152490173934e-5,
+                                         .00372607865913943, -.00207005122509878, 7.81710782006007e-5,
+                                         3.8173115333209e-5, .00423188073215978, -.330731648461098,
+                                         .499311098121487, -.0294224614020919, -.0309473698100117,
+                                         .0245541430111114, 11.5232997774915, -36.089498663223,
+                                         13.1249047206802, 17.699724191644
+                                       };
+    double ep[30]   /* was [5][6] */ = { 1.18235221619919e-11,
+                                         4.54156560960751e-12, 7.25253521267534e-13, 9.44170736690998e-14,
+                                         -1.19216455127025e-15, 1.02022447988636e-8, -8.70656030600515e-9,
+                                         -1.81874953197265e-9, -2.89483768978003e-10, 9.83305964350091e-12,
+                                         -9.94087795995219e-6, 6.72319644758312e-6, 1.82391722383996e-6,
+                                         3.46086590595832e-7, -3.32236505461873e-8, .00205810606354174,
+                                         -.00261848001140506, -8.96451046938099e-4, -1.86858322081096e-4,
+                                         5.87525102093395e-5, -.00650673267299652, .50597898461601,
+                                         .205104310731812, .0321138011065329, -.0544333376857938,
+                                         .0350084639895791, -21.8764543973822, -1.67577204662189,
+                                         12.1847428124429, 29.3820268460826
+                                       };
+
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; homogeneous dust aggregates\n");
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    return 0;
+} /* ips_h_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  dust aggregates. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_c_a( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 7.00848522113819e-12,
+                                         -2.34008494922127e-12, 1.07369093347642e-13, -7.26185432947517e-14,
+                                         -1.96218020716864e-16, -5.38589091535874e-9, 3.8357901565285e-9,
+                                         -3.67064066072209e-10, 1.93822304483831e-10, 1.44371440578819e-12,
+                                         5.7560737665603e-7, -2.35889261211091e-6, 4.76397692731733e-7,
+                                         -2.04231275245388e-7, -4.1032886405935e-9, 2.30327333546414e-4,
+                                         6.38516652690171e-4, -2.97818033284845e-4, 1.04980224671869e-4,
+                                         5.60507588086593e-6, -8.22083223050224e-5, -.0503436633369645,
+                                         .0988228392396842, -.0201847825087, 7.57770858114792e-4,
+                                         3.69445521733393e-4, 1.80714258284096, -7.89749805432507,
+                                         2.65221396709558, .951373329780637
+                                       };
+    double ep[30]   /* was [5][6] */ = { -6.22408677562333e-11,
+                                         -1.89825723717914e-12, 2.3781647824411e-13, 3.75715998081986e-14,
+                                         -2.14972270927091e-16, 4.0262989995999e-8, 2.48653050776984e-9,
+                                         -6.55089116422171e-10, -1.10762431195546e-10, 1.53656290155567e-12,
+                                         -1.02489365882874e-5, -1.11198026031581e-6, 7.21372280697123e-7,
+                                         1.31743869545228e-7, -4.37491668963704e-9, .00123410669620415,
+                                         1.37549910094186e-4, -3.91545688342924e-4, -7.95520071286138e-5,
+                                         6.59347035059836e-6, -.00160861573302469, .0360059623487543,
+                                         .11019424246455, .0290920098238345, -.00113065151550762,
+                                         6.36434053917017e-4, -1.64569511441852, -6.36071177949543,
+                                         -1.43249124741396, 2.7592514606883
+                                       };
+
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 5th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; composite aggregates\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* ips_c_a */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  5-layered spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_c_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { -2.79703516002897e-12,
+                                         -3.71409613106896e-12, 2.34075927636491e-13, -1.01800844150439e-13,
+                                         -8.21504861578549e-17, 2.99903218454126e-9, 5.15697887841035e-9,
+                                         -5.98389237952855e-10, 2.82978926717624e-10, 2.47507275791509e-12,
+                                         -1.86639771356542e-6, -2.69368563616806e-6, 6.18463391194746e-7,
+                                         -3.10240611167179e-7, -1.51457032675916e-8, 4.43116074420988e-4,
+                                         6.15462610994137e-4, -3.20161849864215e-4, 1.67831302727872e-4,
+                                         3.56293530471352e-5, .00168691259807248, -.0416611063882709,
+                                         .0863122988673855, -.0427972786642571, -.0229644576797283,
+                                         .00236109236817865, 1.4810199621333, -5.78138633671746,
+                                         5.04907160395485, 5.68279807703259
+                                       };
+    double ep[30]   /* was [5][6] */ = { -7.36489754038067e-11,
+                                         -1.70934788512322e-12, 1.39562396421684e-13, -3.84957782562793e-15,
+                                         -6.71733100328753e-16, 4.64194685916225e-8, 2.09527115986019e-9,
+                                         -3.73800275084069e-10, 6.2080817382009e-12, 2.0722415806478e-12,
+                                         -1.10260947084459e-5, -8.57256889521031e-7, 4.09096625424709e-7,
+                                         4.08263907043388e-9, 7.55698359430833e-9, .00116709474370211,
+                                         8.21108412834742e-5, -2.2142358931887e-4, -9.00298905399179e-6,
+                                         -4.35171365095976e-5, .00488782650671213, .0296539924474562,
+                                         .0611883310727851, .00583500314497411, .0746289306922593,
+                                         .00968106067481123, -1.13719115032885, -2.70601432557118,
+                                         .0174866854900613, -21.900852569315
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; composite  5-layered spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* ips_c_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of */
+/*  composite spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_c_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 3.63835105143983e-11,
+                                         -3.15467725353657e-12, 3.05043095219605e-13, -5.11040414125191e-14,
+                                         -8.21504861578549e-17, -2.41785294686923e-8, 4.50093627394633e-9,
+                                         -7.67755302507182e-10, 1.36749247287027e-10, 2.47507275791509e-12,
+                                         4.86478724760649e-6, -2.39731121423556e-6, 7.78808644026713e-7,
+                                         -1.42748156825152e-7, -1.51457032675916e-8, -2.61510400168426e-4,
+                                         5.49155786487583e-4, -3.93896857785426e-4, 7.29629767399327e-5,
+                                         3.56293530471352e-5, .0316265770662144, -.0350623289221934,
+                                         .101563268813365, -.0165846142501944, -.0229644576797283,
+                                         .0883862204249974, 1.26108394204894, -6.99722599821573,
+                                         2.33256252774021, 5.68279807703259
+                                       };
+    double ep[30]   /* was [5][6] */ = { -3.41519090504848e-11,
+                                         -5.5121962033524e-13, 1.16932386253542e-13, 8.17757049965684e-15,
+                                         -6.71733100328753e-16, 2.13852239343546e-8, 7.19099343397864e-10,
+                                         -3.27982472912081e-10, -3.47386375901682e-11, 2.0722415806478e-12,
+                                         -5.33727686471584e-6, -2.55320370665289e-7, 3.84843073428646e-7,
+                                         5.84134188822958e-8, 7.55698359430833e-9, 6.06901846786552e-4,
+                                         -3.51495462968882e-5, -2.22958043659065e-4, -4.42040035304802e-5,
+                                         -4.35171365095976e-5, .0252006314266762, .0389747405277225,
+                                         .0645036999423646, .016375762258038, .0746289306922593,
+                                         .111411915643134, -1.39765319065388, -3.28387965890002,
+                                         -.853109936284488, -21.900852569315
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region */
+    /* 2nd temperature region */
+    /* 3rd temperature region */
+    /* 4th temperature region */
+    /* 1st temperature region */
+    /* 2nd temperature region */
+    /* 3rd temperature region */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; composite spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* ips_c_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  composite spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_p_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 6.16325982329344e-11,
+                                         -5.80807258958069e-12, 4.63137627746193e-13, 5.18726914273965e-14,
+                                         -6.36242594401e-16, -3.95567622182725e-8, 7.69071377086988e-9,
+                                         -1.1539263844744e-9, -1.41793672891967e-10, 2.27869443274476e-11,
+                                         7.76710831193065e-6, -3.73362220126263e-6, 1.14229256770936e-6,
+                                         1.55142036439867e-7, -1.15739341732255e-7, -4.55605687444511e-4,
+                                         7.48673706393613e-4, -5.52919825151213e-4, -8.27373698525786e-5,
+                                         2.1718034913193e-4, .0485053543175252, -.0351377373047415,
+                                         .130524763171563, .0228876670722336, -.139928160766288,
+                                         .277317740164441, 1.1667305021944, -7.43780095534084,
+                                         -1.19404116580805, 33.7974021623102
+                                       };
+    double ep[30]   /* was [5][6] */ = { -4.01211730126533e-11,
+                                         2.70348361838629e-13, 1.13457492402838e-13, -1.33875976650634e-15,
+                                         6.62279938487018e-15, 2.63163452725145e-8, -4.294221814398e-10,
+                                         -3.35269211056638e-10, -9.75361365330163e-12, -5.84029216435355e-11,
+                                         -6.8015372785473e-6, 4.14070085265024e-7, 4.24402149483608e-7,
+                                         3.77766210661819e-8, 2.10425525088402e-7, 7.44664310341164e-4,
+                                         -2.46079635400353e-4, -2.58694273941247e-4, -3.48999709775006e-5,
+                                         -3.87759004379217e-4, .0373848509773533, .073637359921497,
+                                         .0744782095414529, .01358544047349, .365313363904957,
+                                         .301898096742562, -2.26582087568527, -2.90706234915815,
+                                         -.127754000600243, -87.1316397730807
+                                       };
+
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; porous composite spherical particles\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* ips_p_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of compact */
+/*  5-layered spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_c_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 5.08949712869433e-12,
+                                         -5.35931875543137e-12, 2.62306381508425e-13, 3.27041849431648e-15,
+                                         3.08229893598817e-15, -1.53718970829345e-9, 7.16101597203086e-9,
+                                         -6.58245880380291e-10, -1.60318902477784e-11, -1.78022161514338e-11,
+                                         -1.12486539158315e-6, -3.59007641244716e-6, 6.63943455038746e-7,
+                                         2.68510919996057e-8, 3.41691637706396e-8, 4.15532260223064e-4,
+                                         7.89100566557223e-4, -3.32883795128953e-4, -1.97469723429693e-5,
+                                         -2.15715627049837e-5, .00209187007242247, -.0549608891017917,
+                                         .085717047819729, .00841133294515589, .0108331370494338,
+                                         .00272590783978286, 1.87200525396931, -5.19841594568187,
+                                         -.310510712962614, -2.1401641153696
+                                       };
+    double ep[30]   /* was [5][6] */ = { -7.14949444274683e-11,
+                                         -1.67884045460503e-12, 1.55327591989545e-13, -1.03624135991621e-14,
+                                         -1.67515994048708e-15, 4.56493008909558e-8, 1.93188486891451e-9,
+                                         -4.10321918887199e-10, 2.6385121755664e-11, 8.60655825209691e-12,
+                                         -1.10539435401238e-5, -6.79454401316653e-7, 4.40283479754537e-7,
+                                         -2.0762269754789e-8, -6.93702079042461e-9, .00118753618113963,
+                                         4.69783308833343e-6, -2.3166851981471e-4, 7.32598938961178e-6,
+                                         -3.5291428876989e-5, .00565505491673554, .0432350670809456,
+                                         .0610008288910487, -8.29368808539319e-5, .0841125399790784,
+                                         .0112334152485423, -1.69471571838041, -2.20328351321696,
+                                         .993171165391605, -26.0846220035654
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"normal\" silicates; composite spherical particles\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* nrm_c_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_c_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 4.78854076388234e-11,
+                                         -5.93517193620454e-12, 3.96881262106136e-13, 2.21622914715417e-14,
+                                         3.08229893598817e-15, -3.05050729390064e-8, 7.9960206137062e-9,
+                                         -9.72863087619805e-10, -5.94635291659859e-11, -1.78022161514338e-11,
+                                         5.81824214006995e-6, -4.03270370353943e-6, 9.53169040316939e-7,
+                                         6.38107930515063e-8, 3.41691637706396e-8, -2.83923316707453e-4,
+                                         8.89931041863554e-4, -4.61234769343198e-4, -3.28353311308322e-5,
+                                         -2.15715627049837e-5, .0314253145824216, -.0648757583594739,
+                                         .111408530920425, .00909104468384773, .0108331370494338,
+                                         .0887898350638988, 2.265422189081, -7.02120870412906,
+                                         .15880156890083, -2.1401641153696
+                                       };
+    double ep[30]   /* was [5][6] */ = { -3.41819741402517e-11,
+                                         -1.12830247095837e-12, 1.89108843073233e-13, -3.81360510301176e-13,
+                                         -1.67515994048708e-15, 2.23645236101969e-8, 1.335553570315e-9,
+                                         -4.95790312358432e-10, 1.03235732895043e-9, 8.60655825209691e-12,
+                                         -5.89928594921228e-6, -4.48097965263261e-7, 5.37577883121461e-7,
+                                         -1.10333822789504e-6, -6.93702079042461e-9, 6.93401573122865e-4,
+                                         -3.76149993308007e-5, -2.88918973503794e-4, 5.85483209514903e-4,
+                                         -3.5291428876989e-5, .024777055232815, .047470232609802,
+                                         .0763039862991397, -.154423150177907, .0841125399790784,
+                                         .111591386809632, -1.82169470029816, -3.53244895002719,
+                                         17.926078183983, -26.0846220035654
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"normal\" silicates; composite spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* nrm_c_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  composite spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_p_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 7.85371519593748e-11,
+                                         -8.87299168944718e-12, 5.38247846353663e-13, -7.55524770696284e-15,
+                                         -1.30828373044176e-14, -4.80006707485116e-8, 1.1195446958988e-8,
+                                         -1.27651771705338e-9, 2.33980770211242e-11, 9.9783418342877e-11,
+                                         8.81328697797383e-6, -5.15886099896442e-6, 1.20032006666088e-6,
+                                         -3.01991726632572e-8, -2.9869558304736e-7, -4.53668079636133e-4,
+                                         9.82016234606357e-4, -5.4883443988553e-4, 2.29013764931138e-5,
+                                         4.22351796843159e-4, .0476159582199885, -.0471566068685918,
+                                         .120263771157534, -.00818191117398483, -.244253836247334,
+                                         .277785544793629, 1.34553778217146, -5.42723873159659,
+                                         2.63507025221571, 53.997661463508
+                                       };
+    double ep[30]   /* was [5][6] */ = { -4.58654906818365e-11,
+                                         3.91290008494475e-14, 1.99643686652162e-13, -7.82028779667088e-14,
+                                         9.36497786743931e-15, 3.13480653537745e-8, -3.63498200190023e-10,
+                                         -5.18907766097996e-10, 2.06759983260227e-10, -8.00404767157475e-11,
+                                         -8.35471192685874e-6, 5.60196221829381e-7, 5.72588528255506e-7,
+                                         -2.05102104040486e-7, 2.79452359608931e-7, 9.15549311875373e-4,
+                                         -3.45029186519145e-4, -3.11614174394111e-4, 1.02405546738682e-4,
+                                         -4.99840375368722e-4, .0364545274269526, .0933545520942711,
+                                         .0802500034686812, -.0264197796694802, .453874784636414,
+                                         .301945983086209, -3.01214115674458, -2.40199489461792,
+                                         4.83951587103424, -106.308402481092
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"normal\" silicates; porous composite spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* nrm_p_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of composite */
+/*  compact spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_c_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 3.38105553485455e-11,
+                                         -9.33849985456763e-12, 6.01276706343005e-13, 7.65229254992693e-16,
+                                         1.49293993587802e-14, -2.02838511585602e-8, 1.24935575368973e-8,
+                                         -1.44233134195667e-9, 2.46287271557838e-12, -9.82795556754154e-11,
+                                         2.84877650568732e-6, -6.27490514530631e-6, 1.37594297584878e-6,
+                                         -1.04907678327515e-8, 2.51654206970038e-7, 1.22714002652235e-4,
+                                         .00139635734816913, -6.44792574567779e-4, 1.39235031579021e-5,
+                                         -3.18748794293237e-4, .0118510085000898, -.11361648748866,
+                                         .147358324017058, -.00688309740787277, .212460479770846,
+                                         .0982198926271953, 3.99912701111438, -9.13464156449306,
+                                         2.261062921392, -52.8047276482448
+                                       };
+    double ep[30]   /* was [5][6] */ = { -5.54781995920463e-11,
+                                         -1.75271970941438e-12, 2.6738072461238e-13, 2.80139428238772e-14,
+                                         5.65983780170079e-15, 3.7604745371584e-8, 2.08588528672575e-9,
+                                         -7.02838675855814e-10, -9.3235744224089e-11, -4.52779932946938e-11,
+                                         -1.00387845744382e-5, -7.43208094438225e-7, 7.54715549033486e-7,
+                                         1.25247698258547e-7, 1.45019976976705e-7, .00119556198105876,
+                                         -1.58225900002028e-5, -4.01284196762128e-4, -7.80450767416168e-5,
+                                         -2.3170269259738e-4, .0072962291583653, .0566447875027636,
+                                         .102575992311186, .0211668231124049, .18192448184292,
+                                         .109663478851364, -2.38289344711759, -4.97886338012167,
+                                         .0566889340414748, -35.1624944667169
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; composite spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* irs_c_s */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of compact */
+/*  5-layered sphericla particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_c_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 1.70508948351477e-11,
+                                         -8.13531566799258e-12, 4.75062926575866e-13, 4.93616807759143e-15,
+                                         -3.97322091747243e-15, -9.7487815841611e-9, 1.08881343069455e-8,
+                                         -1.15799932983925e-9, -1.09122307820087e-11, 3.02096189805582e-11,
+                                         6.86841201060741e-7, -5.47675940524962e-6, 1.12655013483057e-6,
+                                         7.19688026167049e-9, -8.6448934229256e-8, 2.85420693378615e-4,
+                                         .001219871525574, -5.40677696871614e-4, 1.83969458834133e-6,
+                                         1.09980600256632e-4, .00467027871016589, -.0966934069009319,
+                                         .128291627860611, -.00250033083691768, -.0483957313087191,
+                                         .00571961882492061, 3.35832159655028, -8.01189130848149,
+                                         1.61075348102171, 7.89707541733308
+                                       };
+    double ep[30]   /* was [5][6] */ = { -6.47972548162755e-11,
+                                         -2.00937566079048e-12, 5.60943163643822e-11, 8.01929008945014e-15,
+                                         5.547882156451e-15, 4.21525305378917e-8, 2.32343408108912e-9,
+                                         -1.24246570547719e-7, -3.21935520870997e-11, -4.45469973774392e-11,
+                                         -1.06267375522626e-5, -8.11911225464655e-7, 1.08602993003868e-4,
+                                         5.19531322741465e-8, 1.43179952681586e-7, .00120631667027662,
+                                         -6.07902377383124e-6, -.0467555501212897, -3.45304239783009e-5,
+                                         -2.29480193872413e-4, .00567895411217888, .0546390379960075,
+                                         9.89466902884033, .00904196525890367, .18064867058766,
+                                         .0193858771554221, -2.32537279817566, -816.5506674504,
+                                         1.01172494080519, -34.8981382167346
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; compact 5-layered spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* irs_c_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  5-layered spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_p_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 8.96773074857445e-12,
+                                         -1.00059186545087e-11, 4.29165746710068e-13, -2.06107052640973e-14,
+                                         -2.90096647131548e-18, -4.52346007828537e-9, 1.31015565493775e-8,
+                                         -1.07643520003061e-9, 6.73949147957524e-11, -6.53490849918787e-12,
+                                         -5.14999243071951e-7, -6.39496683907595e-6, 1.07072790630826e-6,
+                                         -9.0580411485153e-8, 4.6665337261259e-8, 3.81710740418527e-4,
+                                         .00135906147931384, -5.18451622215369e-4, 6.51898800406398e-5,
+                                         -1.25342723299598e-4, .00662657430083621, -.0982256036580519,
+                                         .120554616636895, -.0240303268395795, .152064247253868,
+                                         .00776645724385527, 3.33404126191471, -6.14129505789404,
+                                         4.9008931785266, -44.8939661684724
+                                       };
+    double ep[30]   /* was [5][6] */ = { -6.89956740572676e-11,
+                                         -2.13039301488055e-12, 3.72610228925694e-13, 2.46022245735189e-15,
+                                         1.20592372746624e-14, 4.41735257676424e-8, 2.45268159317063e-9,
+                                         -9.18600007827935e-10, -2.68117733461386e-11, -9.24919691382196e-11,
+                                         -1.08772892714465e-5, -8.35335761563827e-7, 9.29591457329738e-7,
+                                         6.5615588467925e-8, 2.79801643892125e-7, .00119499989856874,
+                                         -2.67662552025424e-5, -4.69567004516968e-4, -5.08130832339838e-5,
+                                         -4.11688178661673e-4, .0104885901605351, .0633425961606103,
+                                         .114879683458859, .0133652293166528, .280919930581346,
+                                         .027981056254553, -2.46205624927029, -5.26990396362187,
+                                         1.6479728128063, -28.3809618086616
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; porous 5-layered spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* irs_p_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-poor" silicate dust model, Fe/(Fe+Mg)=0 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  5-layered spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int ips_p_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { -1.11273466842134e-11,
+                                         -4.3864935836449e-12, 3.11973513365184e-13, -1.47889064517314e-14,
+                                         -6.36242594401e-16, 8.45467152887459e-9, 5.87553836312308e-9,
+                                         -7.81333888580475e-10, 3.71128462723842e-11, 2.27869443274476e-11,
+                                         -3.10107327781121e-6, -2.91861320517099e-6, 7.87235736665606e-7,
+                                         -3.50776662753613e-8, -1.15739341732255e-7, 5.33370752643551e-4,
+                                         6.13225956804579e-4, -3.93375417709984e-4, 1.72038855015232e-5,
+                                         2.1718034913193e-4, .00349839344699195, -.0320815807348939,
+                                         .0994699809579733, -.0025094316976995, -.139928160766288,
+                                         .005744949380228, 1.12775533786856, -5.985155774304,
+                                         1.38619339830858, 33.7974021623102
+                                       };
+    double ep[30]   /* was [5][6] */ = { -8.29208232001774e-11,
+                                         -1.38555904483831e-12, 1.5232269442255e-13, -1.27424572482406e-12,
+                                         6.62279938487018e-15, 5.20116523211783e-8, 1.64236953942682e-9,
+                                         -4.04052715053511e-10, 3.47630944149498e-9, -5.84029216435355e-11,
+                                         -1.21304181159164e-5, -5.96778918866169e-7, 4.46733580634883e-7,
+                                         -3.74936967508991e-6, 2.10425525088402e-7, .00122860492094876,
+                                         3.37500082588048e-6, -2.43942256054794e-4, .00200641509260141,
+                                         -3.87759004379217e-4, .00725910757183928, .041330941712239,
+                                         .0664544372119637, -.531831149799181, .365313363904957,
+                                         .0128869482389276, -1.32552897783752, -2.69130796594824,
+                                         57.6428786572292, -87.1316397730807
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-poor\" silicates; porous 5-layered spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* ips_p_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "normal" silicate dust model, Fe/(Fe+Mg)=0.3 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  5-layered spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int nrm_p_5( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { -3.42512260664181e-12,
+                                         -6.39519672284482e-12, 3.58333252702902e-13, -2.07904677131994e-14,
+                                         -1.30828373044176e-14, 4.00643345707715e-9, 8.32587601858491e-9,
+                                         -8.81289429556535e-10, 5.8677724840142e-11, 9.9783418342877e-11,
+                                         -2.36634357360831e-6, -4.01815578974051e-6, 8.67113875506433e-7,
+                                         -6.63459139353054e-8, -2.9869558304736e-7, 5.06330578089306e-4,
+                                         8.27355223991723e-4, -4.20124993705012e-4, 4.04113784646693e-5,
+                                         4.22351796843159e-4, .00409097272925876, -.0483890387342808,
+                                         .101450295374589, -.01155325068306, -.244253836247334,
+                                         .0060177875765669, 1.60756061479057, -5.48430544923485,
+                                         2.89704668567564, 53.997661463508
+                                       };
+    double ep[30]   /* was [5][6] */ = { -7.78528782774519e-11,
+                                         -1.62343151233391e-12, 1.5627583476775e-13, -3.05426999846083e-14,
+                                         9.36497786743931e-15, 4.92509361904375e-8, 1.8358493032799e-9,
+                                         -4.20354714202562e-10, 7.72593517572306e-11, -8.00404767157475e-11,
+                                         -1.16987010630897e-5, -5.97102252247488e-7, 4.6768448742788e-7,
+                                         -6.16264365628349e-8, 2.79452359608931e-7, .00121215805115239,
+                                         -3.54389014170137e-5, -2.53842721861715e-4, 2.32827286610477e-5,
+                                         -4.99840375368722e-4, .00883586501144021, .0521482016285399,
+                                         .0670254394966715, -.00411669467032501, .453874784636414,
+                                         .0154425119227787, -1.80886247230953, -2.16049699341054,
+                                         2.23872527151849, -106.308402481092
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature regions, */
+    /* 2nd temperature regions, */
+    /* 3rd temperature regions, */
+    /* 4th temperature regions, */
+    /* 1st temperature regions, */
+    /* 2nd temperature regions, */
+    /* 3rd temperature regions, */
+    /* 4th temperature regions, */
+    //printf("Dust model: \"normal\" silicates; porous 5-layered spheres\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* nrm_p_5 */
+
+/* ............................................................................. */
+/*  Fit coefficients for "iron-rich" silicate dust model, Fe/(Fe+Mg)=0.4 for */
+/*  Rosseland and Planck mean opacities (extinction) in the case of porous */
+/*  composite spherical particles. */
+/* ............................................................................. */
+/*  Input parameter(s): */
+/* ............................................................................. */
+
+/*  'ross': opacity kind, */
+/*        = .true. - Rosseland mean, */
+/*        = .false. - Planck mean */
+
+/* ............................................................................. */
+/*  Output parameter(s): */
+/* ............................................................................. */
+
+/*    'eD': eD(5,6) opacity fit coefficients (extinction), */
+
+/* ............................................................................. */
+int irs_p_s( int *ross, double *ed )
+{
+    /* Initialized data */
+
+    double er[30]   /* was [5][6] */ = { 2.68810001584323e-11,
+                                         -1.41448526625583e-11, 4.89432507733348e-13, -1.09694487093443e-13,
+                                         -2.90096647131548e-18, -1.12477333823967e-8, 1.78857661984583e-8,
+                                         -1.18479013761268e-9, 3.20753068449201e-10, -6.53490849918787e-12,
+                                         -1.01566610086506e-6, -8.34447302544632e-6, 1.12743324344216e-6,
+                                         -3.77103037922897e-7, 4.6665337261259e-8, 7.19092035096105e-4,
+                                         .00166564397599198, -5.13682572822325e-4, 2.25890434374501e-4,
+                                         -1.25342723299598e-4, -.00340209389403125, -.109455596095692,
+                                         .107619609550656, -.0687472517167857, .152064247253868,
+                                         .241084737867738, 3.38446486439366, -3.25573585597726,
+                                         9.68700809982378, -44.8939661684724
+                                       };
+    double ep[30]   /* was [5][6] */ = { -9.38221635967739e-11,
+                                         -3.14048020738633e-13, 2.98137289493519e-13, 7.3237247695491e-15,
+                                         1.20592372746624e-14, 6.51531135580471e-8, -7.6988007707677e-12,
+                                         -7.76249490370792e-10, -3.99940104538424e-11, -9.24919691382196e-11,
+                                         -1.71960674810085e-5, 4.97519361287919e-7, 8.33111875808792e-7,
+                                         7.61246665638358e-8, 2.79801643892125e-7, .00192789340102626,
+                                         -3.9265195831664e-4, -4.41327484073404e-4, -5.44567135496901e-5,
+                                         -4.11688178661673e-4, -9.90219555706369e-4, .112649942798147,
+                                         .10942434723916, .0138692387601316, .280919930581346,
+                                         .248460261889448, -4.03276741578672, -3.8837275854887,
+                                         1.55063616069495, -28.3809618086616
+                                       };
+
+    /* Local variables */
+    int i__, j;
+
+    /* Fit coefficients for Rosseland mean opacity (extinction) */
+    /* Parameter adjustments */
+    ed -= 6;
+
+    /* Function Body */
+    /* Fit coefficients for Planck mean opacity (extinction) */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    /* 1st temperature region, */
+    /* 2nd temperature region, */
+    /* 3rd temperature region, */
+    /* 4th temperature region, */
+    //printf("Dust model: \"iron-rich\" silicates; porous composite spherical particles\n");
+    /* Set up output parameters: */
+    for( i__ = 1; i__ <= 5; ++i__ )
+    {
+        for( j = 1; j <= 6; ++j )
+        {
+            if( *ross )
+            {
+                /* Rosseland mean opacities, */
+                ed[i__ + j * 5] = er[i__ + j * 5 - 6];
+            }
+            else
+            {
+                /* Planck mean opacities, */
+                ed[i__ + j * 5] = ep[i__ + j * 5 - 6];
+            }
+        }
+    }
+    /* Exit: */
+    return 0;
+} /* irs_p_s */
+
+
+
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/generate_opacity.h PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/generate_opacity.h
--- PLUTO4/Src/Radiation/SemenovOpacity/generate_opacity.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/generate_opacity.h	2013-06-01 18:33:00.198214819 +0200
@@ -0,0 +1,34 @@
+#ifndef GENERATE_OPACITY_H
+#define GENERATE_OPACITY_H
+
+int init_d( int *ross, char *model, char *top, char *shape, double *ed, int model_len, int top_len, int shape_len );
+int init_g( int *ross, double *eg );
+int init_g2( char *filepath, double *eg );
+
+int cop( double *ed, double *eg, double *rho_in__, double *t_in__, double *akext );
+int gop( double *eg, double *rho_in__, double *t_in__, double *ak );
+int bint( double *xa, int *n, double *x, double *res, double *ri );
+int eint( int *n, double *x, int *m, double *y, double *d__, double *xp, double *yp, double *dp );
+int nrm_h_s( int *ross, double *ed );
+int nrm_h_a( int *ross, double *ed );
+int nrm_c_a( int *ross, double *ed );
+int irs_h_s( int *ross, double *ed );
+int irs_h_a( int *ross, double *ed );
+int irs_c_a( int *ross, double *ed );
+int ips_h_s( int *ross, double *ed );
+int ips_h_a( int *ross, double *ed );
+int ips_c_a( int *ross, double *ed );
+int ips_c_5( int *ross, double *ed );
+int ips_c_s( int *ross, double *ed );
+int ips_p_s( int *ross, double *ed );
+int nrm_c_5( int *ross, double *ed );
+int nrm_c_s( int *ross, double *ed );
+int nrm_p_s( int *ross, double *ed );
+int irs_c_s( int *ross, double *ed );
+int irs_c_5( int *ross, double *ed );
+int irs_p_5( int *ross, double *ed );
+int ips_p_5( int *ross, double *ed );
+int nrm_p_5( int *ross, double *ed );
+int irs_p_s( int *ross, double *ed );
+
+#endif
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/kP_h2001.dat PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/kP_h2001.dat
--- PLUTO4/Src/Radiation/SemenovOpacity/kP_h2001.dat	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/kP_h2001.dat	2013-06-01 18:33:00.210214819 +0200
@@ -0,0 +1,722 @@
+    1.4128
+     -0.3732     -0.3696     -0.3608     -0.3511     -0.3469     -0.3498     -0.3492
+     -0.3482     -0.3537     -0.3718     -0.4206     -0.5147     -0.6175     -0.6697
+     -0.6738     -0.6649     -0.6554     -0.6165     -0.5741     -0.5351     -0.4992
+     -0.4661     -0.4359     -0.4107     -0.3904     -0.3740     -0.3601     -0.3475
+     -0.3376     -0.3316     -0.3283     -0.3259     -0.3228     -0.3190     -0.3194
+     -0.3225     -0.3267     -0.3307     -0.3350     -0.3496     -0.3806     -0.4341
+     -0.5197     -0.6445     -0.8021     -0.9522     -1.0364     -1.0424     -0.9975
+     -0.9305     -0.8605     -0.8007     -0.7590     -0.7358     -0.7242     -0.7126
+     -0.6821     -0.6112     -0.4950     -0.3463     -0.1791     -0.0013      0.1839
+      0.3759      0.5751      0.7815      0.9943      1.2115      1.4304      1.6480
+      1.8616     -0.3732     -0.3696     -0.3609     -0.3512     -0.3469     -0.3498
+     -0.3493     -0.3491     -0.3583     -0.3898     -0.4645     -0.5748     -0.6613
+     -0.6845     -0.6760     -0.6642     -0.6544     -0.6156     -0.5733     -0.5344
+     -0.4987     -0.4658     -0.4357     -0.4106     -0.3904     -0.3739     -0.3601
+     -0.3474     -0.3375     -0.3316     -0.3282     -0.3259     -0.3228     -0.3192
+     -0.3197     -0.3231     -0.3278     -0.3329     -0.3391     -0.3575     -0.3958
+     -0.4623     -0.5674     -0.7150     -0.8882     -1.0355     -1.1067     -1.1052
+     -1.0614     -1.0005     -0.9396     -0.8917     -0.8640     -0.8536     -0.8502
+     -0.8405     -0.8032     -0.7188     -0.5897     -0.4317     -0.2574     -0.0734
+      0.1181      0.3170      0.5238      0.7381      0.9585      1.1825      1.4070
+      1.6289      1.8456     -0.3731     -0.3696     -0.3609     -0.3512     -0.3469
+     -0.3498     -0.3496     -0.3510     -0.3677     -0.4199     -0.5205     -0.6316
+     -0.6894     -0.6900     -0.6754     -0.6629     -0.6532     -0.6147     -0.5725
+     -0.5338     -0.4982     -0.4655     -0.4355     -0.4105     -0.3903     -0.3739
+     -0.3600     -0.3474     -0.3374     -0.3315     -0.3282     -0.3259     -0.3229
+     -0.3194     -0.3201     -0.3239     -0.3292     -0.3356     -0.3443     -0.3677
+     -0.4154     -0.4979     -0.6247     -0.7935     -0.9751     -1.1119     -1.1686
+     -1.1619     -1.1210     -1.0675     -1.0174     -0.9839     -0.9721     -0.9749
+     -0.9789     -0.9687     -0.9216     -0.8228     -0.6814     -0.5145     -0.3335
+     -0.1433      0.0549      0.2612      0.4759      0.6982      0.9260      1.1564
+      1.3860      1.6117      1.8308     -0.3732     -0.3696     -0.3609     -0.3512
+     -0.3469     -0.3499     -0.3504     -0.3552     -0.3851     -0.4644     -0.5822
+     -0.6766     -0.7033     -0.6902     -0.6736     -0.6613     -0.6520     -0.6138
+     -0.5718     -0.5332     -0.4977     -0.4653     -0.4354     -0.4104     -0.3903
+     -0.3738     -0.3600     -0.3473     -0.3373     -0.3314     -0.3281     -0.3259
+     -0.3230     -0.3196     -0.3206     -0.3248     -0.3309     -0.3389     -0.3510
+     -0.3810     -0.4408     -0.5420     -0.6912     -0.8773     -1.0586     -1.1788
+     -1.2219     -1.2121     -1.1758     -1.1312     -1.0941     -1.0776     -1.0835
+     -1.0996     -1.1096     -1.0963     -1.0365     -0.9229     -0.7701     -0.5951
+     -0.4074     -0.2107     -0.0055      0.2086      0.4315      0.6618      0.8967
+      1.1330      1.3671      1.5960      1.8170     -0.3732     -0.3697     -0.3609
+     -0.3512     -0.3469     -0.3502     -0.3520     -0.3637     -0.4146     -0.5214
+     -0.6405     -0.7058     -0.7077     -0.6879     -0.6714     -0.6597     -0.6509
+     -0.6129     -0.5711     -0.5326     -0.4974     -0.4650     -0.4353     -0.4104
+     -0.3902     -0.3738     -0.3600     -0.3473     -0.3372     -0.3313     -0.3281
+     -0.3260     -0.3232     -0.3199     -0.3211     -0.3259     -0.3331     -0.3432
+     -0.3597     -0.3982     -0.4731     -0.5953     -0.7657     -0.9627     -1.1346
+     -1.2353     -1.2668     -1.2562     -1.2258     -1.1915     -1.1697     -1.1731
+     -1.1986     -1.2277     -1.2417     -1.2219     -1.1475     -1.0193     -0.8560
+     -0.6733     -0.4791     -0.2756     -0.0629      0.1594      0.3906      0.6287
+      0.8704      1.1121      1.3501      1.5815      1.8038     -0.3732     -0.3697
+     -0.3609     -0.3512     -0.3470     -0.3508     -0.3556     -0.3797     -0.4586
+     -0.5843     -0.6870     -0.7207     -0.7067     -0.6849     -0.6692     -0.6582
+     -0.6499     -0.6122     -0.5704     -0.5321     -0.4971     -0.4649     -0.4352
+     -0.4103     -0.3902     -0.3738     -0.3599     -0.3472     -0.3372     -0.3312
+     -0.3281     -0.3260     -0.3233     -0.3202     -0.3218     -0.3272     -0.3358
+     -0.3487     -0.3709     -0.4206     -0.5137     -0.6576     -0.8458     -1.0455
+     -1.2002     -1.2814     -1.3041     -1.2945     -1.2711     -1.2487     -1.2448
+     -1.2712     -1.3176     -1.3587     -1.3742     -1.3447     -1.2541     -1.1121
+     -0.9392     -0.7493     -0.5483     -0.3377     -0.1170      0.1137      0.3533
+      0.5989      0.8469      1.0933      1.3347      1.5680      1.7909     -0.3732
+     -0.3697     -0.3609     -0.3513     -0.3472     -0.3521     -0.3628     -0.4072
+     -0.5156     -0.6441     -0.7180     -0.7257     -0.7032     -0.6816     -0.6672
+     -0.6569     -0.6489     -0.6114     -0.5698     -0.5317     -0.4968     -0.4647
+     -0.4351     -0.4103     -0.3901     -0.3737     -0.3599     -0.3471     -0.3371
+     -0.3312     -0.3281     -0.3261     -0.3235     -0.3207     -0.3227     -0.3289
+     -0.3392     -0.3558     -0.3856     -0.4496     -0.5632     -0.7276     -0.9283
+     -1.1215     -1.2544     -1.3181     -1.3348     -1.3275     -1.3120     -1.3030
+     -1.3202     -1.3725     -1.4406     -1.4921     -1.5060     -1.4635     -1.3564
+     -1.2016     -1.0198     -0.8229     -0.6150     -0.3968     -0.1679      0.0715
+      0.3194      0.5722      0.8259      1.0765      1.3204      1.5550      1.7778
+     -0.3732     -0.3697     -0.3610     -0.3513     -0.3477     -0.3550     -0.3766
+     -0.4492     -0.5796     -0.6926     -0.7348     -0.7248     -0.6988     -0.6786
+     -0.6653     -0.6557     -0.6481     -0.6107     -0.5692     -0.5313     -0.4966
+     -0.4646     -0.4350     -0.4102     -0.3901     -0.3737     -0.3598     -0.3470
+     -0.3370     -0.3311     -0.3281     -0.3262     -0.3238     -0.3212     -0.3237
+     -0.3310     -0.3436     -0.3651     -0.4050     -0.4865     -0.6215     -0.8032
+     -1.0094     -1.1876     -1.2975     -1.3469     -1.3597     -1.3558     -1.3489
+     -1.3554     -1.3969     -1.4778     -1.5676     -1.6272     -1.6359     -1.5777
+     -1.4543     -1.2879     -1.0979     -0.8940     -0.6790     -0.4528     -0.2152
+      0.0330      0.2888      0.5483      0.8071      1.0611      1.3071      1.5422
+      1.7643     -0.3732     -0.3697     -0.3610     -0.3515     -0.3487     -0.3607
+     -0.4009     -0.5051     -0.6416     -0.7257     -0.7415     -0.7210     -0.6944
+     -0.6759     -0.6636     -0.6546     -0.6473     -0.6101     -0.5687     -0.5310
+     -0.4965     -0.4645     -0.4350     -0.4102     -0.3901     -0.3736     -0.3598
+     -0.3470     -0.3369     -0.3311     -0.3281     -0.3264     -0.3241     -0.3218
+     -0.3249     -0.3337     -0.3493     -0.3773     -0.4303     -0.5323     -0.6873
+     -0.8817     -1.0856     -1.2425     -1.3309     -1.3691     -1.3800     -1.3802
+     -1.3827     -1.4069     -1.4760     -1.5878     -1.6983     -1.7629     -1.7625
+     -1.6870     -1.5481     -1.3712     -1.1735     -0.9626     -0.7401     -0.5055
+     -0.2589     -0.0021      0.2614      0.5270      0.7902      1.0470      1.2942
+      1.5292      1.7498     -0.3732     -0.3697     -0.3610     -0.3518     -0.3508
+     -0.3719     -0.4392     -0.5694     -0.6929     -0.7446     -0.7422     -0.7159
+     -0.6902     -0.6734     -0.6622     -0.6536     -0.6466     -0.6094     -0.5682
+     -0.5307     -0.4963     -0.4645     -0.4349     -0.4102     -0.3900     -0.3736
+     -0.3597     -0.3469     -0.3368     -0.3311     -0.3282     -0.3265     -0.3244
+     -0.3225     -0.3265     -0.3370     -0.3567     -0.3934     -0.4630     -0.5870
+     -0.7583     -0.9601     -1.1535     -1.2862     -1.3562     -1.3862     -1.3966
+     -1.4012     -1.4142     -1.4588     -1.5591     -1.7031     -1.8320     -1.8979
+     -1.8847     -1.7910     -1.6380     -1.4516     -1.2466     -1.0285     -0.7980
+     -0.5546     -0.2990     -0.0337      0.2369      0.5080      0.7749      1.0338
+      1.2816      1.5157      1.7340     -0.3732     -0.3697     -0.3611     -0.3525
+     -0.3551     -0.3922     -0.4920     -0.6337     -0.7290     -0.7535     -0.7394
+     -0.7103     -0.6864     -0.6713     -0.6609     -0.6528     -0.6459     -0.6088
+     -0.5678     -0.5305     -0.4962     -0.4644     -0.4349     -0.4101     -0.3900
+     -0.3736     -0.3596     -0.3468     -0.3368     -0.3311     -0.3283     -0.3267
+     -0.3249     -0.3234     -0.3285     -0.3414     -0.3664     -0.4146     -0.5045
+     -0.6494     -0.8321     -1.0356     -1.2111     -1.3199     -1.3752     -1.3994
+     -1.4101     -1.4198     -1.4447     -1.5128     -1.6473     -1.8238     -1.9679
+     -2.0308     -2.0017     -1.8900     -1.7242     -1.5291     -1.3169     -1.0914
+     -0.8526     -0.6001     -0.3354     -0.0620      0.2151      0.4910      0.7609
+      1.0212      1.2688      1.5013      1.7164     -0.3732     -0.3697     -0.3613
+     -0.3539     -0.3636     -0.4254     -0.5554     -0.6887     -0.7505     -0.7562
+     -0.7347     -0.7049     -0.6832     -0.6694     -0.6597     -0.6520     -0.6453
+     -0.6083     -0.5675     -0.5303     -0.4961     -0.4644     -0.4349     -0.4101
+     -0.3900     -0.3735     -0.3595     -0.3467     -0.3367     -0.3311     -0.3284
+     -0.3269     -0.3254     -0.3246     -0.3310     -0.3470     -0.3792     -0.4426
+     -0.5554     -0.7170     -0.9063     -1.1052     -1.2579     -1.3455     -1.3893
+     -1.4095     -1.4213     -1.4366     -1.4755     -1.5705     -1.7420     -1.9496
+     -2.1047     -2.1602     -2.1128     -1.9840     -1.8068     -1.6037     -1.3844
+     -1.1512     -0.9036     -0.6418     -0.3683     -0.0873      0.1958      0.4756
+      0.7478      1.0087      1.2555      1.4855      1.6965     -0.3732     -0.3698
+     -0.3617     -0.3569     -0.3795     -0.4736     -0.6213     -0.7287     -0.7615
+     -0.7553     -0.7291     -0.6998     -0.6803     -0.6678     -0.6587     -0.6513
+     -0.6446     -0.6078     -0.5672     -0.5302     -0.4961     -0.4643     -0.4348
+     -0.4101     -0.3900     -0.3735     -0.3595     -0.3466     -0.3367     -0.3311
+     -0.3285     -0.3272     -0.3260     -0.3260     -0.3342     -0.3544     -0.3963
+     -0.4790     -0.6150     -0.7868     -0.9791     -1.1665     -1.2946     -1.3647
+     -1.3998     -1.4174     -1.4308     -1.4527     -1.5080     -1.6335     -1.8439
+     -2.0799     -2.2410     -2.2845     -2.2176     -2.0731     -1.8858     -1.6753
+     -1.4488     -1.2075     -0.9508     -0.6798     -0.3977     -0.1097      0.1785
+      0.4617      0.7354      0.9962      1.2412      1.4678      1.6735     -0.3732
+     -0.3699     -0.3626     -0.3628     -0.4067     -0.5343     -0.6803     -0.7535
+     -0.7660     -0.7523     -0.7230     -0.6953     -0.6779     -0.6664     -0.6578
+     -0.6506     -0.6441     -0.6074     -0.5670     -0.5301     -0.4960     -0.4643
+     -0.4348     -0.4101     -0.3899     -0.3734     -0.3594     -0.3466     -0.3366
+     -0.3312     -0.3286     -0.3276     -0.3268     -0.3278     -0.3383     -0.3642
+     -0.4191     -0.5250     -0.6807     -0.8565     -1.0483     -1.2179     -1.3228
+     -1.3792     -1.4076     -1.4236     -1.4391     -1.4690     -1.5438     -1.7035
+     -1.9534     -2.2134     -2.3750     -2.4026     -2.3159     -2.1575     -1.9613
+     -1.7437     -1.5098     -1.2601     -0.9942     -0.7140     -0.4238     -0.1295
+      0.1631      0.4488      0.7232      0.9831      1.2255      1.4477      1.6468
+     -0.3733     -0.3702     -0.3645     -0.3742     -0.4485     -0.6011     -0.7253
+     -0.7668     -0.7669     -0.7480     -0.7170     -0.6914     -0.6757     -0.6651
+     -0.6570     -0.6500     -0.6435     -0.6070     -0.5668     -0.5300     -0.4959
+     -0.4642     -0.4348     -0.4100     -0.3899     -0.3734     -0.3593     -0.3465
+     -0.3366     -0.3312     -0.3288     -0.3280     -0.3278     -0.3300     -0.3437
+     -0.3772     -0.4494     -0.5810     -0.7489     -0.9247     -1.1119     -1.2595
+     -1.3443     -1.3899     -1.4133     -1.4286     -1.4470     -1.4865     -1.5845
+     -1.7817     -2.0702     -2.3487     -2.5051     -2.5134     -2.4077     -2.2372
+     -2.0331     -1.8087     -1.5672     -1.3088     -1.0336     -0.7445     -0.4468
+     -0.1469      0.1493      0.4366      0.7110      0.9692      1.2080      1.4245
+      1.6157     -0.3733     -0.3707     -0.3683     -0.3947     -0.5047     -0.6646
+     -0.7546     -0.7730     -0.7657     -0.7427     -0.7112     -0.6880     -0.6739
+     -0.6640     -0.6563     -0.6494     -0.6430     -0.6067     -0.5667     -0.5299
+     -0.4959     -0.4642     -0.4348     -0.4100     -0.3899     -0.3733     -0.3592
+     -0.3464     -0.3366     -0.3313     -0.3291     -0.3285     -0.3290     -0.3329
+     -0.3508     -0.3948     -0.4890     -0.6453     -0.8160     -0.9907     -1.1680
+     -1.2921     -1.3608     -1.3979     -1.4176     -1.4328     -1.4549     -1.5065
+     -1.6316     -1.8690     -2.1935     -2.4840     -2.6294     -2.6161     -2.4929
+     -2.3121     -2.1009     -1.8698     -1.6206     -1.3532     -1.0688     -0.7714
+     -0.4670     -0.1623      0.1366      0.4248      0.6984      0.9539      1.1880
+      1.3976      1.5793     -0.3735     -0.3718     -0.3758     -0.4282     -0.5708
+     -0.7163     -0.7710     -0.7752     -0.7632     -0.7369     -0.7059     -0.6851
+     -0.6723     -0.6630     -0.6556     -0.6488     -0.6425     -0.6065     -0.5665
+     -0.5298     -0.4959     -0.4642     -0.4348     -0.4100     -0.3898     -0.3732
+     -0.3592     -0.3464     -0.3367     -0.3314     -0.3293     -0.3292     -0.3305
+     -0.3367     -0.3603     -0.4185     -0.5393     -0.7141     -0.8801     -1.0535
+     -1.2152     -1.3172     -1.3735     -1.4038     -1.4208     -1.4366     -1.4635
+     -1.5302     -1.6865     -1.9659     -2.3219     -2.6174     -2.7461     -2.7101
+     -2.5716     -2.3820     -2.1645     -1.9266     -1.6695     -1.3933     -1.1000
+     -0.7948     -0.4845     -0.1760      0.1249      0.4132      0.6850      0.9368
+      1.1651      1.3662      1.5365     -0.3738     -0.3740     -0.3899     -0.4768
+     -0.6383     -0.7520     -0.7790     -0.7752     -0.7598     -0.7308     -0.7011
+     -0.6825     -0.6708     -0.6622     -0.6550     -0.6482     -0.6421     -0.6063
+     -0.5664     -0.5298     -0.4958     -0.4642     -0.4347     -0.4100     -0.3898
+     -0.3732     -0.3591     -0.3463     -0.3367     -0.3316     -0.3297     -0.3300
+     -0.3325     -0.3416     -0.3730     -0.4502     -0.6004     -0.7826     -0.9411
+     -1.1116     -1.2535     -1.3366     -1.3833     -1.4082     -1.4234     -1.4402
+     -1.4735     -1.5589     -1.7505     -2.0722     -2.4538     -2.7467     -2.8536
+     -2.7952     -2.6436     -2.4466     -2.2232     -1.9787     -1.7136     -1.4287
+     -1.1271     -0.8149     -0.4996     -0.1881      0.1138      0.4013      0.6704
+      0.9174      1.1384      1.3294      1.4865     -0.3744     -0.3785     -0.4144
+     -0.5383     -0.6979     -0.7732     -0.7822     -0.7741     -0.7556     -0.7246
+     -0.6970     -0.6804     -0.6696     -0.6614     -0.6544     -0.6477     -0.6418
+     -0.6061     -0.5664     -0.5298     -0.4958     -0.4642     -0.4347     -0.4099
+     -0.3897     -0.3731     -0.3590     -0.3463     -0.3367     -0.3317     -0.3301
+     -0.3310     -0.3350     -0.3481     -0.3902     -0.4921     -0.6698     -0.8466
+     -0.9995     -1.1634     -1.2836     -1.3519     -1.3908     -1.4113     -1.4255
+     -1.4442     -1.4858     -1.5940     -1.8245     -2.1871     -2.5873     -2.8698
+     -2.9505     -2.8710     -2.7086     -2.5055     -2.2766     -2.0255     -1.7526
+     -1.4593     -1.1500     -0.8319     -0.5126     -0.1990      0.1030      0.3888
+      0.6542      0.8951      1.1073      1.2863      1.4282     -0.3756     -0.3873
+     -0.4528     -0.6064     -0.7428     -0.7841     -0.7830     -0.7722     -0.7508
+     -0.7186     -0.6933     -0.6785     -0.6685     -0.6608     -0.6539     -0.6472
+     -0.6415     -0.6060     -0.5663     -0.5297     -0.4958     -0.4641     -0.4347
+     -0.4099     -0.3897     -0.3730     -0.3589     -0.3463     -0.3368     -0.3319
+     -0.3306     -0.3323     -0.3383     -0.3568     -0.4137     -0.5459     -0.7427
+     -0.9048     -1.0556     -1.2076     -1.3071     -1.3642     -1.3966     -1.4137
+     -1.4273     -1.4487     -1.5014     -1.6367     -1.9092     -2.3094     -2.7201
+     -2.9843     -3.0360     -2.9376     -2.7663     -2.5581     -2.3240     -2.0664
+     -1.7860     -1.4850     -1.1690     -0.8459     -0.5236     -0.2090      0.0922
+      0.3753      0.6358      0.8692      1.0708      1.2359      1.3606     -0.3781
+     -0.4036     -0.5059     -0.6721     -0.7715     -0.7889     -0.7825     -0.7697
+     -0.7453     -0.7130     -0.6902     -0.6768     -0.6676     -0.6601     -0.6533
+     -0.6468     -0.6413     -0.6059     -0.5662     -0.5297     -0.4958     -0.4641
+     -0.4347     -0.4099     -0.3896     -0.3729     -0.3589     -0.3463     -0.3369
+     -0.3322     -0.3312     -0.3339     -0.3425     -0.3685     -0.4456     -0.6116
+     -0.8127     -0.9582     -1.1083     -1.2438     -1.3255     -1.3742     -1.4009
+     -1.4154     -1.4292     -1.4545     -1.5213     -1.6882     -2.0046     -2.4373
+     -2.8499     -3.0882     -3.1095     -2.9947     -2.8164     -2.6037     -2.3647
+     -2.1010     -1.8134     -1.5057     -1.1842     -0.8573     -0.5330     -0.2183
+      0.0812      0.3605      0.6148      0.8391      1.0281      1.1771      1.2832
+     -0.3832     -0.4312     -0.5703     -0.7266     -0.7874     -0.7905     -0.7814
+     -0.7667     -0.7394     -0.7079     -0.6876     -0.6754     -0.6668     -0.6596
+     -0.6528     -0.6464     -0.6411     -0.6058     -0.5662     -0.5297     -0.4958
+     -0.4641     -0.4347     -0.4099     -0.3896     -0.3729     -0.3588     -0.3463
+     -0.3370     -0.3325     -0.3320     -0.3360     -0.3482     -0.3846     -0.4883
+     -0.6866     -0.8751     -1.0087     -1.1563     -1.2726     -1.3404     -1.3823
+     -1.4041     -1.4168     -1.4312     -1.4619     -1.5467     -1.7497     -2.1102
+     -2.5689     -2.9744     -3.1796     -3.1710     -3.0424     -2.8584     -2.6416
+     -2.3980     -2.1285     -1.8348     -1.5213     -1.1955     -0.8660     -0.5409
+     -0.2271      0.0696      0.3439      0.5905      0.8038      0.9783      1.1093
+      1.1954     -0.3929     -0.4731     -0.6384     -0.7651     -0.7950     -0.7904
+     -0.7799     -0.7632     -0.7333     -0.7034     -0.6853     -0.6742     -0.6660
+     -0.6590     -0.6523     -0.6461     -0.6409     -0.6057     -0.5662     -0.5296
+     -0.4957     -0.4641     -0.4347     -0.4098     -0.3895     -0.3728     -0.3588
+     -0.3464     -0.3371     -0.3329     -0.3330     -0.3386     -0.3557     -0.4068
+     -0.5440     -0.7648     -0.9286     -1.0574     -1.1981     -1.2952     -1.3528
+     -1.3887     -1.4064     -1.4179     -1.4336     -1.4718     -1.5788     -1.8219
+     -2.2251     -2.7019     -3.0909     -3.2575     -3.2207     -3.0807     -2.8919
+     -2.6713     -2.4232     -2.1486     -1.8497     -1.5318     -1.2031     -0.8722
+     -0.5475     -0.2357      0.0570      0.3250      0.5622      0.7626      0.9203
+      1.0316      1.0973     -0.4106     -0.5291     -0.7011     -0.7884     -0.7980
+     -0.7896     -0.7781     -0.7590     -0.7272     -0.6995     -0.6833     -0.6731
+     -0.6654     -0.6585     -0.6518     -0.6458     -0.6408     -0.6057     -0.5661
+     -0.5296     -0.4957     -0.4641     -0.4346     -0.4098     -0.3894     -0.3727
+     -0.3588     -0.3464     -0.3373     -0.3334     -0.3343     -0.3421     -0.3660
+     -0.4372     -0.6132     -0.8387     -0.9752     -1.1044     -1.2331     -1.3131
+     -1.3635     -1.3937     -1.4081     -1.4190     -1.4368     -1.4849     -1.6187
+     -1.9053     -2.3477     -2.8341     -3.1969     -3.3212     -3.2592     -3.1097
+     -2.9164     -2.6922     -2.4399     -2.1609     -1.8580     -1.5373     -1.2070
+     -0.8762     -0.5529     -0.2443      0.0432      0.3032      0.5293      0.7146
+      0.8535      0.9439      0.9895     -0.4402     -0.5949     -0.7508     -0.8006
+     -0.7986     -0.7884     -0.7761     -0.7543     -0.7213     -0.6961     -0.6816
+     -0.6721     -0.6648     -0.6580     -0.6513     -0.6456     -0.6407     -0.6056
+     -0.5661     -0.5296     -0.4957     -0.4641     -0.4346     -0.4097     -0.3894
+     -0.3726     -0.3587     -0.3465     -0.3375     -0.3340     -0.3359     -0.3468
+     -0.3802     -0.4787     -0.6933     -0.9021     -1.0178     -1.1485     -1.2613
+     -1.3277     -1.3727     -1.3976     -1.4094     -1.4201     -1.4411     -1.5022
+     -1.6676     -1.9998     -2.4762     -2.9630     -3.2903     -3.3712     -3.2872
+     -3.1294     -2.9317     -2.7037     -2.4477     -2.1652     -1.8597     -1.5376
+     -1.2074     -0.8779     -0.5574     -0.2532      0.0277      0.2782      0.4909
+      0.6588      0.7772      0.8463      0.8733     -0.4843     -0.6626     -0.7843
+     -0.8061     -0.7980     -0.7870     -0.7737     -0.7490     -0.7158     -0.6931
+     -0.6801     -0.6713     -0.6643     -0.6575     -0.6510     -0.6454     -0.6406
+     -0.6056     -0.5661     -0.5296     -0.4957     -0.4640     -0.4346     -0.4097
+     -0.3893     -0.3726     -0.3587     -0.3465     -0.3378     -0.3347     -0.3380
+     -0.3530     -0.3999     -0.5338     -0.7780     -0.9533     -1.0589     -1.1881
+     -1.2835     -1.3403     -1.3804     -1.4005     -1.4104     -1.4214     -1.4469
+     -1.5248     -1.7266     -2.1050     -2.6085     -3.0861     -3.3695     -3.4082
+     -3.3054     -3.1400     -2.9378     -2.7059     -2.4464     -2.1615     -1.8548
+     -1.5330     -1.2042     -0.8774     -0.5609     -0.2625      0.0101      0.2491
+      0.4463      0.5948      0.6914      0.7398      0.7503     -0.5422     -0.7233
+     -0.8039     -0.8080     -0.7969     -0.7855     -0.7709     -0.7432     -0.7108
+     -0.6906     -0.6788     -0.6706     -0.6638     -0.6570     -0.6506     -0.6452
+     -0.6406     -0.6056     -0.5661     -0.5296     -0.4957     -0.4640     -0.4346
+     -0.4096     -0.3892     -0.3725     -0.3587     -0.3467     -0.3382     -0.3357
+     -0.3408     -0.3615     -0.4272     -0.6041     -0.8582     -0.9948     -1.0995
+     -1.2222     -1.3010     -1.3515     -1.3869     -1.4026     -1.4112     -1.4232
+     -1.4549     -1.5538     -1.7965     -2.2198     -2.7425     -3.2007     -3.4337
+     -3.4336     -3.3146     -3.1419     -2.9347     -2.6987     -2.4362     -2.1498
+     -1.8434     -1.5233     -1.1976     -0.8748     -0.5637     -0.2726     -0.0099
+      0.2155      0.3949      0.5221      0.5966      0.6258      0.6224     -0.6092
+     -0.7700     -0.8138     -0.8080     -0.7955     -0.7840     -0.7676     -0.7372
+     -0.7064     -0.6885     -0.6777     -0.6700     -0.6633     -0.6565     -0.6503
+     -0.6451     -0.6405     -0.6055     -0.5661     -0.5296     -0.4957     -0.4640
+     -0.4345     -0.4096     -0.3891     -0.3725     -0.3588     -0.3468     -0.3386
+     -0.3369     -0.3444     -0.3733     -0.4652     -0.6878     -0.9262     -1.0304
+     -1.1391     -1.2502     -1.3153     -1.3618     -1.3920     -1.4042     -1.4119
+     -1.4255     -1.4658     -1.5905     -1.8776     -2.3426     -2.8759     -3.3043
+     -3.4830     -3.4486     -3.3156     -3.1354     -2.9227     -2.6824     -2.4175
+     -2.1306     -1.8258     -1.5088     -1.1874     -0.8701     -0.5658     -0.2836
+     -0.0328      0.1767      0.3361      0.4408      0.4938      0.5062      0.4919
+     -0.6774     -0.8007     -0.8182     -0.8071     -0.7941     -0.7823     -0.7637
+     -0.7312     -0.7026     -0.6866     -0.6767     -0.6694     -0.6628     -0.6561
+     -0.6501     -0.6450     -0.6405     -0.6055     -0.5660     -0.5295     -0.4956
+     -0.4640     -0.4345     -0.4095     -0.3890     -0.3724     -0.3588     -0.3470
+     -0.3391     -0.3384     -0.3492     -0.3897     -0.5168     -0.7788     -0.9788
+     -1.0638     -1.1761     -1.2726     -1.3276     -1.3711     -1.3960     -1.4053
+     -1.4127     -1.4287     -1.4805     -1.6359     -1.9702     -2.4716     -3.0064
+     -3.3947     -3.5185     -3.4545     -3.3089     -3.1210     -2.9023     -2.6578
+     -2.3908     -2.1043     -1.8020     -1.4895     -1.1737     -0.8633     -0.5673
+     -0.2957     -0.0590      0.1323      0.2699      0.3516      0.3849      0.3835
+      0.3611     -0.7380     -0.8183     -0.8195     -0.8058     -0.7927     -0.7804
+     -0.7593     -0.7253     -0.6993     -0.6850     -0.6759     -0.6689     -0.6623
+     -0.6557     -0.6499     -0.6449     -0.6404     -0.6055     -0.5660     -0.5295
+     -0.4956     -0.4640     -0.4344     -0.4094     -0.3890     -0.3724     -0.3589
+     -0.3472     -0.3398     -0.3405     -0.3559     -0.4128     -0.5846     -0.8675
+     -1.0181     -1.0971     -1.2092     -1.2902     -1.3389     -1.3794     -1.3990
+     -1.4062     -1.4136     -1.4332     -1.4999     -1.6911     -2.0737     -2.6048
+     -3.1313     -3.4702     -3.5417     -3.4526     -3.2952     -3.0993     -2.8742
+     -2.6254     -2.3567     -2.0713     -1.7726     -1.4655     -1.1566     -0.8543
+     -0.5682     -0.3092     -0.0887      0.0822      0.1965      0.2562      0.2723
+      0.2603      0.2326     -0.7843     -0.8272     -0.8192     -0.8043     -0.7913
+     -0.7783     -0.7542     -0.7198     -0.6964     -0.6836     -0.6751     -0.6684
+     -0.6619     -0.6553     -0.6498     -0.6449     -0.6404     -0.6055     -0.5660
+     -0.5295     -0.4956     -0.4639     -0.4344     -0.4094     -0.3889     -0.3724
+     -0.3589     -0.3475     -0.3407     -0.3431     -0.3650     -0.4453     -0.6685
+     -0.9437     -1.0488     -1.1308     -1.2373     -1.3043     -1.3497     -1.3864
+     -1.4013     -1.4069     -1.4149     -1.4394     -1.5252     -1.7570     -2.1871
+     -2.7402     -3.2482     -3.5304     -3.5541     -3.4437     -3.2750     -3.0707
+     -2.8391     -2.5861     -2.3161     -2.0323     -1.7379     -1.4371     -1.1361
+     -0.8432     -0.5686     -0.3241     -0.1222      0.0264      0.1172      0.1566
+      0.1590      0.1395      0.1088     -0.8147     -0.8310     -0.8182     -0.8027
+     -0.7898     -0.7758     -0.7487     -0.7148     -0.6940     -0.6824     -0.6745
+     -0.6680     -0.6614     -0.6550     -0.6496     -0.6448     -0.6404     -0.6054
+     -0.5660     -0.5295     -0.4956     -0.4639     -0.4343     -0.4093     -0.3888
+     -0.3724     -0.3591     -0.3479     -0.3418     -0.3467     -0.3778     -0.4905
+     -0.7640     -1.0022     -1.0753     -1.1640     -1.2604     -1.3162     -1.3602
+     -1.3922     -1.4029     -1.4074     -1.4165     -1.4480     -1.5575     -1.8341
+     -2.3091     -2.8756     -3.3543     -3.5754     -3.5573     -3.4285     -3.2489
+     -3.0358     -2.7977     -2.5408     -2.2698     -1.9880     -1.6983     -1.4044
+     -1.1122     -0.8300     -0.5686     -0.3407     -0.1594     -0.0344      0.0337
+      0.0558      0.0480      0.0240     -0.0077     -0.8321     -0.8322     -0.8168
+     -0.8012     -0.7884     -0.7729     -0.7429     -0.7103     -0.6919     -0.6814
+     -0.6739     -0.6675     -0.6610     -0.6548     -0.6495     -0.6448     -0.6404
+     -0.6054     -0.5660     -0.5295     -0.4956     -0.4639     -0.4343     -0.4092
+     -0.3887     -0.3724     -0.3592     -0.3483     -0.3432     -0.3516     -0.3959
+     -0.5520     -0.8614     -1.0436     -1.1010     -1.1952     -1.2787     -1.3269
+     -1.3703     -1.3968     -1.4041     -1.4080     -1.4188     -1.4597     -1.5980
+     -1.9228     -2.4378     -3.0087     -3.4475     -3.6065     -3.5529     -3.4078
+     -3.2172     -2.9954     -2.7508     -2.4902     -2.2186     -1.9391     -1.6543
+     -1.3678     -1.0851     -0.8148     -0.5682     -0.3588     -0.1999     -0.0988
+     -0.0512     -0.0429     -0.0575     -0.0834     -0.1143     -0.8409     -0.8320
+     -0.8152     -0.7997     -0.7869     -0.7695     -0.7369     -0.7064     -0.6901
+     -0.6805     -0.6734     -0.6671     -0.6605     -0.6546     -0.6495     -0.6447
+     -0.6403     -0.6054     -0.5659     -0.5294     -0.4956     -0.4639     -0.4342
+     -0.4091     -0.3887     -0.3724     -0.3594     -0.3489     -0.3451     -0.3583
+     -0.4218     -0.6315     -0.9489     -1.0726     -1.1276     -1.2231     -1.2931
+     -1.3373     -1.3795     -1.4003     -1.4050     -1.4087     -1.4220     -1.4755
+     -1.6477     -2.0227     -2.5714     -3.1372     -3.5258     -3.6254     -3.5419
+     -3.3819     -3.1805     -2.9500     -2.6992     -2.4352     -2.1631     -1.8860
+     -1.6064     -1.3276     -1.0551     -0.7976     -0.5673     -0.3783     -0.2429
+     -0.1647     -0.1347     -0.1361     -0.1544     -0.1803     -0.2092     -0.8448
+     -0.8311     -0.8135     -0.7983     -0.7852     -0.7655     -0.7310     -0.7031
+     -0.6886     -0.6797     -0.6729     -0.6666     -0.6602     -0.6544     -0.6494
+     -0.6447     -0.6403     -0.6054     -0.5659     -0.5294     -0.4955     -0.4638
+     -0.4341     -0.4090     -0.3887     -0.3725     -0.3596     -0.3497     -0.3476
+     -0.3676     -0.4585     -0.7270     -1.0180     -1.0946     -1.1550     -1.2469
+     -1.3048     -1.3478     -1.3876     -1.4029     -1.4057     -1.4095     -1.4266
+     -1.4963     -1.7077     -2.1330     -2.7078     -3.2585     -3.5886     -3.6337
+     -3.5250     -3.3513     -3.1391     -2.9001     -2.6435     -2.3765     -2.1042
+     -1.8296     -1.5552     -1.2842     -1.0223     -0.7788     -0.5662     -0.3989
+     -0.2871     -0.2298     -0.2134     -0.2211     -0.2405     -0.2648     -0.2908
+     -0.8462     -0.8297     -0.8119     -0.7969     -0.7834     -0.7609     -0.7254
+     -0.7002     -0.6872     -0.6790     -0.6725     -0.6662     -0.6598     -0.6543
+     -0.6493     -0.6446     -0.6403     -0.6053     -0.5659     -0.5294     -0.4955
+     -0.4638     -0.4341     -0.4089     -0.3886     -0.3725     -0.3599     -0.3506
+     -0.3509     -0.3808     -0.5100     -0.8311     -1.0666     -1.1139     -1.1826
+     -1.2663     -1.3148     -1.3586     -1.3945     -1.4049     -1.4062     -1.4106
+     -1.4329     -1.5233     -1.7788     -2.2525     -2.8450     -3.3701     -3.6359
+     -3.6332     -3.5031     -3.3161     -3.0934     -2.8463     -2.5843     -2.3146
+     -2.0423     -1.7702     -1.5010     -1.2380     -0.9873     -0.7584     -0.5648
+     -0.4201     -0.3310     -0.2912     -0.2845     -0.2955     -0.3143     -0.3361
+     -0.3588     -0.8461     -0.8282     -0.8103     -0.7956     -0.7814     -0.7558
+     -0.7202     -0.6977     -0.6861     -0.6784     -0.6721     -0.6658     -0.6595
+     -0.6542     -0.6493     -0.6446     -0.6402     -0.6053     -0.5658     -0.5294
+     -0.4955     -0.4637     -0.4340     -0.4088     -0.3886     -0.3726     -0.3603
+     -0.3519     -0.3555     -0.3998     -0.5798     -0.9313     -1.0986     -1.1330
+     -1.2088     -1.2817     -1.3242     -1.3695     -1.4001     -1.4063     -1.4067
+     -1.4122     -1.4416     -1.5576     -1.8614     -2.3796     -2.9810     -3.4695
+     -3.6687     -3.6253     -3.4764     -3.2767     -3.0438     -2.7891     -2.5221
+     -2.2502     -1.9779     -1.7085     -1.4444     -1.1895     -0.9503     -0.7370
+     -0.5633     -0.4410     -0.3726     -0.3467     -0.3462     -0.3582     -0.3753
+     -0.3942     -0.4136     -0.8454     -0.8266     -0.8087     -0.7942     -0.7789
+     -0.7502     -0.7156     -0.6956     -0.6851     -0.6779     -0.6717     -0.6653
+     -0.6593     -0.6541     -0.6492     -0.6446     -0.6402     -0.6052     -0.5658
+     -0.5293     -0.4954     -0.4637     -0.4339     -0.4088     -0.3886     -0.3728
+     -0.3608     -0.3535     -0.3619     -0.4272     -0.6689     -1.0155     -1.1197
+     -1.1534     -1.2326     -1.2938     -1.3337     -1.3799     -1.4044     -1.4073
+     -1.4072     -1.4143     -1.4535     -1.6004     -1.9554     -2.5123     -3.1135
+     -3.5546     -3.6887     -3.6111     -3.4453     -3.2334     -2.9907     -2.7289
+     -2.4575     -2.1836     -1.9117     -1.6449     -1.3860     -1.1393     -0.9119
+     -0.7149     -0.5616     -0.4611     -0.4104     -0.3946     -0.3976     -0.4092
+     -0.4241     -0.4401     -0.4564     -0.8443     -0.8249     -0.8072     -0.7929
+     -0.7760     -0.7443     -0.7115     -0.6938     -0.6842     -0.6774     -0.6713
+     -0.6649     -0.6591     -0.6540     -0.6492     -0.6445     -0.6401     -0.6052
+     -0.5658     -0.5293     -0.4954     -0.4636     -0.4338     -0.4087     -0.3886
+     -0.3730     -0.3614     -0.3557     -0.3708     -0.4666     -0.7736     -1.0774
+     -1.1352     -1.1751     -1.2530     -1.3037     -1.3438     -1.3896     -1.4077
+     -1.4080     -1.4077     -1.4174     -1.4695     -1.6527     -2.0604     -2.6489
+     -3.2403     -3.6242     -3.6977     -3.5914     -3.4101     -3.1864     -2.9344
+     -2.6661     -2.3908     -2.1152     -1.8439     -1.5798     -1.3262     -1.0879
+     -0.8729     -0.6928     -0.5599     -0.4795     -0.4431     -0.4342     -0.4389
+     -0.4493     -0.4619     -0.4753     -0.4890     -0.8430     -0.8231     -0.8058
+     -0.7915     -0.7726     -0.7384     -0.7080     -0.6923     -0.6834     -0.6770
+     -0.6709     -0.6645     -0.6589     -0.6539     -0.6491     -0.6444     -0.6401
+     -0.6052     -0.5657     -0.5293     -0.4954     -0.4635     -0.4337     -0.4086
+     -0.3887     -0.3732     -0.3621     -0.3586     -0.3837     -0.5222     -0.8836
+     -1.1181     -1.1485     -1.1975     -1.2697     -1.3122     -1.3548     -1.3979
+     -1.4101     -1.4086     -1.4085     -1.4217     -1.4906     -1.7156     -2.1754
+     -2.7873     -3.3587     -3.6779     -3.6975     -3.5668     -3.3711     -3.1359
+     -2.8753     -2.6010     -2.3223     -2.0455     -1.7749     -1.5136     -1.2654
+     -1.0358     -0.8337     -0.6711     -0.5583     -0.4956     -0.4703     -0.4658
+     -0.4709     -0.4800     -0.4906     -0.5017     -0.5132     -0.8415     -0.8215
+     -0.8045     -0.7900     -0.7686     -0.7326     -0.7049     -0.6910     -0.6828
+     -0.6766     -0.6705     -0.6642     -0.6588     -0.6538     -0.6490     -0.6444
+     -0.6400     -0.6051     -0.5657     -0.5293     -0.4953     -0.4635     -0.4336
+     -0.4086     -0.3887     -0.3735     -0.3632     -0.3627     -0.4024     -0.5976
+     -0.9850     -1.1432     -1.1621     -1.2194     -1.2830     -1.3203     -1.3664
+     -1.4049     -1.4118     -1.4090     -1.4094     -1.4277     -1.5180     -1.7897
+     -2.2989     -2.9258     -3.4662     -3.7165     -3.6895     -3.5378     -3.3283
+     -3.0823     -2.8136     -2.5341     -2.2524     -1.9747     -1.7050     -1.4468
+     -1.2043     -0.9838     -0.7953     -0.6504     -0.5568     -0.5092     -0.4919
+     -0.4902     -0.4952     -0.5029     -0.5117     -0.5212     -0.5310     -0.8399
+     -0.8198     -0.8032     -0.7883     -0.7640     -0.7272     -0.7024     -0.6898
+     -0.6822     -0.6763     -0.6700     -0.6639     -0.6587     -0.6537     -0.6489
+     -0.6443     -0.6400     -0.6051     -0.5657     -0.5292     -0.4953     -0.4634
+     -0.4335     -0.4086     -0.3888     -0.3738     -0.3645     -0.3684     -0.4297
+     -0.6936     -1.0660     -1.1588     -1.1769     -1.2396     -1.2935     -1.3286
+     -1.3782     -1.4105     -1.4131     -1.4094     -1.4107     -1.4359     -1.5527
+     -1.8754     -2.4292     -3.0621     -3.5606     -3.7413     -3.6750     -3.5047
+     -3.2820     -3.0258     -2.7498     -2.4655     -2.1814     -1.9031     -1.6346
+     -1.3797     -1.1432     -0.9325     -0.7583     -0.6315     -0.5555     -0.5201
+     -0.5087     -0.5085     -0.5131     -0.5197     -0.5272     -0.5352     -0.5438
+     -0.8383     -0.8182     -0.8019     -0.7863     -0.7589     -0.7222     -0.7002
+     -0.6888     -0.6817     -0.6759     -0.6696     -0.6637     -0.6585     -0.6536
+     -0.6488     -0.6442     -0.6399     -0.6050     -0.5657     -0.5292     -0.4953
+     -0.4633     -0.4334     -0.4086     -0.3890     -0.3743     -0.3663     -0.3765
+     -0.4694     -0.8048     -1.1225     -1.1695     -1.1932     -1.2572     -1.3020
+     -1.3379     -1.3896     -1.4148     -1.4140     -1.4098     -1.4126     -1.4473
+     -1.5960     -1.9725     -2.5646     -3.1943     -3.6399     -3.7541     -3.6549
+     -3.4677     -3.2324     -2.9666     -2.6839     -2.3955     -2.1094     -1.8309
+     -1.5639     -1.3126     -1.0827     -0.8826     -0.7234     -0.6146     -0.5544
+     -0.5287     -0.5213     -0.5220     -0.5262     -0.5318     -0.5383     -0.5453
+     -0.5530     -0.8366     -0.8167     -0.8007     -0.7840     -0.7533     -0.7178
+     -0.6983     -0.6879     -0.6813     -0.6755     -0.6692     -0.6634     -0.6584
+     -0.6535     -0.6487     -0.6441     -0.6398     -0.6050     -0.5656     -0.5292
+     -0.4952     -0.4632     -0.4334     -0.4086     -0.3891     -0.3749     -0.3688
+     -0.3882     -0.5261     -0.9194     -1.1578     -1.1785     -1.2107     -1.2719
+     -1.3092     -1.3485     -1.4000     -1.4180     -1.4147     -1.4103     -1.4153
+     -1.4625     -1.6489     -2.0803     -2.7031     -3.3199     -3.7034     -3.7568
+     -3.6299     -3.4269     -3.1798     -2.9050     -2.6163     -2.3244     -2.0367
+     -1.7582     -1.4931     -1.2459     -1.0233     -0.8347     -0.6915     -0.6001
+     -0.5535     -0.5352     -0.5306     -0.5318     -0.5356     -0.5405     -0.5462
+     -0.5525     -0.5595     -0.8349     -0.8153     -0.7995     -0.7812     -0.7475
+     -0.7139     -0.6967     -0.6872     -0.6809     -0.6751     -0.6688     -0.6632
+     -0.6583     -0.6533     -0.6486     -0.6440     -0.6398     -0.6050     -0.5656
+     -0.5292     -0.4951     -0.4631     -0.4333     -0.4086     -0.3893     -0.3757
+     -0.3721     -0.4053     -0.6038     -1.0220     -1.1785     -1.1874     -1.2284
+     -1.2837     -1.3159     -1.3603     -1.4090     -1.4203     -1.4152     -1.4108
+     -1.4190     -1.4827     -1.7124     -2.1979     -2.8430     -3.4365     -3.7510
+     -3.7510     -3.6003     -3.3827     -3.1243     -2.8413     -2.5473     -2.2523
+     -1.9634     -1.6854     -1.4225     -1.1801     -0.9656     -0.7896     -0.6630
+     -0.5880     -0.5528     -0.5400     -0.5373     -0.5389     -0.5423     -0.5467
+     -0.5518     -0.5576     -0.5640     -0.8331     -0.8139     -0.7982     -0.7780
+     -0.7416     -0.7106     -0.6953     -0.6865     -0.6805     -0.6747     -0.6684
+     -0.6630     -0.6581     -0.6532     -0.6485     -0.6439     -0.6397     -0.6049
+     -0.5656     -0.5291     -0.4951     -0.4630     -0.4332     -0.4087     -0.3896
+     -0.3767     -0.3769     -0.4306     -0.7031     -1.1015     -1.1906     -1.1974
+     -1.2453     -1.2930     -1.3229     -1.3730     -1.4164     -1.4221     -1.4155
+     -1.4116     -1.4243     -1.5089     -1.7871     -2.3236     -2.9824     -3.5416
+     -3.7838     -3.7381     -3.5667     -3.3352     -3.0662     -2.7757     -2.4769
+     -2.1795     -1.8898     -1.6126     -1.3525     -1.1154     -0.9101     -0.7480
+     -0.6383     -0.5783     -0.5523     -0.5435     -0.5421     -0.5439     -0.5470
+     -0.5510     -0.5557     -0.5611     -0.5673     -0.8315     -0.8127     -0.7968
+     -0.7741     -0.7358     -0.7078     -0.6941     -0.6860     -0.6801     -0.6742
+     -0.6680     -0.6628     -0.6579     -0.6530     -0.6483     -0.6439     -0.6397
+     -0.6049     -0.5656     -0.5291     -0.4950     -0.4629     -0.4332     -0.4087
+     -0.3899     -0.3781     -0.3836     -0.4680     -0.8184     -1.1552     -1.1983
+     -1.2088     -1.2606     -1.3004     -1.3308     -1.3861     -1.4224     -1.4233
+     -1.4159     -1.4127     -1.4316     -1.5424     -1.8735     -2.4559     -3.1193
+     -3.6329     -3.8033     -3.7192     -3.5292     -3.2845     -3.0056     -2.7083
+     -2.4055     -2.1060     -1.8159     -1.5400     -1.2831     -1.0523     -0.8574
+     -0.7104     -0.6175     -0.5708     -0.5519     -0.5460     -0.5456     -0.5474
+     -0.5504     -0.5541     -0.5585     -0.5636     -0.5695     -0.8298     -0.8114
+     -0.7953     -0.7696     -0.7305     -0.7054     -0.6930     -0.6854     -0.6798
+     -0.6738     -0.6677     -0.6626     -0.6577     -0.6529     -0.6482     -0.6438
+     -0.6397     -0.6049     -0.5656     -0.5291     -0.4949     -0.4628     -0.4332
+     -0.4088     -0.3904     -0.3800     -0.3935     -0.5223     -0.9368     -1.1877
+     -1.2041     -1.2216     -1.2736     -1.3065     -1.3402     -1.3988     -1.4269
+     -1.4241     -1.4162     -1.4142     -1.4416     -1.5842     -1.9712     -2.5928
+     -3.2517     -3.7088     -3.8114     -3.6950     -3.4881     -3.2310     -2.9429
+     -2.6395     -2.3331     -2.0321     -1.7420     -1.4677     -1.2148     -0.9913
+     -0.8082     -0.6772     -0.6006     -0.5651     -0.5516     -0.5478     -0.5480
+     -0.5499     -0.5527     -0.5562     -0.5605     -0.5654     -0.5711     -0.8283
+     -0.8103     -0.7935     -0.7646     -0.7256     -0.7033     -0.6921     -0.6850
+     -0.6794     -0.6733     -0.6674     -0.6624     -0.6575     -0.6527     -0.6481
+     -0.6437     -0.6396     -0.6049     -0.5655     -0.5290     -0.4948     -0.4627
+     -0.4332     -0.4090     -0.3909     -0.3826     -0.4080     -0.5979     -1.0422
+     -1.2061     -1.2096     -1.2352     -1.2843     -1.3121     -1.3512     -1.4105
+     -1.4303     -1.4248     -1.4165     -1.4163     -1.4552     -1.6354     -2.0797
+     -2.7326     -3.3772     -3.7687     -3.8099     -3.6662     -3.4435     -3.1747
+     -2.8782     -2.5694     -2.2600     -1.9578     -1.6681     -1.3961     -1.1479
+     -0.9328     -0.7631     -0.6489     -0.5873     -0.5608     -0.5514     -0.5491
+     -0.5497     -0.5516     -0.5543     -0.5577     -0.5618     -0.5666     -0.5722
+     -0.8268     -0.8092     -0.7914     -0.7591     -0.7212     -0.7016     -0.6913
+     -0.6846     -0.6790     -0.6727     -0.6670     -0.6621     -0.6573     -0.6526
+     -0.6480     -0.6436     -0.6396     -0.6049     -0.5655     -0.5290     -0.4947
+     -0.4626     -0.4332     -0.4091     -0.3917     -0.3863     -0.4298     -0.6965
+     -1.1229     -1.2162     -1.2157     -1.2489     -1.2927     -1.3176     -1.3638
+     -1.4206     -1.4327     -1.4252     -1.4170     -1.4193     -1.4733     -1.6972
+     -2.1979     -2.8735     -3.4934     -3.8127     -3.8004     -3.6331     -3.3958
+     -3.1159     -2.8116     -2.4981     -2.1863     -1.8833     -1.5945     -1.3252
+     -1.0827     -0.8774     -0.7225     -0.6252     -0.5770     -0.5577     -0.5513
+     -0.5500     -0.5509     -0.5528     -0.5555     -0.5588     -0.5628     -0.5675
+     -0.5730     -0.8254     -0.8080     -0.7889     -0.7533     -0.7174     -0.7000
+     -0.6906     -0.6842     -0.6785     -0.6722     -0.6667     -0.6618     -0.6571
+     -0.6524     -0.6479     -0.6436     -0.6396     -0.6048     -0.5655     -0.5289
+     -0.4946     -0.4626     -0.4332     -0.4094     -0.3927     -0.3915     -0.4623
+     -0.8131     -1.1769     -1.2220     -1.2229     -1.2618     -1.2994     -1.3239
+     -1.3778     -1.4290     -1.4345     -1.4256     -1.4175     -1.4236     -1.4971
+     -1.7700     -2.3243     -3.0139     -3.5979     -3.8422     -3.7842     -3.5962
+     -3.3450     -3.0548     -2.7436     -2.4259     -2.1121     -1.8088     -1.5213
+     -1.2554     -1.0196     -0.8257     -0.6868     -0.6062     -0.5693     -0.5554
+     -0.5512     -0.5507     -0.5517     -0.5537     -0.5563     -0.5595     -0.5634
+     -0.5681     -0.5735     -0.8241     -0.8069     -0.7858     -0.7474     -0.7142
+     -0.6987     -0.6900     -0.6837     -0.6779     -0.6717     -0.6664     -0.6616
+     -0.6569     -0.6523     -0.6478     -0.6435     -0.6395     -0.6048     -0.5655
+     -0.5289     -0.4945     -0.4625     -0.4333     -0.4097     -0.3941     -0.3992
+     -0.5105     -0.9349     -1.2091     -1.2259     -1.2314     -1.2733     -1.3048
+     -1.3313     -1.3924     -1.4356     -1.4358     -1.4258     -1.4183     -1.4295
+     -1.5275     -1.8545     -2.4571     -3.1517     -3.6883     -3.8586     -3.7623
+     -3.5557     -3.2914     -2.9916     -2.6741     -2.3529     -2.0376     -1.7343
+     -1.4486     -1.1870     -0.9591     -0.7782     -0.6563     -0.5911     -0.5636
+     -0.5538     -0.5511     -0.5511     -0.5523     -0.5543     -0.5569     -0.5600
+     -0.5639     -0.5685     -0.5739     -0.8229     -0.8056     -0.7823     -0.7417
+     -0.7114     -0.6976     -0.6894     -0.6833     -0.6773     -0.6712     -0.6660
+     -0.6613     -0.6567     -0.6521     -0.6477     -0.6435     -0.6395     -0.6048
+     -0.5655     -0.5288     -0.4944     -0.4625     -0.4333     -0.4101     -0.3959
+     -0.4105     -0.5795     -1.0452     -1.2269     -1.2292     -1.2410     -1.2830
+     -1.3094     -1.3404     -1.4068     -1.4407     -1.4367     -1.4261     -1.4194
+     -1.4377     -1.5659     -1.9504     -2.5946     -3.2851     -3.7633     -3.8640
+     -3.7353     -3.5118     -3.2352     -2.9265     -2.6034     -2.2793     -1.9628
+     -1.6600     -1.3767     -1.1202     -0.9016     -0.7353     -0.6309     -0.5796
+     -0.5595     -0.5527     -0.5511     -0.5514     -0.5527     -0.5547     -0.5572
+     -0.5604     -0.5642     -0.5688     -0.5741     -0.8217     -0.8043     -0.7781
+     -0.7362     -0.7090     -0.6965     -0.6888     -0.6828     -0.6767     -0.6707
+     -0.6657     -0.6611     -0.6565     -0.6520     -0.6477     -0.6435     -0.6395
+     -0.6048     -0.5654     -0.5287     -0.4943     -0.4625     -0.4334     -0.4106
+     -0.3986     -0.4276     -0.6723     -1.1309     -1.2363     -1.2326     -1.2513
+     -1.2909     -1.3137     -1.3516     -1.4202     -1.4445     -1.4373     -1.4263
+     -1.4210     -1.4490     -1.6133     -2.0573     -2.7351     -3.4117     -3.8220
+     -3.8601     -3.7040     -3.4647     -3.1765     -2.8597     -2.5317     -2.2051
+     -1.8879     -1.5861     -1.3057     -1.0554     -0.8477     -0.6976     -0.6103
+     -0.5710     -0.5565     -0.5519     -0.5510     -0.5516     -0.5530     -0.5550
+     -0.5575     -0.5606     -0.5644     -0.5690     -0.5743     -0.8206     -0.8027
+     -0.7733     -0.7312     -0.7069     -0.6956     -0.6883     -0.6823     -0.6760
+     -0.6703     -0.6654     -0.6608     -0.6564     -0.6519     -0.6476     -0.6434
+     -0.6395     -0.6048     -0.5654     -0.5286     -0.4942     -0.4625     -0.4336
+     -0.4113     -0.4023     -0.4535     -0.7863     -1.1886     -1.2413     -1.2366
+     -1.2616     -1.2972     -1.3183     -1.3648     -1.4320     -1.4473     -1.4378
+     -1.4266     -1.4232     -1.4641     -1.6709     -2.1741     -2.8769     -3.5291
+     -3.8650     -3.8484     -3.6686     -3.4147     -3.1155     -2.7913     -2.4591
+     -2.1305     -1.8130     -1.5126     -1.2360     -0.9930     -0.7980     -0.6651
+     -0.5942     -0.5647     -0.5544     -0.5513     -0.5510     -0.5518     -0.5532
+     -0.5552     -0.5577     -0.5608     -0.5646     -0.5691     -0.5745     -0.8196
+     -0.8008     -0.7679     -0.7267     -0.7051     -0.6947     -0.6877     -0.6817
+     -0.6753     -0.6698     -0.6650     -0.6606     -0.6562     -0.6518     -0.6476
+     -0.6434     -0.6395     -0.6048     -0.5653     -0.5285     -0.4942     -0.4625
+     -0.4338     -0.4122     -0.4078     -0.4927     -0.9104     -1.2231     -1.2442
+     -1.2415     -1.2714     -1.3021     -1.3237     -1.3797     -1.4419     -1.4493
+     -1.4381     -1.4270     -1.4263     -1.4842     -1.7393     -2.2994     -3.0183
+     -3.6349     -3.8934     -3.8302     -3.6296     -3.3618     -3.0524     -2.7216
+     -2.3857     -2.0556     -1.7382     -1.4398     -1.1677     -0.9335     -0.7528
+     -0.6379     -0.5818     -0.5601     -0.5529     -0.5510     -0.5510     -0.5519
+     -0.5534     -0.5553     -0.5578     -0.5609     -0.5647     -0.5692     -0.5745
+     -0.8185     -0.7986     -0.7622     -0.7228     -0.7035     -0.6939     -0.6872
+     -0.6810     -0.6746     -0.6693     -0.6647     -0.6604     -0.6561     -0.6517
+     -0.6475     -0.6434     -0.6395     -0.6048     -0.5653     -0.5284     -0.4941
+     -0.4625     -0.4340     -0.4134     -0.4159     -0.5506     -1.0275     -1.2421
+     -1.2462     -1.2475     -1.2801     -1.3061     -1.3303     -1.3959     -1.4498
+     -1.4507     -1.4383     -1.4276     -1.4308     -1.5102     -1.8192     -2.4315
+     -3.1575     -3.7269     -3.9089     -3.8065     -3.5872     -3.3063     -2.9875
+     -2.6507     -2.3117     -1.9805     -1.6637     -1.3677     -1.1012     -0.8773
+     -0.7126     -0.6158     -0.5725     -0.5568     -0.5518     -0.5507     -0.5510
+     -0.5520     -0.5535     -0.5554     -0.5579     -0.5610     -0.5648     -0.5693
+     -0.5746     -0.8174     -0.7959     -0.7563     -0.7193     -0.7021     -0.6931
+     -0.6865     -0.6802     -0.6739     -0.6689     -0.6644     -0.6602     -0.6559
+     -0.6517     -0.6475     -0.6434     -0.6395     -0.6048     -0.5652     -0.5283
+     -0.4940     -0.4625     -0.4343     -0.4152     -0.4281     -0.6320     -1.1221
+     -1.2520     -1.2480     -1.2543     -1.2875     -1.3096     -1.3388     -1.4122
+     -1.4559     -1.4517     -1.4386     -1.4283     -1.4370     -1.5435     -1.9107
+     -2.5687     -3.2927     -3.8033     -3.9134     -3.7779     -3.5416     -3.2484
+     -2.9208     -2.5788     -2.2372     -1.9053     -1.5895     -1.2968     -1.0369
+     -0.8250     -0.6778     -0.5983     -0.5657     -0.5545     -0.5511     -0.5505
+     -0.5510     -0.5520     -0.5535     -0.5555     -0.5580     -0.5611     -0.5648
+     -0.5693     -0.5746     -0.8163     -0.7927     -0.7503     -0.7163     -0.7008
+     -0.6923     -0.6858     -0.6794     -0.6733     -0.6685     -0.6641     -0.6600
+     -0.6558     -0.6516     -0.6474     -0.6433     -0.6394     -0.6047     -0.5652
+     -0.5282     -0.4940     -0.4626     -0.4348     -0.4176     -0.4468     -0.7375
+     -1.1879     -1.2571     -1.2500     -1.2617     -1.2935     -1.3129     -1.3494
+     -1.4279     -1.4605     -1.4524     -1.4387     -1.4293     -1.4455     -1.5851
+     -2.0134     -2.7092     -3.4216     -3.8637     -3.9086     -3.7451     -3.4931
+     -3.1881     -2.8526     -2.5060     -2.1624     -1.8301     -1.5158     -1.2270
+     -0.9752     -0.7771     -0.6484     -0.5849     -0.5607     -0.5528     -0.5506
+     -0.5504     -0.5509     -0.5520     -0.5536     -0.5555     -0.5580     -0.5611
+     -0.5649     -0.5694     -0.5747     -0.8150     -0.7888     -0.7446     -0.7137
+     -0.6995     -0.6915     -0.6851     -0.6785     -0.6727     -0.6681     -0.6639
+     -0.6598     -0.6557     -0.6516     -0.6474     -0.6433     -0.6394     -0.6047
+     -0.5651     -0.5281     -0.4940     -0.4627     -0.4353     -0.4212     -0.4755
+     -0.8599     -1.2283     -1.2597     -1.2525     -1.2694     -1.2983     -1.3166
+     -1.3625     -1.4421     -1.4639     -1.4529     -1.4389     -1.4308     -1.4572
+     -1.6361     -2.1265     -2.8515     -3.5418     -3.9081     -3.8962     -3.7085
+     -3.4417     -3.1258     -2.7830     -2.4325     -2.0872     -1.7551     -1.4428
+     -1.1589     -0.9165     -0.7341     -0.6242     -0.5747     -0.5571     -0.5516
+     -0.5502     -0.5503     -0.5509     -0.5521     -0.5536     -0.5556     -0.5581
+     -0.5611     -0.5649     -0.5694     -0.5747     -0.8136     -0.7843     -0.7391
+     -0.7114     -0.6983     -0.6906     -0.6843     -0.6776     -0.6721     -0.6678
+     -0.6637     -0.6597     -0.6557     -0.6515     -0.6474     -0.6433     -0.6394
+     -0.6047     -0.5650     -0.5280     -0.4940     -0.4629     -0.4361     -0.4265
+     -0.5193     -0.9837     -1.2507     -1.2611     -1.2556     -1.2767     -1.3020
+     -1.3209     -1.3778     -1.4542     -1.4663     -1.4533     -1.4392     -1.4329
+     -1.4728     -1.6976     -2.2488     -2.9940     -3.6511     -3.9378     -3.8772
+     -3.6685     -3.3878     -3.0615     -2.7122     -2.3584     -2.0119     -1.6803
+     -1.3706     -1.0926     -0.8614     -0.6962     -0.6048     -0.5672     -0.5546
+     -0.5508     -0.5500     -0.5502     -0.5509     -0.5521     -0.5536     -0.5556
+     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747     -0.8119     -0.7791
+     -0.7342     -0.7092     -0.6971     -0.6898     -0.6834     -0.6768     -0.6716
+     -0.6675     -0.6635     -0.6596     -0.6556     -0.6515     -0.6474     -0.6433
+     -0.6394     -0.6047     -0.5649     -0.5279     -0.4940     -0.4630     -0.4372
+     -0.4344     -0.5839     -1.0909     -1.2625     -1.2622     -1.2594     -1.2834
+     -1.3051     -1.3264     -1.3950     -1.4641     -1.4681     -1.4535     -1.4395
+     -1.4359     -1.4935     -1.7702     -2.3785     -3.1348     -3.7469     -3.9545
+     -3.8528     -3.6253     -3.3313     -2.9954     -2.6403     -2.2837     -1.9365
+     -1.6059     -1.2995     -1.0286     -0.8103     -0.6638     -0.5898     -0.5618
+     -0.5528     -0.5502     -0.5498     -0.5501     -0.5509     -0.5521     -0.5536
+     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747     -0.8098
+     -0.7733     -0.7296     -0.7072     -0.6959     -0.6889     -0.6825     -0.6760
+     -0.6712     -0.6672     -0.6633     -0.6595     -0.6555     -0.6514     -0.6474
+     -0.6433     -0.6394     -0.6046     -0.5648     -0.5279     -0.4940     -0.4633
+     -0.4387     -0.4465     -0.6735     -1.1702     -1.2684     -1.2631     -1.2640
+     -1.2891     -1.3077     -1.3336     -1.4132     -1.4719     -1.4693     -1.4537
+     -1.4400     -1.4402     -1.5204     -1.8544     -2.5141     -3.2724     -3.8276
+     -3.9599     -3.8238     -3.5791     -3.2725     -2.9277     -2.5676     -2.2087
+     -1.8611     -1.5320     -1.2297     -0.9672     -0.7637     -0.6367     -0.5784
+     -0.5578     -0.5515     -0.5498     -0.5497     -0.5501     -0.5509     -0.5521
+     -0.5536     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747
+     -0.8073     -0.7671     -0.7256     -0.7053     -0.6947     -0.6880     -0.6816
+     -0.6753     -0.6708     -0.6670     -0.6632     -0.6594     -0.6555     -0.6514
+     -0.6473     -0.6433     -0.6394     -0.6046     -0.5647     -0.5278     -0.4940
+     -0.4636     -0.4409     -0.4653     -0.7863     -1.2212     -1.2713     -1.2641
+     -1.2691     -1.2938     -1.3102     -1.3429     -1.4314     -1.4778     -1.4702
+     -1.4539     -1.4406     -1.4461     -1.5546     -1.9501     -2.6539     -3.4045
+     -3.8922     -3.9559     -3.7906     -3.5301     -3.2116     -2.8586     -2.4941
+     -2.1334     -1.7858     -1.4587     -1.1614     -0.9089     -0.7222     -0.6148
+     -0.5698     -0.5550     -0.5507     -0.5496     -0.5496     -0.5501     -0.5509
+     -0.5521     -0.5537     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694
+     -0.5747     -0.8042     -0.7607     -0.7219     -0.7036     -0.6936     -0.6870
+     -0.6807     -0.6746     -0.6704     -0.6668     -0.6630     -0.6593     -0.6554
+     -0.6514     -0.6473     -0.6433     -0.6394     -0.6045     -0.5646     -0.5278
+     -0.4941     -0.4641     -0.4440     -0.4947     -0.9117     -1.2506     -1.2727
+     -1.2655     -1.2746     -1.2975     -1.3129     -1.3548     -1.4486     -1.4822
+     -1.4708     -1.4540     -1.4415     -1.4542     -1.5973     -2.0569     -2.7961
+     -3.5291     -3.9408     -3.9440     -3.7538     -3.4785     -3.1485     -2.7882
+     -2.4200     -2.0579     -1.7108     -1.3863     -1.0950     -0.8542     -0.6859
+     -0.5974     -0.5636     -0.5530     -0.5500     -0.5494     -0.5495     -0.5501
+     -0.5509     -0.5521     -0.5537     -0.5556     -0.5581     -0.5612     -0.5649
+     -0.5694     -0.5747     -0.8004     -0.7542     -0.7186     -0.7018     -0.6924
+     -0.6861     -0.6798     -0.6741     -0.6701     -0.6666     -0.6629     -0.6592
+     -0.6554     -0.6514     -0.6473     -0.6433     -0.6394     -0.6045     -0.5645
+     -0.5277     -0.4942     -0.4647     -0.4486     -0.5399     -1.0318     -1.2663
+     -1.2735     -1.2673     -1.2800     -1.3005     -1.3161     -1.3693     -1.4638
+     -1.4854     -1.4712     -1.4542     -1.4428     -1.4654     -1.6495     -2.1736
+     -2.9392     -3.6436     -3.9744     -3.9255     -3.7138     -3.4244     -3.0836
+     -2.7168     -2.3453     -1.9823     -1.6361     -1.3148     -1.0308     -0.8037
+     -0.6551     -0.5841     -0.5591     -0.5516     -0.5496     -0.5492     -0.5495
+     -0.5501     -0.5509     -0.5521     -0.5537     -0.5556     -0.5581     -0.5612
+     -0.5649     -0.5694     -0.5747     -0.7958     -0.7479     -0.7156     -0.7002
+     -0.6914     -0.6853     -0.6789     -0.6736     -0.6699     -0.6664     -0.6628
+     -0.6592     -0.6554     -0.6514     -0.6473     -0.6433     -0.6394     -0.6044
+     -0.5644     -0.5277     -0.4943     -0.4655     -0.4557     -0.6068     -1.1296
+     -1.2742     -1.2740     -1.2695     -1.2850     -1.3028     -1.3203     -1.3864
+     -1.4767     -1.4877     -1.4715     -1.4544     -1.4446     -1.4805     -1.7123
+     -2.2988     -3.0817     -3.7456     -3.9944     -3.9016     -3.6708     -3.3679
+     -3.0170     -2.6443     -2.2702     -1.9067     -1.5618     -1.2446     -0.9693
+     -0.7578     -0.6296     -0.5741     -0.5559     -0.5507     -0.5493     -0.5491
+     -0.5495     -0.5501     -0.5509     -0.5521     -0.5537     -0.5556     -0.5581
+     -0.5612     -0.5649     -0.5694     -0.5747     -0.7905     -0.7419     -0.7128
+     -0.6986     -0.6903     -0.6844     -0.6781     -0.6732     -0.6696     -0.6663
+     -0.6628     -0.6591     -0.6554     -0.6513     -0.6473     -0.6433     -0.6394
+     -0.6043     -0.5643     -0.5277     -0.4945     -0.4667     -0.4667     -0.6994
+     -1.1979     -1.2780     -1.2744     -1.2723     -1.2895     -1.3048     -1.3258
+     -1.4056     -1.4871     -1.4893     -1.4717     -1.4546     -1.4472     -1.5004
+     -1.7863     -2.4311     -3.2219     -3.8331     -4.0027     -3.8730     -3.6250
+     -3.3090     -2.9488     -2.5711     -2.1948     -1.8312     -1.4882     -1.1759
+     -0.9109     -0.7169     -0.6091     -0.5667     -0.5536     -0.5500     -0.5491
+     -0.5491     -0.5494     -0.5501     -0.5509     -0.5521     -0.5537     -0.5556
+     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747     -0.7844     -0.7363
+     -0.7103     -0.6972     -0.6893     -0.6835     -0.6774     -0.6728     -0.6694
+     -0.6662     -0.6627     -0.6591     -0.6553     -0.6513     -0.6473     -0.6433
+     -0.6394     -0.6042     -0.5643     -0.5277     -0.4947     -0.4684     -0.4840
+     -0.8147     -1.2397     -1.2799     -1.2749     -1.2756     -1.2932     -1.3066
+     -1.3331     -1.4258     -1.4952     -1.4905     -1.4719     -1.4550     -1.4509
+     -1.5263     -1.8718     -2.5686     -3.3579     -3.9049     -4.0012     -3.8404
+     -3.5766     -3.2480     -2.8793     -2.4971     -2.1192     -1.7559     -1.4153
+     -1.1091     -0.8561     -0.6814     -0.5930     -0.5613     -0.5520     -0.5495
+     -0.5489     -0.5490     -0.5494     -0.5501     -0.5509     -0.5521     -0.5537
+     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747     -0.7777
+     -0.7313     -0.7080     -0.6958     -0.6884     -0.6827     -0.6768     -0.6725
+     -0.6693     -0.6661     -0.6626     -0.6591     -0.6553     -0.6513     -0.6473
+     -0.6433     -0.6393     -0.6041     -0.5642     -0.5277     -0.4950     -0.4710
+     -0.5113     -0.9402     -1.2630     -1.2807     -1.2756     -1.2793     -1.2963
+     -1.3085     -1.3427     -1.4460     -1.5013     -1.4913     -1.4720     -1.4555
+     -1.4560     -1.5594     -1.9690     -2.7097     -3.4876     -3.9606     -3.9913
+     -3.8044     -3.5257     -3.1849     -2.8085     -2.4226     -2.0435     -1.6808
+     -1.3434     -1.0443     -0.8054     -0.6513     -0.5808     -0.5575     -0.5509
+     -0.5492     -0.5488     -0.5490     -0.5494     -0.5500     -0.5509     -0.5521
+     -0.5537     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694     -0.5747
+     -0.7705     -0.7268     -0.7058     -0.6946     -0.6876     -0.6819     -0.6763
+     -0.6723     -0.6691     -0.6660     -0.6626     -0.6590     -0.6553     -0.6513
+     -0.6473     -0.6433     -0.6393     -0.6040     -0.5641     -0.5278     -0.4955
+     -0.4747     -0.5539     -1.0570     -1.2751     -1.2811     -1.2765     -1.2831
+     -1.2986     -1.3107     -1.3551     -1.4650     -1.5058     -1.4918     -1.4721
+     -1.4562     -1.4632     -1.6008     -2.0770     -2.8528     -3.6088     -4.0008
+     -3.9746     -3.7654     -3.4723     -3.1200     -2.7366     -2.3476     -1.9677
+     -1.6062     -1.2726     -0.9822     -0.7593     -0.6265     -0.5716     -0.5547
+     -0.5501     -0.5489     -0.5488     -0.5490     -0.5494     -0.5500     -0.5509
+     -0.5521     -0.5537     -0.5556     -0.5581     -0.5612     -0.5649     -0.5694
+     -0.5747
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/kR_h2001.dat PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/kR_h2001.dat
--- PLUTO4/Src/Radiation/SemenovOpacity/kR_h2001.dat	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/kR_h2001.dat	2013-06-01 18:33:00.207214819 +0200
@@ -0,0 +1,722 @@
+    1.4128
+     -3.2068     -3.1983     -3.1906     -3.1817     -3.1625     -3.1258     -3.0997
+     -3.0877     -3.0829     -3.0870     -3.1075     -3.1536     -3.2067     -3.2364
+     -3.2516     -3.2704     -3.2925     -3.2272     -3.1365     -3.0419     -2.9457
+     -2.8489     -2.7511     -2.6521     -2.5521     -2.4519     -2.3529     -2.2560
+     -2.1622     -2.0722     -1.9864     -1.9049     -1.8275     -1.7536     -1.6829
+     -1.6148     -1.5483     -1.4817     -1.4143     -1.3480     -1.2891     -1.2471
+     -1.2327     -1.2549     -1.3129     -1.3819     -1.4158     -1.3808     -1.2831
+     -1.1608     -1.0441     -0.9464     -0.8732     -0.8251     -0.7970     -0.7769
+     -0.7424     -0.6684     -0.5490     -0.3977     -0.2286     -0.0504      0.1328
+      0.3193      0.5089      0.7016      0.8975      1.0966      1.2984      1.5019
+      1.7058     -3.2996     -3.2868     -3.2745     -3.2591     -3.2289     -3.1915
+     -3.1701     -3.1571     -3.1514     -3.1567     -3.1851     -3.2355     -3.2771
+     -3.2931     -3.3043     -3.3216     -3.3407     -3.2711     -3.1754     -3.0765
+     -2.9765     -2.8758     -2.7739     -2.6707     -2.5665     -2.4624     -2.3602
+     -2.2609     -2.1654     -2.0743     -1.9878     -1.9059     -1.8283     -1.7544
+     -1.6839     -1.6162     -1.5504     -1.4853     -1.4207     -1.3599     -1.3111
+     -1.2853     -1.2944     -1.3457     -1.4304     -1.5113     -1.5388     -1.4883
+     -1.3796     -1.2552     -1.1417     -1.0502     -0.9847     -0.9446     -0.9224
+     -0.9033     -0.8611     -0.7731     -0.6405     -0.4798     -0.3040     -0.1206
+      0.0672      0.2583      0.4526      0.6503      0.8514      1.0559      1.2630
+      1.4716      1.6799     -3.3961     -3.3791     -3.3620     -3.3389     -3.3008
+     -3.2677     -3.2472     -3.2326     -3.2257     -3.2350     -3.2712     -3.3176
+     -3.3428     -3.3492     -3.3581     -3.3730     -3.3884     -3.3143     -3.2136
+     -3.1104     -3.0063     -2.9015     -2.7953     -2.6875     -2.5789     -2.4710
+     -2.3658     -2.2646     -2.1678     -2.0758     -1.9888     -1.9066     -1.8289
+     -1.7550     -1.6848     -1.6177     -1.5528     -1.4894     -1.4283     -1.3744
+     -1.3380     -1.3321     -1.3692     -1.4521     -1.5607     -1.6462     -1.6612
+     -1.5932     -1.4754     -1.3507     -1.2414     -1.1568     -1.0995     -1.0671
+     -1.0500     -1.0296     -0.9769     -0.8738     -0.7289     -0.5596     -0.3777
+     -0.1893      0.0031      0.1988      0.3979      0.6007      0.8072      1.0172
+      1.2297      1.4431      1.6556     -3.4953     -3.4744     -3.4524     -3.4212
+     -3.3809     -3.3515     -3.3295     -3.3129     -3.3063     -3.3226     -3.3620
+     -3.3965     -3.4061     -3.4067     -3.4134     -3.4246     -3.4362     -3.3569
+     -3.2513     -3.1437     -3.0353     -2.9262     -2.8153     -2.7025     -2.5893
+     -2.4778     -2.3701     -2.2673     -2.1694     -2.0768     -1.9895     -1.9071
+     -1.8294     -1.7557     -1.6857     -1.6192     -1.5553     -1.4941     -1.4375
+     -1.3922     -1.3714     -1.3900     -1.4592     -1.5742     -1.7013     -1.7836
+     -1.7809     -1.6953     -1.5707     -1.4472     -1.3433     -1.2662     -1.2175
+     -1.1925     -1.1792     -1.1548     -1.0888     -0.9706     -0.8143     -0.6372
+     -0.4497     -0.2565     -0.0596      0.1407      0.3448      0.5529      0.7650
+      0.9806      1.1984      1.4165      1.6327     -3.5963     -3.5717     -3.5445
+     -3.5068     -3.4683     -3.4397     -3.4157     -3.3975     -3.3945     -3.4179
+     -3.4531     -3.4716     -3.4693     -3.4660     -3.4695     -3.4767     -3.4839
+     -3.3991     -3.2886     -3.1766     -3.0640     -2.9501     -2.8339     -2.7157
+     -2.5978     -2.4831     -2.3734     -2.2693     -2.1706     -2.0776     -1.9900
+     -1.9076     -1.8298     -1.7563     -1.6867     -1.6208     -1.5582     -1.4997
+     -1.4487     -1.4145     -1.4131     -1.4611     -1.5658     -1.7112     -1.8493
+     -1.9207     -1.8965     -1.7948     -1.6658     -1.5451     -1.4474     -1.3785
+     -1.3385     -1.3204     -1.3093     -1.2776     -1.1965     -1.0636     -0.8970
+     -0.7130     -0.5202     -0.3224     -0.1209      0.0842      0.2935      0.5071
+      0.7249      0.9461      1.1691      1.3916      1.6111     -3.6985     -3.6704
+     -3.6378     -3.5967     -3.5607     -3.5309     -3.5049     -3.4871     -3.4908
+     -3.5172     -3.5414     -3.5442     -3.5336     -3.5268     -3.5264     -3.5292
+     -3.5313     -3.4411     -3.3260     -3.2097     -3.0927     -2.9734     -2.8510
+     -2.7269     -2.6046     -2.4870     -2.3757     -2.2706     -2.1715     -2.0781
+     -1.9904     -1.9079     -1.8302     -1.7569     -1.6878     -1.6226     -1.5616
+     -1.5065     -1.4627     -1.4425     -1.4655     -1.5480     -1.6898     -1.8609
+     -2.0011     -2.0548     -2.0074     -1.8920     -1.7612     -1.6445     -1.5539
+     -1.4938     -1.4623     -1.4505     -1.4392     -1.3971     -1.2997     -1.1531
+     -0.9773     -0.7870     -0.5892     -0.3869     -0.1808      0.0293      0.2440
+      0.4633      0.6869      0.9137      1.1416      1.3682      1.5904     -3.8015
+     -3.7701     -3.7327     -3.6913     -3.6560     -3.6245     -3.5973     -3.5830
+     -3.5935     -3.6164     -3.6259     -3.6159     -3.5992     -3.5887     -3.5840
+     -3.5819     -3.5786     -3.4834     -3.3642     -3.2439     -3.1218     -2.9960
+     -2.8663     -2.7361     -2.6098     -2.4900     -2.3774     -2.2716     -2.1721
+     -2.0785     -1.9907     -1.9082     -1.8306     -1.7576     -1.6889     -1.6247
+     -1.5657     -1.5149     -1.4805     -1.4783     -1.5311     -1.6524     -1.8305
+     -2.0203     -2.1533     -2.1840     -2.1134     -1.9877     -1.8570     -1.7455
+     -1.6628     -1.6119     -1.5889     -1.5821     -1.5678     -1.5124     -1.3984
+     -1.2394     -1.0554     -0.8593     -0.6568     -0.4499     -0.2391     -0.0239
+      0.1964      0.4216      0.6511      0.8833      1.1160      1.3460      1.5703
+     -3.9058     -3.8710     -3.8302     -3.7899     -3.7540     -3.7210     -3.6941
+     -3.6860     -3.6998     -3.7128     -3.7077     -3.6879     -3.6663     -3.6518
+     -3.6426     -3.6350     -3.6266     -3.5272     -3.4043     -3.2798     -3.1514
+     -3.0173     -2.8796     -2.7435     -2.6138     -2.4921     -2.3786     -2.2723
+     -2.1725     -2.0788     -1.9909     -1.9085     -1.8311     -1.7583     -1.6901
+     -1.6271     -1.5706     -1.5255     -1.5032     -1.5239     -1.6125     -1.7754
+     -1.9862     -2.1855     -2.3029     -2.3070     -2.2150     -2.0823     -1.9537
+     -1.8485     -1.7743     -1.7327     -1.7178     -1.7145     -1.6940     -1.6228
+     -1.4928     -1.3227     -1.1315     -0.9301     -0.7230     -0.5116     -0.2959
+     -0.0752      0.1508      0.3821      0.6174      0.8550      1.0919      1.3249
+      1.5505     -4.0118     -3.9739     -3.9316     -3.8919     -3.8548     -3.8209
+     -3.7969     -3.7952     -3.8062     -3.8058     -3.7886     -3.7613     -3.7354
+     -3.7168     -3.7027     -3.6896     -3.6764     -3.5735     -3.4473     -3.3176
+     -3.1809     -3.0369     -2.8907     -2.7493     -2.6167     -2.4937     -2.3794
+     -2.2728     -2.1728     -2.0790     -1.9911     -1.9088     -1.8315     -1.7590
+     -1.6916     -1.6300     -1.5768     -1.5392     -1.5326     -1.5822     -1.7121
+     -1.9168     -2.1541     -2.3526     -2.4474     -2.4231     -2.3129     -2.1763
+     -2.0515     -1.9535     -1.8884     -1.8563     -1.8488     -1.8467     -1.8166
+     -1.7282     -1.5833     -1.4034     -1.2057     -0.9994     -0.7878     -0.5717
+     -0.3509     -0.1246      0.1075      0.3448      0.5860      0.8285      1.0692
+      1.3044      1.5305     -4.1198     -4.0792     -4.0369     -3.9969     -3.9589
+     -3.9252     -3.9065     -3.9083     -3.9106     -3.8969     -3.8703     -3.8371
+     -3.8074     -3.7847     -3.7654     -3.7470     -3.7294     -3.6238     -3.4939
+     -3.3568     -3.2092     -3.0541     -2.8997     -2.7537     -2.6188     -2.4948
+     -2.3800     -2.2731     -2.1730     -2.0791     -1.9913     -1.9090     -1.8320
+     -1.7599     -1.6933     -1.6336     -1.5847     -1.5568     -1.5710     -1.6560
+     -1.8311     -2.0752     -2.3304     -2.5179     -2.5851     -2.5325     -2.4080
+     -2.2703     -2.1506     -2.0605     -2.0049     -1.9823     -1.9813     -1.9776
+     -1.9346     -1.8286     -1.6701     -1.4816     -1.2782     -1.0672     -0.8511
+     -0.6302     -0.4040     -0.1718      0.0665      0.3100      0.5567      0.8038
+      1.0476      1.2842      1.5098     -4.2295     -4.1873     -4.1452     -4.1046
+     -4.0661     -4.0348     -4.0221     -4.0224     -4.0127     -3.9883     -3.9543
+     -3.9164     -3.8834     -3.8565     -3.8320     -3.8089     -3.7872     -3.6789
+     -3.5436     -3.3963     -3.2354     -3.0685     -2.9068     -2.7570     -2.6204
+     -2.4955     -2.3804     -2.2733     -2.1731     -2.0793     -1.9915     -1.9093
+     -1.8325     -1.7609     -1.6954     -1.6380     -1.5948     -1.5801     -1.6209
+     -1.7480     -1.9699     -2.2480     -2.5107     -2.6787     -2.7146     -2.6357
+     -2.5011     -2.3646     -2.2511     -2.1696     -2.1239     -2.1106     -2.1144
+     -2.1060     -2.0473     -1.9240     -1.7536     -1.5576     -1.3489     -1.1334
+     -0.9128     -0.6869     -0.4550     -0.2167      0.0279      0.2775      0.5295
+      0.7806      1.0267      1.2639      1.4880     -4.3400     -4.2971     -4.2551
+     -4.2140     -4.1759     -4.1495     -4.1417     -4.1354     -4.1139     -4.0814
+     -4.0418     -4.0001     -3.9639     -3.9327     -3.9037     -3.8763     -3.8506
+     -3.7389     -3.5954     -3.4343     -3.2583     -3.0802     -2.9121     -2.7593
+     -2.6215     -2.4961     -2.3807     -2.2735     -2.1732     -2.0794     -1.9917
+     -1.9097     -1.8331     -1.7622     -1.6979     -1.6437     -1.6082     -1.6109
+     -1.6856     -1.8600     -2.1275     -2.4319     -2.6910     -2.8326     -2.8355
+     -2.7337     -2.5928     -2.4595     -2.3530     -2.2807     -2.2453     -2.2408
+     -2.2473     -2.2306     -2.1544     -2.0149     -1.8340     -1.6315     -1.4179
+     -1.1980     -0.9726     -0.7415     -0.5037     -0.2591     -0.0081      0.2473
+      0.5042      0.7586      1.0063      1.2429      1.4645     -4.4497     -4.4067
+     -4.3644     -4.3232     -4.2876     -4.2684     -4.2622     -4.2463     -4.2156
+     -4.1771     -4.1327     -4.0879     -4.0488     -4.0137     -3.9807     -3.9495
+     -3.9199     -3.8028     -3.6471     -3.4690     -3.2775     -3.0893     -2.9160
+     -2.7610     -2.6223     -2.4965     -2.3809     -2.2736     -2.1733     -2.0796
+     -1.9919     -1.9100     -1.8338     -1.7636     -1.7011     -1.6511     -1.6259
+     -1.6519     -1.7678     -1.9927     -2.3017     -2.6225     -2.8678     -2.9780
+     -2.9478     -2.8275     -2.6837     -2.5550     -2.4563     -2.3938     -2.3688
+     -2.3722     -2.3788     -2.3503     -2.2558     -2.1015     -1.9115     -1.7031
+     -1.4850     -1.2606     -1.0304     -0.7937     -0.5498     -0.2988     -0.0415
+      0.2195      0.4806      0.7376      0.9859      1.2209      1.4385     -4.5560
+     -4.5131     -4.4707     -4.4304     -4.4005     -4.3897     -4.3809     -4.3552
+     -4.3179     -4.2747     -4.2260     -4.1786     -4.1368     -4.0983     -4.0619
+     -4.0273     -3.9942     -3.8686     -3.6963     -3.4993     -3.2930     -3.0962
+     -2.9189     -2.7623     -2.6228     -2.4967     -2.3810     -2.2737     -2.1734
+     -2.0797     -1.9921     -1.9104     -1.8347     -1.7654     -1.7052     -1.6609
+     -1.6496     -1.7060     -1.8701     -2.1456     -2.4893     -2.8154     -3.0385
+     -3.1137     -3.0522     -2.9180     -2.7740     -2.6512     -2.5609     -2.5087
+     -2.4943     -2.5040     -2.5076     -2.4643     -2.3514     -2.1840     -1.9862
+     -1.7725     -1.5500     -1.3211     -1.0858     -0.8433     -0.5931     -0.3355
+     -0.0722      0.1938      0.4585      0.7172      0.9649      1.1971      1.4094
+     -4.6563     -4.6135     -4.5713     -4.5340     -4.5140     -4.5104     -4.4954
+     -4.4615     -4.4196     -4.3721     -4.3194     -4.2698     -4.2255     -4.1843
+     -4.1451     -4.1076     -4.0712     -3.9333     -3.7409     -3.5244     -3.3049
+     -3.1013     -2.9210     -2.7631     -2.6232     -2.4969     -2.3811     -2.2737
+     -2.1735     -2.0798     -1.9923     -1.9109     -1.8357     -1.7677     -1.7105
+     -1.6739     -1.6816     -1.7766     -1.9936     -2.3171     -2.6862     -3.0067
+     -3.2011     -3.2391     -3.1494     -3.0058     -2.8640     -2.7478     -2.6667
+     -2.6253     -2.6212     -2.6352     -2.6323     -2.5719     -2.4414     -2.2626
+     -2.0579     -1.8394     -1.6126     -1.3791     -1.1384     -0.8899     -0.6333
+     -0.3693     -0.1003      0.1702      0.4376      0.6969      0.9430      1.1710
+      1.3763     -4.7479     -4.7051     -4.6641     -4.6335     -4.6274     -4.6270
+     -4.6038     -4.5639     -4.5182     -4.4663     -4.4100     -4.3584     -4.3120
+     -4.2687     -4.2272     -4.1871     -4.1481     -3.9940     -3.7792     -3.5444
+     -3.3140     -3.1050     -2.9225     -2.7638     -2.6235     -2.4971     -2.3812
+     -2.2738     -2.1736     -2.0800     -1.9926     -1.9115     -1.8369     -1.7705
+     -1.7174     -1.6914     -1.7248     -1.8665     -2.1383     -2.5042     -2.8881
+     -3.1933     -3.3541     -3.3538     -3.2404     -3.0914     -2.9535     -2.8448
+     -2.7733     -2.7434     -2.7487     -2.7645     -2.7518     -2.6727     -2.5258
+     -2.3371     -2.1264     -1.9035     -1.6724     -1.4340     -1.1878     -0.9331
+     -0.6700     -0.3999     -0.1257      0.1485      0.4176      0.6764      0.9195
+      1.1418      1.3384     -4.8285     -4.7861     -4.7481     -4.7301     -4.7386
+     -4.7358     -4.7041     -4.6599     -4.6108     -4.5540     -4.4944     -4.4412
+     -4.3932     -4.3482     -4.3049     -4.2627     -4.2215     -4.0483     -3.8107
+     -3.5598     -3.3206     -3.1076     -2.9236     -2.7642     -2.6237     -2.4972
+     -2.3813     -2.2739     -2.1737     -2.0801     -1.9929     -1.9122     -1.8384
+     -1.7741     -1.7265     -1.7152     -1.7825     -1.9778     -2.3029     -2.7034
+     -3.0908     -3.3728     -3.4957     -3.4578     -3.3261     -3.1751     -3.0423
+     -2.9417     -2.8806     -2.8625     -2.8758     -2.8904     -2.8646     -2.7663
+     -2.6048     -2.4074     -2.1914     -1.9643     -1.7288     -1.4854     -1.2335
+     -0.9725     -0.7031     -0.4273     -0.1486      0.1284      0.3982      0.6552
+      0.8938      1.1087      1.2946     -4.8970     -4.8557     -4.8244     -4.8252
+     -4.8442     -4.8335     -4.7945     -4.7470     -4.6941     -4.6321     -4.5698
+     -4.5154     -4.4663     -4.4199     -4.3752     -4.3313     -4.2885     -4.0946
+     -3.8357     -3.5714     -3.3255     -3.1096     -2.9243     -2.7645     -2.6239
+     -2.4973     -2.3813     -2.2739     -2.1738     -2.0803     -1.9933     -1.9130
+     -1.8404     -1.7789     -1.7389     -1.7478     -1.8581     -2.1109     -2.4852
+     -2.9101     -3.2907     -3.5432     -3.6242     -3.5517     -3.4069     -3.2567
+     -3.1302     -3.0381     -2.9883     -2.9818     -3.0011     -3.0114     -2.9698
+     -2.8524     -2.6780     -2.4732     -2.2524     -2.0211     -1.7812     -1.5326
+     -1.2748     -1.0076     -0.7322     -0.4513     -0.1690      0.1097      0.3789
+      0.6327      0.8652      1.0708      1.2441     -4.9534     -4.9145     -4.8960
+     -4.9188     -4.9398     -4.9179     -4.8732     -4.8229     -4.7657     -4.6985
+     -4.6342     -4.5791     -4.5292     -4.4819     -4.4360     -4.3909     -4.3468
+     -4.1325     -3.8548     -3.5799     -3.3289     -3.1109     -2.9249     -2.7648
+     -2.6240     -2.4973     -2.3813     -2.2740     -2.1739     -2.0805     -1.9938
+     -1.9140     -1.8428     -1.7851     -1.7557     -1.7923     -1.9545     -2.2651
+     -2.6818     -3.1203     -3.4850     -3.7018     -3.7382     -3.6360     -3.4832
+     -3.3360     -3.2165     -3.1336     -3.0958     -3.1004     -3.1231     -3.1258
+     -3.0662     -2.9309     -2.7451     -2.5339     -2.3086     -2.0732     -1.8287
+     -1.5748     -1.3111     -1.0380     -0.7572     -0.4720     -0.1871      0.0921
+      0.3593      0.6084      0.8330      1.0272      1.1858     -4.9986     -4.9651
+     -4.9669     -5.0083     -5.0213     -4.9881     -4.9392     -4.8863     -4.8241
+     -4.7522     -4.6870     -4.6317     -4.5812     -4.5333     -4.4865     -4.4404
+     -4.3955     -4.1623     -3.8691     -3.5861     -3.3314     -3.1119     -2.9252
+     -2.7650     -2.6241     -2.4974     -2.3814     -2.2740     -2.1740     -2.0808
+     -1.9943     -1.9153     -1.8460     -1.7935     -1.7789     -1.8521     -2.0730
+     -2.4385     -2.8889     -3.3299     -3.6709     -3.8453     -3.8370     -3.7116
+     -3.5550     -3.4125     -3.3006     -3.2278     -3.2026     -3.2167     -3.2399
+     -3.2320     -3.1531     -3.0013     -2.8057     -2.5887     -2.3592     -2.1197
+     -1.8705     -1.6112     -1.3419     -1.0633     -0.7778     -0.4894     -0.2031
+      0.0752      0.3390      0.5815      0.7963      0.9770      1.1189     -5.0346
+     -5.0115     -5.0395     -5.0891     -5.0868     -5.0443     -4.9926     -4.9368
+     -4.8691     -4.7937     -4.7286     -4.6733     -4.6227     -4.5743     -4.5269
+     -4.4801     -4.4346     -4.1851     -3.8796     -3.5905     -3.3331     -3.1126
+     -2.9255     -2.7651     -2.6242     -2.4974     -2.3814     -2.2741     -2.1741
+     -2.0810     -1.9950     -1.9169     -1.8501     -1.8048     -1.8109     -1.9311
+     -2.2138     -2.6283     -3.1022     -3.5355     -3.8450     -3.9708     -3.9208
+     -3.7789     -3.6221     -3.4857     -3.3819     -3.3200     -3.3076     -3.3290
+     -3.3498     -3.3281     -3.2296     -3.0630     -2.8590     -2.6369     -2.4033
+     -2.1595     -1.9055     -1.6411     -1.3664     -1.0831     -0.7939     -0.5035
+     -0.2171      0.0588      0.3174      0.5516      0.7543      0.9194      1.0427
+     -5.0643     -5.0589     -5.1129     -5.1567     -5.1367     -5.0878     -5.0340
+     -4.9751     -4.9019     -4.8245     -4.7602     -4.7053     -4.6546     -4.6060
+     -4.5580     -4.5108     -4.4649     -4.2021     -3.8871     -3.5936     -3.3344
+     -3.1130     -2.9258     -2.7652     -2.6243     -2.4975     -2.3814     -2.2742
+     -2.1743     -2.0814     -1.9958     -1.9190     -1.8556     -1.8204     -1.8551
+     -2.0318     -2.3752     -2.8312     -3.3174     -3.7339     -4.0028     -4.0763
+     -3.9906     -3.8385     -3.6842     -3.5549     -3.4598     -3.4098     -3.4095
+     -3.4357     -3.4509     -3.4129     -3.2951     -3.1155     -2.9042     -2.6774
+     -2.4397     -2.1917     -1.9330     -1.6636     -1.3843     -1.0971     -0.8055
+     -0.5143     -0.2294      0.0424      0.2940      0.5177      0.7062      0.8535
+      0.9571     -5.0912     -5.1114     -5.1826     -5.2085     -5.1734     -5.1204
+     -5.0650     -5.0025     -4.9242     -4.8464     -4.7835     -4.7291     -4.6785
+     -4.6297     -4.5814     -4.5340     -4.4879     -4.2146     -3.8925     -3.5958
+     -3.3353     -3.1134     -2.9259     -2.7653     -2.6243     -2.4975     -2.3815
+     -2.2742     -2.1744     -2.0818     -1.9969     -1.9216     -1.8629     -1.8420
+     -1.9151     -2.1557     -2.5550     -3.0432     -3.5307     -3.9210     -4.1401
+     -4.1615     -4.0481     -3.8909     -3.7412     -3.6196     -3.5338     -3.4965
+     -3.5069     -3.5348     -3.5413     -3.4850     -3.3489     -3.1580     -2.9404
+     -2.7092     -2.4675     -2.2152     -1.9520     -1.6782     -1.3950     -1.1051
+     -0.8125     -0.5221     -0.2403      0.0258      0.2684      0.4794      0.6513
+      0.7791      0.8624     -5.1199     -5.1699     -5.2431     -5.2453     -5.1994
+     -5.1440     -5.0872     -5.0207     -4.9382     -4.8616     -4.8002     -4.7464
+     -4.6960     -4.6471     -4.5985     -4.5510     -4.5049     -4.2235     -3.8964
+     -3.5974     -3.3359     -3.1137     -2.9261     -2.7654     -2.6244     -2.4975
+     -2.3815     -2.2743     -2.1747     -2.0824     -1.9982     -1.9251     -1.8729
+     -1.8722     -1.9950     -2.3020     -2.7500     -3.2601     -3.7383     -4.0918
+     -4.2539     -4.2277     -4.0949     -3.9365     -3.7929     -3.6792     -3.6036
+     -3.5794     -3.5982     -3.6247     -3.6196     -3.5437     -3.3909     -3.1901
+     -2.9668     -2.7313     -2.4857     -2.2293     -1.9619     -1.6845     -1.3986
+     -1.1073     -0.8149     -0.5270     -0.2500      0.0084      0.2399      0.4359
+      0.5891      0.6961      0.7596     -5.1550     -5.2315     -5.2903     -5.2699
+     -5.2173     -5.1608     -5.1025     -5.0315     -4.9461     -4.8717     -4.8119
+     -4.7587     -4.7086     -4.6595     -4.6108     -4.5634     -4.5172     -4.2300
+     -3.8991     -3.5985     -3.3363     -3.1139     -2.9262     -2.7655     -2.6244
+     -2.4975     -2.3815     -2.2744     -2.1749     -2.0830     -1.9999     -1.9297
+     -1.8866     -1.9141     -2.0976     -2.4688     -2.9567     -3.4779     -3.9359
+     -4.2411     -4.3434     -4.2776     -4.1324     -3.9757     -3.8392     -3.7337
+     -3.6691     -3.6575     -3.6820     -3.7041     -3.6846     -3.5887     -3.4206
+     -3.2113     -2.9828     -2.7432     -2.4936     -2.2333     -1.9625     -1.6823
+     -1.3949     -1.1036     -0.8131     -0.5292     -0.2588     -0.0100      0.2080
+      0.3866      0.5194      0.6053      0.6502     -5.1993     -5.2903     -5.3231
+     -5.2856     -5.2294     -5.1722     -5.1121     -5.0364     -4.9498     -4.8782
+     -4.8199     -4.7674     -4.7174     -4.6683     -4.6196     -4.5723     -4.5261
+     -4.2345     -3.9010     -3.5993     -3.3367     -3.1141     -2.9264     -2.7656
+     -2.6245     -2.4975     -2.3816     -2.2746     -2.1753     -2.0838     -2.0020
+     -1.9358     -1.9058     -1.9719     -2.2242     -2.6531     -3.1714     -3.6923
+     -4.1181     -4.3652     -4.4101     -4.3140     -4.1620     -4.0090     -3.8800
+     -3.7828     -3.7302     -3.7300     -3.7571     -3.7719     -3.7357     -3.6200
+     -3.4383     -3.2214     -2.9880     -2.7443     -2.4909     -2.2272     -1.9537
+     -1.6719     -1.3842     -1.0944     -0.8073     -0.5290     -0.2670     -0.0300
+      0.1723      0.3314      0.4425      0.5078      0.5363     -5.2521     -5.3401
+     -5.3438     -5.2954     -5.2373     -5.1796     -5.1174     -5.0370     -4.9508
+     -4.8821     -4.8252     -4.7733     -4.7236     -4.6743     -4.6257     -4.5786
+     -4.5324     -4.2377     -3.9024     -3.5999     -3.3370     -3.1143     -2.9265
+     -2.7657     -2.6245     -2.4975     -2.3816     -2.2747     -2.1757     -2.0849
+     -2.0048     -1.9441     -1.9327     -2.0498     -2.3739     -2.8516     -3.3901
+     -3.8986     -4.2795     -4.4624     -4.4573     -4.3395     -4.1846     -4.0367
+     -3.9154     -3.8269     -3.7867     -3.7959     -3.8225     -3.8276     -3.7728
+     -3.6381     -3.4443     -3.2205     -2.9824     -2.7347     -2.4778     -2.2113
+     -1.9360     -1.6536     -1.3670     -1.0800     -0.7977     -0.5267     -0.2749
+     -0.0519      0.1325      0.2703      0.3595      0.4058      0.4206     -5.3091
+     -5.3771     -5.3559     -5.3011     -5.2421     -5.1841     -5.1191     -5.0346
+     -4.9502     -4.8844     -4.8287     -4.7774     -4.7277     -4.6784     -4.6300
+     -4.5830     -4.5369     -4.2400     -3.9033     -3.6003     -3.3372     -3.1144
+     -2.9266     -2.7658     -2.6245     -2.4975     -2.3817     -2.2749     -2.1762
+     -2.0862     -2.0084     -1.9557     -1.9706     -2.1511     -2.5441     -3.0608
+     -3.6085     -4.0915     -4.4156     -4.5342     -4.4885     -4.3561     -4.2009
+     -4.0592     -3.9453     -3.8663     -3.8385     -3.8546     -3.8780     -3.8709
+     -3.7964     -3.6438     -3.4392     -3.2090     -2.9663     -2.7149     -2.4548
+     -2.1862     -1.9099     -1.6281     -1.3437     -1.0608     -0.7848     -0.5226
+     -0.2830     -0.0760      0.0883      0.2039      0.2719      0.3016      0.3055
+     -5.3637     -5.4012     -5.3624     -5.3041     -5.2449     -5.1864     -5.1181
+     -5.0302     -4.9487     -4.8855     -4.8309     -4.7800     -4.7305     -4.6812
+     -4.6330     -4.5861     -4.5400     -4.2416     -3.9040     -3.6006     -3.3374
+     -3.1146     -2.9267     -2.7658     -2.6245     -2.4975     -2.3818     -2.2751
+     -2.1768     -2.0878     -2.0133     -1.9717     -2.0236     -2.2774     -2.7314
+     -3.2770     -3.8220     -4.2650     -4.5241     -4.5838     -4.5072     -4.3652
+     -4.2118     -4.0767     -3.9702     -3.9015     -3.8854     -3.9056     -3.9235
+     -3.9020     -3.8072     -3.6382     -3.4239     -3.1878     -2.9407     -2.6857
+     -2.4229     -2.1527     -1.8764     -1.5962     -1.3152     -1.0375     -0.7690
+     -0.5172     -0.2916     -0.1027      0.0401      0.1332      0.1818      0.1978
+      0.1936     -5.4096     -5.4150     -5.3655     -5.3054     -5.2462     -5.1870
+     -5.1148     -5.0248     -4.9468     -4.8858     -4.8322     -4.7818     -4.7323
+     -4.6830     -4.6351     -4.5883     -4.5422     -4.2427     -3.9045     -3.6008
+     -3.3375     -3.1147     -2.9268     -2.7659     -2.6245     -2.4976     -2.3819
+     -2.2754     -2.1775     -2.0900     -2.0200     -1.9945     -2.0961     -2.4278
+     -2.9322     -3.4965     -4.0248     -4.4141     -4.6057     -4.6157     -4.5158
+     -4.3679     -4.2177     -4.0896     -3.9907     -3.9331     -3.9274     -3.9491
+     -3.9593     -3.9216     -3.8065     -3.6226     -3.3995     -3.1578     -2.9065
+     -2.6482     -2.3831     -2.1120     -1.8365     -1.5588     -1.2820     -1.0106
+     -0.7509     -0.5110     -0.3012     -0.1322     -0.0118      0.0598      0.0917
+      0.0971      0.0871     -5.4431     -5.4222     -5.3664     -5.3055     -5.2465
+     -5.1862     -5.1096     -5.0190     -4.9447     -4.8857     -4.8329     -4.7828
+     -4.7333     -4.6842     -4.6365     -4.5898     -4.5438     -4.2435     -3.9049
+     -3.6011     -3.3377     -3.1148     -2.9269     -2.7659     -2.6244     -2.4976
+     -2.3820     -2.2758     -2.1785     -2.0928     -2.0291     -2.0268     -2.1924
+     -2.5993     -3.1431     -3.7147     -4.2108     -4.5360     -4.6632     -4.6336
+     -4.5162     -4.3652     -4.2195     -4.0985     -4.0074     -3.9615     -3.9645
+     -3.9851     -3.9859     -3.9305     -3.7957     -3.5983     -3.3672     -3.1202
+     -2.8649     -2.6036     -2.3367     -2.0653     -1.7911     -1.5166     -1.2448
+     -0.9807     -0.7309     -0.5044     -0.3121     -0.1643     -0.0665     -0.0143
+      0.0040      0.0015     -0.0123     -5.4643     -5.4253     -5.3661     -5.3049
+     -5.2461     -5.1841     -5.1031     -5.0133     -4.9426     -4.8853     -4.8332
+     -4.7834     -4.7339     -4.6850     -4.6375     -4.5909     -4.5449     -4.2441
+     -3.9052     -3.6013     -3.3379     -3.1150     -2.9270     -2.7659     -2.6244
+     -2.4976     -2.3822     -2.2762     -2.1797     -2.0965     -2.0418     -2.0725
+     -2.3145     -2.7881     -3.3606     -3.9262     -4.3742     -4.6308     -4.7010
+     -4.6404     -4.5101     -4.3582     -4.2179     -4.1039     -4.0214     -3.9874
+     -3.9969     -4.0143     -4.0040     -3.9296     -3.7762     -3.5666     -3.3282
+     -3.0762     -2.8172     -2.5531     -2.2848     -2.0135     -1.7413     -1.4704
+     -1.2044     -0.9484     -0.7097     -0.4981     -0.3247     -0.1990     -0.1226
+     -0.0872     -0.0794     -0.0872     -0.1031     -5.4760     -5.4261     -5.3650
+     -5.3038     -5.2451     -5.1809     -5.0957     -5.0080     -4.9407     -4.8847
+     -4.8333     -4.7837     -4.7341     -4.6854     -4.6382     -4.5917     -4.5456
+     -4.2445     -3.9054     -3.6015     -3.3380     -3.1151     -2.9270     -2.7658
+     -2.6244     -2.4977     -2.3824     -2.2768     -2.1813     -2.1015     -2.0599
+     -2.1365     -2.4622     -2.9903     -3.5808     -4.1246     -4.5113     -4.7004
+     -4.7236     -4.6383     -4.4987     -4.3477     -4.2135     -4.1065     -4.0338
+     -4.0112     -4.0249     -4.0373     -4.0141     -3.9200     -3.7492     -3.5287
+     -3.2836     -3.0270     -2.7644     -2.4979     -2.2285     -1.9577     -1.6878
+     -1.4211     -1.1614     -0.9143     -0.6878     -0.4924     -0.3394     -0.2356
+     -0.1787     -0.1570     -0.1567     -0.1679     -0.1846     -5.4817     -5.4256
+     -5.3633     -5.3024     -5.2436     -5.1766     -5.0878     -5.0032     -4.9388
+     -4.8841     -4.8332     -4.7837     -4.7341     -4.6857     -4.6386     -4.5922
+     -4.5462     -4.2448     -3.9056     -3.6016     -3.3382     -3.1152     -2.9271
+     -2.7658     -2.6244     -2.4977     -2.3826     -2.2775     -2.1834     -2.1083
+     -2.0857     -2.2233     -2.6325     -3.2024     -3.7987     -4.3035     -4.6213
+     -4.7487     -4.7343     -4.6293     -4.4833     -4.3348     -4.2072     -4.1074
+     -4.0453     -4.0331     -4.0486     -4.0545     -4.0168     -3.9027     -3.7160
+     -3.4858     -3.2344     -2.9734     -2.7075     -2.4388     -2.1686     -1.8988
+     -1.6314     -1.3693     -1.1165     -0.8791     -0.6659     -0.4881     -0.3560
+     -0.2735     -0.2334     -0.2221     -0.2269     -0.2398     -0.2562     -5.4838
+     -5.4243     -5.3614     -5.3008     -5.2417     -5.1712     -5.0798     -4.9989
+     -4.9371     -4.8834     -4.8330     -4.7835     -4.7340     -4.6859     -4.6390
+     -4.5926     -4.5466     -4.2451     -3.9058     -3.6018     -3.3383     -3.1153
+     -2.9271     -2.7658     -2.6244     -2.4978     -2.3829     -2.2784     -2.1861
+     -2.1179     -2.1226     -2.3366     -2.8209     -3.4212     -4.0084     -4.4578
+     -4.7055     -4.7802     -4.7354     -4.6147     -4.4650     -4.3203     -4.1995
+     -4.1074     -4.0567     -4.0533     -4.0685     -4.0664     -4.0126     -3.8788
+     -3.6776     -3.4385     -3.1815     -2.9163     -2.6473     -2.3767     -2.1060
+     -1.8373     -1.5728     -1.3156     -1.0702     -0.8433     -0.6447     -0.4856
+     -0.3747     -0.3115     -0.2852     -0.2814     -0.2893     -0.3026     -0.3180
+     -5.4841     -5.4224     -5.3593     -5.2991     -5.2394     -5.1648     -5.0721
+     -4.9952     -4.9356     -4.8828     -4.8327     -4.7832     -4.7339     -4.6861
+     -4.6392     -4.5929     -4.5470     -4.2454     -3.9061     -3.6020     -3.3385
+     -3.1154     -2.9271     -2.7657     -2.6244     -2.4979     -2.3833     -2.2795
+     -2.1897     -2.1313     -2.1753     -2.4771     -3.0233     -3.6426     -4.2029
+     -4.5851     -4.7671     -4.7988     -4.7288     -4.5960     -4.4447     -4.3050
+     -4.1911     -4.1074     -4.0682     -4.0718     -4.0847     -4.0733     -4.0020
+     -3.8492     -3.6349     -3.3878     -3.1254     -2.8563     -2.5845     -2.3122
+     -2.0413     -1.7739     -1.5125     -1.2606     -1.0232     -0.8077     -0.6247
+     -0.4851     -0.3948     -0.3486     -0.3329     -0.3341     -0.3434     -0.3561
+     -0.3700     -5.4833     -5.4203     -5.3571     -5.2974     -5.2365     -5.1574
+     -5.0649     -4.9920     -4.9342     -4.8822     -4.8324     -4.7828     -4.7337
+     -4.6861     -4.6394     -4.5931     -4.5472     -4.2456     -3.9062     -3.6022
+     -3.3386     -3.1154     -2.9270     -2.7657     -2.6244     -2.4981     -2.3838
+     -2.2810     -2.1946     -2.1505     -2.2488     -2.6423     -3.2362     -3.8610
+     -4.3759     -4.6861     -4.8102     -4.8072     -4.7161     -4.5741     -4.4233
+     -4.2894     -4.1826     -4.1081     -4.0802     -4.0885     -4.0976     -4.0753
+     -3.9853     -3.8146     -3.5886     -3.3342     -3.0668     -2.7939     -2.5195
+     -2.2457     -1.9748     -1.7090     -1.4511     -1.2049     -0.9759     -0.7729
+     -0.6066     -0.4870     -0.4158     -0.3836     -0.3755     -0.3797     -0.3893
+     -0.4008     -0.4127     -5.4819     -5.4179     -5.3549     -5.2955     -5.2330
+     -5.1494     -5.0585     -4.9893     -4.9329     -4.8816     -4.8320     -4.7824
+     -4.7336     -4.6862     -4.6395     -4.5933     -4.5475     -4.2458     -3.9064
+     -3.6023     -3.3387     -3.1154     -2.9270     -2.7656     -2.6244     -2.4983
+     -2.3844     -2.2829     -2.2013     -2.1782     -2.3480     -2.8279     -3.4562
+     -4.0700     -4.5232     -4.7630     -4.8392     -4.8073     -4.6985     -4.5502
+     -4.4015     -4.2740     -4.1744     -4.1100     -4.0925     -4.1034     -4.1073
+     -4.0724     -3.9631     -3.7757     -3.5391     -3.2781     -3.0060     -2.7296
+     -2.4527     -2.1778     -1.9071     -1.6431     -1.3889     -1.1487     -0.9291
+     -0.7395     -0.5909     -0.4909     -0.4369     -0.4156     -0.4126     -0.4182
+     -0.4272     -0.4372     -0.4471     -5.4801     -5.4154     -5.3527     -5.2936
+     -5.2288     -5.1410     -5.0528     -4.9869     -4.9319     -4.8811     -4.8316
+     -4.7820     -4.7335     -4.6863     -4.6397     -4.5935     -4.5477     -4.2460
+     -3.9066     -3.6025     -3.3388     -3.1154     -2.9269     -2.7656     -2.6245
+     -2.4985     -2.3852     -2.2853     -2.2107     -2.2183     -2.4755     -3.0288
+     -3.6792     -4.2623     -4.6437     -4.8192     -4.8573     -4.8005     -4.6770
+     -4.5250     -4.3799     -4.2591     -4.1671     -4.1135     -4.1049     -4.1164
+     -4.1138     -4.0647     -3.9359     -3.7332     -3.4871     -3.2199     -2.9434
+     -2.6637     -2.3846     -2.1087     -1.8384     -1.5765     -1.3263     -1.0928
+     -0.8833     -0.7081     -0.5778     -0.4967     -0.4571     -0.4439     -0.4440
+     -0.4498     -0.4577     -0.4660     -0.4739     -5.4781     -5.4129     -5.3507
+     -5.2916     -5.2238     -5.1325     -5.0479     -4.9848     -4.9309     -4.8806
+     -4.8311     -4.7816     -4.7334     -4.6863     -4.6398     -4.5937     -4.5479
+     -4.2462     -3.9068     -3.6026     -3.3388     -3.1154     -2.9268     -2.7655
+     -2.6245     -2.4989     -2.3862     -2.2887     -2.2241     -2.2758     -2.6306
+     -3.2413     -3.8995     -4.4316     -4.7386     -4.8593     -4.8665     -4.7881
+     -4.6528     -4.4993     -4.3590     -4.2451     -4.1612     -4.1185     -4.1172
+     -4.1274     -4.1171     -4.0522     -3.9042     -3.6876     -3.4328     -3.1599
+     -2.8792     -2.5964     -2.3152     -2.0386     -1.7690     -1.5095     -1.2637
+     -1.0374     -0.8391     -0.6794     -0.5676     -0.5037     -0.4757     -0.4680
+     -0.4697     -0.4751     -0.4817     -0.4883     -0.4945     -5.4758     -5.4104
+     -5.3487     -5.2893     -5.2179     -5.1242     -5.0437     -4.9830     -4.9301
+     -4.8801     -4.8306     -4.7812     -4.7333     -4.6864     -4.6400     -4.5939
+     -4.5482     -4.2464     -3.9069     -3.6027     -3.3389     -3.1154     -2.9267
+     -2.7655     -2.6247     -2.4993     -2.3874     -2.2932     -2.2434     -2.3562
+     -2.8091     -3.4620     -4.1098     -4.5747     -4.8105     -4.8874     -4.8680
+     -4.7711     -4.6266     -4.4736     -4.3390     -4.2321     -4.1569     -4.1250
+     -4.1289     -4.1364     -4.1170     -4.0349     -3.8684     -3.6391     -3.3765
+     -3.0983     -2.8135     -2.5278     -2.2449     -1.9678     -1.6991     -1.4422
+     -1.2014     -0.9831     -0.7969     -0.6537     -0.5602     -0.5113     -0.4920
+     -0.4878     -0.4902     -0.4949     -0.5001     -0.5053     -0.5099     -5.4734
+     -5.4079     -5.3468     -5.2868     -5.2111     -5.1164     -5.0402     -4.9815
+     -4.9293     -4.8797     -4.8301     -4.7810     -4.7333     -4.6865     -4.6401
+     -4.5941     -4.5484     -4.2466     -3.9071     -3.6027     -3.3389     -3.1153
+     -2.9266     -2.7655     -2.6248     -2.4998     -2.3891     -2.2994     -2.2714
+     -2.4643     -3.0060     -3.6869     -4.3025     -4.6913     -4.8632     -4.9065
+     -4.8632     -4.7503     -4.5992     -4.4485     -4.3201     -4.2203     -4.1547
+     -4.1327     -4.1399     -4.1434     -4.1134     -4.0130     -3.8290     -3.5883
+     -3.3185     -3.0351     -2.7466     -2.4583     -2.1738     -1.8964     -1.6289
+     -1.3750     -1.1397     -0.9304     -0.7575     -0.6314     -0.5551     -0.5187
+     -0.5057     -0.5037     -0.5061     -0.5099     -0.5140     -0.5178     -0.5213
+     -5.4708     -5.4055     -5.3449     -5.2838     -5.2035     -5.1093     -5.0371
+     -4.9801     -4.9287     -4.8793     -4.8296     -4.7807     -4.7333     -4.6866
+     -4.6403     -4.5943     -4.5486     -4.2467     -3.9072     -3.6028     -3.3389
+     -3.1152     -2.9265     -2.7655     -2.6250     -2.5004     -2.3912     -2.3081
+     -2.3124     -2.6019     -3.2162     -3.9102     -4.4715     -4.7830     -4.9011
+     -4.9177     -4.8531     -4.7264     -4.5713     -4.4242     -4.3025     -4.2100
+     -4.1544     -4.1412     -4.1498     -4.1482     -4.1060     -3.9866     -3.7864
+     -3.5353     -3.2589     -2.9707     -2.6786     -2.3878     -2.1021     -1.8246
+     -1.5586     -1.3081     -1.0790     -0.8797     -0.7212     -0.6126     -0.5520
+     -0.5254     -0.5169     -0.5161     -0.5182     -0.5212     -0.5242     -0.5271
+     -0.5296     -5.4682     -5.4031     -5.3430     -5.2804     -5.1953     -5.1030
+     -5.0345     -4.9789     -4.9281     -4.8788     -4.8292     -4.7806     -4.7334
+     -4.6868     -4.6405     -4.5945     -4.5488     -4.2469     -3.9072     -3.6028
+     -3.3388     -3.1151     -2.9265     -2.7655     -2.6252     -2.5012     -2.3941
+     -2.3205     -2.3716     -2.7672     -3.4363     -4.1242     -4.6138     -4.8524
+     -4.9286     -4.9219     -4.8386     -4.7002     -4.5434     -4.4010     -4.2863
+     -4.2015     -4.1561     -4.1502     -4.1586     -4.1507     -4.0947     -3.9562
+     -3.7409     -3.4804     -3.1978     -2.9051     -2.6097     -2.3166     -2.0298
+     -1.7526     -1.4884     -1.2419     -1.0197     -0.8315     -0.6886     -0.5972
+     -0.5503     -0.5313     -0.5256     -0.5254     -0.5272     -0.5294     -0.5317
+     -0.5337     -0.5356     -5.4655     -5.4010     -5.3412     -5.2762     -5.1868
+     -5.0976     -5.0323     -4.9779     -4.9276     -4.8784     -4.8288     -4.7805
+     -4.7335     -4.6869     -4.6407     -4.5947     -4.5489     -4.2470     -3.9073
+     -3.6028     -3.3388     -3.1150     -2.9264     -2.7656     -2.6255     -2.5022
+     -2.3980     -2.3386     -2.4549     -2.9552     -3.6624     -4.3210     -4.7295
+     -4.9031     -4.9486     -4.9203     -4.8202     -4.6724     -4.5160     -4.3793
+     -4.2714     -4.1949     -4.1595     -4.1593     -4.1660     -4.1508     -4.0792
+     -3.9219     -3.6928     -3.4238     -3.1353     -2.8383     -2.5397     -2.2447
+     -1.9571     -1.6804     -1.4185     -1.1765     -0.9623     -0.7866     -0.6600
+     -0.5850     -0.5494     -0.5360     -0.5323     -0.5324     -0.5337     -0.5354
+     -0.5370     -0.5385     -0.5398     -5.4629     -5.3989     -5.3392     -5.2713
+     -5.1782     -5.0929     -5.0304     -4.9771     -4.9272     -4.8779     -4.8284
+     -4.7805     -4.7336     -4.6871     -4.6409     -4.5949     -4.5491     -4.2471
+     -3.9073     -3.6028     -3.3387     -3.1148     -2.9263     -2.7656     -2.6259
+     -2.5036     -2.4034     -2.3652     -2.5673     -3.1601     -3.8890     -4.4938
+     -4.8207     -4.9395     -4.9620     -4.9135     -4.7984     -4.6437     -4.4893
+     -4.3589     -4.2579     -4.1904     -4.1643     -4.1681     -4.1720     -4.1480
+     -4.0597     -3.8841     -3.6425     -3.3656     -3.0715     -2.7704     -2.4690
+     -2.1722     -1.8841     -1.6083     -1.3490     -1.1124     -0.9073     -0.7453
+     -0.6356     -0.5755     -0.5492     -0.5397     -0.5373     -0.5374     -0.5385
+     -0.5397     -0.5408     -0.5419     -0.5428     -5.4603     -5.3969     -5.3371
+     -5.2656     -5.1699     -5.0889     -5.0287     -4.9763     -4.9268     -4.8774
+     -4.8282     -4.7805     -4.7338     -4.6874     -4.6412     -4.5951     -4.5492
+     -4.2471     -3.9073     -3.6028     -3.3385     -3.1147     -2.9263     -2.7658
+     -2.6264     -2.5053     -2.4109     -2.4043     -2.7104     -3.3772     -4.1086
+     -4.6395     -4.8899     -4.9661     -4.9694     -4.9025     -4.7738     -4.6146
+     -4.4638     -4.3401     -4.2461     -4.1879     -4.1703     -4.1764     -4.1765
+     -4.1422     -4.0361     -3.8431     -3.5901     -3.3059     -3.0066     -2.7016
+     -2.3976     -2.0993     -1.8109     -1.5363     -1.2803     -1.0499     -0.8552
+     -0.7082     -0.6153     -0.5684     -0.5491     -0.5426     -0.5409     -0.5411
+     -0.5418     -0.5427     -0.5436     -0.5443     -0.5450     -5.4578     -5.3951
+     -5.3348     -5.2589     -5.1622     -5.0856     -5.0273     -4.9757     -4.9264
+     -4.8769     -4.8280     -4.7806     -4.7340     -4.6876     -4.6414     -4.5953
+     -4.5493     -4.2472     -3.9073     -3.6027     -3.3384     -3.1145     -2.9262
+     -2.7659     -2.6270     -2.5076     -2.4217     -2.4615     -2.8817     -3.6028
+     -4.3127     -4.7581     -4.9404     -4.9862     -4.9714     -4.8876     -4.7470
+     -4.5856     -4.4395     -4.3227     -4.2360     -4.1874     -4.1771     -4.1840
+     -4.1792     -4.1330     -4.0085     -3.7992     -3.5358     -3.2448     -2.9405
+     -2.6319     -2.3255     -2.0260     -1.7377     -1.4647     -1.2126     -0.9894
+     -0.8065     -0.6756     -0.5989     -0.5631     -0.5492     -0.5447     -0.5436
+     -0.5437     -0.5443     -0.5449     -0.5455     -0.5460     -0.5465     -5.4554
+     -5.3933     -5.3321     -5.2514     -5.1552     -5.0827     -5.0261     -4.9752
+     -4.9260     -4.8765     -4.8279     -4.7808     -4.7342     -4.6878     -4.6416
+     -4.5955     -4.5494     -4.2472     -3.9073     -3.6026     -3.3382     -3.1144
+     -2.9262     -2.7661     -2.6278     -2.5108     -2.4375     -2.5430     -3.0755
+     -3.8318     -4.4939     -4.8517     -4.9761     -5.0009     -4.9688     -4.8691
+     -4.7186     -4.5572     -4.4167     -4.3067     -4.2278     -4.1886     -4.1843
+     -4.1907     -4.1799     -4.1204     -3.9771     -3.7527     -3.4798     -3.1823
+     -2.8734     -2.5614     -2.2528     -1.9525     -1.6645     -1.3937     -1.1462
+     -0.9315     -0.7619     -0.6477     -0.5861     -0.5593     -0.5494     -0.5462
+     -0.5455     -0.5456     -0.5460     -0.5464     -0.5468     -0.5472     -0.5475
+     -5.4531     -5.3916     -5.3289     -5.2433     -5.1490     -5.0803     -5.0251
+     -4.9747     -4.9257     -4.8761     -4.8279     -4.7809     -4.7344     -4.6880
+     -4.6418     -4.5956     -4.5494     -4.2471     -3.9072     -3.6024     -3.3380
+     -3.1143     -2.9262     -2.7664     -2.6288     -2.5151     -2.4608     -2.6542
+     -3.2858     -4.0572     -4.6481     -4.9231     -5.0019     -5.0107     -4.9620
+     -4.8475     -4.6892     -4.5296     -4.3955     -4.2922     -4.2217     -4.1913
+     -4.1916     -4.1964     -4.1784     -4.1042     -3.9422     -3.7038     -3.4222
+     -3.1187     -2.8052     -2.4901     -2.1797     -1.8787     -1.5916     -1.3234
+     -1.0816     -0.8766     -0.7218     -0.6246     -0.5762     -0.5565     -0.5495
+     -0.5473     -0.5468     -0.5469     -0.5472     -0.5475     -0.5478     -0.5480
+     -0.5482     -5.4510     -5.3899     -5.3251     -5.2349     -5.1436     -5.0782
+     -5.0242     -4.9743     -4.9253     -4.8759     -4.8280     -4.7811     -4.7346
+     -4.6883     -4.6420     -4.5957     -4.5494     -4.2471     -3.9071     -3.6022
+     -3.3378     -3.1141     -2.9263     -2.7667     -2.6301     -2.5212     -2.4954
+     -2.7973     -3.5078     -4.2706     -4.7744     -4.9754     -5.0212     -5.0161
+     -4.9514     -4.8231     -4.6594     -4.5030     -4.3758     -4.2791     -4.2175
+     -4.1953     -4.1988     -4.2008     -4.1744     -4.0842     -3.9039     -3.6528
+     -3.3631     -3.0538     -2.7361     -2.4182     -2.1062     -1.8049     -1.5189
+     -1.2542     -1.0189     -0.8254     -0.6865     -0.6059     -0.5688     -0.5546
+     -0.5496     -0.5481     -0.5477     -0.5478     -0.5480     -0.5482     -0.5484
+     -0.5486     -0.5488     -5.4490     -5.3882     -5.3206     -5.2263     -5.1390
+     -5.0764     -5.0235     -4.9740     -4.9249     -4.8757     -4.8281     -4.7814
+     -4.7349     -4.6885     -4.6421     -4.5958     -4.5494     -4.2470     -3.9069
+     -3.6020     -3.3375     -3.1140     -2.9263     -2.7671     -2.6318     -2.5299
+     -2.5468     -2.9699     -3.7366     -4.4638     -4.8748     -5.0120     -5.0360
+     -5.0175     -4.9372     -4.7963     -4.6296     -4.4779     -4.3575     -4.2678
+     -4.2152     -4.2002     -4.2056     -4.2040     -4.1678     -4.0605     -3.8627
+     -3.5999     -3.3026     -2.9878     -2.6661     -2.3456     -2.0323     -1.7311
+     -1.4468     -1.1862     -0.9588     -0.7782     -0.6564     -0.5912     -0.5634
+     -0.5532     -0.5497     -0.5486     -0.5484     -0.5484     -0.5486     -0.5487
+     -0.5489     -0.5490     -0.5491     -5.4471     -5.3863     -5.3153     -5.2180
+     -5.1352     -5.0749     -5.0229     -4.9737     -4.9246     -4.8756     -4.8283
+     -4.7816     -4.7351     -4.6887     -4.6423     -4.5959     -4.5493     -4.2468
+     -3.9067     -3.6017     -3.3373     -3.1139     -2.9264     -2.7676     -2.6342
+     -2.5425     -2.6213     -3.1661     -3.9663     -4.6313     -4.9520     -5.0374
+     -5.0467     -5.0152     -4.9196     -4.7679     -4.6003     -4.4542     -4.3406
+     -4.2583     -4.2146     -4.2058     -4.2119     -4.2055     -4.1582     -4.0331
+     -3.8186     -3.5452     -3.2408     -2.9207     -2.5953     -2.2725     -1.9582
+     -1.6574     -1.3754     -1.1198     -0.9017     -0.7357     -0.6313     -0.5800
+     -0.5595     -0.5522     -0.5498     -0.5490     -0.5489     -0.5489     -0.5490
+     -0.5491     -0.5492     -0.5493     -0.5494     -5.4454     -5.3842     -5.3090
+     -5.2101     -5.1319     -5.0737     -5.0224     -4.9735     -4.9242     -4.8756
+     -4.8285     -4.7819     -4.7353     -4.6888     -4.6424     -4.5959     -4.5492
+     -4.2466     -3.9064     -3.6014     -3.3370     -3.1138     -2.9266     -2.7683
+     -2.6374     -2.5613     -2.7253     -3.3793     -4.1888     -4.7709     -5.0089
+     -5.0558     -5.0540     -5.0095     -4.8990     -4.7382     -4.5717     -4.4320
+     -4.3251     -4.2507     -4.2155     -4.2118     -4.2174     -4.2053     -4.1456
+     -4.0020     -3.7720     -3.4889     -3.1777     -2.8525     -2.5237     -2.1990
+     -1.8840     -1.5840     -1.3049     -1.0554     -0.8482     -0.6982     -0.6110
+     -0.5715     -0.5567     -0.5515     -0.5498     -0.5493     -0.5492     -0.5492
+     -0.5493     -0.5493     -0.5494     -0.5495     -0.5495     -5.4437     -5.3819
+     -5.3019     -5.2030     -5.1291     -5.0726     -5.0220     -4.9732     -4.9240
+     -4.8757     -4.8287     -4.7821     -4.7355     -4.6890     -4.6425     -4.5959
+     -4.5491     -4.2464     -3.9061     -3.6010     -3.3367     -3.1138     -2.9267
+     -2.7692     -2.6419     -2.5894     -2.8622     -3.6038     -4.3956     -4.8835
+     -5.0486     -5.0697     -5.0583     -5.0003     -4.8754     -4.7079     -4.5443
+     -4.4114     -4.3110     -4.2449     -4.2177     -4.2180     -4.2220     -4.2031
+     -4.1297     -3.9675     -3.7231     -3.4310     -3.1133     -2.7834     -2.4515
+     -2.1251     -1.8098     -1.5111     -1.2356     -0.9933     -0.7986     -0.6659
+     -0.5950     -0.5653     -0.5547     -0.5510     -0.5499     -0.5495     -0.5494
+     -0.5494     -0.5495     -0.5495     -0.5496     -0.5496     -0.5497     -5.4421
+     -5.3791     -5.2941     -5.1967     -5.1268     -5.0717     -5.0217     -4.9730
+     -4.9238     -4.8758     -4.8290     -4.7823     -4.7357     -4.6891     -4.6425
+     -4.5959     -4.5489     -4.2461     -3.9057     -3.6006     -3.3365     -3.1137
+     -2.9270     -2.7704     -2.6483     -2.6318     -3.0307     -3.8340     -4.5797
+     -4.9711     -5.0752     -5.0801     -5.0599     -4.9877     -4.8494     -4.6774
+     -4.5181     -4.3923     -4.2985     -4.2410     -4.2209     -4.2242     -4.2256
+     -4.1987     -4.1104     -3.9297     -3.6723     -3.3717     -3.0477     -2.7134
+     -2.3787     -2.0509     -1.7357     -1.4387     -1.1677     -0.9341     -0.7537
+     -0.6389     -0.5828     -0.5609     -0.5533     -0.5507     -0.5499     -0.5496
+     -0.5496     -0.5496     -0.5496     -0.5497     -0.5497     -0.5497     -0.5497
+     -5.4406     -5.3759     -5.2858     -5.1913     -5.1249     -5.0710     -5.0215
+     -4.9728     -4.9236     -4.8760     -4.8292     -4.7826     -4.7359     -4.6892
+     -4.6426     -4.5959     -4.5487     -4.2457     -3.9053     -3.6002     -3.3362
+     -3.1137     -2.9273     -2.7720     -2.6575     -2.6947     -3.2252     -4.0629
+     -4.7374     -5.0368     -5.0931     -5.0876     -5.0588     -4.9718     -4.8214
+     -4.6472     -4.4933     -4.3745     -4.2877     -4.2388     -4.2249     -4.2300
+     -4.2279     -4.1920     -4.0876     -3.8889     -3.6195     -3.3109     -2.9810
+     -2.6426     -2.3053     -1.9765     -1.6617     -1.3671     -1.1015     -0.8781
+     -0.7137     -0.6170     -0.5736     -0.5576     -0.5523     -0.5505     -0.5499
+     -0.5497     -0.5497     -0.5497     -0.5497     -0.5497     -0.5498     -0.5498
+     -0.5498     -5.4390     -5.3719     -5.2773     -5.1867     -5.1233     -5.0705
+     -5.0214     -4.9726     -4.9236     -4.8762     -4.8294     -4.7828     -4.7361
+     -4.6893     -4.6426     -4.5958     -4.5484     -4.2453     -3.9048     -3.5997
+     -3.3360     -3.1137     -2.9277     -2.7741     -2.6713     -2.7852     -3.4384
+     -4.2822     -4.8678     -5.0834     -5.1057     -5.0928     -5.0549     -4.9528
+     -4.7919     -4.6177     -4.4701     -4.3581     -4.2786     -4.2380     -4.2296
+     -4.2354     -4.2289     -4.1827     -4.0612     -3.8454     -3.5650     -3.2488
+     -2.9132     -2.5709     -2.2315     -1.9020     -1.5880     -1.2965     -1.0375
+     -0.8260     -0.6790     -0.5996     -0.5668     -0.5553     -0.5516     -0.5503
+     -0.5499     -0.5498     -0.5498     -0.5498     -0.5498     -0.5498     -0.5498
+     -0.5498     -0.5498     -5.4374     -5.3673     -5.2689     -5.1828     -5.1219
+     -5.0701     -5.0213     -4.9725     -4.9236     -4.8764     -4.8297     -4.7829
+     -4.7362     -4.6894     -4.6427     -4.5958     -4.5481     -4.2447     -3.9041
+     -3.5991     -3.3358     -3.1138     -2.9282     -2.7771     -2.6920     -2.9087
+     -3.6633     -4.4838     -4.9721     -5.1143     -5.1148     -5.0964     -5.0480
+     -4.9308     -4.7613     -4.5891     -4.4484     -4.3429     -4.2714     -4.2386
+     -4.2347     -4.2402     -4.2282     -4.1708     -4.0313     -3.7995     -3.5090
+     -3.1854     -2.8444     -2.4986     -2.1574     -1.8274     -1.5148     -1.2271
+     -0.9760     -0.7783     -0.6497     -0.5862     -0.5619     -0.5537     -0.5511
+     -0.5502     -0.5499     -0.5498     -0.5498     -0.5498     -0.5498     -0.5498
+     -0.5499     -0.5499     -0.5499     -5.4357     -5.3617     -5.2609     -5.1795
+     -5.1208     -5.0698     -5.0213     -4.9723     -4.9237     -4.8766     -4.8299
+     -4.7831     -4.7363     -4.6895     -4.6427     -4.5956     -4.5476     -4.2441
+     -3.9034     -3.5986     -3.3356     -3.1139     -2.9289     -2.7814     -2.7236
+     -3.0661     -3.8933     -4.6620     -5.0525     -5.1336     -5.1212     -5.0983
+     -5.0379     -4.9062     -4.7304     -4.5617     -4.4282     -4.3291     -4.2659
+     -4.2402     -4.2401     -4.2442     -4.2258     -4.1561     -3.9979     -3.7514
+     -3.4514     -3.1207     -2.7746     -2.4257     -2.0829     -1.7530     -1.4422
+     -1.1593     -0.9175     -0.7354     -0.6256     -0.5761     -0.5584     -0.5526
+     -0.5507     -0.5501     -0.5499     -0.5499     -0.5498     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -5.4337     -5.3553     -5.2535
+     -5.1769     -5.1200     -5.0696     -5.0212     -4.9721     -4.9238     -4.8768
+     -4.8301     -4.7832     -4.7364     -4.6895     -4.6427     -4.5955     -4.5471
+     -4.2433     -3.9026     -3.5980     -3.3354     -3.1140     -2.9298     -2.7875
+     -2.7717     -3.2534     -4.1209     -4.8144     -5.1117     -5.1456     -5.1256
+     -5.0986     -5.0245     -4.8793     -4.6994     -4.5357     -4.4095     -4.3169
+     -4.2621     -4.2427     -4.2454     -4.2473     -4.2215     -4.1382     -3.9614
+     -3.7012     -3.3923     -3.0547     -2.7039     -2.3522     -2.0083     -1.6787
+     -1.3704     -1.0932     -0.8625     -0.6976     -0.6063     -0.5687     -0.5559
+     -0.5518     -0.5505     -0.5501     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -5.4315     -5.3481
+     -5.2470     -5.1747     -5.1193     -5.0696     -5.0212     -4.9720     -4.9240
+     -4.8771     -4.8302     -4.7834     -4.7365     -4.6896     -4.6426     -4.5953
+     -4.5465     -4.2424     -3.9017     -3.5974     -3.3353     -3.1141     -2.9311
+     -2.7966     -2.8434     -3.4627     -4.3378     -4.9405     -5.1522     -5.1535
+     -5.1287     -5.0968     -5.0080     -4.8505     -4.6689     -4.5112     -4.3920
+     -4.3064     -4.2598     -4.2460     -4.2506     -4.2492     -4.2152     -4.1171
+     -3.9218     -3.6493     -3.3317     -2.9876     -2.6324     -2.2783     -1.9335
+     -1.6048     -1.2996     -1.0294     -0.8116     -0.6653     -0.5913     -0.5632
+     -0.5541     -0.5512     -0.5503     -0.5500     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -5.4289
+     -5.3402     -5.2413     -5.1729     -5.1188     -5.0696     -5.0212     -4.9719
+     -4.9242     -4.8772     -4.8304     -4.7835     -4.7365     -4.6896     -4.6426
+     -4.5951     -4.5457     -4.2414     -3.9007     -3.5969     -3.3352     -3.1143
+     -2.9329     -2.8103     -2.9459     -3.6856     -4.5365     -5.0416     -5.1774
+     -5.1584     -5.1312     -5.0926     -4.9884     -4.8203     -4.6391     -4.4881
+     -4.3758     -4.2976     -4.2588     -4.2498     -4.2555     -4.2499     -4.2068
+     -4.0925     -3.8796     -3.5957     -3.2697     -2.9194     -2.5602     -2.2040
+     -1.8587     -1.5313     -1.2300     -0.9682     -0.7651     -0.6383     -0.5799
+     -0.5593     -0.5528     -0.5508     -0.5502     -0.5500     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -5.4257     -5.3319     -5.2366     -5.1714     -5.1185     -5.0696     -5.0211
+     -4.9719     -4.9243     -4.8774     -4.8305     -4.7836     -4.7366     -4.6896
+     -4.6425     -4.5948     -4.5448     -4.2401     -3.8996     -3.5964     -3.3351
+     -3.1146     -2.9353     -2.8313     -3.0836     -3.9141     -4.7124     -5.1196
+     -5.1916     -5.1610     -5.1331     -5.0857     -4.9660     -4.7892     -4.6104
+     -4.4667     -4.3608     -4.2906     -4.2589     -4.2542     -4.2599     -4.2492
+     -4.1961     -4.0644     -3.8350     -3.5405     -3.2064     -2.8501     -2.4873
+     -2.1293     -1.7840     -1.4584     -1.1620     -0.9101     -0.7237     -0.6164
+     -0.5715     -0.5565     -0.5520     -0.5506     -0.5501     -0.5500     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -5.4220     -5.3236     -5.2326     -5.1703     -5.1183     -5.0697
+     -5.0209     -4.9719     -4.9245     -4.8776     -4.8306     -4.7836     -4.7366
+     -4.6896     -4.6424     -4.5944     -4.5437     -4.2387     -3.8984     -3.5959
+     -3.3350     -3.1151     -2.9389     -2.8639     -3.2554     -4.1401     -4.8635
+     -5.1766     -5.1990     -5.1622     -5.1342     -5.0757     -4.9410     -4.7578
+     -4.5828     -4.4467     -4.3471     -4.2852     -4.2599     -4.2588     -4.2636
+     -4.2469     -4.1830     -4.0329     -3.7882     -3.4837     -3.1417     -2.7799
+     -2.4139     -2.0545     -1.7094     -1.3862     -1.0958     -0.8555     -0.6875
+     -0.5991     -0.5653     -0.5546     -0.5514     -0.5504     -0.5501     -0.5500
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -5.4175     -5.3155     -5.2294     -5.1694     -5.1182
+     -5.0698     -5.0208     -4.9719     -4.9246     -4.8777     -4.8307     -4.7837
+     -4.7367     -4.6896     -4.6423     -4.5940     -4.5425     -4.2371     -3.8971
+     -3.5955     -3.3350     -3.1156     -2.9442     -2.9141     -3.4547     -4.3558
+     -4.9899     -5.2152     -5.2025     -5.1630     -5.1341     -5.0626     -4.9138
+     -4.7263     -4.5567     -4.4281     -4.3349     -4.2814     -4.2617     -4.2635
+     -4.2664     -4.2430     -4.1671     -3.9982     -3.7395     -3.4254     -3.0757
+     -2.7088     -2.3399     -1.9795     -1.6352     -1.3151     -1.0318     -0.8051
+     -0.6567     -0.5858     -0.5608     -0.5532     -0.5509     -0.5502     -0.5500
+     -0.5500     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -5.4122     -5.3079     -5.2267     -5.1688
+     -5.1182     -5.0698     -5.0206     -4.9720     -4.9248     -4.8778     -4.8308
+     -4.7837     -4.7367     -4.6896     -4.6422     -4.5935     -4.5410     -4.2352
+     -3.8959     -3.5951     -3.3350     -3.1164     -2.9522     -2.9898     -3.6718
+     -4.5541     -5.0924     -5.2382     -5.2034     -5.1639     -5.1325     -5.0464
+     -4.8846     -4.6954     -4.5321     -4.4107     -4.3244     -4.2789     -4.2642
+     -4.2682     -4.2683     -4.2375     -4.1481     -3.9606     -3.6891     -3.3656
+     -3.0085     -2.6369     -2.2656     -1.9045     -1.5613     -1.2451     -0.9704
+     -0.7593     -0.6312     -0.5758     -0.5576     -0.5522     -0.5506     -0.5501
+     -0.5500     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -5.4060     -5.3011     -5.2246
+     -5.1683     -5.1183     -5.0698     -5.0204     -4.9721     -4.9249     -4.8779
+     -4.8309     -4.7838     -4.7367     -4.6896     -4.6420     -4.5929     -4.5392
+     -4.2331     -3.8946     -3.5948     -3.3350     -3.1176     -2.9645     -3.0983
+     -3.8968     -4.7307     -5.1725     -5.2498     -5.2023     -5.1649     -5.1288
+     -5.0271     -4.8541     -4.6652     -4.5090     -4.3944     -4.3157     -4.2775
+     -4.2673     -4.2728     -4.2690     -4.2301     -4.1260     -3.9202     -3.6370
+     -3.3042     -2.9402     -2.5642     -2.1909     -1.8295     -1.4880     -1.1766
+     -0.9121     -0.7185     -0.6108     -0.5684     -0.5553     -0.5515     -0.5504
+     -0.5501     -0.5500     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -5.3991     -5.2951
+     -5.2229     -5.1679     -5.1183     -5.0698     -5.0202     -4.9721     -4.9250
+     -4.8780     -4.8309     -4.7838     -4.7367     -4.6895     -4.6418     -4.5922
+     -4.5372     -4.2308     -3.8934     -3.5945     -3.3350     -3.1193     -2.9837
+     -3.2433     -4.1209     -4.8840     -5.2320     -5.2541     -5.2000     -5.1660
+     -5.1227     -5.0050     -4.8227     -4.6361     -4.4875     -4.3794     -4.3086
+     -4.2771     -4.2709     -4.2769     -4.2685     -4.2210     -4.1004     -3.8775
+     -3.5833     -3.2414     -2.8707     -2.4910     -2.1159     -1.7546     -1.4154
+     -1.1100     -0.8574     -0.6830     -0.5947     -0.5630     -0.5537     -0.5510
+     -0.5503     -0.5500     -0.5500     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -5.3915
+     -5.2900     -5.2215     -5.1677     -5.1184     -5.0697     -5.0201     -4.9722
+     -4.9251     -4.8781     -4.8310     -4.7839     -4.7367     -4.6894     -4.6415
+     -4.5913     -4.5348     -4.2283     -3.8922     -3.5942     -3.3350     -3.1219
+     -3.0141     -3.4222     -4.3362     -5.0141     -5.2728     -5.2544     -5.1979
+     -5.1668     -5.1138     -4.9802     -4.7908     -4.6083     -4.4674     -4.3656
+     -4.3032     -4.2775     -4.2749     -4.2805     -4.2666     -4.2097     -4.0714
+     -3.8328     -3.5280     -3.1771     -2.8003     -2.4171     -2.0408     -1.6800
+     -1.3438     -1.0454     -0.8068     -0.6529     -0.5825     -0.5592     -0.5526
+     -0.5507     -0.5502     -0.5500     -0.5500     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -5.3835     -5.2857     -5.2204     -5.1675     -5.1185     -5.0695     -5.0200
+     -4.9723     -4.9252     -4.8781     -4.8310     -4.7839     -4.7367     -4.6894
+     -4.6412     -4.5903     -4.5320     -4.2256     -3.8912     -3.5940     -3.3351
+     -3.1258     -3.0618     -3.6263     -4.5361     -5.1216     -5.2973     -5.2518
+     -5.1963     -5.1669     -5.1019     -4.9533     -4.7589     -4.5818     -4.4487
+     -4.3532     -4.2992     -4.2786     -4.2791     -4.2833     -4.2634     -4.1961
+     -4.0392     -3.7862     -3.4711     -3.1115     -2.7289     -2.3429     -1.9656
+     -1.6058     -1.2732     -0.9834     -0.7608     -0.6282     -0.5733     -0.5564
+     -0.5518     -0.5505     -0.5501     -0.5500     -0.5499     -0.5499     -0.5499
+     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499     -0.5499
+     -0.5499
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/semenov_opacity.c PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/semenov_opacity.c
--- PLUTO4/Src/Radiation/SemenovOpacity/semenov_opacity.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/semenov_opacity.c	2013-06-01 18:33:00.202214819 +0200
@@ -0,0 +1,362 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2012-2013  Markus Flaig.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#include "radiation.h"
+#include "error.h"
+#include "semenov_opacity.h"
+#include "generate_opacity.h"
+
+// Check if density and temperature are in allowed range
+#define SEM_OPAC_CHECK  1
+
+SemenovOpaciytInfo opacity_info = {.opacity_tabel_planck = NULL, .opacity_table_rosseland = NULL};
+
+/**
+    Initializes all necessary structures needed for the semenov opacity
+*/
+void SemenovOpacityInit()
+{
+    double ed[30], eg_total[2 * 5041], *eg_planck, *eg_rosseland, *eg = NULL;
+    double T, dT, rho, drho;
+    int it, irho, ross;
+    double akext;
+    double *opacity_table = NULL;
+    char file_path[512];
+
+    eg_planck = &eg_total[0];
+    eg_rosseland = &eg_total[5041];
+
+//  opacity_info.nT   = 2048;
+//  opacity_info.T0   = 1.000e+01;
+//  opacity_info.T1   = 9.999e+03;
+//  opacity_info.nrho = 2048;
+//  opacity_info.rho0 = 1.000e-16;
+//  opacity_info.rho1 = 9.999e-09;
+//  opacity_info.top[0] = 'h';
+//  strncpy(opacity_info.model,"nrm",3);
+//  opacity_info.shape[0] = 's';
+
+    SemenovOpacityReadOptions();
+
+    opacity_info.opacity_tabel_planck = NULL;
+    opacity_info.opacity_table_rosseland = NULL;
+
+    if( prank == 0 )
+    {
+        /*
+            NOTE
+            The define SEMENOV_OPACITY_PATH is added to the compiler command line. To modify the define or change something
+            look at the file Src/Radiation/makefile. We changed the CFLAGS if the semenov opacity is chosen.
+        */
+        sprintf( file_path, "%s/%s", SEMENOV_OPACITY_PATH, "kP_h2001.dat" );
+        init_g2( file_path, eg_planck );
+        sprintf( file_path, "%s/%s", SEMENOV_OPACITY_PATH, "kR_h2001.dat" );
+        init_g2( file_path, eg_rosseland );
+    }
+    MPI_Bcast( &opacity_info, sizeof( SemenovOpaciytInfo ), MPI_CHAR, 0, MPI_COMM_WORLD );
+    MPI_Bcast( eg_total, 2 * 5041, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+
+    /* Allocate memory for opacity tables */
+    opacity_info.opacity_tabel_planck = malloc( opacity_info.nT * opacity_info.nrho * sizeof( double ) );
+    CHECK_ALLOCATED_MEMORY( opacity_info.opacity_tabel_planck );
+    opacity_info.opacity_table_rosseland = malloc( opacity_info.nT * opacity_info.nrho * sizeof( double ) );
+    CHECK_ALLOCATED_MEMORY( opacity_info.opacity_table_rosseland );
+
+    for( ross = 0; ross <= 1; ross++ )
+    {
+        opacity_table = ross == 1 ? opacity_info.opacity_table_rosseland : opacity_info.opacity_tabel_planck;
+        eg = ross == 1 ? eg_rosseland : eg_planck;
+
+        /* Initialization of all necessary data for a chosen dust model: */
+        init_d( &ross, opacity_info.model, opacity_info.top, opacity_info.shape, ed, ( int )3, ( int )1, ( int )1 );
+
+        rho = opacity_info.rho0;
+        drho = exp( log( opacity_info.rho1 / opacity_info.rho0 ) / ( opacity_info.nrho - 1 ) );
+        for( irho = 1; irho <= opacity_info.nrho; ++irho )
+        {
+
+            T = opacity_info.T0;
+            dT = exp( log( opacity_info.T1 / opacity_info.T0 ) / ( opacity_info.nT - 1 ) );
+            for( it = 1; it <= opacity_info.nT; ++it )
+            {
+                /*
+                    Calculation of Rosseland or Planck mean opacities using a chosen density,
+                    temperature, silicate dust model, shape of the grains and their topology:
+                */
+                cop( ed, eg, &rho, &T, &akext );
+                opacity_table[opacity_info.nrho * ( irho - 1 ) + ( it - 1 )] = akext;
+                T *= dT;
+            }
+            rho *= drho;
+        }
+    }
+}
+
+/**
+    Reads the necessary parameters for generating the opacities from the file pluto.ini.
+    A possible set of options could be.
+
+    \verbatim
+    [Radiation Semenov Opacity]
+
+    semenov-opacity-nT      2048
+    semenov-opacity-T0      1.000e+01
+    semenov-opacity-T1      9.999e+03
+    semenov-opacity-nrho    2048
+    semenov-opacity-rho0    1.000e-16
+    semenov-opacity-rho1    9.999e-09
+    semenov-opacity-top     h
+    semenov-opacity-model   nrm
+    semenov-opacity-shape   s
+    \endverbatim
+    More information can be found on the web page <a href="http://www.mpia.de/homes/henning/Dust_opacities/Opacities/opacities.htmll"></a>
+    or in the comments of the file SemenovOpacity/generate_opacity.c.
+*/
+void SemenovOpacityReadOptions()
+{
+    char opacity_option_string[256];
+    char *option_value;
+
+    if( prank == 0 )
+    {
+        strcpy( opacity_option_string, "semenov-opacity-nT" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.nT = atoi( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-T0" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.T0 = atof( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-T1" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.T1 = atof( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-nrho" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.nrho = atoi( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-rho0" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.rho0 = atof( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-rho1" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            opacity_info.rho1 = atof( ParGet( opacity_option_string, 1 ) );
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-top" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            option_value = ParGet( opacity_option_string, 1 );
+            if( strlen( option_value ) == 1 )
+            {
+                opacity_info.top[0] = option_value[0];
+            }
+            else
+            {
+                ERROR( "Expected a string with one character for option %s", opacity_option_string );
+            }
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-model" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            option_value = ParGet( opacity_option_string, 1 );
+            if( strlen( option_value ) == 3 )
+            {
+                strncpy( opacity_info.model, option_value, 3 );
+            }
+            else
+            {
+                ERROR( "Expected a string with 3 characters for option %s", opacity_option_string );
+            }
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+
+        strcpy( opacity_option_string, "semenov-opacity-shape" );
+        if( ParQuery( opacity_option_string ) )
+        {
+            option_value = ParGet( opacity_option_string, 1 );
+            if( strlen( option_value ) == 1 )
+            {
+                opacity_info.shape[0] = option_value[0];
+            }
+            else
+            {
+                ERROR( "Expected a string with one character for option %s", opacity_option_string );
+            }
+        }
+        else
+        {
+            ERROR( "%s not found in pluto.ini", opacity_option_string );
+        }
+    }
+}
+
+/**
+    Frees the memory allocated for the semenov opacities
+*/
+void SemenovOpacityFinalise()
+{
+    if( opacity_info.opacity_tabel_planck )
+    {
+        free( opacity_info.opacity_tabel_planck );
+    }
+
+    if( opacity_info.opacity_table_rosseland )
+    {
+        free( opacity_info.opacity_table_rosseland );
+    }
+}
+
+/**
+    Computes and returns the Planck mean opacity in cgs units.
+
+    \param[in]  rho     Density in cgs units
+    \param[in]  T       Temperature in cgs units
+*/
+double SemenovPlanckOpacity( double rho, double T )
+{
+    double dT, drho, irho0, iT0;
+    int irhom, irhop, iTm, iTp;
+
+
+    drho = exp( log( opacity_info.rho1 / opacity_info.rho0 ) / ( opacity_info.nrho - 1 ) );
+    dT   = exp( log( opacity_info.T1   / opacity_info.T0 ) / ( opacity_info.nT   - 1 ) );
+
+    irho0 = log( rho / opacity_info.rho0 ) / log( drho ) + 1.0;
+    iT0   = log( T  / opacity_info.T0 ) / log( dT ) + 1.0;
+
+    irhom = ( int )( irho0 );
+    iTm   = ( int )( iT0 );
+    irhop = irhom + 1;
+    iTp   = iTm + 1;
+
+#ifdef SEM_OPAC_CHECK
+    if( ( iTm   < 1 ) || ( iTp   > opacity_info.nT ) )
+    {
+        print( "SEM_OPAC_PLANCK): Temperature out of range (T = %e).\n", T );
+        QUIT_PLUTO( 1 );
+    }
+    if( ( irhom < 1 ) || ( irhop > opacity_info.nrho ) )
+    {
+        print( "SEM_OPAC_PLANCK): Density out of range (rho = %e).\n", rho );
+        QUIT_PLUTO( 1 );
+    }
+#endif /* SEM_OPAC_CHECK */
+
+
+    return
+        ( iT0 - iTm ) * ( irho0 - irhom ) * opacity_info.opacity_tabel_planck[opacity_info.nrho * ( irhop - 1 ) + ( iTp - 1 )] +
+        ( iT0 - iTm ) * ( irhop - irho0 ) * opacity_info.opacity_tabel_planck[opacity_info.nrho * ( irhom - 1 ) + ( iTp - 1 )] +
+        ( iTp - iT0 ) * ( irho0 - irhom ) * opacity_info.opacity_tabel_planck[opacity_info.nrho * ( irhop - 1 ) + ( iTm - 1 )] +
+        ( iTp - iT0 ) * ( irhop - irho0 ) * opacity_info.opacity_tabel_planck[opacity_info.nrho * ( irhom - 1 ) + ( iTm - 1 )];
+}
+
+/**
+    Computes and returns the Rosseland mean opacity in cgs units.
+
+    \param[in]  rho     Density in cgs units
+    \param[in]  T       Temperature in cgs units
+*/
+double SemenovRosselandOpacity( double rho, double T )
+{
+    double dT, drho, irho0, iT0;
+    int irhom, irhop, iTm, iTp;
+
+
+    drho = exp( log( opacity_info.rho1 / opacity_info.rho0 ) / ( opacity_info.nrho - 1 ) );
+    dT   = exp( log( opacity_info.T1   / opacity_info.T0 ) / ( opacity_info.nT   - 1 ) );
+
+    irho0 = log( rho / opacity_info.rho0 ) / log( drho ) + 1.0;
+    iT0   = log( T  / opacity_info.T0 ) / log( dT ) + 1.0;
+
+    irhom = ( int )( irho0 );
+    iTm   = ( int )( iT0 );
+    irhop = irhom + 1;
+    iTp   = iTm + 1;
+
+#ifdef SEM_OPAC_CHECK
+    if( ( iTm   < 1 ) || ( iTp   > opacity_info.nT ) )
+    {
+        print( "SEM_OPAC_ROSS): Temperature out of range (T = %e).\n", T );
+        QUIT_PLUTO( 1 );
+    }
+    if( ( irhom < 1 ) || ( irhop > opacity_info.nrho ) )
+    {
+        print( "SEM_OPAC_ROSS): Density out of range (rho = %e).\n", rho );
+        QUIT_PLUTO( 1 );
+    }
+#endif /* SEM_OPAC_CHECK */
+
+
+    return
+        ( iT0 - iTm ) * ( irho0 - irhom ) * opacity_info.opacity_table_rosseland[opacity_info.nrho * ( irhop - 1 ) + ( iTp - 1 )] +
+        ( iT0 - iTm ) * ( irhop - irho0 ) * opacity_info.opacity_table_rosseland[opacity_info.nrho * ( irhom - 1 ) + ( iTp - 1 )] +
+        ( iTp - iT0 ) * ( irho0 - irhom ) * opacity_info.opacity_table_rosseland[opacity_info.nrho * ( irhop - 1 ) + ( iTm - 1 )] +
+        ( iTp - iT0 ) * ( irhop - irho0 ) * opacity_info.opacity_table_rosseland[opacity_info.nrho * ( irhom - 1 ) + ( iTm - 1 )];
+}
diff -rupN PLUTO4/Src/Radiation/SemenovOpacity/semenov_opacity.h PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/semenov_opacity.h
--- PLUTO4/Src/Radiation/SemenovOpacity/semenov_opacity.h	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/SemenovOpacity/semenov_opacity.h	2013-06-01 18:33:00.205214819 +0200
@@ -0,0 +1,44 @@
+/**
+Copyright (C) 2011-2013 Stefan Kolb.
+Copyright (C) 2012-2013  Markus Flaig.
+
+This file is part of the radiation module for the code PLUTO.
+
+The radiation module is free software: you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+The radiation module is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the radiation module. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SEMINOV_OPACITY_H
+#define SEMINOV_OPACITY_H
+
+typedef struct
+{
+    int nT;                          /** Number of temperature points */
+    double T0;                       /** First temperature point */
+    double T1;                       /** Last temperature point */
+    int nrho;                        /** Number of density points */
+    double rho0;                     /** First density point */
+    double rho1;                     /** Last density point */
+    char top[1];                     /** Grain topology = ['h','c','p'] */
+    char model[3];                   /** Dust model = ['nrm','ips','irs'] */
+    char shape[1];                   /** Shape of dust particles = ['s','a','5'] */
+    double *opacity_tabel_planck;    /** Pointer to Planck opacity table */
+    double *opacity_table_rosseland; /** Pointer to Rosseland opacity table */
+} SemenovOpaciytInfo;
+
+void SemenovOpacityInit();
+void SemenovOpacityReadOptions();
+void SemenovOpacityFinalise();
+double SemenovPlanckOpacity( double rho, double T );
+double SemenovRosselandOpacity( double rho, double T );
+#endif
diff -rupN PLUTO4/Src/Radiation/Templates/init.c PLUTO_RADIATION_MOD/Src/Radiation/Templates/init.c
--- PLUTO4/Src/Radiation/Templates/init.c	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/Templates/init.c	2013-06-01 18:33:00.195214820 +0200
@@ -0,0 +1,369 @@
+/**
+    \file
+    \brief Contains basic functions for problem initialization.
+
+    The file was modified to contain all needed function to use the
+    radiation module.
+
+    The init.c file collects most of the user-supplied functions useful
+    for problem configuration.
+    It is automatically searched for by the makefile.
+
+    \author A. Mignone (mignone@ph.unito.it)
+    \author S. Kolb
+
+    \date   March 14, 2013
+*/
+
+#include "pluto.h"
+
+/**
+    The Init() function can be used to assign initial conditions as
+    as a function of spatial position.
+
+    \param [out] v   a pointer to a vector of primitive variables
+    \param [in] x1   coordinate point in the 1st dimension
+    \param [in] x2   coordinate point in the 2nd dimension
+    \param [in] x3   coordinate point in the 3rdt dimension
+
+    The meaning of x1, x2 and x3 depends on the geometry:
+    \f[ \begin{array}{cccl}
+        x_1  & x_2    & x_3  & \mathrm{Geometry}    \\ \noalign{\medskip}
+        \hline
+        x    &   y    &  z   & \mathrm{Cartesian}   \\ \noalign{\medskip}
+        R    &   z    &  -   & \mathrm{cylindrical} \\ \noalign{\medskip}
+        R    & \phi   &  z   & \mathrm{polar}       \\ \noalign{\medskip}
+        r    & \theta & \phi & \mathrm{spherical}
+        \end{array}
+    \f]
+
+    Variable names are accessed by means of an index v[nv], where
+    nv = RHO is density, nv = PRS is pressure, nv = (VX1, VX2, VX3) are
+    the three components of velocity, and so forth.
+
+*/
+void Init( double *v, double x1, double x2, double x3 )
+{
+    v[RHO] = 1.0;
+    v[VX1] = 0.0;
+    v[VX2] = 0.0;
+    v[VX3] = 0.0;
+    v[PRS] = 1.0;
+    v[TRC] = 0.0;
+
+    RadiationSetMu( 0.6 );
+
+    #if PHYSICS == MHD || PHYSICS == RMHD
+        v[BX1] = 0.0;
+        v[BX2] = 0.0;
+        v[BX3] = 0.0;
+
+        v[AX1] = 0.0;
+        v[AX2] = 0.0;
+        v[AX3] = 0.0;
+    #endif
+}
+
+#if RADIATION == YES
+/**
+    This function is called at the initialization of the radiation module to set the initial values of the
+    radiation energy density \f$ E \f$. The default is to call the function \ref RadiationSetInitialEradBlackBody
+    which sets \f$ E \f$ to \f$ E=a_R T^4\f$.
+
+    To customize this function iterate over all array element of the local domain (ghost cells included). And
+    set \f$ E \f$ to the value you want. To access the radiation energy density data you have to use the
+    attribute Erad of the global struct radiation_data.
+
+    To set all cells in \f$ E \f$ to 1 in code units you can write:
+
+    \code{.c}
+    int k,j,i;
+
+    TOT_LOOP(k,j,i)
+    {
+        radiation_data.Erad[k][j][i] = 1.0;
+    }
+    \endcode
+*/
+void RadiationSetInitialErad( Grid *grid, Data *data )
+{
+    RadiationSetInitialEradBlackBody( grid, data );
+}
+
+/**
+    This function can be used to initialize the opacity as needed for example to use the Semenov opacities.
+
+    To use the Semenov opacities call the function \ref SemenovOpacityInit() here
+*/
+void RadiationOpacityInit()
+{
+
+}
+
+/**
+    This function is called every time the Rosseland opacity is needed in the radiation module.
+    \Note It is essential implement this function.
+
+    There are different available routines which can be used here.
+
+    Rosseland mean opacity after paper Lin & Papaloizou (1985): \ref RosselandOpacityLinPapaloizou1985(density,temperature)
+
+    Rosseland mean opacity after paper Bell & Lin (1994): \ref RosselandOpacityBellLin1994(density,temperature)
+
+    Rosseland mean opacity after paper Semenov et al. (2003): \ref SemenovRosselandOpacity(density,temperature)
+    \Note It is necessary to call \ref SemenovOpacityInit() in \ref RadiationOpacityInit() to use the Semenov opacities.
+
+    \param[in] density      density in cgs units
+    \param[in] temperature  temperature in cgs units
+    \return the Rosseland mean opacity in cgs units
+*/
+double RadiationRosselandOpacity( double density, double temperature )
+{
+    return RosselandOpacityLinPapaloizou1985( density, temperature );
+}
+
+/**
+    Same as \ref RadiationRosselandOpacity but for the Planck opacity.
+
+    \Note Except for the Semenov opacities there is currently no Planck mean opacity routine
+    implemented. A solution to this is to use here for simplicity also the Rosseland mean opacity.
+
+    If you want to use the Semenov opacities use the function \ref SemenovPlanckOpacity(density,temperature)
+
+    \param[in] density      density in cgs units
+    \param[in] temperature  temperature in cgs units
+    \return the Planck mean opacity in cgs units
+*/
+double RadiationPlanckOpacity( double density, double temperature )
+{
+    return RosselandOpacityLinPapaloizou1985( density, temperature );
+}
+
+#if IRRADIATION == YES
+/**
+    Same as \ref RadiationRosselandOpacity and \ref RadiationPlanckOpacity but for the opacity used for irradiation.
+
+    \param[in] density      density in cgs units
+    \param[in] temperature  temperature in cgs units
+    \return opacity in cgs units
+*/
+double IrradiationOpacity( double density, double temperature )
+{
+    return RosselandOpacityLinPapaloizou1985( density, temperature );
+}
+#endif
+
+#endif
+
+/**
+    Perform runtime data analysis.
+
+    \param [in] d the PLUTO Data structure
+    \param [in] grid   pointer to array of Grid structures
+*/
+void Analysis( const Data *d, Grid *grid )
+{
+
+}
+
+#if PHYSICS == MHD
+/**
+    Define the component of a static, curl-free background
+    magnetic field.
+
+    \param [in] x1  position in the 1st coordinate direction \f$x_1\f$
+    \param [in] x2  position in the 2nd coordinate direction \f$x_2\f$
+    \param [in] x3  position in the 3rd coordinate direction \f$x_3\f$
+    \param [out] B0 array containing the vector components of the background magnetic field
+*/
+void BackgroundField( double x1, double x2, double x3, double *B0 )
+{
+    B0[0] = 0.0;
+    B0[1] = 0.0;
+    B0[2] = 0.0;
+}
+#endif
+
+/**
+    Assign user-defined boundary conditions.
+
+    \param [in,out] d  pointer to the PLUTO data structure containing
+        cell-centered primitive quantities (d->Vc) and staggered
+        magnetic fields (d->Vs, when used) to be filled.
+    \param [in] box    pointer to a RBox structure containing the lower
+        and upper indices of the ghost zone-centers/nodes or edges at
+        which data values should be assigned.
+    \param [in] side   specifies the boundary side where ghost zones need
+        to be filled. It can assume the following pre-definite values:
+        X1_BEG, X1_END, X2_BEG, X2_END, X3_BEG, X3_END. The special value
+        side == 0 is used to control a region inside the computational domain.
+    \param [in] grid  pointer to an array of Grid structures.
+*/
+void UserDefBoundary( const Data *d, RBox *box, int side, Grid *grid )
+{
+    int   i, j, k, nv;
+    double  *x1, *x2, *x3;
+
+    x1 = grid[IDIR].x;
+    x2 = grid[JDIR].x;
+    x3 = grid[KDIR].x;
+
+    if( side == 0 )     /* -- check solution inside domain -- */
+    {
+        DOM_LOOP( k, j, i ) {};
+    }
+
+    if( side == X1_BEG )  /* -- X1_BEG boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+
+    if( side == X1_END )  /* -- X1_END boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+
+    if( side == X2_BEG )  /* -- X2_BEG boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+
+    if( side == X2_END )  /* -- X2_END boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+
+    if( side == X3_BEG )  /* -- X3_BEG boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+
+    if( side == X3_END )  /* -- X3_END boundary -- */
+    {
+        if( box->vpos == CENTER )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X1FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X2FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+        else if( box->vpos == X3FACE )
+        {
+            BOX_LOOP( box, k, j, i ) {  }
+        }
+    }
+}
+
+#if BODY_FORCE != NO
+/**
+    * Prescribe the acceleration vector as a function of the coordinates
+    * and the vector of primitive variables *v.
+
+    \param [in] v  pointer to a cell-centered vector of primitive variables
+    \param [out] g acceleration vector
+    \param [in] x1  position in the 1st coordinate direction \f$x_1\f$
+    \param [in] x2  position in the 2nd coordinate direction \f$x_2\f$
+    \param [in] x3  position in the 3rd coordinate direction \f$x_3\f$
+
+*/
+void BodyForceVector( double *v, double *g, double x1, double x2, double x3 )
+{
+    g[IDIR] = 0.0;
+    g[JDIR] = 0.0;
+    g[KDIR] = 0.0;
+}
+
+/**
+    Return the gravitational potential as function of the coordinates.
+
+    \param [in] x1  position in the 1st coordinate direction \f$x_1\f$
+    \param [in] x2  position in the 2nd coordinate direction \f$x_2\f$
+    \param [in] x3  position in the 3rd coordinate direction \f$x_3\f$
+
+    \return The body force potential \f$ \Phi(x_1,x_2,x_3) \f$.
+*/
+double BodyForcePotential( double x1, double x2, double x3 )
+{
+    return 0.0;
+}
+#endif
diff -rupN PLUTO4/Src/Radiation/Templates/pluto.ini PLUTO_RADIATION_MOD/Src/Radiation/Templates/pluto.ini
--- PLUTO4/Src/Radiation/Templates/pluto.ini	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Src/Radiation/Templates/pluto.ini	2013-06-01 18:33:00.193214820 +0200
@@ -0,0 +1,86 @@
+[Grid]
+
+X1-grid    1    0.0    100    u    1.0
+X2-grid    1    0.0    100    u    1.0
+X3-grid    1    0.0    1      u    1.0
+
+[Chombo Refinement]
+
+Levels           4
+Ref_ratio        2 2 2 2 2 
+Regrid_interval  2 2 2 2 
+Refine_thresh    0.3
+Tag_buffer_size  3
+Block_factor     8
+Max_grid_size    64
+Fill_ratio       0.75
+
+[Time]
+
+CFL              0.4
+CFL_max_var      1.1
+tstop            1.0
+first_dt         1.e-4
+
+[Solver]
+
+Solver         tvdlf
+
+[Boundary]
+
+X1-beg        outflow
+X1-end        outflow
+X2-beg        outflow
+X2-end        outflow
+X3-beg        outflow
+X3-end        outflow
+
+[Radiation-Boundary]
+
+rX1-beg        reflective
+rX1-end        reflective
+rX2-beg        fixedvalueT 5.0
+rX2-end        symmetric
+rX3-beg        periodic
+rX3-end        periodic
+
+[Radiation Option]
+
+absolute-tolerance  1e-80
+relative-tolerance  1e-8
+max-iterations      10000
+fpe-signal-haldler  disable
+#petsc-options      -help -ksp_type=cgne -pc_type=icc
+
+[Radiation Semenov Opacity]
+
+semenov-opacity-nT       2048
+semenov-opacity-T0       1.000e+01
+semenov-opacity-T1       9.999e+03
+semenov-opacity-nrho     2048
+semenov-opacity-rho0     1.000e-16
+semenov-opacity-rho1     9.999e-09
+semenov-opacity-top      h
+semenov-opacity-model    nrm
+semenov-opacity-shape    s
+
+[Static Grid Output]
+
+uservar    0
+dbl        1.0  -1   single_file
+flt       -1.0  -1   single_file
+vtk       -1.0  -1   single_file
+tab       -1.0  -1   
+ppm       -1.0  -1   
+png       -1.0  -1
+log        1
+analysis  -1.0  -1
+
+[Chombo HDF5 output]
+
+Checkpoint_interval  -1.0  0
+Plot_interval         1.0  0 
+
+[Parameters]
+
+SCRH   0 
diff -rupN PLUTO4/Tools/Python/make.py PLUTO_RADIATION_MOD/Tools/Python/make.py
--- PLUTO4/Tools/Python/make.py	2012-11-05 13:26:22.000000000 +0100
+++ PLUTO_RADIATION_MOD/Tools/Python/make.py	2013-06-01 18:32:59.898214832 +0200
@@ -7,6 +7,7 @@ import time
 import file
 import ut
 import menu
+import radiation #MODIFICATION FOR (RADIATION MODULE)
 
 ###############################################################
 #
@@ -265,6 +266,11 @@ def problem(work_dir, pluto_path, pluto_
     options_HD.append(['NO','YES'])
     default_HD.append('NO')
 
+    #MODIFICATION FOR (RADIATION MODULE)
+    entries_HD.append('RADIATION')
+    options_HD.append(['NO','YES'])
+    default_HD.append('NO')
+
 
 #    if (physics_module == "HD" and dim_splitting == "YES"):
 #      if (geometry == "POLAR" or geometry == "SPHERICAL"):
@@ -290,6 +296,10 @@ def problem(work_dir, pluto_path, pluto_
       selection = menu.Browse(entries_HD, default_HD, options_HD)
 #      selection = menu.select(entries_HD,options_HD,default_HD,'HD MENU')
 
+    #MODIFICATION FOR (RADIATION MODULE)
+    if default_HD[entries_HD.index('RADIATION')] == 'YES':
+      radiation.show_radiation_menue(work_dir,pluto_dir,AUTO_UPDATE)
+
 # RHD
 
   if physics_module == 'RHD':
@@ -388,6 +398,11 @@ def problem(work_dir, pluto_path, pluto_
     entries_MHD.append('ROTATING_FRAME')
     options_MHD.append(['NO','YES'])
     default_MHD.append('NO')
+    
+    #MODIFICATION FOR (RADIATION MODULE)
+    entries_MHD.append('RADIATION')
+    options_MHD.append(['NO','YES'])
+    default_MHD.append('NO')
 
 #  Read MHD pre-existing MHD submenu defaults, if they exists
  
@@ -413,6 +428,9 @@ def problem(work_dir, pluto_path, pluto_
         selection = menu.Browse(entries_MHD, default_MHD, options_MHD)
 #        selection = menu.select(entries_MHD,options_MHD,default_MHD,'MHD MENU')
 
+    #MODIFICATION FOR (RADIATION MODULE)
+    if default_MHD[entries_MHD.index('RADIATION')] == 'YES':
+      radiation.show_radiation_menue(work_dir,pluto_dir,AUTO_UPDATE)
 
 # RMHD
 
@@ -516,11 +534,19 @@ def problem(work_dir, pluto_path, pluto_
       i = entries_MHD.index(x)
       tmp.append('#define  '+x.ljust(21)+'   '+default_MHD[i]+'\n')
 
+    #MODIFICATION FOR (RADIATION MODULE)
+    if default_MHD[entries_MHD.index('RADIATION')] == 'YES':
+      radiation.modify_definitions(work_dir,tmp)
+
   if physics_module == 'HD':
     for x in entries_HD:
       i = entries_HD.index(x)
       tmp.append('#define    '+x.ljust(21)+'   '+default_HD[i]+'\n')
 
+    #MODIFICATION FOR (RADIATION MODULE)
+    if default_HD[entries_HD.index('RADIATION')] == 'YES':
+      radiation.modify_definitions(work_dir,tmp)
+
   if physics_module == 'RHD':
     for x in entries_RHD:
       i = entries_RHD.index(x)
@@ -643,6 +669,12 @@ def problem(work_dir, pluto_path, pluto_
       if   (default_MOD[n] == 'SUPER_TIME_STEPPING'): sts_flag = 1
       elif (default_MOD[n] == 'RK_CHEBYSHEV'):        rkc_flag = 1
       elif (default_MOD[n] == 'EXPLICIT'):            exp_flag = 1
+
+    #MODIFICATION FOR (RADIATION MODULE)
+    n = entries_HD.index('RADIATION')
+    if (default_HD[n] == 'YES'):
+      pluto_path.append('Radiation/')
+      additional_flags.append(' -DPLUTO4')
       
   elif (physics_module == 'RHD'):
     pluto_path.append('RHD/')
@@ -680,6 +712,12 @@ def problem(work_dir, pluto_path, pluto_
       if   (default_MOD[n] == 'SUPER_TIME_STEPPING'): sts_flag = 1
       elif (default_MOD[n] == 'RK_CHEBYSHEV'):        rkc_flag = 1
       elif (default_MOD[n] == 'EXPLICIT'):            exp_flag = 1
+
+    #MODIFICATION FOR (RADIATION MODULE)
+    n = entries_MHD.index('RADIATION')
+    if (default_MHD[n] == 'YES'):
+      pluto_path.append('Radiation/')
+      additional_flags.append(' -DPLUTO4')
   
     # ***************************
     #  need shearingbox module ?
@@ -906,7 +944,9 @@ def problem(work_dir, pluto_path, pluto_
       try:
         xl   = string.split(x)
         scrh = file.string_list(work_dir+'/definitions.h',xl[1])
-        no_us_fr[no_us_fr.index(x)] = scrh[0]
+        #MODIFICATION FOR (RADIATION MODULE)
+        if scrh[0].split()[1] == xl[1]:
+          no_us_fr[no_us_fr.index(x)] = scrh[0]
       except IndexError:
         continue
 
@@ -1007,6 +1047,11 @@ def makefile(work_dir, pluto_path, pluto
 # copy template
  
  shutil.copy(pluto_dir + makefile_template[0], mkfl_name)
+ 
+ #MODIFICATION FOR (RADIATION MODULE)
+ scrh = file.word_find(mkfl_name,'local_make')
+ ipos = scrh[0]
+ file.replace_line (mkfl_name, "", ipos)
 
 # write main PLUTO dir
 
@@ -1041,6 +1086,10 @@ def makefile(work_dir, pluto_path, pluto
    file.insert(mkfl_name, 'CFLAGS += '+x+'\n', ipos)
    ipos = ipos + 1
 
+ #MODIFICATION FOR (RADIATION MODULE)
+ file.insert(mkfl_name, '\n\n-include local_make\n\n', ipos)
+ ipos = ipos+1
+
 # Check for libpng
 
 # if (WITH_CHOMBO == 0):
diff -rupN PLUTO4/Tools/Python/radiation.py PLUTO_RADIATION_MOD/Tools/Python/radiation.py
--- PLUTO4/Tools/Python/radiation.py	1970-01-01 01:00:00.000000000 +0100
+++ PLUTO_RADIATION_MOD/Tools/Python/radiation.py	2013-06-01 18:32:59.897214832 +0200
@@ -0,0 +1,142 @@
+import os
+import file
+import string
+import menu
+import shutil
+import hashlib
+
+entries_RADIATION_SOR_SOLVER = []
+options_RADIATION_SOR_SOLVER = []
+default_RADIATION_SOR_SOLVER = []
+
+def show_radiation_sor_solver_menue(work_dir,AUTO_UPDATE):
+  del entries_RADIATION_SOR_SOLVER[:]
+  del options_RADIATION_SOR_SOLVER[:]
+  del default_RADIATION_SOR_SOLVER[:]
+  entries_RADIATION_SOR_SOLVER.append('RADIATION_SOR_OMEGA_MODE')
+  options_RADIATION_SOR_SOLVER.append(['SOR_FIXED_OMEGA','SOR_ADAPTIVE_OMEGA'])
+  default_RADIATION_SOR_SOLVER.append('SOR_ADAPTIVE_OMEGA')
+  
+  entries_RADIATION_SOR_SOLVER.append('RADIATION_SOR_NORM')
+  options_RADIATION_SOR_SOLVER.append(['NORM_PETSC','NORM_RELATIVE_L2','NORM_RELATIVE_MAX','NORM_RESIDUAL_L2','NORM_RESIDUAL_MAX','NORM_RESIDUAL_RELATIVE_L2', 'NORM_RESIDUAL_RELATIVE_MAX'])
+  default_RADIATION_SOR_SOLVER.append('NORM_RESIDUAL_L2')
+    
+  #Read pre-existing options, if they exists
+    
+  if (os.path.exists(work_dir+'/definitions.h')):
+    for x in entries_RADIATION_SOR_SOLVER:
+      try:
+        scrh = file.string_list(work_dir+'/definitions.h',x)
+        tmp  = string.split(scrh[0])
+        default_RADIATION_SOR_SOLVER[entries_RADIATION_SOR_SOLVER.index(x)] = tmp[2]
+      except IndexError:
+        continue
+    
+  if AUTO_UPDATE == 0:
+    selection = ''
+    menu.SetTitle("Radiation SOR Solver Menu")
+    selection = menu.Browse(entries_RADIATION_SOR_SOLVER, default_RADIATION_SOR_SOLVER, options_RADIATION_SOR_SOLVER)
+
+entries_RADIATION = []
+options_RADIATION = []
+default_RADIATION = []
+
+def show_radiation_menue(work_dir,pluto_dir,AUTO_UPDATE):
+  del entries_RADIATION[:]
+  del options_RADIATION[:]
+  del default_RADIATION[:]
+
+  entries_RADIATION.append('RADIATION_FLUXLIMITER')
+  options_RADIATION.append(['FLUXLIMITER_MINERBO','FLUXLIMITER_KLEY','FLUXLIMITER_LEVERMORE_POMRANING','FLUXLIMITER_CONST'])
+  default_RADIATION.append('FLUXLIMITER_MINERBO')
+
+  entries_RADIATION.append('RADIATION_PRESSURE')
+  options_RADIATION.append(['YES','NO'])
+  default_RADIATION.append('NO')
+
+  entries_RADIATION.append('RADIATION_SOLVER')
+  options_RADIATION.append(['PETSC_LIBRARY','SOLVER_SOR'])
+  default_RADIATION.append('PETSC_LIBRARY')
+   
+  entries_RADIATION.append('IRRADIATION')
+  options_RADIATION.append(['YES','NO'])
+  default_RADIATION.append('NO')
+  
+  #If the files init.c and pluto,ini are the same as in the directory $PLUTO_DIR/Src/Templates/
+  #then replace them with the the init.c and pluto.ini from $PLUTO_DIR/Src/Radiation/Templates/
+  
+  def isFileEqual(filepath1, filepath2):
+    f1 = open(filepath1)
+    f2 = open(filepath2)
+    
+    if not f1:
+      return False
+    if not f2:
+      return False
+    
+    hash1 = hashlib.md5(f1.read()).hexdigest()
+    hash2 = hashlib.md5(f2.read()).hexdigest()
+    f1.close()
+    f2.close()
+    return hash1 == hash2
+  
+  if (os.path.exists(work_dir+'/init.c')):
+    if isFileEqual(pluto_dir+'/Src/Templates/init.c',work_dir+'/init.c'):
+      shutil.copy(pluto_dir+'/Src/Radiation/Templates/init.c',work_dir+'/init.c')
+        
+  if (os.path.exists(work_dir+'/pluto.ini')):
+    if isFileEqual(pluto_dir+'/Src/Templates/pluto.ini',work_dir+'/pluto.ini'):
+      shutil.copy(pluto_dir+'/Src/Radiation/Templates/pluto.ini',work_dir+'/pluto.ini')
+    
+  #Read Radiation pre-existing Radiation submenu defaults, if they exists
+    
+  if (os.path.exists(work_dir+'/definitions.h')):
+    for x in entries_RADIATION:
+      try:
+        scrh = file.string_list(work_dir+'/definitions.h',x)
+        tmp  = string.split(scrh[0])
+        default_RADIATION[entries_RADIATION.index(x)] = tmp[2]
+      except IndexError:
+        continue
+    
+  if AUTO_UPDATE == 0:
+    selection = ''
+    menu.SetTitle("Radiation Menu")
+    selection = menu.Browse(entries_RADIATION, default_RADIATION, options_RADIATION)
+  
+  if default_RADIATION[entries_RADIATION.index('RADIATION_SOLVER')] == 'SOLVER_SOR':
+      show_radiation_sor_solver_menue(work_dir,AUTO_UPDATE)
+
+def modify_definitions(work_dir,tmp):
+  tmp.append('\n/* -- radiation dependent declarations -- */\n\n');
+
+  for x in entries_RADIATION:
+    i = entries_RADIATION.index(x)
+    tmp.append('#define    '+x.ljust(24)+'   '+default_RADIATION[i]+'\n')
+      
+  for x in entries_RADIATION_SOR_SOLVER:
+    i = entries_RADIATION_SOR_SOLVER.index(x)
+    tmp.append('#define    '+x.ljust(24)+'   '+default_RADIATION_SOR_SOLVER[i]+'\n')
+    
+  tmp.append('\n/* -- radiation begin additional options -- */\n');
+  
+  if os.path.isfile( work_dir+'/definitions.h'):
+    definitions_file = open(work_dir+'/definitions.h', 'r')
+    definitions_lines = definitions_file.readlines()
+    definitions_file.close()
+    definitions_begin_pos = 0
+    definitions_end_pos = 0
+    definitions_current_pos = 0;
+    for line in definitions_lines:
+      if line.find("radiation begin additional options") != -1:
+        definitions_begin_pos = definitions_current_pos + 1
+      if line.find("radiation end additional options") != -1:
+        definitions_end_pos = definitions_current_pos
+      definitions_current_pos += 1
+    
+    for i in xrange(definitions_begin_pos,definitions_end_pos):
+      line = definitions_lines[i]
+      if len(line.replace("\n","")) > 0:
+        tmp.append(line)
+
+  tmp.append('/* -- radiation end additional options -- */\n');
