[cig-commits] r22730 - in seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER: . DATA EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Bolivia_9s/SEMD/DATA EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Vanuatu/SEMD/DATA EXAMPLES/benchmarks/prem_iso_noocean_Q_Cowling_Vanuatu/SEMD/DATA EXAMPLES/global_PREM_kernels/amplitude/DATA EXAMPLES/global_PREM_kernels/traveltime/DATA EXAMPLES/global_s362ani/DATA EXAMPLES/noise_examples/global_long EXAMPLES/noise_examples/global_short EXAMPLES/noise_examples/regional EXAMPLES/noise_examples/test_global EXAMPLES/noise_examples/test_regional EXAMPLES/regional_Greece_small/DATA EXAMPLES/regional_MiddleEast/DATA EXAMPLES/small_benchmark_run_to_test_more_complex_Earth EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK EXAMPLES/small_benchmark_run_to_test_very_simple_Earth EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/OUTPUT_FILES_reference_OK setup setup/adios_xml_files src/auxiliaries src/compute_optimized_dumping_undo_att src/create_header_file src/cuda src/meshfem3D src/shared src/specfem3D utils utils/Cluster utils/Cluster/estimate_best_values_runs utils/Profiles utils/Visualization/VTK_ParaView utils/Visualization/VTK_ParaView/convert_interpolated_chunk_to_ParaView utils/Visualization/opendx_AVS utils/attenuation utils/s362ani

danielpeter at geodynamics.org danielpeter at geodynamics.org
Mon Aug 26 04:20:58 PDT 2013


Author: danielpeter
Date: 2013-08-26 04:20:57 -0700 (Mon, 26 Aug 2013)
New Revision: 22730

Added:
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_method_stubs.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/shared_par.f90
Removed:
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core.f90
Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Bolivia_9s/SEMD/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_iso_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/amplitude/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/traveltime/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_s362ani/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_3_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_3_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_3_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_3_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_attenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_3_noattenuation
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_Greece_small/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_MiddleEast/DATA/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/Par_file
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/Makefile.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure.ac
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/adios_xml_files/par_header.xml
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/config.h.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/constants.h.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/precision.h.in
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_1D.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_2D.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_corners_chunks.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_faces_chunks.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_AVS_DX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_paraview_strain_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_surf_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data_vtk.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/convolve_source_timefunction.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_AVS_DX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_GMT_global.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/compute_optimized_dumping_undo_att.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/create_header_file.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_scalar_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_vector_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/check_fields_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_add_sources_elastic_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_coupling_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_crust_mantle_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_inner_core_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_outer_core_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_kernels_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_acoustic_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_elastic_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/it_update_displacement_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/mesh_constants_cuda.h
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/noise_tomography_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_constants_cuda.h
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_mesh_constants_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/save_and_compare_cpu_vs_gpu.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/specfem3D_gpu_cuda_method_stubs.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/transfer_fields_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/write_seismograms_cuda.cu
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_missing_nodes.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_410_650.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_cmb.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_icb.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_central_cube_mesh.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_scalar_mesh.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_vector_mesh.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/calc_jacobian.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_area.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_coordinates_grid.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_element_properties.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_volumes.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_MPI_interfaces.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_addressing.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube_buffers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_chunk_buffers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_doubling_elements.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_mass_matrices.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_meshes.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regular_elements.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/define_superbrick.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/finalize_mesher.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/fix_non_blocking_flags.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_1D_buffers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_eta.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_xi.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_interfaces.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_ellipticity.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_global.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_boundaries.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_discontinuities.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_model.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_perm_color.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape2D.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape3D.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/heap_sort.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_layers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_mesher.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/lgndr.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_models.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_par.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1066a.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1dref.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ak135.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_inner_core.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_atten3D_QRFSI12.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_attenuation.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crust.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crustmaps.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_epcrust.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_eucrust.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gapp2.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gll.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_heterogen_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_iasp91.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp1d.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp3d.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ppm.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s20rts.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s362ani.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s40rts.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea1d.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea99_s.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/moho_stretching.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver_adios.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_MPI_interfaces.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_color_perm.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_counters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_inner_outer.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_model.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/sort_array_coordinates.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/stretching_function.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/test_MPI_interfaces.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_helpers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_manager.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/auto_ner.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/broadcast_computed_parameters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/calendar.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_elements.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_number_of_sources.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_points.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_name_database.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_serial_name_database.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/define_all_layers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/euler_angles.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/exit_mpi.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/force_ftz.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_model_parameters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_timestep_and_layers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_value_parameters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/gll_library.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/hex_nodes.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/intgrl.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/lagrange_poly.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_ellipticity.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_gravity.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/memory_eval.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_prem.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_topo_bathy.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/param_reader.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_compute_parameters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_parameter_file.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_value_parameters.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/reduce.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rthetaphi_xyz.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/save_header_file.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/spline_routines.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_VTK_file.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_c_binary.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/Makefile
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube_block.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar_block.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector_block.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/check_simulation_stability.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_spectrum.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_time_function.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_add_sources.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_adj_source_frechet.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_arrays_source.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_boundary_kernel.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_coupling.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_element.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_acoustic.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_Dev.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_noDev.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_elastic.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_Dev.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_noDev.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_Dev.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_noDev.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_kernels.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_seismograms.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_crust_mantle.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_outer_core.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/convert_time.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/create_central_cube_buffers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/define_derivation_matrices.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/finalize_simulation.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/fix_non_blocking_flags.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_attenuation.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_backazimuth.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_cmt.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_event_info.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/initialize_simulation.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/iterate_time.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_receivers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_regular_points.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_sources.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/multiply_arrays_source.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/netlib_specfun_erf.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/noise_tomography.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/prepare_timerun.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_buffers_solver.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_attenuation_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays_adios.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases_adios.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_topography_bathymetry.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/recompute_jacobian.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/rules.mk
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays_adios.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_kernels.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_regular_kernels.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_GLL_points.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_sources_receivers.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D_par.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk.cpp
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk_stubs.c
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_output.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_surface.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_volume.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_ASCII.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_SAC.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_seismograms.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_specfem_adios_header.F90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/estimate_best_values_runs/estimate_best_values_runs.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/test_cache_size.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Profiles/write_profile.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/convert_interpolated_chunk_to_ParaView/read_interpolated_kernel_for_one_chunk_with_binary_kernel_stored_only_and_VTK_output.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/create_slice_VTK.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/constants_topo.h
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_slices.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_surface.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_epicenter_OpenDX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_main_cities_OpenDX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_palette_GMT_OpenDX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_topo_bathy_to_OpenDX.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/longlatdepth2xyz.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/attenuation/attenuation_output.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/create_specfem3D_gpu_cuda_method_stubs.pl
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/extract_all_seismos_from_large_file.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/filter_station_list.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_NS.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_equator.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_one_fourth.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/s362ani/program_test_s362ani.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/update_headers_change_word_f90.pl
Log:
updates Makefiles and rules for proper compilation; adds modules for shared parameters; adds adios stubs

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -120,6 +120,8 @@
 # path to store the local database files on each node
 # mesh files
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 1000
@@ -192,5 +194,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Bolivia_9s/SEMD/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Bolivia_9s/SEMD/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Bolivia_9s/SEMD/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      =  /scratch/siemins/DATABASES_MPI.335170
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 100
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_ani_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      =  /scratch/siemins/DATABASES_MPI.336749
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 100
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_iso_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_iso_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/benchmarks/prem_iso_noocean_Q_Cowling_Vanuatu/SEMD/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      =  /scratch/siemins/DATABASES_MPI.336745
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 100
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/amplitude/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/amplitude/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/amplitude/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 1000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/traveltime/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/traveltime/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_PREM_kernels/traveltime/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 1000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_s362ani/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_s362ani/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/global_s362ani/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 1000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_1_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_2_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_3_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_3_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_long/Par_file_NOISE_3_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_1_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_2_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_3_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_3_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/global_short/Par_file_NOISE_3_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_1_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_2_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_3_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_3_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/regional/Par_file_NOISE_3_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_1_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_2_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_3_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_3_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_global/Par_file_NOISE_3_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_1_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_attenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_attenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_attenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_2_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_3_noattenuation
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_3_noattenuation	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/noise_examples/test_regional/Par_file_NOISE_3_noattenuation	2013-08-26 11:20:57 UTC (rev 22730)
@@ -95,6 +95,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = /scratch/yangl/DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 10000

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_Greece_small/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_Greece_small/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_Greece_small/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 500
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_MiddleEast/DATA/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_MiddleEast/DATA/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/regional_MiddleEast/DATA/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 1000
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h	2013-08-26 11:20:57 UTC (rev 22730)
@@ -156,5 +156,5 @@
  integer, parameter :: NSPEC2D_CMB =            1
  integer, parameter :: NSPEC2D_ICB =            1
  logical, parameter :: USE_DEVILLE_PRODUCTS_VAL = .true.
- logical, parameter :: USE_ATTENUATION_MIMIC = .false.
- logical, parameter :: COMPUTE_AND_STORE_STRAIN = .true. 
+ logical, parameter :: USE_ATTENUATION_MIMIC_VAL = .false.
+ logical, parameter :: COMPUTE_AND_STORE_STRAIN_VAL = .true.

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 500
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/OUTPUT_FILES_reference_OK/values_from_mesher.h	2013-08-26 11:20:57 UTC (rev 22730)
@@ -178,7 +178,7 @@
  integer, parameter :: NSPEC2D_CMB =            1
  integer, parameter :: NSPEC2D_ICB =            1
  logical, parameter :: USE_DEVILLE_PRODUCTS_VAL = .true.
- logical, parameter :: PARTIAL_PHYS_DISPERSION_ONLY = .false.
- logical, parameter :: COMPUTE_AND_STORE_STRAIN = .false.
+ logical, parameter :: PARTIAL_PHYS_DISPERSION_ONLY_VAL = .false.
+ logical, parameter :: COMPUTE_AND_STORE_STRAIN_VAL = .false.
  integer, parameter :: NSPEC_CRUST_MANTLE_3DMOVIE = 1
  integer, parameter :: NGLOB_CRUST_MANTLE_3DMOVIE = 1

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/Par_file
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/Par_file	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/EXAMPLES/small_benchmark_run_to_test_very_simple_Earth/Par_file	2013-08-26 11:20:57 UTC (rev 22730)
@@ -121,6 +121,8 @@
 
 # path to store the local database files on each node
 LOCAL_PATH                      = ./DATABASES_MPI
+# temporary wavefield/kernel/movie files
+LOCAL_TMP_PATH                  = ./DATABASES_MPI
 
 # interval at which we output time step info and max of norm of displacement
 NTSTEP_BETWEEN_OUTPUT_INFO      = 500
@@ -193,5 +195,6 @@
 ADIOS_FOR_FORWARD_ARRAYS        = .true.
 ADIOS_FOR_MPI_ARRAYS            = .true.
 ADIOS_FOR_ARRAYS_SOLVER         = .true.
+ADIOS_FOR_SOLVER_MESHFILES      = .true.
 ADIOS_FOR_AVS_DX                = .true.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/Makefile.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/Makefile.in	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/Makefile.in	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -33,18 +33,132 @@
 FCFLAGS = #@FCFLAGS@
 MPIFC = @MPIFC@
 MPILIBS = @MPILIBS@
+
 FLAGS_CHECK = @FLAGS_CHECK@
+#FLAGS_NO_CHECK = @FLAGS_NO_CHECK@
+
 FCFLAGS_f90 = @FCFLAGS_f90@ -I at top_builddir@ -I${SETUP}
+
 FC_MODEXT = @FC_MODEXT@
 FC_MODDIR = @FC_MODDIR@
  
 FCCOMPILE_CHECK =@FCENV@ ${FC} ${FCFLAGS} $(FLAGS_CHECK)
+#FCCOMPILE_NO_CHECK =@FCENV@ ${FC} ${FCFLAGS} $(FLAGS_NO_CHECK)
+
 MPIFCCOMPILE_CHECK =@FCENV@ ${MPIFC} ${FCFLAGS} $(FLAGS_CHECK)
+#MPIFCCOMPILE_NO_CHECK =@FCENV@ ${MPIFC} ${FCFLAGS} $(FLAGS_NO_CHECK)
 
 CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = -I${SETUP} @CPPFLAGS@
 
+FCLINK = $(MPIFCCOMPILE_CHECK)
+
+
+#######################################
+####
+#### CUDA
+#### with configure: ./configure --with-cuda CUDA_LIB=.. CUDA_INC=.. MPI_INC=.. ..
+####
+#######################################
+
+ at COND_CUDA_TRUE@CUDA = yes
+ at COND_CUDA_FALSE@CUDA = no
+
+ at COND_CUDA5_TRUE@CUDA5 = yes
+ at COND_CUDA5_FALSE@CUDA5 = no
+
+# default cuda libraries
+# runtime library -lcudart needed, others are optional -lcuda -lcublas
+ at COND_CUDA_TRUE@CUDA_LIBS = -lcudart
+ at COND_CUDA_FALSE@CUDA_LIBS = 
+
+CUDA_LIB_LOCATION = @CUDA_LIB@
+CUDA_LINK = $(CUDA_LIB_LOCATION) $(CUDA_LIBS)
+CUDA_INC = @CUDA_INC@ -I../../setup -I../../
+MPI_INC = @MPI_INC@
+
+ at COND_CUDA_TRUE@NVCC = nvcc
+ at COND_CUDA_FALSE@NVCC = @CC@
+
+# GPU architecture
+
+# CUDA architecture / code version
+# Fermi: -gencode=arch=compute_10,code=sm_10 not supported
+# Tesla (default): -gencode=arch=compute_20,code=sm_20
+# Geforce GT 650m: -gencode=arch=compute_30,code=sm_30
+# Kepler (cuda5) : -gencode=arch=compute_35,code=sm_35
+GENCODE_20 = -gencode=arch=compute_20,code=\"sm_20,compute_20\"
+GENCODE_30 = -gencode=arch=compute_30,code=\"sm_30,compute_30\"
+GENCODE_35 = -gencode=arch=compute_35,code=\"sm_35,compute_35\"
+
+# CUDA version 5.x
+ at COND_CUDA_TRUE@@COND_CUDA5_TRUE at GENCODE = $(GENCODE_35)
+# CUDA version 4.x
+ at COND_CUDA_TRUE@@COND_CUDA5_FALSE at GENCODE = $(GENCODE_20)
+
+# CUDA flags and linking
+ at COND_CUDA_TRUE@NVCC_FLAGS_BASE = $(CUDA_INC) $(MPI_INC)
+ at COND_CUDA_TRUE@@COND_CUDA5_TRUE at NVCC_FLAGS = $(NVCC_FLAGS_BASE) -dc -DCUDA $(GENCODE)
+ at COND_CUDA_TRUE@@COND_CUDA5_FALSE at NVCC_FLAGS = $(NVCC_FLAGS_BASE) -DCUDA -DUSE_OLDER_CUDA4_GPU $(GENCODE)
+
+ at COND_CUDA_TRUE@@COND_CUDA5_TRUE at NVCCLINK_BASE = $(NVCC) $(CUDA_INC) $(MPI_INC) -DCUDA
+ at COND_CUDA_TRUE@@COND_CUDA5_TRUE at NVCCLINK = $(NVCCLINK_BASE) -dlink $(GENCODE)
+ at COND_CUDA_TRUE@@COND_CUDA5_FALSE at NVCCLINK = $(NVCCLINK_BASE) -DUSE_OLDER_CUDA4_GPU $(GENCODE)
+
+ at COND_CUDA_FALSE@NVCC_FLAGS = $(MPI_INC)
+ at COND_CUDA_FALSE@NVCCLINK = $(NVCC) $(NVCC_FLAGS)
+
+#######################################
+####
+#### VTK
+#### with configure: ./configure --with-vtk ..
+####
+#######################################
+
+ at COND_VTK_TRUE@VTK = yes
+ at COND_VTK_FALSE@VTK = no
+
+ at COND_VTK_TRUE@CPPFLAGS =${CPPFLAGS} -DWITH_VTK
+ at COND_VTK_TRUE@FCCOMPILE_CHECK =${FCCOMPILE_CHECK} -DWITH_VTK
+#@COND_VTK_TRUE at FCCOMPILE_NO_CHECK =${FCCOMPILE_NO_CHECK} -DWITH_VTK
+ at COND_VTK_TRUE@MPIFCCOMPILE_CHECK =${MPIFCCOMPILE_CHECK} -DWITH_VTK
+#@COND_VTK_TRUE at MPIFCCOMPILE_NO_CHECK =${MPIFCCOMPILE_NO_CHECK} -DWITH_VTK
+
+#######################################
+####
+#### ADIOS
+#### with configure: ./configure --with-adios ..
+####
+#######################################
+
+ at COND_ADIOS_TRUE@ADIOS = yes
+ at COND_ADIOS_FALSE@ADIOS = no
+
+
+#######################################
+####
+#### FORCE_VECTORIZATION
+#### with configure: ./configure --with-vec ..
+####
+#######################################
+ at COND_VECTORIZATION_TRUE@FORCE_VECTORIZATION = yes
+ at COND_VECTORIZATION_FALSE@FORCE_VECTORIZATION = no
+
+ at COND_VTK_TRUE@CPPFLAGS =${CPPFLAGS} -DFORCE_VECTORIZATION
+ at COND_VTK_TRUE@FCCOMPILE_CHECK =${FCCOMPILE_CHECK} -DFORCE_VECTORIZATION
+#@COND_VTK_TRUE at FCCOMPILE_NO_CHECK =${FCCOMPILE_NO_CHECK} -DFORCE_VECTORIZATION
+ at COND_VTK_TRUE@MPIFCCOMPILE_CHECK =${MPIFCCOMPILE_CHECK} -DFORCE_VECTORIZATION
+#@COND_VTK_TRUE at MPIFCCOMPILE_NO_CHECK =${MPIFCCOMPILE_NO_CHECK} -DFORCE_VECTORIZATION
+
+
+
+#######################################
+####
+#### directories
+####
+#######################################
+
 ## compilation directories
 # B : build directory
 B = @top_builddir@
@@ -59,15 +173,19 @@
 # output file directory
 OUTPUT = $B/OUTPUT_FILES
 
+
+#######################################
 ####
 #### targets
 ####
+#######################################
 
 # code subdirectories
 SUBDIRS = \
 	shared \
 	create_header_file \
 	compute_optimized_dumping_undo_att \
+	cuda \
 	meshfem3D \
 	specfem3D \
 	auxiliaries
@@ -83,6 +201,7 @@
 	xcheck_buffers_corners_chunks \
 	xcheck_buffers_faces_chunks \
 	xcombine_vol_data \
+	xcombine_vol_data_vtk \
 	xcombine_surf_data \
 	xcombine_AVS_DX \
 	xconvolve_source_timefunction \
@@ -110,9 +229,13 @@
 
 ifdef CLEAN
 clean:
+	@echo "cleaning by CLEAN defined"
+	(rm -rf bin obj )
 	-rm -f $(foreach dir, $(CLEAN), $($(dir)_OBJECTS) $($(dir)_MODULES) $($(dir)_SHARED_OBJECTS) $($(dir)_TARGETS))
 else
 clean:
+	@echo "cleaning by CLEAN not defined"
+	(rm -rf bin obj )
 	-rm -f $(foreach dir, $(SUBDIRS), $($(dir)_OBJECTS) $($(dir)_MODULES) $($(dir)_TARGETS))
 endif
 
@@ -129,6 +252,7 @@
 	@echo "    xcheck_buffers_corners_chunks"
 	@echo "    xcheck_buffers_faces_chunks"
 	@echo "    xcombine_vol_data"
+	@echo "    xcombine_vol_data_vtk"
 	@echo "    xcombine_surf_data"
 	@echo "    xcombine_AVS_DX"
 	@echo "    xconvolve_source_timefunction"
@@ -138,9 +262,15 @@
 
 .PHONY: all default backup clean help
 
+#######################################
+
+
 # Get dependencies and rules for building stuff
 include $(patsubst %, ${S_TOP}/src/%/rules.mk, $(SUBDIRS))
 
+
+#######################################
+
 ##
 ## Shortcuts
 ##

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Specfem3D Globe 5.1.5.
+# Generated by GNU Autoconf 2.69 for Specfem3D Globe 6.0.0.
 #
 # Report bugs to <jtromp AT princeton.edu>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='Specfem3D Globe'
 PACKAGE_TARNAME='Specfem3DGlobe'
-PACKAGE_VERSION='5.1.5'
-PACKAGE_STRING='Specfem3D Globe 5.1.5'
+PACKAGE_VERSION='6.0.0'
+PACKAGE_STRING='Specfem3D Globe 6.0.0'
 PACKAGE_BUGREPORT='jtromp AT princeton.edu'
 PACKAGE_URL=''
 
@@ -630,6 +630,13 @@
 FC_MODINC
 FC_MODEXT
 LOCAL_PATH_IS_ALSO_GLOBAL
+RANLIB
+ARFLAGS
+AR
+MPI_INC
+CUDA_INC
+CUDA_LIB
+FLAGS_NO_CHECK
 FLAGS_CHECK
 MPILIBS
 MPIFC
@@ -649,6 +656,16 @@
 LDFLAGS
 FCFLAGS
 FC
+COND_VECTORIZATION_FALSE
+COND_VECTORIZATION_TRUE
+COND_ADIOS_FALSE
+COND_ADIOS_TRUE
+COND_VTK_FALSE
+COND_VTK_TRUE
+COND_CUDA5_FALSE
+COND_CUDA5_TRUE
+COND_CUDA_FALSE
+COND_CUDA_TRUE
 CUSTOM_MPI_TYPE
 CUSTOM_REAL
 host_os
@@ -701,6 +718,10 @@
 ac_user_opts='
 enable_option_checking
 enable_double_precision
+with_cuda
+with_vtk
+with_adios
+with_vec
 '
       ac_precious_vars='build_alias
 host_alias
@@ -716,6 +737,13 @@
 MPIFC
 MPILIBS
 FLAGS_CHECK
+FLAGS_NO_CHECK
+CUDA_LIB
+CUDA_INC
+MPI_INC
+AR
+ARFLAGS
+RANLIB
 LOCAL_PATH_IS_ALSO_GLOBAL'
 
 
@@ -1257,7 +1285,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Specfem3D Globe 5.1.5 to adapt to many kinds of systems.
+\`configure' configures Specfem3D Globe 6.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1322,7 +1350,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Specfem3D Globe 5.1.5:";;
+     short | recursive ) echo "Configuration of Specfem3D Globe 6.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1333,6 +1361,15 @@
   --enable-double-precision
                           solver in double precision [default=no]
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-cuda             build cuda GPU enabled version [default=no]
+  --with-vtk              build VTK enabled version [default=no]
+  --with-adios            build ADIOS enabled version [default=no]
+  --with-vec              build FORCE_VECTORIZATION enabled version
+                          [default=no]
+
 Some influential environment variables:
   FC          Fortran compiler command
   FCFLAGS     Fortran compiler flags
@@ -1346,7 +1383,17 @@
   CPP         C preprocessor
   MPIFC       MPI Fortran compiler command
   MPILIBS     extra libraries for linking MPI programs
-  FLAGS_CHECK Fortran compiler flags
+  FLAGS_CHECK Fortran compiler flags for non-critical subroutines
+  FLAGS_NO_CHECK
+              Fortran compiler flags for creating fast, production-run code
+              for critical subroutines
+  CUDA_LIB    Location of CUDA library libcudart
+  CUDA_INC    Location of CUDA include files
+  MPI_INC     Location of MPI include mpi.h, which is needed by nvcc when
+              compiling cuda files
+  AR          ar library creation
+  ARFLAGS     ar flag library creation
+  RANLIB      ranlib library creation
   LOCAL_PATH_IS_ALSO_GLOBAL
               files on a local path on each node are also seen as global with
               same path [default=true]
@@ -1417,7 +1464,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Specfem3D Globe configure 5.1.5
+Specfem3D Globe configure 6.0.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1757,7 +1804,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Specfem3D Globe $as_me 5.1.5, which was
+It was created by Specfem3D Globe $as_me 6.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2213,6 +2260,9 @@
 
 # 'configure' options
 
+###
+### precision
+###
 # Check whether --enable-double-precision was given.
 if test "${enable_double_precision+set}" = set; then :
   enableval=$enable_double_precision; want_double_precision="$enableval"
@@ -2230,7 +2280,95 @@
 
 
 
+###
+### CUDA
+###
 
+# Check whether --with-cuda was given.
+if test "${with_cuda+set}" = set; then :
+  withval=$with_cuda; want_cuda="$withval"
+else
+  want_cuda=no
+fi
+
+ if test "$want_cuda" != no; then
+  COND_CUDA_TRUE=
+  COND_CUDA_FALSE='#'
+else
+  COND_CUDA_TRUE='#'
+  COND_CUDA_FALSE=
+fi
+
+ if test "$want_cuda" = cuda5; then
+  COND_CUDA5_TRUE=
+  COND_CUDA5_FALSE='#'
+else
+  COND_CUDA5_TRUE='#'
+  COND_CUDA5_FALSE=
+fi
+
+
+###
+### VTK
+###
+
+# Check whether --with-vtk was given.
+if test "${with_vtk+set}" = set; then :
+  withval=$with_vtk; want_vtk="$withval"
+else
+  want_vtk=no
+fi
+
+ if test "$want_vtk" != no; then
+  COND_VTK_TRUE=
+  COND_VTK_FALSE='#'
+else
+  COND_VTK_TRUE='#'
+  COND_VTK_FALSE=
+fi
+
+
+###
+### ADIOS
+###
+
+# Check whether --with-adios was given.
+if test "${with_adios+set}" = set; then :
+  withval=$with_adios; want_adios="$withval"
+else
+  want_adios=no
+fi
+
+ if test "$want_adios" != no; then
+  COND_ADIOS_TRUE=
+  COND_ADIOS_FALSE='#'
+else
+  COND_ADIOS_TRUE='#'
+  COND_ADIOS_FALSE=
+fi
+
+
+
+###
+### FORCE_VECTORIZATION
+###
+
+# Check whether --with-vec was given.
+if test "${with_vec+set}" = set; then :
+  withval=$with_vec; want_vec="$withval"
+else
+  want_vec=no
+fi
+
+ if test "$want_vec" != no; then
+  COND_VECTORIZATION_TRUE=
+  COND_VECTORIZATION_FALSE='#'
+else
+  COND_VECTORIZATION_TRUE='#'
+  COND_VECTORIZATION_FALSE=
+fi
+
+
 # Checks for programs.
 
 # a courtesy to the installed base of users
@@ -5087,6 +5225,16 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
 if test x"$MPIFC" = x; then
     MPIFC=mpif90
 fi
@@ -5217,7 +5365,55 @@
 
 
 
+if test "$want_adios" != no; then
 
+
+
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  ac_fn_c_check_header_mongrel "$LINENO" "adios.h" "ac_cv_header_adios_h" "$ac_includes_default"
+if test "x$ac_cv_header_adios_h" = xyes; then :
+
+else
+
+    as_fn_error $? "adios C header not found; try CPPFLAGS=\"-I<adios include dir>\"" "$LINENO" 5
+
+fi
+
+
+
+  ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for adios_init in -ladiosf" >&5
+$as_echo_n "checking for adios_init in -ladiosf... " >&6; }
+      FC_BCK=$FC
+  FC=$MPIFC
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+use adios_write_mod; call adios_init_noxml(MPI_COMM_WORLD, ierr)
+      end
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+     as_fn_error $? "adiosf library not found; try LDFLAGS=\"-L<adios lib dir>\"
+					     and FCFLAGS=\"-I<adios inc dir>\"" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext    FC=$FC_BCK
+
+fi
+
 # Checks for typedefs, structures, and compiler characteristics.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Fortran 90 module extension" >&5
@@ -5542,6 +5738,26 @@
 LTLIBOBJS=$ac_ltlibobjs
 
 
+if test -z "${COND_CUDA_TRUE}" && test -z "${COND_CUDA_FALSE}"; then
+  as_fn_error $? "conditional \"COND_CUDA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${COND_CUDA5_TRUE}" && test -z "${COND_CUDA5_FALSE}"; then
+  as_fn_error $? "conditional \"COND_CUDA5\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${COND_VTK_TRUE}" && test -z "${COND_VTK_FALSE}"; then
+  as_fn_error $? "conditional \"COND_VTK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${COND_ADIOS_TRUE}" && test -z "${COND_ADIOS_FALSE}"; then
+  as_fn_error $? "conditional \"COND_ADIOS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${COND_VECTORIZATION_TRUE}" && test -z "${COND_VECTORIZATION_FALSE}"; then
+  as_fn_error $? "conditional \"COND_VECTORIZATION\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 case $FC_MODINC in #(
   *\ ) FC_MODINC=$FC_MODINC'${ac_empty}' ;;
 esac
@@ -5945,7 +6161,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Specfem3D Globe $as_me 5.1.5, which was
+This file was extended by Specfem3D Globe $as_me 6.0.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6015,7 +6231,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Specfem3D Globe config.status 5.1.5
+Specfem3D Globe config.status 6.0.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -6786,6 +7002,10 @@
 fi
 
 
+#daniel: adding custom lines to config.h.in through autoheader
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
 $as_echo "" >&6; }
 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure.ac
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure.ac	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/configure.ac	2013-08-26 11:20:57 UTC (rev 22730)
@@ -8,7 +8,7 @@
 
 
 AC_PREREQ(2.61)
-AC_INIT([Specfem3D Globe], [5.1.5], [jtromp AT princeton.edu], [Specfem3DGlobe])
+AC_INIT([Specfem3D Globe], [6.0.0], [jtromp AT princeton.edu], [Specfem3DGlobe])
 AC_CONFIG_SRCDIR([src/specfem3D/specfem3D.F90])
 AC_CONFIG_HEADER([setup/config.h])
 AC_CONFIG_MACRO_DIR([m4])
@@ -17,6 +17,9 @@
 
 # 'configure' options
 
+###
+### precision
+###
 AC_ARG_ENABLE([double-precision],
     [AS_HELP_STRING([--enable-double-precision],
         [solver in double precision @<:@default=no@:>@])],
@@ -32,7 +35,48 @@
 AC_SUBST([CUSTOM_REAL])
 AC_SUBST([CUSTOM_MPI_TYPE])
 
+###
+### CUDA
+###
+AC_ARG_WITH([cuda],
+    [AC_HELP_STRING([--with-cuda],
+        [build cuda GPU enabled version @<:@default=no@:>@])],
+    [want_cuda="$withval"],
+    [want_cuda=no])
+AM_CONDITIONAL([COND_CUDA], [test "$want_cuda" != no])
+AM_CONDITIONAL([COND_CUDA5], [test "$want_cuda" = cuda5])
 
+###
+### VTK
+###
+AC_ARG_WITH([vtk],
+    [AC_HELP_STRING([--with-vtk],
+        [build VTK enabled version @<:@default=no@:>@])],
+    [want_vtk="$withval"],
+    [want_vtk=no])
+AM_CONDITIONAL([COND_VTK], [test "$want_vtk" != no])
+
+###
+### ADIOS
+###
+AC_ARG_WITH([adios],
+    [AC_HELP_STRING([--with-adios],
+        [build ADIOS enabled version @<:@default=no@:>@])],
+    [want_adios="$withval"],
+    [want_adios=no])
+AM_CONDITIONAL([COND_ADIOS], [test "$want_adios" != no])
+
+
+###
+### FORCE_VECTORIZATION
+###
+AC_ARG_WITH([vec],
+    [AC_HELP_STRING([--with-vec],
+        [build FORCE_VECTORIZATION enabled version @<:@default=no@:>@])],
+    [want_vec="$withval"],
+    [want_vec=no])
+AM_CONDITIONAL([COND_VECTORIZATION], [test "$want_vec" != no])
+
 # Checks for programs.
 
 # a courtesy to the installed base of users
@@ -73,7 +117,17 @@
 
 AC_ARG_VAR(MPIFC, [MPI Fortran compiler command])
 AC_ARG_VAR(MPILIBS, [extra libraries for linking MPI programs])
-AC_ARG_VAR(FLAGS_CHECK, [Fortran compiler flags])
+AC_ARG_VAR(FLAGS_CHECK, [Fortran compiler flags for non-critical subroutines])
+AC_ARG_VAR(FLAGS_NO_CHECK, [Fortran compiler flags for creating fast, production-run code for critical subroutines])
+
+AC_ARG_VAR(CUDA_LIB,[Location of CUDA library libcudart])
+AC_ARG_VAR(CUDA_INC,[Location of CUDA include files])
+AC_ARG_VAR(MPI_INC,[Location of MPI include mpi.h, which is needed by nvcc when compiling cuda files])
+
+AC_ARG_VAR(AR, [ar library creation])
+AC_ARG_VAR(ARFLAGS, [ar flag library creation])
+AC_ARG_VAR(RANLIB, [ranlib library creation])
+
 if test x"$MPIFC" = x; then
     MPIFC=mpif90
 fi
@@ -92,6 +146,10 @@
 
 CIT_FC_MPI_HEADER([$MPIFC], [$FLAGS_CHECK])
 
+if test "$want_adios" != no; then
+    CIT_ADIOS_HEADER
+    CIT_ADIOS_LIB
+fi
 
 # Checks for typedefs, structures, and compiler characteristics.
 
@@ -143,6 +201,14 @@
 
 AC_OUTPUT
 
+#daniel: adding custom lines to config.h.in through autoheader
+AH_BOTTOM([
+/* Uncomment and define to select optimized file i/o for regional simulations */
+/* map fails when output files are > 4GB, which is often the case for GPU simulations */
+// #define USE_MAP_FUNCTION
+])
+
+
 dnl FYI, this is not a "result", but AS_ECHO is not available in 2.61, and it
 dnl basically works like a portable echo.
 AC_MSG_RESULT([])

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/adios_xml_files/par_header.xml
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/adios_xml_files/par_header.xml	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/adios_xml_files/par_header.xml	2013-08-26 11:20:57 UTC (rev 22730)
@@ -5,7 +5,7 @@
     <!--*** Solver information ***-->
     <attribute name="code_name"       path="/solver_info" value="SPECFEM3D_GLOBE" type="string"/>
     <attribute name="version_name"    path="/solver_info" value="SUNFLOWER"       type="string"/>
-    <attribute name="version_number"  path="/solver_info" value="5.1"             type="string"/>
+    <attribute name="version_number"  path="/solver_info" value="6.0"             type="string"/>
     <!--************************************************************-->
     <!--*** Values read from DATA/Par_file ***-->
     <!-- double precision variables -->
@@ -52,7 +52,6 @@
     <var name="PRINT_SOURCE_TIME_FUNCTION"   path="/specfem3D_globe_parameter_file" type="byte"/>
     <var name="SAVE_MESH_FILES"              path="/specfem3D_globe_parameter_file" type="byte"/>
     <var name="ATTENUATION"                  path="/specfem3D_globe_parameter_file" type="byte"/>
-    <var name="ATTENUATION_NEW"              path="/specfem3D_globe_parameter_file" type="byte"/>
     <var name="ABSORBING_CONDITIONS"         path="/specfem3D_globe_parameter_file" type="byte"/>
     <var name="SAVE_FORWARD"                 path="/specfem3D_globe_parameter_file" type="byte"/>
     <var name="OUTPUT_SEISMOS_ASCII_TEXT"    path="/specfem3D_globe_parameter_file" type="byte"/>

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/config.h.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/config.h.in	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/config.h.in	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,8 +1,5 @@
 /* setup/config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* configuration flags to be save in the adios output file. */
-#undef CONFIGURE_FLAGS
-
 /* Define to dummy `main' function (if any) required to link to the Fortran
    libraries. */
 #undef FC_DUMMY_MAIN
@@ -74,5 +71,5 @@
 
 /* Uncomment and define to select optimized file i/o for regional simulations */
 /* map fails when output files are > 4GB, which is often the case for GPU simulations */
-/* #define USE_MAP_FUNCTION */
+// #define USE_MAP_FUNCTION
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/constants.h.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/constants.h.in	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/constants.h.in	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -46,10 +46,6 @@
 ! set to SIZE_DOUBLE to run in double precision (increases memory size by 2)
   integer, parameter :: CUSTOM_REAL = @CUSTOM_REAL@
 
-! this for non blocking assembly
-  integer, parameter :: ELEMENTS_NONBLOCKING_CM_IC = 1500
-  integer, parameter :: ELEMENTS_NONBLOCKING_OC = 3000
-
 !*********************************************************************************************************
 
 ! if files on a local path on each node are also seen as global with same path
@@ -243,11 +239,6 @@
 !*********************************************************************************************************
 ! added these parameters for the GPU version of the solver with mesh coloring
 
-! sort outer elements first and then inner elements
-! in order to use non blocking MPI to overlap communications
-  logical, parameter :: SORT_MESH_INNER_OUTER = .true.
-  integer, parameter :: NGNOD_HEXAHEDRA = 8
-
 ! add mesh coloring for the GPU + MPI implementation
   logical, parameter :: USE_MESH_COLORING_GPU = .false.
   integer, parameter :: MAX_NUMBER_OF_COLORS = 1000
@@ -279,6 +270,25 @@
 
 !!-----------------------------------------------------------
 !!
+!! new version compatibility
+!!
+!!-----------------------------------------------------------
+!! (uncomment desired resolution)
+! old version
+! old version 5.1.5 uses full 3d attenuation arrays (set to .true.), custom_real for attenuation arrays (Qmu_store, tau_e_store)
+  logical, parameter :: USE_VERSION_5_1_5 = .true.
+!  logical, parameter :: USE_3D_ATTENUATION_ARRAYS = .true.
+  integer, parameter :: CUSTOM_REAL_ATT = CUSTOM_REAL
+! new version
+! new version uses full 3d attenuation, double precision for attenuation arrays (Qmu_store, tau_e_store)
+!!  logical, parameter :: USE_VERSION_5_1_5 = .false.
+!!  logical, parameter :: USE_3D_ATTENUATION_ARRAYS = .true.
+!!  integer,parameter :: CUSTOM_REAL_ATT = SIZE_DOUBLE
+
+
+
+!!-----------------------------------------------------------
+!!
 !! time stamp information
 !!
 !!-----------------------------------------------------------
@@ -501,12 +511,12 @@
 ! number of faces a given slice can share with other slices
 ! this is at most 2, except when there is only once slice per chunk
 ! in which case it is 4
-  integer, parameter :: NUMFACES_SHARED = 2 !!!!!  DK DK removed support for one slice only, was 4
+  integer, parameter :: NUMFACES_SHARED = 4
 
 ! number of corners a given slice can share with other slices
 ! this is at most 1, except when there is only once slice per chunk
 ! in which case it is 4
-  integer, parameter :: NUMCORNERS_SHARED = 1 !!!!!!  DK DK removed support for one slice only, was 4
+  integer, parameter :: NUMCORNERS_SHARED = 4
 
 ! number of slaves per corner
   integer, parameter :: NUMSLAVES = 2
@@ -558,32 +568,6 @@
 !!
 !!-----------------------------------------------------------
 
-! number of layers in DATA/1066a/1066a.dat
-  integer, parameter :: NR_1066A = 160
-
-! number of layers in ak135-F
-  integer, parameter :: NR_AK135F_NO_MUD = 136
-
-! number of layers in DATA/s362ani/REF
-  integer, parameter :: NR_REF = 750
-
-! number of layers in DATA/Lebedev_sea99 1D model
-  integer, parameter :: NR_SEA1D = 163
-
-! three_d_mantle_model_constants
-  integer, parameter :: NK_20 = 20,NS_20 = 20,NS_40 = 40, ND = 1
-
-! heterogen_mantle_model_constants
-  integer, parameter :: N_R = 256,N_THETA = 256,N_PHI = 256
-
-! Japan 3D model (Zhao, 1994) constants
-  integer, parameter :: MPA=42,MRA=48,MHA=21,MPB=42,MRB=48,MHB=18
-  integer, parameter :: MKA=2101,MKB=2101
-
-! QRFSI12 constants
-  integer,parameter :: NKQ=8,MAXL_Q=12
-  integer,parameter :: NSQ=(MAXL_Q+1)**2,NDEPTHS_REFQ=913
-
 ! The meaningful range of Zhao et al. (1994) model is as follows:
 !        latitude : 32 - 45 N
 !        longitude: 130-145 E
@@ -595,30 +579,6 @@
   double precision,parameter :: LON_MIN = 130.d0
   double precision,parameter :: DEP_MAX = 500.d0
 
-! crustal_model_constants
-! crustal model parameters for crust2.0
-  integer, parameter :: NKEYS_CRUST = 359
-  integer, parameter :: NLAYERS_CRUST = 8
-  integer, parameter :: NCAP_CRUST = 180
-
-! General Crustmaps parameters
-  integer, parameter :: CRUSTMAP_RESOLUTION = 4 !means 1/4 degrees
-  integer, parameter :: NLAYERS_CRUSTMAP = 5
-
-! parameters for EPCRUST , from Molinari & Morelli model(2011)
-!       latitude :  9.0N - 89.5N
-!       longitude:  56.0W - 70.0E
-  character(len=*), parameter :: PATHNAME_EPCRUST = 'DATA/epcrust/EPcrust_0_5.txt'
-  integer, parameter :: EPCRUST_NLON = 253, EPCRUST_NLAT = 162, EPCRUST_NLAYER = 3
-  double precision, parameter :: EPCRUST_LON_MIN = -56.0d0
-  double precision, parameter :: EPCRUST_LON_MAX =  70.0d0
-  double precision, parameter :: EPCRUST_LAT_MIN =   9.0d0
-  double precision, parameter :: EPCRUST_LAT_MAX =  89.5d0
-  double precision, parameter :: EPCRUST_SAMPLE = 0.5d0
-  logical, parameter :: flag_smooth_epcrust = .true.
-  integer, parameter :: NTHETA_EP = 4, NPHI_EP = 20
-  double precision, parameter :: cap_degree_EP = 0.2d0
-
 ! parameters for GLL model (used for iterative model inversions)
   character(len=*), parameter :: PATHNAME_GLL_modeldir = 'DATA/GLL/'
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/precision.h.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/precision.h.in	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/setup/precision.h.in	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_1D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_1D.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_1D.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,11 @@
 
   program check_buffers_1D
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
   integer ithisproc,iotherproc
   integer ipoin
 
@@ -53,60 +54,62 @@
   double precision, dimension(:), allocatable :: xleft,yleft,zleft,xright,yright,zright
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
-          NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE,REFERENCE_1D_MODEL, &
-          THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
+!          NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE,REFERENCE_1D_MODEL, &
+!          THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! this is for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               nglob
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
 ! processor identification
   character(len=150) prname,prname_other
 
   integer :: NGLOB1D_RADIAL_MAX
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+
   integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_CORNER
   integer, dimension(NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_SPEC_THIS
   integer, dimension(NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_SPEC_OTHER
@@ -118,41 +121,42 @@
   print *
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-         SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC, &
-         NSPEC2D_XI, &
-         NSPEC2D_ETA, &
-         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-         NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-         NGLOB, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
-
+  call read_compute_parameters()
+!         MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!         SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC, &
+!         NSPEC2D_XI, &
+!         NSPEC2D_ETA, &
+!         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!         NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!         NGLOB, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
 ! get the base pathname for output files
   call get_value_string(OUTPUT_FILES, 'OUTPUT_FILES', 'OUTPUT_FILES')
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_2D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_2D.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_2D.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,11 @@
 
   program check_buffers_2D
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
   integer ithisproc,iotherproc
 
   integer ipoin
@@ -59,58 +60,58 @@
      xright_eta,yright_eta,zright_eta
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! now this is for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               nglob
 
 ! processor identification
   character(len=150) prname,prname_other
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
 ! ************** PROGRAM STARTS HERE **************
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_corners_chunks.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_corners_chunks.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_corners_chunks.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -29,10 +29,11 @@
 
   program check_buffers_corners_chunks
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
   integer imsg
   integer ipoin1D
   integer iboolmaster,iboolworker1,iboolworker2
@@ -51,57 +52,57 @@
   integer, dimension(:), allocatable :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! this is for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               nglob
 
   character(len=150) filename,prname
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
 ! ************** PROGRAM STARTS HERE **************
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_faces_chunks.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_faces_chunks.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/check_buffers_faces_chunks.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -29,10 +29,11 @@
 
   program check_buffers_faces_chunks
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
   integer imsg
 
   integer npoin2D_sender,npoin2D_receiver
@@ -55,57 +56,57 @@
   integer, dimension(:), allocatable :: iprocfrom_faces,iprocto_faces,imsg_type
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! this is for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               nglob
 
   character(len=150) filename,prname
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
 ! ************** PROGRAM STARTS HERE **************
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_AVS_DX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_AVS_DX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_AVS_DX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,11 @@
 
   program combine_AVS_DX
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
 ! threshold for number of points per wavelength displayed
 ! otherwise the scale is too large and we cannot see the small values
 ! all values above this threshold are truncated
@@ -45,7 +46,7 @@
 ! maximum polynomial degree for which we can compute the stability condition
   integer, parameter :: NGLL_MAX_STABILITY = 15
 
-  integer iproc,nspec,npoin
+  integer iproc,nspec_ab,npoin
   integer ispec
   integer iglob1,iglob2,iglob3,iglob4
   integer ipoin,numpoin,numpoin2,iglobpointoffset,ntotpoin,ntotspec
@@ -123,46 +124,46 @@
   integer, dimension(:), allocatable :: ichunk_slice
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-          RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!          RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC_COMP, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC_COMP, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               nglob
 
   integer region_min,region_max
 
@@ -170,15 +171,15 @@
 
   integer proc_p1,proc_p2
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
 ! ************** PROGRAM STARTS HERE **************
 
@@ -191,41 +192,42 @@
   print *
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-                 NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-                 NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-                 NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-                 NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-                 NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-                 NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-                 ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-                 CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-                 RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-                 R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-                 MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,&
-                 MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-                 TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-                 ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-                 ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-                 MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-                 PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-                 ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-                 INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-                 LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                 SIMULATION_TYPE,SAVE_FORWARD, &
-                 NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                 NSPEC_COMP,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX,&
-                 NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                 NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-                 ratio_sampling_array, ner, doubling_index,r_bottom,r_top,&
-                 this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-                 OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                 ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,&
-                 HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-                 DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-                 WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,&
-                 USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
-
+  call read_compute_parameters()
+!                 MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!                 NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!                 NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!                 NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!                 NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!                 NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!                 NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!                 ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!                 CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!                 RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!                 R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!                 MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,&
+!                 MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!                 TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!                 ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!                 ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!                 MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!                 PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!                 ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!                 INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!                 LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                 SIMULATION_TYPE,SAVE_FORWARD, &
+!                 NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!                 NSPEC_COMP,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX,&
+!                 NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!                 NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!                 ratio_sampling_array, ner, doubling_index,r_bottom,r_top,&
+!                 this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!                 OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                 ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,&
+!                 HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!                 DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!                 WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,&
+!                 USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
   if(.not. SAVE_MESH_FILES) stop 'AVS or DX files were not saved by the mesher'
 
 ! get the base pathname for output files
@@ -419,9 +421,9 @@
     open(unit=10,file=prname(1:len_trim(prname))//'AVS_DXelementssurface.txt',status='old',action='read')
   endif
 
-  read(10,*) nspec
-  print *,'There are ',nspec,' AVS or DX elements in the slice'
-  ntotspec = ntotspec + nspec
+  read(10,*) nspec_ab
+  print *,'There are ',nspec_ab,' AVS or DX elements in the slice'
+  ntotspec = ntotspec + nspec_ab
   close(10)
 
   enddo
@@ -565,13 +567,13 @@
 
   endif
 
-  read(10,*) nspec
+  read(10,*) nspec_ab
   read(12,*) npoin
   print *,'There are ',npoin,' global AVS or DX points in the slice'
-  print *,'There are ',nspec,' AVS or DX elements in the slice'
+  print *,'There are ',nspec_ab,' AVS or DX elements in the slice'
 
 ! read local elements in this slice and output global AVS or DX elements
-  do ispec=1,nspec
+  do ispec=1,nspec_ab
       read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4
       if(icolor == 5 .or. icolor == 6) then
         read(13,*) numelem2,deltavp,deltavs
@@ -757,7 +759,7 @@
 
   enddo
 
-  iglobelemoffset = iglobelemoffset + nspec
+  iglobelemoffset = iglobelemoffset + nspec_ab
   iglobpointoffset = iglobpointoffset + npoin
 
   close(10)
@@ -885,11 +887,11 @@
     open(unit=10,file=prname(1:len_trim(prname))//'AVS_DXelementssurface.txt',status='old',action='read')
   endif
 
-  read(10,*) nspec
-  print *,'There are ',nspec,' AVS or DX elements in the slice'
+  read(10,*) nspec_ab
+  print *,'There are ',nspec_ab,' AVS or DX elements in the slice'
 
 ! read local elements in this slice and output global AVS or DX elements
-  do ispec=1,nspec
+  do ispec=1,nspec_ab
       read(10,*) numelem,idoubling,iglob1,iglob2,iglob3,iglob4
       if(numelem /= ispec) stop 'incorrect element number'
 
@@ -937,7 +939,7 @@
       endif
   enddo
 
-  iglobelemoffset = iglobelemoffset + nspec
+  iglobelemoffset = iglobelemoffset + nspec_ab
 
   close(10)
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_paraview_strain_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_paraview_strain_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_paraview_strain_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_surf_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_surf_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_surf_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -481,10 +481,10 @@
 
   subroutine reverse_ellipticity(x,y,z,nspl,rspl,espl,espl2)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   real(kind=CUSTOM_REAL) :: x,y,z
   integer nspl
   double precision rspl(NR),espl(NR),espl2(NR)
@@ -526,10 +526,10 @@
 ! creates a spline for the ellipticity profile in PREM
 ! radius and density are non-dimensional
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer nspl
 
   logical ONE_CRUST
@@ -677,10 +677,10 @@
   subroutine prem_density(x,rho,ONE_CRUST,RICB,RCMB,RTOPDDOUBLEPRIME, &
       R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision x,rho,RICB,RCMB,RTOPDDOUBLEPRIME, &
       R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN
 
@@ -1020,10 +1020,10 @@
 
 ! convert x y z to r theta phi, double precision call
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision x,y,z,r,theta,phi
   double precision xmesh,ymesh,zmesh
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data_vtk.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data_vtk.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/combine_vol_data_vtk.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -590,10 +590,10 @@
 
   subroutine reverse_ellipticity(x,y,z,nspl,rspl,espl,espl2)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   real(kind=CUSTOM_REAL) :: x,y,z
   integer nspl
   double precision rspl(NR),espl(NR),espl2(NR)
@@ -635,10 +635,10 @@
 ! creates a spline for the ellipticity profile in PREM
 ! radius and density are non-dimensional
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer nspl
 
   logical ONE_CRUST
@@ -787,10 +787,10 @@
   subroutine prem_density(x,rho,ONE_CRUST,RICB,RCMB,RTOPDDOUBLEPRIME, &
       R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision x,rho,RICB,RCMB,RTOPDDOUBLEPRIME, &
       R600,R670,R220,R771,R400,R80,RMOHO,RMIDDLE_CRUST,ROCEAN
 
@@ -1133,10 +1133,10 @@
 
 ! convert x y z to r theta phi, double precision call
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision x,y,z,r,theta,phi
   double precision xmesh,ymesh,zmesh
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/convolve_source_timefunction.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/convolve_source_timefunction.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/convolve_source_timefunction.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_AVS_DX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_AVS_DX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_AVS_DX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -38,11 +38,11 @@
   integer iformat
 
 ! parameters read from parameter file
-  integer NEX_XI,NEX_ETA
-  integer NSTEP,NTSTEP_BETWEEN_FRAMES,NCHUNKS
-  integer NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
-  logical MOVIE_SURFACE
-  integer USE_COMPONENT
+  integer :: NEX_XI,NEX_ETA
+  integer :: NSTEP,NTSTEP_BETWEEN_FRAMES,NCHUNKS
+  integer :: NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+  logical :: MOVIE_SURFACE
+  integer :: USE_COMPONENT
 
 ! ************** PROGRAM STARTS HERE **************
 
@@ -95,10 +95,10 @@
                                 NCHUNKS,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
                                 USE_COMPONENT)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
 !---------------------
 ! threshold and normalization parameters
 
@@ -791,102 +791,125 @@
 !=====================================================================
 !
 
-  subroutine read_AVS_DX_parameters(NEX_XI,NEX_ETA, &
-          NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NCHUNKS,MOVIE_SURFACE, &
-          NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA)
+  subroutine read_AVS_DX_parameters(NEX_XI_out,NEX_ETA_out, &
+                                    NSTEP_out,NTSTEP_BETWEEN_FRAMES_out, &
+                                    NCHUNKS_out,MOVIE_SURFACE_out, &
+                                    NPROCTOT_out,NEX_PER_PROC_XI_out,NEX_PER_PROC_ETA_out)
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+  integer :: NPROCTOT_out,NCHUNKS_out
 
+  integer :: NEX_PER_PROC_XI_out,NEX_PER_PROC_ETA_out
+  integer :: NEX_XI_out,NEX_ETA_out
+
+  logical :: MOVIE_SURFACE_out
+  integer :: NSTEP_out,NTSTEP_BETWEEN_FRAMES_out
+
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI,NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI,NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               NGLOB
 
-  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
   print *
   print *,'reading parameter file'
   print *
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-         SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
-
+  call read_compute_parameters()
+!        MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!         SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
   if(MOVIE_COARSE) stop 'create_movie_AVS_DX does not work with MOVIE_COARSE'
 
+  ! return values
+  NPROCTOT_out = NPROCTOT
+  NCHUNKS_out = NCHUNKS
+
+  NEX_PER_PROC_XI_out = NEX_PER_PROC_XI
+  NEX_PER_PROC_ETA_out = NEX_PER_PROC_ETA
+  NEX_XI_out = NEX_XI
+  NEX_ETA_out = NEX_ETA
+
+  MOVIE_SURFACE_out = MOVIE_SURFACE
+  NSTEP_out = NSTEP
+  NTSTEP_BETWEEN_FRAMES_out = NTSTEP_BETWEEN_FRAMES
+
   end subroutine read_AVS_DX_parameters
 
 ! ------------------------------------------------------------------
@@ -898,10 +921,10 @@
 
 ! leave sorting subroutines in same source file to allow for inlining
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer npointot
   integer iglob(npointot),loc(npointot)
   logical ifseg(npointot)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_GMT_global.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_GMT_global.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/create_movie_GMT_global.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -40,10 +40,11 @@
 !
 ! example scripts can be found in: UTILS/Visualization/GMT/
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "constants.h"
-
 !---------------------
 ! USER PARAMETER
 
@@ -100,58 +101,60 @@
          store_val_ux,store_val_uy,store_val_uz
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               NGLOB
 
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
-  logical :: CASE_3D,OUTPUT_BINARY
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CASE_3D,OUTPUT_BINARY
+  logical :: OUTPUT_BINARY
 
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+
   real(kind=CUSTOM_REAL) :: LAT_SOURCE,LON_SOURCE,DEP_SOURCE
   real(kind=CUSTOM_REAL) :: dist_lon,dist_lat,distance,mute_factor,val
   character(len=256) line
@@ -170,40 +173,41 @@
   print *
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-         SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-         this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO, &
-         CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
-         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
-
+  call read_compute_parameters()
+!         MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!         SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!         this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO, &
+!         CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
+!         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
   if(.not. MOVIE_SURFACE) stop 'movie frames were not saved by the solver'
 
   print *

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/auxiliaries/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -36,6 +36,7 @@
 	$E/xcombine_AVS_DX \
 	$E/xcombine_paraview_strain_data \
 	$E/xcombine_vol_data \
+	$E/xcombine_vol_data_vtk \
 	$E/xcombine_surf_data \
 	$E/xcreate_movie_AVS_DX \
 	$E/xcreate_movie_GMT_global \
@@ -43,33 +44,38 @@
 	$(EMPTY_MACRO)
 
 auxiliaries_OBJECTS = \
-	$O/check_buffers_1D.o \
-	$O/check_buffers_2D.o \
-	$O/check_buffers_corners_chunks.o \
-	$O/check_buffers_faces_chunks.o \
-	$O/combine_AVS_DX.o \
-	$O/combine_paraview_strain_data.o \
-	$O/combine_surf_data.o \
-	$O/combine_vol_data.o \
-	$O/convolve_source_timefunction.o \
-	$O/create_movie_AVS_DX.o \
-	$O/create_movie_GMT_global.o \
+	$O/check_buffers_1D.aux.o \
+	$O/check_buffers_2D.aux.o \
+	$O/check_buffers_corners_chunks.aux.o \
+	$O/check_buffers_faces_chunks.aux.o \
+	$O/combine_AVS_DX.aux.o \
+	$O/combine_paraview_strain_data.auxsolver.o \
+	$O/combine_surf_data.auxsolver.o \
+	$O/combine_vol_data.auxsolver.o \
+	$O/combine_vol_data_vtk.auxsolver.o \
+	$O/convolve_source_timefunction.aux.o \
+	$O/create_movie_AVS_DX.aux.o \
+	$O/create_movie_GMT_global.aux.o \
 	$(EMPTY_MACRO)
 
 # These files come from the shared directory
 auxiliaries_SHARED_OBJECTS = \
-	$O/auto_ner.o \
-	$O/calendar.o \
-	$O/create_serial_name_database.o \
-	$O/get_cmt.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/calendar.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_points.shared.o \
+	$O/create_serial_name_database.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
 	$(EMPTY_MACRO)
 
 
@@ -79,39 +85,46 @@
 #### rules for executables
 ####
 
-${E}/xcheck_buffers_1D: $O/check_buffers_1D.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_1D $O/check_buffers_1D.o $(auxiliaries_SHARED_OBJECTS)
+all_aux: required $(auxiliaries_TARGETS)
 
-${E}/xcheck_buffers_2D: $O/check_buffers_2D.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_2D $O/check_buffers_2D.o $(auxiliaries_SHARED_OBJECTS)
+aux: required $(auxiliaries_TARGETS)
 
-${E}/xcheck_buffers_corners_chunks: $O/check_buffers_corners_chunks.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_corners_chunks $O/check_buffers_corners_chunks.o $(auxiliaries_SHARED_OBJECTS)
+${E}/xcheck_buffers_1D: $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_1D.aux.o 
+	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_1D $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_1D.aux.o
 
-${E}/xcheck_buffers_faces_chunks: $O/check_buffers_faces_chunks.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_faces_chunks $O/check_buffers_faces_chunks.o $(auxiliaries_SHARED_OBJECTS)
+${E}/xcheck_buffers_2D: $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_2D.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_2D $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_2D.aux.o
 
-${E}/xconvolve_source_timefunction: $O/convolve_source_timefunction.o
-	${FCCOMPILE_CHECK} -o ${E}/xconvolve_source_timefunction $O/convolve_source_timefunction.o
+${E}/xcheck_buffers_corners_chunks: $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_corners_chunks.aux.o 
+	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_corners_chunks $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_corners_chunks.aux.o
 
-${E}/xcombine_AVS_DX: $O/combine_AVS_DX.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcombine_AVS_DX $O/combine_AVS_DX.o $(auxiliaries_SHARED_OBJECTS)
+${E}/xcheck_buffers_faces_chunks: $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_faces_chunks.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xcheck_buffers_faces_chunks $(auxiliaries_SHARED_OBJECTS) $O/check_buffers_faces_chunks.aux.o
 
-${E}/xcombine_paraview_strain_data: $O/combine_paraview_strain_data.o $O/write_c_binary.o
-	${FCCOMPILE_CHECK} -o ${E}/xcombine_paraview_strain_data  $O/combine_paraview_strain_data.o $O/write_c_binary.o
+${E}/xconvolve_source_timefunction: $O/convolve_source_timefunction.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xconvolve_source_timefunction $O/convolve_source_timefunction.aux.o
 
-${E}/xcombine_vol_data: $O/combine_vol_data.o $O/write_c_binary.o
-	${FCCOMPILE_CHECK} -o ${E}/xcombine_vol_data  $O/combine_vol_data.o $O/write_c_binary.o
+${E}/xcombine_AVS_DX: $(auxiliaries_SHARED_OBJECTS) $O/get_cmt.solver.o $O/combine_AVS_DX.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xcombine_AVS_DX $(auxiliaries_SHARED_OBJECTS) $O/get_cmt.solver.o $O/combine_AVS_DX.aux.o
 
-${E}/xcombine_surf_data: $O/combine_surf_data.o $O/write_c_binary.o
-	${FCCOMPILE_CHECK} -o ${E}/xcombine_surf_data  $O/combine_surf_data.o $O/write_c_binary.o
+${E}/xcombine_paraview_strain_data: $O/combine_paraview_strain_data.auxsolver.o $O/write_c_binary.cc.o
+	${FCCOMPILE_CHECK} -o ${E}/xcombine_paraview_strain_data  $O/combine_paraview_strain_data.auxsolver.o $O/write_c_binary.cc.o
 
-${E}/xcreate_movie_AVS_DX: $O/create_movie_AVS_DX.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcreate_movie_AVS_DX $O/create_movie_AVS_DX.o $(auxiliaries_SHARED_OBJECTS)
+${E}/xcombine_vol_data: $O/combine_vol_data.auxsolver.o $O/write_c_binary.cc.o
+	${FCCOMPILE_CHECK} -o ${E}/xcombine_vol_data  $O/combine_vol_data.auxsolver.o $O/write_c_binary.cc.o
 
-${E}/xcreate_movie_GMT_global: $O/create_movie_GMT_global.o $(auxiliaries_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcreate_movie_GMT_global $O/create_movie_GMT_global.o $(auxiliaries_SHARED_OBJECTS)
+${E}/xcombine_vol_data_vtk: $O/combine_vol_data_vtk.auxsolver.o $O/write_c_binary.cc.o
+	${FCCOMPILE_CHECK} -o ${E}/xcombine_vol_data_vtk  $O/combine_vol_data_vtk.auxsolver.o $O/write_c_binary.cc.o
 
+${E}/xcombine_surf_data: $O/combine_surf_data.auxsolver.o $O/write_c_binary.cc.o
+	${FCCOMPILE_CHECK} -o ${E}/xcombine_surf_data  $O/combine_surf_data.auxsolver.o $O/write_c_binary.cc.o
+
+${E}/xcreate_movie_AVS_DX: $(auxiliaries_SHARED_OBJECTS) $O/create_movie_AVS_DX.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xcreate_movie_AVS_DX $(auxiliaries_SHARED_OBJECTS) $O/create_movie_AVS_DX.aux.o
+
+${E}/xcreate_movie_GMT_global: $(auxiliaries_SHARED_OBJECTS) $O/create_movie_GMT_global.aux.o
+	${FCCOMPILE_CHECK} -o ${E}/xcreate_movie_GMT_global $(auxiliaries_SHARED_OBJECTS) $O/create_movie_GMT_global.aux.o
+
 ${E}/xextract_database: $(S_TOP)/utils/extract_database/extract_database.f90
 	${FCCOMPILE_CHECK} -o ${E}/xextract_database ${FCFLAGS_f90} $(S_TOP)/utils/extract_database/extract_database.f90
 
@@ -126,39 +139,12 @@
 ####
 
 ##
-## auxiliary objects
+## auxiliaries
 ##
+$O/%.aux.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/check_buffers_1D.o: ${SETUP}/constants.h $S/check_buffers_1D.f90
-	${FCCOMPILE_CHECK} -c -o $O/check_buffers_1D.o ${FCFLAGS_f90} $S/check_buffers_1D.f90
+$O/%.auxsolver.o: $S/%.f90 ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/check_buffers_2D.o: ${SETUP}/constants.h $S/check_buffers_2D.f90
-	${FCCOMPILE_CHECK} -c -o $O/check_buffers_2D.o ${FCFLAGS_f90} $S/check_buffers_2D.f90
 
-$O/check_buffers_corners_chunks.o: ${SETUP}/constants.h $S/check_buffers_corners_chunks.f90
-	${FCCOMPILE_CHECK} -c -o $O/check_buffers_corners_chunks.o ${FCFLAGS_f90} $S/check_buffers_corners_chunks.f90
-
-$O/check_buffers_faces_chunks.o: ${SETUP}/constants.h $S/check_buffers_faces_chunks.f90
-	${FCCOMPILE_CHECK} -c -o $O/check_buffers_faces_chunks.o ${FCFLAGS_f90} $S/check_buffers_faces_chunks.f90
-
-$O/combine_AVS_DX.o: ${SETUP}/constants.h $S/combine_AVS_DX.f90
-	${FCCOMPILE_CHECK} -c -o $O/combine_AVS_DX.o ${FCFLAGS_f90} $S/combine_AVS_DX.f90
-
-$O/combine_paraview_strain_data.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/combine_paraview_strain_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/combine_paraview_strain_data.o ${FCFLAGS_f90} $S/combine_paraview_strain_data.f90
-
-$O/combine_surf_data.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/combine_surf_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/combine_surf_data.o ${FCFLAGS_f90} $S/combine_surf_data.f90
-
-$O/combine_vol_data.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/combine_vol_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/combine_vol_data.o ${FCFLAGS_f90} $S/combine_vol_data.f90
-
-$O/convolve_source_timefunction.o: $S/convolve_source_timefunction.f90
-	${FCCOMPILE_CHECK} -c -o $O/convolve_source_timefunction.o ${FCFLAGS_f90} $S/convolve_source_timefunction.f90
-
-$O/create_movie_AVS_DX.o: ${SETUP}/constants.h $S/create_movie_AVS_DX.f90
-	${FCCOMPILE_CHECK} -c -o $O/create_movie_AVS_DX.o ${FCFLAGS_f90} $S/create_movie_AVS_DX.f90
-
-$O/create_movie_GMT_global.o: ${SETUP}/constants.h $S/create_movie_GMT_global.f90
-	${FCCOMPILE_CHECK} -c -o $O/create_movie_GMT_global.o ${FCFLAGS_f90} $S/create_movie_GMT_global.f90
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/compute_optimized_dumping_undo_att.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/compute_optimized_dumping_undo_att.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/compute_optimized_dumping_undo_att.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,63 +31,69 @@
 
   program xcompute_optimized_dumping
 
+  use shared_parameters
+  use constants
+
   implicit none
 
-  include "constants.h"
-
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY, &
-          ATT1,ATT2,ATT3,ATT4,ATT5
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY, &
+!          ATT1,ATT2,ATT3,ATT4,ATT5
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER, &
-          RATIO_BY_WHICH_TO_INCREASE_IT
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER, &
+!          RATIO_BY_WHICH_TO_INCREASE_IT
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION,CASE_3D, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,SAVE_REGULAR_KL, &
-          USE_LDDRK,INCREASE_CFL_FOR_LDDRK,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL, &
-          USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK,GPU_MODE,ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
-          ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_AVS_DX, &
-          EXACT_MASS_MATRIX_FOR_ROTATION,ATTENUATION_1D_WITH_3D_STORAGE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION,CASE_3D, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,SAVE_REGULAR_KL, &
+!          USE_LDDRK,INCREASE_CFL_FOR_LDDRK,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL, &
+!          USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK,GPU_MODE,ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
+!          ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_AVS_DX, &
+!          EXACT_MASS_MATRIX_FOR_ROTATION,ATTENUATION_1D_WITH_3D_STORAGE
 
-  character(len=150) LOCAL_PATH,MODEL
+!  character(len=150) LOCAL_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer :: NPROC,
+!  integer :: NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+!  integer :: ratio_divide_central_cube
 
+  integer :: NSOURCES
+
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               NGLOB
 
-  double precision :: static_memory_size_on_CPU
+  double precision :: static_memory_size
 
   integer :: NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
          NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
@@ -102,57 +108,61 @@
          NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
          NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION
 
-  integer :: iregion
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
-  integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_CORNER
-  integer, dimension(MAX_NUM_REGIONS) :: NGLOB1D_RADIAL_TEMP
+!  integer :: iregion
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_CORNER
+!  integer, dimension(MAX_NUM_REGIONS) :: NGLOB1D_RADIAL_TEMP
 
   integer :: NT_DUMP_ATTENUATION_optimal_to_use,number_of_dumpings_to_do
   double precision :: gigabytes_avail_per_core,percentage_to_use_per_core,what_we_can_use_in_GB,size_to_store_at_each_time_step, &
                          disk_size_of_each_dumping
 
-  logical :: PARTIAL_PHYS_DISPERSION_ONLY,UNDO_ATTENUATION
-  integer :: NT_DUMP_ATTENUATION
+!  integer :: ATT1,ATT2,ATT3 !,ATT4,ATT5
 
+
+!  logical :: PARTIAL_PHYS_DISPERSION_ONLY,UNDO_ATTENUATION
+!  integer :: NT_DUMP_ATTENUATION
+
 ! ************** PROGRAM STARTS HERE **************
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,LOCAL_PATH,MODEL,SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY,&
-         SAVE_REGULAR_KL,PARTIAL_PHYS_DISPERSION_ONLY,UNDO_ATTENUATION,NT_DUMP_ATTENUATION, &
-          USE_LDDRK,INCREASE_CFL_FOR_LDDRK,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL, &
-          USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK,GPU_MODE,ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
-          ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_AVS_DX,RATIO_BY_WHICH_TO_INCREASE_IT, &
-          ATT1,ATT2,ATT3,ATT4,ATT5,EXACT_MASS_MATRIX_FOR_ROTATION,ATTENUATION_1D_WITH_3D_STORAGE)
-
+  call read_compute_parameters()
+!        MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,LOCAL_PATH,MODEL,SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY,&
+!         SAVE_REGULAR_KL,PARTIAL_PHYS_DISPERSION_ONLY,UNDO_ATTENUATION,NT_DUMP_ATTENUATION, &
+!          USE_LDDRK,INCREASE_CFL_FOR_LDDRK,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL, &
+!          USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK,GPU_MODE,ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
+!          ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_AVS_DX,RATIO_BY_WHICH_TO_INCREASE_IT, &
+!          ATT1,ATT2,ATT3,ATT4,ATT5,EXACT_MASS_MATRIX_FOR_ROTATION,ATTENUATION_1D_WITH_3D_STORAGE)
+!
 ! optimal dumping interval calculation can only be done when SIMULATION_TYPE == 3 in the Par_file,
 ! thus set it to that value here in this serial code even if it has a different value in the Par_file
   SIMULATION_TYPE = 3
@@ -160,21 +170,20 @@
 ! count the total number of sources in the CMTSOLUTION file
   call count_number_of_sources(NSOURCES)
 
-  do iregion=1,MAX_NUM_REGIONS
-    NGLOB1D_RADIAL_CORNER(iregion,:) = NGLOB1D_RADIAL(iregion)
-  enddo
+!  do iregion=1,MAX_NUM_REGIONS
+!    NGLOB1D_RADIAL_CORNER(iregion,:) = NGLOB1D_RADIAL(iregion)
+!  enddo
 
-  if (CUT_SUPERBRICK_XI .or. CUT_SUPERBRICK_ETA) then
-    NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) = NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) + &
-                                                maxval(DIFF_NSPEC1D_RADIAL(:,:))*(NGLLZ-1)
-  endif
+!  if (CUT_SUPERBRICK_XI .or. CUT_SUPERBRICK_ETA) then
+!    NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) = NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) + &
+!                                                maxval(DIFF_NSPEC1D_RADIAL(:,:))*(NGLLZ-1)
+!  endif
 
 ! evaluate the amount of static memory needed by the solver
-  call memory_eval(OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE,&
-                   TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,&
-                   ONE_CRUST,doubling_index,this_region_has_a_doubling,&
-                   ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_sampling_array,&
-                   NSPEC,NGLOB,SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD, &
+  call memory_eval(doubling_index,this_region_has_a_doubling, &
+                   ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+                   ratio_sampling_array,NPROCTOT, &
+                   NSPEC,NGLOB, &
                    NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
                    NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
                    NSPEC_INNER_CORE_ATTENUATION, &
@@ -186,21 +195,21 @@
                    NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
                    NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
                    NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-                   NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION,ATT1,ATT2,ATT3, &
-                   APPROXIMATE_HESS_KL,ANISOTROPIC_KL,NOISE_TOMOGRAPHY, &
-                   NCHUNKS,USE_LDDRK,EXACT_MASS_MATRIX_FOR_ROTATION,static_memory_size_on_CPU)
+                   NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
+                   NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+                   static_memory_size)
 
-! in the case of GPUs, the buffers remain on the host i.e. on the CPU, thus static_memory_size_on_CPU could be set to zero here
+! in the case of GPUs, the buffers remain on the host i.e. on the CPU, thus static_memory_size could be set to zero here
 ! because the solver uses almost no permanent host memory, since all calculations are performed and stored on the device;
 ! however we prefer not to do that here because we probably have some temporary copies of all the arrays created on the host first,
 ! and it is not clear if they are then suppressed when the time loop of the solver starts because static memory allocation
 ! is used for big arrays on the host rather than dynamic, thus there is no way of freeing it dynamically.
-! Thus for now we prefer not to set static_memory_size_on_CPU to zero here.
+! Thus for now we prefer not to set static_memory_size to zero here.
 !
-! if(GPU_MODE) static_memory_size_on_CPU = 0.d0
+! if(GPU_MODE) static_memory_size = 0.d0
 
-  NGLOB1D_RADIAL_TEMP(:) = &
-  (/maxval(NGLOB1D_RADIAL_CORNER(1,:)),maxval(NGLOB1D_RADIAL_CORNER(2,:)),maxval(NGLOB1D_RADIAL_CORNER(3,:))/)
+!  NGLOB1D_RADIAL_TEMP(:) = &
+!  (/maxval(NGLOB1D_RADIAL_CORNER(1,:)),maxval(NGLOB1D_RADIAL_CORNER(2,:)),maxval(NGLOB1D_RADIAL_CORNER(3,:))/)
 
   print *
   print *,'number of processors = ',NPROCTOT
@@ -222,22 +231,22 @@
   print *,' by typing "size -d bin/xspecfem3D"'
   print *,' after compiling the code with the DATA/Par_file you plan to use)'
   print *
-  print *,'size of static arrays per slice = ',static_memory_size_on_CPU/1.d6,' MB'
-  print *,'                                = ',static_memory_size_on_CPU/1048576.d0,' MiB'
-  print *,'                                = ',static_memory_size_on_CPU/1.d9,' GB'
-  print *,'                                = ',static_memory_size_on_CPU/1073741824.d0,' GiB'
+  print *,'size of static arrays per slice = ',static_memory_size/1.d6,' MB'
+  print *,'                                = ',static_memory_size/1048576.d0,' MiB'
+  print *,'                                = ',static_memory_size/1.d9,' GB'
+  print *,'                                = ',static_memory_size/1073741824.d0,' GiB'
   print *
 
-  if(static_memory_size_on_CPU*dble(NPROCTOT)/1.d6 < 10000.d0) then
-    print *,'size of static arrays for all slices = ',static_memory_size_on_CPU*dble(NPROCTOT)/1.d6,' MB'
-    print *,'                                     = ',static_memory_size_on_CPU*dble(NPROCTOT)/1048576.d0,' MiB'
-    print *,'                                     = ',static_memory_size_on_CPU*dble(NPROCTOT)/1.d9,' GB'
+  if(static_memory_size*dble(NPROCTOT)/1.d6 < 10000.d0) then
+    print *,'size of static arrays for all slices = ',static_memory_size*dble(NPROCTOT)/1.d6,' MB'
+    print *,'                                     = ',static_memory_size*dble(NPROCTOT)/1048576.d0,' MiB'
+    print *,'                                     = ',static_memory_size*dble(NPROCTOT)/1.d9,' GB'
   else
-    print *,'size of static arrays for all slices = ',static_memory_size_on_CPU*dble(NPROCTOT)/1.d9,' GB'
+    print *,'size of static arrays for all slices = ',static_memory_size*dble(NPROCTOT)/1.d9,' GB'
   endif
-  print *,'                                     = ',static_memory_size_on_CPU*dble(NPROCTOT)/1073741824.d0,' GiB'
-  print *,'                                     = ',static_memory_size_on_CPU*dble(NPROCTOT)/1.d12,' TB'
-  print *,'                                     = ',static_memory_size_on_CPU*dble(NPROCTOT)/1099511627776.d0,' TiB'
+  print *,'                                     = ',static_memory_size*dble(NPROCTOT)/1073741824.d0,' GiB'
+  print *,'                                     = ',static_memory_size*dble(NPROCTOT)/1.d12,' TB'
+  print *,'                                     = ',static_memory_size*dble(NPROCTOT)/1099511627776.d0,' TiB'
   print *
 
   print *,'How much memory (in GB) is installed on your machine per CPU core?'
@@ -270,17 +279,17 @@
 
   what_we_can_use_in_GB = gigabytes_avail_per_core * percentage_to_use_per_core / 100.d0
 
-! convert static_memory_size_on_CPU to GB
-  static_memory_size_on_CPU = static_memory_size_on_CPU / 1.d9
+! convert static_memory_size to GB
+  static_memory_size = static_memory_size / 1.d9
 
   print *
-  print *,'without undoing of attenuation you are using ',static_memory_size_on_CPU,' GB per core'
-  print *,'  i.e. ',sngl(100.d0 * static_memory_size_on_CPU / gigabytes_avail_per_core),'% of the installed memory'
+  print *,'without undoing of attenuation you are using ',static_memory_size,' GB per core'
+  print *,'  i.e. ',sngl(100.d0 * static_memory_size / gigabytes_avail_per_core),'% of the installed memory'
 
-  if(static_memory_size_on_CPU >= gigabytes_avail_per_core) &
+  if(static_memory_size >= gigabytes_avail_per_core) &
     stop 'you are using more memory than what you told us is installed!!! there is an error'
 
-  if(static_memory_size_on_CPU >= what_we_can_use_in_GB) &
+  if(static_memory_size >= what_we_can_use_in_GB) &
     stop 'you are using more memory than what you allowed us to use!!! there is an error'
 
 ! compute the size to store in memory at each time step
@@ -305,7 +314,7 @@
   print *
   print *,'*******************************************************************************'
   print *,'the optimal value to put in DATA/Par_file is thus:'
-  NT_DUMP_ATTENUATION_optimal_to_use = int((what_we_can_use_in_GB - static_memory_size_on_CPU) / size_to_store_at_each_time_step)
+  NT_DUMP_ATTENUATION_optimal_to_use = int((what_we_can_use_in_GB - static_memory_size) / size_to_store_at_each_time_step)
   print *
   print *,'NT_DUMP_ATTENUATION = ',NT_DUMP_ATTENUATION_optimal_to_use
   print *

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/compute_optimized_dumping_undo_att/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -32,25 +32,30 @@
 	$(EMPTY_MACRO)
 
 compute_optimized_dumping_undo_att_OBJECTS = \
-	$O/compute_optimized_dumping_undo_att.o \
+	$O/compute_optimized_dumping_undo_att.optdump.o \
 	$(EMPTY_MACRO)
 
 # These files come from the shared directory
 compute_optimized_dumping_undo_att_SHARED_OBJECTS = \
-	$O/auto_ner.o \
-	$O/count_number_of_sources.o \
-	$O/euler_angles.o \
-	$O/force_ftz.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/memory_eval.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
-	$O/save_header_file.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_number_of_sources.shared.o \
+	$O/count_points.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/euler_angles.shared.o \
+	$O/force_ftz.cc.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/memory_eval.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
+	$O/save_header_file.shared.o \
 	$(EMPTY_MACRO)
 
 #######################################
@@ -59,12 +64,12 @@
 #### rules for executables
 ####
 
-${E}/xcompute_optimized_dumping_undo_att: $(compute_optimized_dumping_undo_att_OBJECTS) $(compute_optimized_dumping_undo_att_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcompute_optimized_dumping_undo_att $(compute_optimized_dumping_undo_att_OBJECTS) $(compute_optimized_dumping_undo_att_SHARED_OBJECTS)
+${E}/xcompute_optimized_dumping_undo_att: $(compute_optimized_dumping_undo_att_SHARED_OBJECTS) $(compute_optimized_dumping_undo_att_OBJECTS)
+	${FCCOMPILE_CHECK} -o ${E}/xcompute_optimized_dumping_undo_att $(compute_optimized_dumping_undo_att_SHARED_OBJECTS) $(compute_optimized_dumping_undo_att_OBJECTS)
 
 ## uses MPI compiler to link executable instead (usedful for cross-compilation)
-#${E}/xcompute_optimized_dumping_undo_att: $(compute_optimized_dumping_undo_att_OBJECTS) $(compute_optimized_dumping_undo_att_SHARED_OBJECTS)
-#	${MPIFCCOMPILE_CHECK} -o ${E}/xcompute_optimized_dumping_undo_att $(compute_optimized_dumping_undo_att_OBJECTS) $(compute_optimized_dumping_undo_att_SHARED_OBJECTS)
+#${E}/xcompute_optimized_dumping_undo_att: $(compute_optimized_dumping_undo_att_SHARED_OBJECTS) $(compute_optimized_dumping_undo_att_OBJECTS)
+#	${MPIFCCOMPILE_CHECK} -o ${E}/xcompute_optimized_dumping_undo_att $(compute_optimized_dumping_undo_att_SHARED_OBJECTS) $(compute_optimized_dumping_undo_att_OBJECTS)
 
 #######################################
 
@@ -76,10 +81,6 @@
 #### rule for each .o file below
 ####
 
-##
-## compute_optimized_dumping_undo_att objects
-##
+$O/%.optdump.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/compute_optimized_dumping_undo_att.o: $S/compute_optimized_dumping_undo_att.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_optimized_dumping_undo_att.o ${FCFLAGS_f90} $S/compute_optimized_dumping_undo_att.f90
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/create_header_file.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/create_header_file.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/create_header_file.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,55 +30,60 @@
 
   program xcreate_header_file
 
+  use shared_parameters
+  use constants
+
   implicit none
 
-  include "constants.h"
-
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW,CASE_3D, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION,CASE_3D, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer :: NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+!  integer :: ratio_divide_central_cube
 
+  integer :: NSOURCES
+
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
-               NSPEC2D_XI, &
-               NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC, &
+!               NSPEC2D_XI, &
+!               NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               NGLOB
 
   double precision :: static_memory_size
   character(len=150) HEADER_FILE
@@ -96,11 +101,11 @@
          NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
          NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION
 
-  integer :: iregion
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
-  integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_CORNER
+!  integer :: iregion
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_CORNERS) :: NGLOB1D_RADIAL_CORNER
 
 ! ************** PROGRAM STARTS HERE **************
 
@@ -109,58 +114,57 @@
   print *,'creating file ', trim(HEADER_FILE), ' to compile solver with correct values'
 
 ! read the parameter file and compute additional parameters
-  call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,ATTENUATION_NEW,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-         SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
-         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+  call read_compute_parameters()
+!         MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!         SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!         NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
+!         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
 
-
 ! count the total number of sources in the CMTSOLUTION file
   call count_number_of_sources(NSOURCES)
 
-  do iregion=1,MAX_NUM_REGIONS
-    NGLOB1D_RADIAL_CORNER(iregion,:) = NGLOB1D_RADIAL(iregion)
-  enddo
+!  do iregion=1,MAX_NUM_REGIONS
+!    NGLOB1D_RADIAL_CORNER(iregion,:) = NGLOB1D_RADIAL(iregion)
+!  enddo
 
-  if (CUT_SUPERBRICK_XI .or. CUT_SUPERBRICK_ETA) then
-    NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) = NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) + &
-                                                maxval(DIFF_NSPEC1D_RADIAL(:,:))*(NGLLZ-1)
-  endif
+!  if (CUT_SUPERBRICK_XI .or. CUT_SUPERBRICK_ETA) then
+!    NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) = NGLOB1D_RADIAL_CORNER(IREGION_OUTER_CORE,:) + &
+!                                                maxval(DIFF_NSPEC1D_RADIAL(:,:))*(NGLLZ-1)
+!  endif
 
 ! evaluate the amount of static memory needed by the solver
-  call memory_eval(OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE, &
-                   TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,TOPOGRAPHY, &
-                   ONE_CRUST,doubling_index,this_region_has_a_doubling,NCHUNKS, &
+  call memory_eval(doubling_index,this_region_has_a_doubling, &
                    ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
                    ratio_sampling_array,NPROCTOT, &
-                   NSPEC,nglob,SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD, &
+                   NSPEC,NGLOB, &
                    NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
                    NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
                    NSPEC_INNER_CORE_ATTENUATION, &
@@ -178,30 +182,23 @@
 
 
 ! create include file for the solver
-  call save_header_file(NSPEC,nglob,NEX_XI,NEX_ETA,NPROC,NPROCTOT, &
-                  TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-                  ELLIPTICITY,GRAVITY,ROTATION, &
-                  OCEANS,ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D, &
-                  ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,NCHUNKS, &
-                  INCLUDE_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES, &
-                  CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,NSOURCES,NSTEP,&
-                  static_memory_size, &
-                  NSPEC2D_TOP,NSPEC2D_BOTTOM, &
-                  NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
-                  NPROC_XI,NPROC_ETA, &
-                  NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
-                  NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
-                  NSPEC_INNER_CORE_ATTENUATION, &
-                  NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
-                  NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
-                  NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
-                  NSPEC_CRUST_MANTLE_ADJOINT, &
-                  NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
-                  NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
-                  NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
-                  NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-                  NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
-                  SIMULATION_TYPE,SAVE_FORWARD,MOVIE_VOLUME)
+  call save_header_file(NSPEC,NGLOB,NPROC,NPROCTOT, &
+                        NSOURCES, &
+                        static_memory_size, &
+                        NSPEC2D_TOP,NSPEC2D_BOTTOM, &
+                        NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
+                        NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
+                        NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
+                        NSPEC_INNER_CORE_ATTENUATION, &
+                        NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
+                        NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
+                        NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
+                        NSPEC_CRUST_MANTLE_ADJOINT, &
+                        NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
+                        NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
+                        NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
+                        NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
+                        NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION )
 
   print *
   print *,'edit file OUTPUT_FILES/values_from_mesher.h to see'

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/create_header_file/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -33,25 +33,30 @@
 	$(EMPTY_MACRO)
 
 create_header_file_OBJECTS = \
-	$O/create_header_file.o \
+	$O/create_header_file.header.o \
 	$(EMPTY_MACRO)
 
 # These files come from the shared directory
 create_header_file_SHARED_OBJECTS = \
-	$O/auto_ner.o \
-	$O/count_number_of_sources.o \
-	$O/euler_angles.o \
-	$O/force_ftz.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/memory_eval.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
-	$O/save_header_file.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_number_of_sources.shared.o \
+	$O/count_points.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/euler_angles.shared.o \
+	$O/force_ftz.cc.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/memory_eval.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
+	$O/save_header_file.shared.o \
 	$(EMPTY_MACRO)
 
 #######################################
@@ -71,12 +76,12 @@
 #### rules for executables
 ####
 
-${E}/xcreate_header_file: $(create_header_file_OBJECTS) $(create_header_file_SHARED_OBJECTS)
-	${FCCOMPILE_CHECK} -o ${E}/xcreate_header_file $(create_header_file_OBJECTS) $(create_header_file_SHARED_OBJECTS)
+${E}/xcreate_header_file: $(create_header_file_SHARED_OBJECTS) $(create_header_file_OBJECTS)
+	${FCCOMPILE_CHECK} -o ${E}/xcreate_header_file $(create_header_file_SHARED_OBJECTS) $(create_header_file_OBJECTS)
 
 ## uses MPI compiler to link executable instead (usedful for cross-compilation)
-#${E}/xcreate_header_file: $(create_header_file_OBJECTS) $(create_header_file_SHARED_OBJECTS)
-#	${MPIFCCOMPILE_CHECK} -o ${E}/xcreate_header_file $(create_header_file_OBJECTS) $(create_header_file_SHARED_OBJECTS)
+#${E}/xcreate_header_file: $(create_header_file_SHARED_OBJECTS) $(create_header_file_OBJECTS)
+#	${MPIFCCOMPILE_CHECK} -o ${E}/xcreate_header_file $(create_header_file_SHARED_OBJECTS) $(create_header_file_OBJECTS)
 
 #######################################
 
@@ -89,9 +94,8 @@
 ####
 
 ##
-## create_header_file objects
+## rule for create_header_file
 ##
+$O/%.header.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/create_header_file.o: $S/create_header_file.f90
-	${FCCOMPILE_CHECK} -c -o $O/create_header_file.o ${FCFLAGS_f90} $S/create_header_file.f90
-

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/Makefile	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -0,0 +1,56 @@
+#=====================================================================
+#
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
+#          --------------------------------------------------
+#
+#          Main authors: Dimitri Komatitsch and Jeroen Tromp
+#                        Princeton University, USA
+#             and University of Pau / CNRS / INRIA, France
+# (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+#                            August 2013
+#
+# 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.
+#
+#=====================================================================
+
+DIR = cuda
+
+# The rest of this file is generic
+#######################################
+
+####
+#### targets
+####
+
+default:
+	$(MAKE) -C ../.. $(DIR)
+
+all:
+	$(MAKE) -C ../.. all
+
+clean:
+	$(MAKE) -C ../.. CLEAN=$(DIR) clean
+
+cleanall:
+	$(MAKE) -C ../.. clean
+
+backup:
+	mkdir -p bak
+	cp *f90 *h Makefile bak
+
+bak: backup
+
+.PHONY: default all clean cleanall backup bak
+

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_scalar_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_scalar_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_scalar_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_vector_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_vector_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/assemble_MPI_vector_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/check_fields_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/check_fields_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/check_fields_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_add_sources_elastic_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_add_sources_elastic_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_add_sources_elastic_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_coupling_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_coupling_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_coupling_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_crust_mantle_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_crust_mantle_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_crust_mantle_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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
@@ -715,7 +715,6 @@
                                           realw* epsilon_trace_over_3,
                                           int SIMULATION_TYPE,
                                           int ATTENUATION,
-                                          int ATTENUATION_NEW,
                                           int USE_ATTENUATION_MIMIC,
                                           int USE_3D_ATTENUATION_ARRAYS,
                                           realw* one_minus_sum_beta,realw* factor_common,
@@ -755,10 +754,6 @@
   realw duxdxl,duxdyl,duxdzl,duydxl,duydyl,duydzl,duzdxl,duzdyl,duzdzl;
   realw duxdxl_plus_duydyl,duxdxl_plus_duzdzl,duydyl_plus_duzdzl;
   realw duxdyl_plus_duydxl,duzdxl_plus_duxdzl,duzdyl_plus_duydzl;
-  // attenuation
-  realw tempx1l_att,tempx2l_att,tempx3l_att,tempy1l_att,tempy2l_att,tempy3l_att,tempz1l_att,tempz2l_att,tempz3l_att;
-  realw duxdxl_att,duxdyl_att,duxdzl_att,duydxl_att,duydyl_att,duydzl_att,duzdxl_att,duzdyl_att,duzdzl_att;
-  realw duxdyl_plus_duydxl_att,duzdxl_plus_duxdzl_att,duzdyl_plus_duydzl_att;
   realw templ;
 
   realw fac1,fac2,fac3;
@@ -780,10 +775,6 @@
   __shared__ realw s_dummyy_loc[NGLL3];
   __shared__ realw s_dummyz_loc[NGLL3];
 
-  __shared__ realw s_dummyx_loc_att[NGLL3];
-  __shared__ realw s_dummyy_loc_att[NGLL3];
-  __shared__ realw s_dummyz_loc_att[NGLL3];
-
   __shared__ realw s_tempx1[NGLL3];
   __shared__ realw s_tempx2[NGLL3];
   __shared__ realw s_tempx3[NGLL3];
@@ -833,21 +824,6 @@
     s_dummyz_loc[tx] = d_displ[iglob*3 + 2];
 #endif
 
-    if(ATTENUATION){
-      if(ATTENUATION_NEW){
-        // takes new routines
-        // use first order Taylor expansion of displacement for local storage of stresses
-        // at this current time step, to fix attenuation in a consistent way
-        s_dummyx_loc_att[tx] = s_dummyx_loc[tx] + deltat * d_veloc[iglob*3];
-        s_dummyy_loc_att[tx] = s_dummyy_loc[tx] + deltat * d_veloc[iglob*3 + 1];
-        s_dummyz_loc_att[tx] = s_dummyz_loc[tx] + deltat * d_veloc[iglob*3 + 2];
-      }else{
-        // takes old routines
-        s_dummyx_loc_att[tx] = s_dummyx_loc[tx];
-        s_dummyy_loc_att[tx] = s_dummyy_loc[tx];
-        s_dummyz_loc_att[tx] = s_dummyz_loc[tx];
-      }
-    }
   } // active
 
   // gets constant arrays into shared memory
@@ -916,37 +892,6 @@
         tempz3l += s_dummyz_loc[l*NGLL2+J*NGLLX+I]*fac3;
     }
 
-    if( ATTENUATION){
-      // temporary variables used for fixing attenuation in a consistent way
-      tempx1l_att = 0.f;
-      tempx2l_att = 0.f;
-      tempx3l_att = 0.f;
-
-      tempy1l_att = 0.f;
-      tempy2l_att = 0.f;
-      tempy3l_att = 0.f;
-
-      tempz1l_att = 0.f;
-      tempz2l_att = 0.f;
-      tempz3l_att = 0.f;
-
-      for (l=0;l<NGLLX;l++) {
-        fac1 = sh_hprime_xx[l*NGLLX+I];
-        tempx1l_att += s_dummyx_loc_att[K*NGLL2+J*NGLLX+l]*fac1;
-        tempy1l_att += s_dummyy_loc_att[K*NGLL2+J*NGLLX+l]*fac1;
-        tempz1l_att += s_dummyz_loc_att[K*NGLL2+J*NGLLX+l]*fac1;
-
-        fac2 = sh_hprime_xx[l*NGLLX+J];
-        tempx2l_att += s_dummyx_loc_att[K*NGLL2+l*NGLLX+I]*fac2;
-        tempy2l_att += s_dummyy_loc_att[K*NGLL2+l*NGLLX+I]*fac2;
-        tempz2l_att += s_dummyz_loc_att[K*NGLL2+l*NGLLX+I]*fac2;
-
-        fac3 = sh_hprime_xx[l*NGLLX+K];
-        tempx3l_att += s_dummyx_loc_att[l*NGLL2+J*NGLLX+I]*fac3;
-        tempy3l_att += s_dummyy_loc_att[l*NGLL2+J*NGLLX+I]*fac3;
-        tempz3l_att += s_dummyz_loc_att[l*NGLL2+J*NGLLX+I]*fac3;
-      }
-    }
 #else
 
     tempx1l = s_dummyx_loc[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
@@ -1003,63 +948,7 @@
             + s_dummyz_loc[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
             + s_dummyz_loc[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
 
-    if( ATTENUATION){
-      // temporary variables used for fixing attenuation in a consistent way
-      tempx1l_att = s_dummyx_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
 
-      tempy1l_att = s_dummyy_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
-
-      tempz1l_att = s_dummyz_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
-
-      tempx2l_att = s_dummyx_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyx_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempy2l_att = s_dummyy_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyy_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempz2l_att = s_dummyz_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyz_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempx3l_att = s_dummyx_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyx_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyx_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyx_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyx_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-
-      tempy3l_att = s_dummyy_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyy_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyy_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyy_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyy_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-
-      tempz3l_att = s_dummyz_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyz_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyz_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyz_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyz_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-    }
-
 #endif
 
     // compute derivatives of ux, uy and uz with respect to x, y and z
@@ -1095,60 +984,22 @@
     duzdxl_plus_duxdzl = duzdxl + duxdzl;
     duzdyl_plus_duydzl = duzdyl + duydzl;
 
-    if( ATTENUATION){
-      // temporary variables used for fixing attenuation in a consistent way
-      duxdxl_att = xixl*tempx1l_att + etaxl*tempx2l_att + gammaxl*tempx3l_att;
-      duxdyl_att = xiyl*tempx1l_att + etayl*tempx2l_att + gammayl*tempx3l_att;
-      duxdzl_att = xizl*tempx1l_att + etazl*tempx2l_att + gammazl*tempx3l_att;
+    // computes deviatoric strain attenuation and/or for kernel calculations
+    if(COMPUTE_AND_STORE_STRAIN) {
+      templ = 0.33333333333333333333f * (duxdxl + duydyl + duzdzl); // 1./3. = 0.33333
 
-      duydxl_att = xixl*tempy1l_att + etaxl*tempy2l_att + gammaxl*tempy3l_att;
-      duydyl_att = xiyl*tempy1l_att + etayl*tempy2l_att + gammayl*tempy3l_att;
-      duydzl_att = xizl*tempy1l_att + etazl*tempy2l_att + gammazl*tempy3l_att;
+      // local storage: stresses at this current time step
+      epsilondev_xx_loc = duxdxl - templ;
+      epsilondev_yy_loc = duydyl - templ;
+      epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl;
+      epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl;
+      epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl;
 
-      duzdxl_att = xixl*tempz1l_att + etaxl*tempz2l_att + gammaxl*tempz3l_att;
-      duzdyl_att = xiyl*tempz1l_att + etayl*tempz2l_att + gammayl*tempz3l_att;
-      duzdzl_att = xizl*tempz1l_att + etazl*tempz2l_att + gammazl*tempz3l_att;
-
-      // precompute some sums to save CPU time
-      duxdyl_plus_duydxl_att = duxdyl_att + duydxl_att;
-      duzdxl_plus_duxdzl_att = duzdxl_att + duxdzl_att;
-      duzdyl_plus_duydzl_att = duzdyl_att + duydzl_att;
-
-      // computes deviatoric strain attenuation and/or for kernel calculations
-      if(COMPUTE_AND_STORE_STRAIN) {
-        templ = 0.33333333333333333333f * (duxdxl_att + duydyl_att + duzdzl_att); // 1./3. = 0.33333
-
-        // local storage: stresses at this current time step
-        epsilondev_xx_loc = duxdxl_att - templ;
-        epsilondev_yy_loc = duydyl_att - templ;
-        epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl_att;
-        epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl_att;
-        epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl_att;
-
-        if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) {
-          epsilon_trace_over_3[tx] = templ;
-        }else{
-          epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
-        }
+      if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) {
+        epsilon_trace_over_3[tx] = templ;
+      }else{
+        epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
       }
-    }else{
-      // computes deviatoric strain attenuation and/or for kernel calculations
-      if(COMPUTE_AND_STORE_STRAIN) {
-        templ = 0.33333333333333333333f * (duxdxl + duydyl + duzdzl); // 1./3. = 0.33333
-
-        // local storage: stresses at this current time step
-        epsilondev_xx_loc = duxdxl - templ;
-        epsilondev_yy_loc = duydyl - templ;
-        epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl;
-        epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl;
-        epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl;
-
-        if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) {
-          epsilon_trace_over_3[tx] = templ;
-        }else{
-          epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
-        }
-      }
     }
 
     // attenuation
@@ -1526,7 +1377,6 @@
                                                 d_epsilon_trace_over_3,
                                                 mp->simulation_type,
                                                 mp->attenuation,
-                                                mp->attenuation_new,
                                                 mp->use_attenuation_mimic,
                                                 mp->use_3d_attenuation_arrays,
                                                 d_one_minus_sum_beta,d_factor_common,
@@ -1577,7 +1427,6 @@
                                                    d_b_epsilon_trace_over_3,
                                                    mp->simulation_type,
                                                    mp->attenuation,
-                                                   mp->attenuation_new,
                                                    mp->use_attenuation_mimic,
                                                    mp->use_3d_attenuation_arrays,
                                                    d_one_minus_sum_beta,d_factor_common,
@@ -1649,10 +1498,10 @@
 
     int nb_colors,nb_blocks_to_compute;
     int istart;
-    int color_offset,color_offset_nonpadded;
-    int color_offset_nonpadded_att1,color_offset_nonpadded_att2,color_offset_nonpadded_att3;
-    int color_offset_nonpadded_strain;
-    int color_offset_ispec;
+    int offset,offset_nonpadded;
+    int offset_nonpadded_att1,offset_nonpadded_att2,offset_nonpadded_att3;
+    int offset_nonpadded_strain;
+    int offset_ispec;
 
     // sets up color loop
     if( *iphase == 1 ){
@@ -1661,38 +1510,38 @@
       istart = 0;
 
       // array offsets
-      color_offset = 0;
-      color_offset_nonpadded = 0;
-      color_offset_nonpadded_att1 = 0;
-      color_offset_nonpadded_att2 = 0;
-      color_offset_nonpadded_att3 = 0;
-      color_offset_nonpadded_strain = 0;
-      color_offset_ispec = 0;
+      offset = 0;
+      offset_nonpadded = 0;
+      offset_nonpadded_att1 = 0;
+      offset_nonpadded_att2 = 0;
+      offset_nonpadded_att3 = 0;
+      offset_nonpadded_strain = 0;
+      offset_ispec = 0;
     }else{
       // inner elements (start after outer elements)
       nb_colors = mp->num_colors_outer_crust_mantle + mp->num_colors_inner_crust_mantle;
       istart = mp->num_colors_outer_crust_mantle;
 
       // array offsets
-      color_offset = (mp->nspec_outer_crust_mantle) * NGLL3_PADDED;
-      color_offset_nonpadded = (mp->nspec_outer_crust_mantle) * NGLL3;
-      color_offset_nonpadded_att1 = (mp->nspec_outer_crust_mantle) * NGLL3 * N_SLS;
+      offset = (mp->nspec_outer_crust_mantle) * NGLL3_PADDED;
+      offset_nonpadded = (mp->nspec_outer_crust_mantle) * NGLL3;
+      offset_nonpadded_att1 = (mp->nspec_outer_crust_mantle) * NGLL3 * N_SLS;
 
       // for factor_common array
       if( mp->use_3d_attenuation_arrays ){
-        color_offset_nonpadded_att2 = (mp->nspec_outer_crust_mantle) * NGLL3;
-        color_offset_nonpadded_att3 = (mp->nspec_outer_crust_mantle) * NGLL3 * N_SLS;
+        offset_nonpadded_att2 = (mp->nspec_outer_crust_mantle) * NGLL3;
+        offset_nonpadded_att3 = (mp->nspec_outer_crust_mantle) * NGLL3 * N_SLS;
       }else{
-        color_offset_nonpadded_att2 = (mp->nspec_outer_crust_mantle) * 1;
-        color_offset_nonpadded_att3 = (mp->nspec_outer_crust_mantle) * 1 * N_SLS;
+        offset_nonpadded_att2 = (mp->nspec_outer_crust_mantle) * 1;
+        offset_nonpadded_att3 = (mp->nspec_outer_crust_mantle) * 1 * N_SLS;
       }
       // for tiso models
       if( ! mp->anisotropic_3D_mantle ){
-        color_offset_ispec = mp->nspec_outer_crust_mantle;
+        offset_ispec = mp->nspec_outer_crust_mantle;
       }
       // for strain
       if( ! ( mp->NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1 ) ){
-        color_offset_nonpadded_strain = (mp->nspec_outer_crust_mantle) * NGLL3;
+        offset_nonpadded_strain = (mp->nspec_outer_crust_mantle) * NGLL3;
       }
     }
 
@@ -1712,88 +1561,88 @@
 
       Kernel_2_crust_mantle(nb_blocks_to_compute,mp,
                             *iphase,
-                            mp->d_ibool_crust_mantle + color_offset_nonpadded,
-                            mp->d_ispec_is_tiso_crust_mantle + color_offset_ispec,
-                            mp->d_xix_crust_mantle + color_offset,
-                            mp->d_xiy_crust_mantle + color_offset,
-                            mp->d_xiz_crust_mantle + color_offset,
-                            mp->d_etax_crust_mantle + color_offset,
-                            mp->d_etay_crust_mantle + color_offset,
-                            mp->d_etaz_crust_mantle + color_offset,
-                            mp->d_gammax_crust_mantle + color_offset,
-                            mp->d_gammay_crust_mantle + color_offset,
-                            mp->d_gammaz_crust_mantle + color_offset,
-                            mp->d_kappavstore_crust_mantle + color_offset,
-                            mp->d_muvstore_crust_mantle + color_offset,
-                            mp->d_kappahstore_crust_mantle + color_offset,
-                            mp->d_muhstore_crust_mantle + color_offset,
-                            mp->d_eta_anisostore_crust_mantle + color_offset,
-                            mp->d_epsilondev_xx_crust_mantle + color_offset_nonpadded,
-                            mp->d_epsilondev_yy_crust_mantle + color_offset_nonpadded,
-                            mp->d_epsilondev_xy_crust_mantle + color_offset_nonpadded,
-                            mp->d_epsilondev_xz_crust_mantle + color_offset_nonpadded,
-                            mp->d_epsilondev_yz_crust_mantle + color_offset_nonpadded,
-                            mp->d_eps_trace_over_3_crust_mantle + color_offset_nonpadded_strain,
-                            mp->d_one_minus_sum_beta_crust_mantle + color_offset_nonpadded_att2,
-                            mp->d_factor_common_crust_mantle + color_offset_nonpadded_att3,
-                            mp->d_R_xx_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_R_yy_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_R_xy_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_R_xz_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_R_yz_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_b_epsilondev_xx_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_epsilondev_yy_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_epsilondev_xy_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_epsilondev_xz_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_epsilondev_yz_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_eps_trace_over_3_crust_mantle + color_offset_nonpadded,
-                            mp->d_b_R_xx_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_b_R_yy_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_b_R_xy_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_b_R_xz_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_b_R_yz_crust_mantle + color_offset_nonpadded_att1,
-                            mp->d_c11store_crust_mantle + color_offset,
-                            mp->d_c12store_crust_mantle + color_offset,
-                            mp->d_c13store_crust_mantle + color_offset,
-                            mp->d_c14store_crust_mantle + color_offset,
-                            mp->d_c15store_crust_mantle + color_offset,
-                            mp->d_c16store_crust_mantle + color_offset,
-                            mp->d_c22store_crust_mantle + color_offset,
-                            mp->d_c23store_crust_mantle + color_offset,
-                            mp->d_c24store_crust_mantle + color_offset,
-                            mp->d_c25store_crust_mantle + color_offset,
-                            mp->d_c26store_crust_mantle + color_offset,
-                            mp->d_c33store_crust_mantle + color_offset,
-                            mp->d_c34store_crust_mantle + color_offset,
-                            mp->d_c35store_crust_mantle + color_offset,
-                            mp->d_c36store_crust_mantle + color_offset,
-                            mp->d_c44store_crust_mantle + color_offset,
-                            mp->d_c45store_crust_mantle + color_offset,
-                            mp->d_c46store_crust_mantle + color_offset,
-                            mp->d_c55store_crust_mantle + color_offset,
-                            mp->d_c56store_crust_mantle + color_offset,
-                            mp->d_c66store_crust_mantle + color_offset);
+                            mp->d_ibool_crust_mantle + offset_nonpadded,
+                            mp->d_ispec_is_tiso_crust_mantle + offset_ispec,
+                            mp->d_xix_crust_mantle + offset,
+                            mp->d_xiy_crust_mantle + offset,
+                            mp->d_xiz_crust_mantle + offset,
+                            mp->d_etax_crust_mantle + offset,
+                            mp->d_etay_crust_mantle + offset,
+                            mp->d_etaz_crust_mantle + offset,
+                            mp->d_gammax_crust_mantle + offset,
+                            mp->d_gammay_crust_mantle + offset,
+                            mp->d_gammaz_crust_mantle + offset,
+                            mp->d_kappavstore_crust_mantle + offset,
+                            mp->d_muvstore_crust_mantle + offset,
+                            mp->d_kappahstore_crust_mantle + offset,
+                            mp->d_muhstore_crust_mantle + offset,
+                            mp->d_eta_anisostore_crust_mantle + offset,
+                            mp->d_epsilondev_xx_crust_mantle + offset_nonpadded,
+                            mp->d_epsilondev_yy_crust_mantle + offset_nonpadded,
+                            mp->d_epsilondev_xy_crust_mantle + offset_nonpadded,
+                            mp->d_epsilondev_xz_crust_mantle + offset_nonpadded,
+                            mp->d_epsilondev_yz_crust_mantle + offset_nonpadded,
+                            mp->d_eps_trace_over_3_crust_mantle + offset_nonpadded_strain,
+                            mp->d_one_minus_sum_beta_crust_mantle + offset_nonpadded_att2,
+                            mp->d_factor_common_crust_mantle + offset_nonpadded_att3,
+                            mp->d_R_xx_crust_mantle + offset_nonpadded_att1,
+                            mp->d_R_yy_crust_mantle + offset_nonpadded_att1,
+                            mp->d_R_xy_crust_mantle + offset_nonpadded_att1,
+                            mp->d_R_xz_crust_mantle + offset_nonpadded_att1,
+                            mp->d_R_yz_crust_mantle + offset_nonpadded_att1,
+                            mp->d_b_epsilondev_xx_crust_mantle + offset_nonpadded,
+                            mp->d_b_epsilondev_yy_crust_mantle + offset_nonpadded,
+                            mp->d_b_epsilondev_xy_crust_mantle + offset_nonpadded,
+                            mp->d_b_epsilondev_xz_crust_mantle + offset_nonpadded,
+                            mp->d_b_epsilondev_yz_crust_mantle + offset_nonpadded,
+                            mp->d_b_eps_trace_over_3_crust_mantle + offset_nonpadded,
+                            mp->d_b_R_xx_crust_mantle + offset_nonpadded_att1,
+                            mp->d_b_R_yy_crust_mantle + offset_nonpadded_att1,
+                            mp->d_b_R_xy_crust_mantle + offset_nonpadded_att1,
+                            mp->d_b_R_xz_crust_mantle + offset_nonpadded_att1,
+                            mp->d_b_R_yz_crust_mantle + offset_nonpadded_att1,
+                            mp->d_c11store_crust_mantle + offset,
+                            mp->d_c12store_crust_mantle + offset,
+                            mp->d_c13store_crust_mantle + offset,
+                            mp->d_c14store_crust_mantle + offset,
+                            mp->d_c15store_crust_mantle + offset,
+                            mp->d_c16store_crust_mantle + offset,
+                            mp->d_c22store_crust_mantle + offset,
+                            mp->d_c23store_crust_mantle + offset,
+                            mp->d_c24store_crust_mantle + offset,
+                            mp->d_c25store_crust_mantle + offset,
+                            mp->d_c26store_crust_mantle + offset,
+                            mp->d_c33store_crust_mantle + offset,
+                            mp->d_c34store_crust_mantle + offset,
+                            mp->d_c35store_crust_mantle + offset,
+                            mp->d_c36store_crust_mantle + offset,
+                            mp->d_c44store_crust_mantle + offset,
+                            mp->d_c45store_crust_mantle + offset,
+                            mp->d_c46store_crust_mantle + offset,
+                            mp->d_c55store_crust_mantle + offset,
+                            mp->d_c56store_crust_mantle + offset,
+                            mp->d_c66store_crust_mantle + offset);
 
       // for padded and aligned arrays
-      color_offset += nb_blocks_to_compute * NGLL3_PADDED;
+      offset += nb_blocks_to_compute * NGLL3_PADDED;
       // for no-aligned arrays
-      color_offset_nonpadded += nb_blocks_to_compute * NGLL3;
-      color_offset_nonpadded_att1 += nb_blocks_to_compute * NGLL3 * N_SLS;
+      offset_nonpadded += nb_blocks_to_compute * NGLL3;
+      offset_nonpadded_att1 += nb_blocks_to_compute * NGLL3 * N_SLS;
       // for factor_common array
       if( mp->use_3d_attenuation_arrays ){
-        color_offset_nonpadded_att2 += nb_blocks_to_compute * NGLL3;
-        color_offset_nonpadded_att3 += nb_blocks_to_compute * NGLL3 * N_SLS;
+        offset_nonpadded_att2 += nb_blocks_to_compute * NGLL3;
+        offset_nonpadded_att3 += nb_blocks_to_compute * NGLL3 * N_SLS;
       }else{
-        color_offset_nonpadded_att2 += nb_blocks_to_compute * 1;
-        color_offset_nonpadded_att3 += nb_blocks_to_compute * 1 * N_SLS;
+        offset_nonpadded_att2 += nb_blocks_to_compute * 1;
+        offset_nonpadded_att3 += nb_blocks_to_compute * 1 * N_SLS;
       }
       // for tiso models
       if( ! mp->anisotropic_3D_mantle ){
-        color_offset_ispec += nb_blocks_to_compute;
+        offset_ispec += nb_blocks_to_compute;
       }
       // for strain
       if( ! ( mp->NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1 ) ){
-        color_offset_nonpadded_strain += nb_blocks_to_compute * NGLL3;
+        offset_nonpadded_strain += nb_blocks_to_compute * NGLL3;
       }
 
     } // icolor

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_inner_core_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_inner_core_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_inner_core_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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
@@ -328,7 +328,6 @@
                                          realw* epsilon_trace_over_3,
                                          int SIMULATION_TYPE,
                                          int ATTENUATION,
-                                         int ATTENUATION_NEW,
                                          int USE_ATTENUATION_MIMIC,
                                          int USE_3D_ATTENUATION_ARRAYS,
                                          realw* one_minus_sum_beta,realw* factor_common,
@@ -364,11 +363,6 @@
   realw duxdxl,duxdyl,duxdzl,duydxl,duydyl,duydzl,duzdxl,duzdyl,duzdzl;
   realw duxdxl_plus_duydyl,duxdxl_plus_duzdzl,duydyl_plus_duzdzl;
   realw duxdyl_plus_duydxl,duzdxl_plus_duxdzl,duzdyl_plus_duydzl;
-
-  // attenuation
-  realw tempx1l_att,tempx2l_att,tempx3l_att,tempy1l_att,tempy2l_att,tempy3l_att,tempz1l_att,tempz2l_att,tempz3l_att;
-  realw duxdxl_att,duxdyl_att,duxdzl_att,duydxl_att,duydyl_att,duydzl_att,duzdxl_att,duzdyl_att,duzdzl_att;
-  realw duxdyl_plus_duydxl_att,duzdxl_plus_duxdzl_att,duzdyl_plus_duydzl_att;
   realw templ;
 
   realw fac1,fac2,fac3;
@@ -392,16 +386,14 @@
   __shared__ realw s_dummyy_loc[NGLL3];
   __shared__ realw s_dummyz_loc[NGLL3];
 
-  __shared__ realw s_dummyx_loc_att[NGLL3];
-  __shared__ realw s_dummyy_loc_att[NGLL3];
-  __shared__ realw s_dummyz_loc_att[NGLL3];
-
   __shared__ realw s_tempx1[NGLL3];
   __shared__ realw s_tempx2[NGLL3];
   __shared__ realw s_tempx3[NGLL3];
+
   __shared__ realw s_tempy1[NGLL3];
   __shared__ realw s_tempy2[NGLL3];
   __shared__ realw s_tempy3[NGLL3];
+
   __shared__ realw s_tempz1[NGLL3];
   __shared__ realw s_tempz2[NGLL3];
   __shared__ realw s_tempz3[NGLL3];
@@ -446,23 +438,6 @@
       s_dummyy_loc[tx] = d_displ[iglob*3 + 1];
       s_dummyz_loc[tx] = d_displ[iglob*3 + 2];
 #endif
-
-      if(ATTENUATION){
-        if(ATTENUATION_NEW){
-          // takes new routines
-          // use first order Taylor expansion of displacement for local storage of stresses
-          // at this current time step, to fix attenuation in a consistent way
-          s_dummyx_loc_att[tx] = s_dummyx_loc[tx] + deltat * d_veloc[iglob*3];
-          s_dummyy_loc_att[tx] = s_dummyy_loc[tx] + deltat * d_veloc[iglob*3 + 1];
-          s_dummyz_loc_att[tx] = s_dummyz_loc[tx] + deltat * d_veloc[iglob*3 + 2];
-        }
-        else{
-          // takes old routines
-          s_dummyx_loc_att[tx] = s_dummyx_loc[tx];
-          s_dummyy_loc_att[tx] = s_dummyy_loc[tx];
-          s_dummyz_loc_att[tx] = s_dummyz_loc[tx];
-        }
-      }
     }
   }
 
@@ -517,40 +492,6 @@
         tempz3l += s_dummyz_loc[offset]*fac3;
     }
 
-    if( ATTENUATION ){
-      // temporary variables used for fixing attenuation in a consistent way
-      tempx1l_att = 0.f;
-      tempx2l_att = 0.f;
-      tempx3l_att = 0.f;
-
-      tempy1l_att = 0.f;
-      tempy2l_att = 0.f;
-      tempy3l_att = 0.f;
-
-      tempz1l_att = 0.f;
-      tempz2l_att = 0.f;
-      tempz3l_att = 0.f;
-
-      for (l=0;l<NGLLX;l++) {
-        fac1 = sh_hprime_xx[l*NGLLX+I];
-        offset = K*NGLL2+J*NGLLX+l;
-        tempx1l_att += s_dummyx_loc_att[offset]*fac1;
-        tempy1l_att += s_dummyy_loc_att[offset]*fac1;
-        tempz1l_att += s_dummyz_loc_att[offset]*fac1;
-
-        fac2 = sh_hprime_xx[l*NGLLX+J];
-        offset = K*NGLL2+l*NGLLX+I;
-        tempx2l_att += s_dummyx_loc_att[offset]*fac2;
-        tempy2l_att += s_dummyy_loc_att[offset]*fac2;
-        tempz2l_att += s_dummyz_loc_att[offset]*fac2;
-
-        fac3 = sh_hprime_xx[l*NGLLX+K];
-        offset = l*NGLL2+J*NGLLX+I;
-        tempx3l_att += s_dummyx_loc_att[offset]*fac3;
-        tempy3l_att += s_dummyy_loc_att[offset]*fac3;
-        tempz3l_att += s_dummyz_loc_att[offset]*fac3;
-      }
-    }
 #else
 
     tempx1l = s_dummyx_loc[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
@@ -607,63 +548,6 @@
             + s_dummyz_loc[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
             + s_dummyz_loc[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
 
-    if( ATTENUATION ){
-      // temporary variables used for fixing attenuation in a consistent way
-      tempx1l_att = s_dummyx_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyx_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
-
-      tempy1l_att = s_dummyy_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyy_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
-
-      tempz1l_att = s_dummyz_loc_att[K*NGLL2+J*NGLLX]*sh_hprime_xx[I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+1]*sh_hprime_xx[NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+2]*sh_hprime_xx[2*NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+3]*sh_hprime_xx[3*NGLLX+I]
-        + s_dummyz_loc_att[K*NGLL2+J*NGLLX+4]*sh_hprime_xx[4*NGLLX+I];
-
-      tempx2l_att = s_dummyx_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyx_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyx_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempy2l_att = s_dummyy_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyy_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyy_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempz2l_att = s_dummyz_loc_att[K*NGLL2+I]*sh_hprime_xx[J]
-        + s_dummyz_loc_att[K*NGLL2+NGLLX+I]*sh_hprime_xx[NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+2*NGLLX+I]*sh_hprime_xx[2*NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+3*NGLLX+I]*sh_hprime_xx[3*NGLLX+J]
-        + s_dummyz_loc_att[K*NGLL2+4*NGLLX+I]*sh_hprime_xx[4*NGLLX+J];
-
-      tempx3l_att = s_dummyx_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyx_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyx_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyx_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyx_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-
-      tempy3l_att = s_dummyy_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyy_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyy_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyy_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyy_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-
-      tempz3l_att = s_dummyz_loc_att[J*NGLLX+I]*sh_hprime_xx[K]
-        + s_dummyz_loc_att[NGLL2+J*NGLLX+I]*sh_hprime_xx[NGLLX+K]
-        + s_dummyz_loc_att[2*NGLL2+J*NGLLX+I]*sh_hprime_xx[2*NGLLX+K]
-        + s_dummyz_loc_att[3*NGLL2+J*NGLLX+I]*sh_hprime_xx[3*NGLLX+K]
-        + s_dummyz_loc_att[4*NGLL2+J*NGLLX+I]*sh_hprime_xx[4*NGLLX+K];
-    }
-
 #endif
 
 // compute derivatives of ux, uy and uz with respect to x, y and z
@@ -699,60 +583,22 @@
     duzdxl_plus_duxdzl = duzdxl + duxdzl;
     duzdyl_plus_duydzl = duzdyl + duydzl;
 
-    if(ATTENUATION){
-      // temporary variables used for fixing attenuation in a consistent way
-      duxdxl_att = xixl*tempx1l_att + etaxl*tempx2l_att + gammaxl*tempx3l_att;
-      duxdyl_att = xiyl*tempx1l_att + etayl*tempx2l_att + gammayl*tempx3l_att;
-      duxdzl_att = xizl*tempx1l_att + etazl*tempx2l_att + gammazl*tempx3l_att;
+    // computes deviatoric strain attenuation and/or for kernel calculations
+    if(COMPUTE_AND_STORE_STRAIN) {
+      templ = 0.33333333333333333333f * (duxdxl + duydyl + duzdzl); // 1./3. = 0.33333
 
-      duydxl_att = xixl*tempy1l_att + etaxl*tempy2l_att + gammaxl*tempy3l_att;
-      duydyl_att = xiyl*tempy1l_att + etayl*tempy2l_att + gammayl*tempy3l_att;
-      duydzl_att = xizl*tempy1l_att + etazl*tempy2l_att + gammazl*tempy3l_att;
+      // local storage: stresses at this current time step
+      epsilondev_xx_loc = duxdxl - templ;
+      epsilondev_yy_loc = duydyl - templ;
+      epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl;
+      epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl;
+      epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl;
 
-      duzdxl_att = xixl*tempz1l_att + etaxl*tempz2l_att + gammaxl*tempz3l_att;
-      duzdyl_att = xiyl*tempz1l_att + etayl*tempz2l_att + gammayl*tempz3l_att;
-      duzdzl_att = xizl*tempz1l_att + etazl*tempz2l_att + gammazl*tempz3l_att;
-
-      // precompute some sums to save CPU time
-      duxdyl_plus_duydxl_att = duxdyl_att + duydxl_att;
-      duzdxl_plus_duxdzl_att = duzdxl_att + duxdzl_att;
-      duzdyl_plus_duydzl_att = duzdyl_att + duydzl_att;
-
-      // computes deviatoric strain attenuation and/or for kernel calculations
-      if(COMPUTE_AND_STORE_STRAIN) {
-        templ = 0.33333333333333333333f * (duxdxl_att + duydyl_att + duzdzl_att); // 1./3. = 0.33333
-
-        // local storage: stresses at this current time step
-        epsilondev_xx_loc = duxdxl_att - templ;
-        epsilondev_yy_loc = duydyl_att - templ;
-        epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl_att;
-        epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl_att;
-        epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl_att;
-
-        if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) {
-          epsilon_trace_over_3[tx] = templ;
-        }else{
-          epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
-        }
+      if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) {
+        epsilon_trace_over_3[tx] = templ;
+      }else{
+        epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
       }
-    }else{
-      // computes deviatoric strain attenuation and/or for kernel calculations
-      if(COMPUTE_AND_STORE_STRAIN) {
-        templ = 0.33333333333333333333f * (duxdxl + duydyl + duzdzl); // 1./3. = 0.33333
-
-        // local storage: stresses at this current time step
-        epsilondev_xx_loc = duxdxl - templ;
-        epsilondev_yy_loc = duydyl - templ;
-        epsilondev_xy_loc = 0.5f * duxdyl_plus_duydxl;
-        epsilondev_xz_loc = 0.5f * duzdxl_plus_duxdzl;
-        epsilondev_yz_loc = 0.5f * duzdyl_plus_duydzl;
-
-        if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) {
-          epsilon_trace_over_3[tx] = templ;
-        }else{
-          epsilon_trace_over_3[tx + working_element*NGLL3] = templ;
-        }
-      }
     }
 
     // compute elements with an elastic isotropic rheology
@@ -1159,7 +1005,6 @@
                                              d_epsilon_trace_over_3,
                                              mp->simulation_type,
                                              mp->attenuation,
-                                             mp->attenuation_new,
                                              mp->use_attenuation_mimic,
                                              mp->use_3d_attenuation_arrays,
                                              d_one_minus_sum_beta,
@@ -1208,7 +1053,6 @@
                                                 d_b_epsilon_trace_over_3,
                                                 mp->simulation_type,
                                                 mp->attenuation,
-                                                mp->attenuation_new,
                                                 mp->use_attenuation_mimic,
                                                 mp->use_3d_attenuation_arrays,
                                                 d_one_minus_sum_beta,
@@ -1277,10 +1121,10 @@
 
     int nb_colors,nb_blocks_to_compute;
     int istart;
-    int color_offset,color_offset_nonpadded;
-    int color_offset_nonpadded_att1,color_offset_nonpadded_att2,color_offset_nonpadded_att3;
-    int color_offset_nonpadded_strain;
-    int color_offset_ispec;
+    int offset,offset_nonpadded;
+    int offset_nonpadded_att1,offset_nonpadded_att2,offset_nonpadded_att3;
+    int offset_nonpadded_strain;
+    int offset_ispec;
 
     // sets up color loop
     if( mp->NSPEC_INNER_CORE > COLORING_MIN_NSPEC_INNER_CORE ){
@@ -1290,35 +1134,35 @@
         istart = 0;
 
         // array offsets
-        color_offset = 0;
-        color_offset_nonpadded = 0;
-        color_offset_nonpadded_att1 = 0;
-        color_offset_nonpadded_att2 = 0;
-        color_offset_nonpadded_att3 = 0;
-        color_offset_nonpadded_strain = 0;
-        color_offset_ispec = 0;
+        offset = 0;
+        offset_nonpadded = 0;
+        offset_nonpadded_att1 = 0;
+        offset_nonpadded_att2 = 0;
+        offset_nonpadded_att3 = 0;
+        offset_nonpadded_strain = 0;
+        offset_ispec = 0;
       }else{
         // inner elements (start after outer elements)
         nb_colors = mp->num_colors_outer_inner_core + mp->num_colors_inner_inner_core;
         istart = mp->num_colors_outer_inner_core;
 
         // array offsets
-        color_offset = (mp->nspec_outer_inner_core) * NGLL3_PADDED;
-        color_offset_nonpadded = (mp->nspec_outer_inner_core) * NGLL3;
-        color_offset_nonpadded_att1 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
+        offset = (mp->nspec_outer_inner_core) * NGLL3_PADDED;
+        offset_nonpadded = (mp->nspec_outer_inner_core) * NGLL3;
+        offset_nonpadded_att1 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
         // for factor_common array
         if( mp->use_3d_attenuation_arrays ){
-          color_offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * NGLL3;
-          color_offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
+          offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * NGLL3;
+          offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
         }else{
-          color_offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * 1;
-          color_offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * 1 * N_SLS;
+          offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * 1;
+          offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * 1 * N_SLS;
         }
         // for idoubling array
-        color_offset_ispec = mp->nspec_outer_inner_core;
+        offset_ispec = mp->nspec_outer_inner_core;
         // for strain
         if( ! mp->NSPEC_INNER_CORE_STRAIN_ONLY == 1 ){
-          color_offset_nonpadded_strain = (mp->nspec_outer_inner_core) * NGLL3;
+          offset_nonpadded_strain = (mp->nspec_outer_inner_core) * NGLL3;
         }
       }
     }else{
@@ -1331,35 +1175,35 @@
         istart = 0;
 
         // array offsets
-        color_offset = 0;
-        color_offset_nonpadded = 0;
-        color_offset_nonpadded_att1 = 0;
-        color_offset_nonpadded_att2 = 0;
-        color_offset_nonpadded_att3 = 0;
-        color_offset_nonpadded_strain = 0;
-        color_offset_ispec = 0;
+        offset = 0;
+        offset_nonpadded = 0;
+        offset_nonpadded_att1 = 0;
+        offset_nonpadded_att2 = 0;
+        offset_nonpadded_att3 = 0;
+        offset_nonpadded_strain = 0;
+        offset_ispec = 0;
       }else{
         // inner element colors (start after outer elements)
         nb_colors = 1;
         istart = 0;
 
         // array offsets
-        color_offset = (mp->nspec_outer_inner_core) * NGLL3_PADDED;
-        color_offset_nonpadded = (mp->nspec_outer_inner_core) * NGLL3;
-        color_offset_nonpadded_att1 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
+        offset = (mp->nspec_outer_inner_core) * NGLL3_PADDED;
+        offset_nonpadded = (mp->nspec_outer_inner_core) * NGLL3;
+        offset_nonpadded_att1 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
         // for factor_common array
         if( mp->use_3d_attenuation_arrays ){
-          color_offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * NGLL3;
-          color_offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
+          offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * NGLL3;
+          offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * NGLL3 * N_SLS;
         }else{
-          color_offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * 1;
-          color_offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * 1 * N_SLS;
+          offset_nonpadded_att2 = (mp->nspec_outer_inner_core) * 1;
+          offset_nonpadded_att3 = (mp->nspec_outer_inner_core) * 1 * N_SLS;
         }
         // for idoubling array
-        color_offset_ispec = mp->nspec_outer_inner_core;
+        offset_ispec = mp->nspec_outer_inner_core;
         // for strain
         if( ! mp->NSPEC_INNER_CORE_STRAIN_ONLY == 1 ){
-          color_offset_nonpadded_strain = (mp->nspec_outer_inner_core) * NGLL3;
+          offset_nonpadded_strain = (mp->nspec_outer_inner_core) * NGLL3;
         }
       }
     }
@@ -1385,67 +1229,67 @@
 
       Kernel_2_inner_core(nb_blocks_to_compute,mp,
                           *iphase,
-                          mp->d_ibool_inner_core + color_offset_nonpadded,
-                          mp->d_idoubling_inner_core + color_offset_ispec,
-                          mp->d_xix_inner_core + color_offset,
-                          mp->d_xiy_inner_core + color_offset,
-                          mp->d_xiz_inner_core + color_offset,
-                          mp->d_etax_inner_core + color_offset,
-                          mp->d_etay_inner_core + color_offset,
-                          mp->d_etaz_inner_core + color_offset,
-                          mp->d_gammax_inner_core + color_offset,
-                          mp->d_gammay_inner_core + color_offset,
-                          mp->d_gammaz_inner_core + color_offset,
-                          mp->d_kappavstore_inner_core + color_offset,
-                          mp->d_muvstore_inner_core + color_offset,
-                          mp->d_epsilondev_xx_inner_core + color_offset_nonpadded,
-                          mp->d_epsilondev_yy_inner_core + color_offset_nonpadded,
-                          mp->d_epsilondev_xy_inner_core + color_offset_nonpadded,
-                          mp->d_epsilondev_xz_inner_core + color_offset_nonpadded,
-                          mp->d_epsilondev_yz_inner_core + color_offset_nonpadded,
-                          mp->d_eps_trace_over_3_inner_core + color_offset_nonpadded_strain,
-                          mp->d_one_minus_sum_beta_inner_core + color_offset_nonpadded_att2,
-                          mp->d_factor_common_inner_core + color_offset_nonpadded_att3,
-                          mp->d_R_xx_inner_core + color_offset_nonpadded_att1,
-                          mp->d_R_yy_inner_core + color_offset_nonpadded_att1,
-                          mp->d_R_xy_inner_core + color_offset_nonpadded_att1,
-                          mp->d_R_xz_inner_core + color_offset_nonpadded_att1,
-                          mp->d_R_yz_inner_core + color_offset_nonpadded_att1,
-                          mp->d_b_epsilondev_xx_inner_core + color_offset_nonpadded,
-                          mp->d_b_epsilondev_yy_inner_core + color_offset_nonpadded,
-                          mp->d_b_epsilondev_xy_inner_core + color_offset_nonpadded,
-                          mp->d_b_epsilondev_xz_inner_core + color_offset_nonpadded,
-                          mp->d_b_epsilondev_yz_inner_core + color_offset_nonpadded,
-                          mp->d_b_eps_trace_over_3_inner_core + color_offset_nonpadded,
-                          mp->d_b_R_xx_inner_core + color_offset_nonpadded_att1,
-                          mp->d_b_R_yy_inner_core + color_offset_nonpadded_att1,
-                          mp->d_b_R_xy_inner_core + color_offset_nonpadded_att1,
-                          mp->d_b_R_xz_inner_core + color_offset_nonpadded_att1,
-                          mp->d_b_R_yz_inner_core + color_offset_nonpadded_att1,
-                          mp->d_c11store_inner_core + color_offset,
-                          mp->d_c12store_inner_core + color_offset,
-                          mp->d_c13store_inner_core + color_offset,
-                          mp->d_c33store_inner_core + color_offset,
-                          mp->d_c44store_inner_core + color_offset);
+                          mp->d_ibool_inner_core + offset_nonpadded,
+                          mp->d_idoubling_inner_core + offset_ispec,
+                          mp->d_xix_inner_core + offset,
+                          mp->d_xiy_inner_core + offset,
+                          mp->d_xiz_inner_core + offset,
+                          mp->d_etax_inner_core + offset,
+                          mp->d_etay_inner_core + offset,
+                          mp->d_etaz_inner_core + offset,
+                          mp->d_gammax_inner_core + offset,
+                          mp->d_gammay_inner_core + offset,
+                          mp->d_gammaz_inner_core + offset,
+                          mp->d_kappavstore_inner_core + offset,
+                          mp->d_muvstore_inner_core + offset,
+                          mp->d_epsilondev_xx_inner_core + offset_nonpadded,
+                          mp->d_epsilondev_yy_inner_core + offset_nonpadded,
+                          mp->d_epsilondev_xy_inner_core + offset_nonpadded,
+                          mp->d_epsilondev_xz_inner_core + offset_nonpadded,
+                          mp->d_epsilondev_yz_inner_core + offset_nonpadded,
+                          mp->d_eps_trace_over_3_inner_core + offset_nonpadded_strain,
+                          mp->d_one_minus_sum_beta_inner_core + offset_nonpadded_att2,
+                          mp->d_factor_common_inner_core + offset_nonpadded_att3,
+                          mp->d_R_xx_inner_core + offset_nonpadded_att1,
+                          mp->d_R_yy_inner_core + offset_nonpadded_att1,
+                          mp->d_R_xy_inner_core + offset_nonpadded_att1,
+                          mp->d_R_xz_inner_core + offset_nonpadded_att1,
+                          mp->d_R_yz_inner_core + offset_nonpadded_att1,
+                          mp->d_b_epsilondev_xx_inner_core + offset_nonpadded,
+                          mp->d_b_epsilondev_yy_inner_core + offset_nonpadded,
+                          mp->d_b_epsilondev_xy_inner_core + offset_nonpadded,
+                          mp->d_b_epsilondev_xz_inner_core + offset_nonpadded,
+                          mp->d_b_epsilondev_yz_inner_core + offset_nonpadded,
+                          mp->d_b_eps_trace_over_3_inner_core + offset_nonpadded,
+                          mp->d_b_R_xx_inner_core + offset_nonpadded_att1,
+                          mp->d_b_R_yy_inner_core + offset_nonpadded_att1,
+                          mp->d_b_R_xy_inner_core + offset_nonpadded_att1,
+                          mp->d_b_R_xz_inner_core + offset_nonpadded_att1,
+                          mp->d_b_R_yz_inner_core + offset_nonpadded_att1,
+                          mp->d_c11store_inner_core + offset,
+                          mp->d_c12store_inner_core + offset,
+                          mp->d_c13store_inner_core + offset,
+                          mp->d_c33store_inner_core + offset,
+                          mp->d_c44store_inner_core + offset);
 
       // for padded and aligned arrays
-      color_offset += nb_blocks_to_compute * NGLL3_PADDED;
+      offset += nb_blocks_to_compute * NGLL3_PADDED;
       // for no-aligned arrays
-      color_offset_nonpadded += nb_blocks_to_compute * NGLL3;
-      color_offset_nonpadded_att1 += nb_blocks_to_compute * NGLL3 * N_SLS;
+      offset_nonpadded += nb_blocks_to_compute * NGLL3;
+      offset_nonpadded_att1 += nb_blocks_to_compute * NGLL3 * N_SLS;
       // for factor_common array
       if( mp->use_3d_attenuation_arrays ){
-        color_offset_nonpadded_att2 += nb_blocks_to_compute * NGLL3;
-        color_offset_nonpadded_att3 += nb_blocks_to_compute * NGLL3 * N_SLS;
+        offset_nonpadded_att2 += nb_blocks_to_compute * NGLL3;
+        offset_nonpadded_att3 += nb_blocks_to_compute * NGLL3 * N_SLS;
       }else{
-        color_offset_nonpadded_att2 += nb_blocks_to_compute * 1;
-        color_offset_nonpadded_att3 += nb_blocks_to_compute * 1 * N_SLS;
+        offset_nonpadded_att2 += nb_blocks_to_compute * 1;
+        offset_nonpadded_att3 += nb_blocks_to_compute * 1 * N_SLS;
       }
       // for array(ispec)
-      color_offset_ispec += nb_blocks_to_compute;
+      offset_ispec += nb_blocks_to_compute;
       // for strain
       if( ! mp->NSPEC_INNER_CORE_STRAIN_ONLY == 1 ){
-        color_offset_nonpadded_strain += nb_blocks_to_compute * NGLL3;
+        offset_nonpadded_strain += nb_blocks_to_compute * NGLL3;
       }
 
     } // icolor

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_outer_core_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_outer_core_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_forces_outer_core_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_kernels_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_kernels_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_kernels_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_acoustic_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_acoustic_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_acoustic_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_elastic_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_elastic_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/compute_stacey_elastic_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/it_update_displacement_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/it_update_displacement_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/it_update_displacement_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/mesh_constants_cuda.h
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/mesh_constants_cuda.h	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/mesh_constants_cuda.h	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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
@@ -543,7 +543,6 @@
   int absorbing_conditions;
 
   int attenuation;
-  int attenuation_new;
   int use_attenuation_mimic;
   int use_3d_attenuation_arrays;
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/noise_tomography_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/noise_tomography_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/noise_tomography_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_constants_cuda.h
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_constants_cuda.h	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_constants_cuda.h	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_mesh_constants_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_mesh_constants_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/prepare_mesh_constants_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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
@@ -136,7 +136,6 @@
                                         int* GRAVITY_f,
                                         int* ROTATION_f,
                                         int* ATTENUATION_f,
-                                        int* ATTENUATION_NEW_f,
                                         int* USE_ATTENUATION_MIMIC_f,
                                         int* USE_3D_ATTENUATION_ARRAYS_f,
                                         int* COMPUTE_AND_STORE_STRAIN_f,
@@ -239,7 +238,6 @@
   mp->rotation = *ROTATION_f;
 
   mp->attenuation = *ATTENUATION_f;
-  mp->attenuation_new = *ATTENUATION_NEW_f;
   mp->use_attenuation_mimic = *USE_ATTENUATION_MIMIC_f;
   mp->use_3d_attenuation_arrays = *USE_3D_ATTENUATION_ARRAYS_f;
 

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/rules.mk	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -0,0 +1,84 @@
+#=====================================================================
+#
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
+#          --------------------------------------------------
+#
+#          Main authors: Dimitri Komatitsch and Jeroen Tromp
+#                        Princeton University, USA
+#             and University of Pau / CNRS / INRIA, France
+# (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
+#                            August 2013
+#
+# 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.
+#
+#=====================================================================
+
+#######################################
+
+cuda_TARGETS = \
+	$(cuda_OBJECTS) \
+	$(EMPTY_MACRO)
+
+cuda_OBJECTS = \
+	$O/assemble_MPI_scalar_cuda.cuda.o \
+	$O/assemble_MPI_vector_cuda.cuda.o \
+	$O/check_fields_cuda.cuda.o \
+	$O/compute_add_sources_elastic_cuda.cuda.o \
+	$O/compute_coupling_cuda.cuda.o \
+	$O/compute_forces_crust_mantle_cuda.cuda.o \
+	$O/compute_forces_inner_core_cuda.cuda.o \
+	$O/compute_forces_outer_core_cuda.cuda.o \
+	$O/compute_kernels_cuda.cuda.o \
+	$O/compute_stacey_acoustic_cuda.cuda.o \
+	$O/compute_stacey_elastic_cuda.cuda.o \
+	$O/initialize_cuda.cuda.o \
+	$O/it_update_displacement_cuda.cuda.o \
+	$O/noise_tomography_cuda.cuda.o \
+	$O/prepare_mesh_constants_cuda.cuda.o \
+	$O/transfer_fields_cuda.cuda.o \
+	$O/write_seismograms_cuda.cuda.o \
+	$O/save_and_compare_cpu_vs_gpu.cudacc.o \
+	$(EMPTY_MACRO)
+
+cuda_STUBS = \
+	$O/specfem3D_gpu_cuda_method_stubs.cudacc.o \
+	$(EMPTY_MACRO)
+
+cuda_DEVICE_OBJ = \
+	$O/cuda_device_obj.o \
+	$(EMPTY_MACRO)
+
+
+#######################################
+
+## compilation directories
+S := ${S_TOP}/src/cuda
+$(cuda_OBJECTS): S = ${S_TOP}/src/cuda
+
+####
+#### rule for each .o file below
+####
+
+###
+### CUDA compilation
+###
+
+$O/%.cuda.o: $S/%.cu ${SETUP}/config.h $S/mesh_constants_cuda.h $S/prepare_constants_cuda.h
+	${NVCC} -c $< -o $@ $(NVCC_FLAGS)
+
+$O/%.cudacc.o: $S/%.c ${SETUP}/config.h
+	${CC} -c $(CPPFLAGS) $(CFLAGS) $(MPI_INC) -o $@ $< 
+
+

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/save_and_compare_cpu_vs_gpu.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/save_and_compare_cpu_vs_gpu.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/save_and_compare_cpu_vs_gpu.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/specfem3D_gpu_cuda_method_stubs.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/specfem3D_gpu_cuda_method_stubs.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/specfem3D_gpu_cuda_method_stubs.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
-/*
+/* 
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -34,8 +34,8 @@
 
 typedef float realw;
 
+ 
 
-
 //
 // src/cuda/assemble_MPI_scalar_cuda.cu
 //
@@ -43,12 +43,12 @@
 void FC_FUNC_(transfer_boun_pot_from_device,
               TRANSFER_BOUN_POT_FROM_DEVICE)(long* Mesh_pointer_f,
                                              realw* send_potential_dot_dot_buffer,
-                                             int* FORWARD_OR_ADJOINT){}
+                                             int* FORWARD_OR_ADJOINT){} 
 
 void FC_FUNC_(transfer_asmbl_pot_to_device,
               TRANSFER_ASMBL_POT_TO_DEVICE)(long* Mesh_pointer,
                                             realw* buffer_recv_scalar,
-                                            int* FORWARD_OR_ADJOINT) {}
+                                            int* FORWARD_OR_ADJOINT) {} 
 
 
 //
@@ -59,13 +59,13 @@
               TRANSFER_BOUN_ACCEL_FROM_DEVICE)(long* Mesh_pointer_f,
                                                   realw* send_accel_buffer,
                                                   int* IREGION,
-                                                  int* FORWARD_OR_ADJOINT){}
+                                                  int* FORWARD_OR_ADJOINT){} 
 
 void FC_FUNC_(transfer_asmbl_accel_to_device,
               TRANSFER_ASMBL_ACCEL_TO_DEVICE)(long* Mesh_pointer,
                                               realw* buffer_recv_vector,
                                               int* IREGION,
-                                              int* FORWARD_OR_ADJOINT) {}
+                                              int* FORWARD_OR_ADJOINT) {} 
 
 
 //
@@ -73,58 +73,58 @@
 //
 
 void FC_FUNC_(pause_for_debug,
-              PAUSE_FOR_DEBUG)() {}
+              PAUSE_FOR_DEBUG)() {} 
 
 void FC_FUNC_(output_free_device_memory,
-              OUTPUT_FREE_DEVICE_MEMORY)(int* myrank) {}
+              OUTPUT_FREE_DEVICE_MEMORY)(int* myrank) {} 
 
 void FC_FUNC_(get_free_device_memory,
-              get_FREE_DEVICE_MEMORY)(realw* free, realw* used, realw* total ) {}
+              get_FREE_DEVICE_MEMORY)(realw* free, realw* used, realw* total ) {} 
 
 void FC_FUNC_(check_norm_acoustic_from_device,
               CHECK_NORM_ACOUSTIC_FROM_DEVICE)(realw* norm,
                                                   long* Mesh_pointer_f,
-                                                  int* SIMULATION_TYPE) {}
+                                                  int* SIMULATION_TYPE) {} 
 
 void FC_FUNC_(check_norm_elastic_from_device,
               CHECK_NORM_ELASTIC_FROM_DEVICE)(realw* norm,
                                               long* Mesh_pointer_f,
-                                              int* SIMULATION_TYPE) {}
+                                              int* SIMULATION_TYPE) {} 
 
 void FC_FUNC_(check_norm_strain_from_device,
               CHECK_NORM_STRAIN_FROM_DEVICE)(realw* strain_norm,
                                              realw* strain_norm2,
-                                             long* Mesh_pointer_f) {}
+                                             long* Mesh_pointer_f) {} 
 
  void FC_FUNC_(check_max_norm_displ_gpu,
- CHECK_MAX_NORM_DISPL_GPU)(int* size, realw* displ,long* Mesh_pointer_f,int* announceID) {}
+ CHECK_MAX_NORM_DISPL_GPU)(int* size, realw* displ,long* Mesh_pointer_f,int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_vector,
- CHECK_MAX_NORM_VECTOR)(int* size, realw* vector1, int* announceID) {}
+ CHECK_MAX_NORM_VECTOR)(int* size, realw* vector1, int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_displ,
- CHECK_MAX_NORM_DISPL)(int* size, realw* displ, int* announceID) {}
+ CHECK_MAX_NORM_DISPL)(int* size, realw* displ, int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_b_displ_gpu,
- CHECK_MAX_NORM_B_DISPL_GPU)(int* size, realw* b_displ,long* Mesh_pointer_f,int* announceID) {}
+ CHECK_MAX_NORM_B_DISPL_GPU)(int* size, realw* b_displ,long* Mesh_pointer_f,int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_b_accel_gpu,
- CHECK_MAX_NORM_B_ACCEL_GPU)(int* size, realw* b_accel,long* Mesh_pointer_f,int* announceID) {}
+ CHECK_MAX_NORM_B_ACCEL_GPU)(int* size, realw* b_accel,long* Mesh_pointer_f,int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_b_veloc_gpu,
- CHECK_MAX_NORM_B_VELOC_GPU)(int* size, realw* b_veloc,long* Mesh_pointer_f,int* announceID) {}
+ CHECK_MAX_NORM_B_VELOC_GPU)(int* size, realw* b_veloc,long* Mesh_pointer_f,int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_b_displ,
- CHECK_MAX_NORM_B_DISPL)(int* size, realw* b_displ,int* announceID) {}
+ CHECK_MAX_NORM_B_DISPL)(int* size, realw* b_displ,int* announceID) {} 
 
  void FC_FUNC_(check_max_norm_b_accel,
- CHECK_MAX_NORM_B_ACCEL)(int* size, realw* b_accel,int* announceID) {}
+ CHECK_MAX_NORM_B_ACCEL)(int* size, realw* b_accel,int* announceID) {} 
 
  void FC_FUNC_(check_error_vectors,
- CHECK_ERROR_VECTORS)(int* sizef, realw* vector1,realw* vector2) {}
+ CHECK_ERROR_VECTORS)(int* sizef, realw* vector1,realw* vector2) {} 
 
  void FC_FUNC_(get_max_accel,
- GET_MAX_ACCEL)(int* itf,int* sizef,long* Mesh_pointer) {}
+ GET_MAX_ACCEL)(int* itf,int* sizef,long* Mesh_pointer) {} 
 
 
 //
@@ -134,12 +134,12 @@
 void FC_FUNC_(compute_add_sources_el_cuda,
               COMPUTE_ADD_SOURCES_EL_CUDA)(long* Mesh_pointer_f,
                                            int* NSOURCESf,
-                                           double* h_stf_pre_compute) {}
+                                           double* h_stf_pre_compute) {} 
 
 void FC_FUNC_(compute_add_sources_el_s3_cuda,
               COMPUTE_ADD_SOURCES_EL_S3_CUDA)(long* Mesh_pointer_f,
                                               int* NSOURCESf,
-                                              double* h_stf_pre_compute) {}
+                                              double* h_stf_pre_compute) {} 
 
 void FC_FUNC_(add_sources_el_sim_type_2_or_3,
               ADD_SOURCES_EL_SIM_TYPE_2_OR_3)(long* Mesh_pointer,
@@ -147,7 +147,7 @@
                                               realw* h_adj_sourcearrays,
                                               int* h_islice_selected_rec,
                                               int* h_ispec_selected_rec,
-                                              int* time_index) {}
+                                              int* time_index) {} 
 
 
 //
@@ -155,20 +155,20 @@
 //
 
 void FC_FUNC_(compute_coupling_fluid_cmb_cuda,
-              COMPUTE_COUPLING_FLUID_CMB_CUDA)(long* Mesh_pointer_f) {}
+              COMPUTE_COUPLING_FLUID_CMB_CUDA)(long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(compute_coupling_fluid_icb_cuda,
-              COMPUTE_COUPLING_FLUID_ICB_CUDA)(long* Mesh_pointer_f) {}
+              COMPUTE_COUPLING_FLUID_ICB_CUDA)(long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(compute_coupling_cmb_fluid_cuda,
-              COMPUTE_COUPLING_CMB_FLUID_CUDA)(long* Mesh_pointer_f) {}
+              COMPUTE_COUPLING_CMB_FLUID_CUDA)(long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(compute_coupling_icb_fluid_cuda,
-              COMPUTE_COUPLING_ICB_FLUID_CUDA)(long* Mesh_pointer_f) {}
+              COMPUTE_COUPLING_ICB_FLUID_CUDA)(long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(compute_coupling_ocean_cuda,
               COMPUTE_COUPLING_OCEAN_CUDA)(long* Mesh_pointer_f,
-                                           int* NCHUNKS_VAL) {}
+                                           int* NCHUNKS_VAL) {} 
 
 
 //
@@ -177,7 +177,7 @@
 
 void FC_FUNC_(compute_forces_crust_mantle_cuda,
               COMPUTE_FORCES_CRUST_MANTLE_CUDA)(long* Mesh_pointer_f,
-                                                int* iphase) {}
+                                                int* iphase) {} 
 
 
 //
@@ -186,7 +186,7 @@
 
 void FC_FUNC_(compute_forces_inner_core_cuda,
               COMPUTE_FORCES_INNER_CORE_CUDA)(long* Mesh_pointer_f,
-                                              int* iphase) {}
+                                              int* iphase) {} 
 
 
 //
@@ -197,7 +197,7 @@
               COMPUTE_FORCES_OUTER_CORE_CUDA)(long* Mesh_pointer_f,
                                               int* iphase,
                                               realw* time_f,
-                                              realw* b_time_f) {}
+                                              realw* b_time_f) {} 
 
 
 //
@@ -205,22 +205,22 @@
 //
 
 void FC_FUNC_(compute_kernels_cm_cuda,
-              COMPUTE_KERNELS_CM_CUDA)(long* Mesh_pointer,realw* deltat_f) {}
+              COMPUTE_KERNELS_CM_CUDA)(long* Mesh_pointer,realw* deltat_f) {} 
 
 void FC_FUNC_(compute_kernels_ic_cuda,
-              COMPUTE_KERNELS_IC_CUDA)(long* Mesh_pointer,realw* deltat_f) {}
+              COMPUTE_KERNELS_IC_CUDA)(long* Mesh_pointer,realw* deltat_f) {} 
 
 void FC_FUNC_(compute_kernels_oc_cuda,
-              COMPUTE_KERNELS_OC_CUDA)(long* Mesh_pointer,realw* deltat_f) {}
+              COMPUTE_KERNELS_OC_CUDA)(long* Mesh_pointer,realw* deltat_f) {} 
 
 void FC_FUNC_(compute_kernels_strgth_noise_cu,
               COMPUTE_KERNELS_STRGTH_NOISE_CU)(long* Mesh_pointer,
                                                realw* h_noise_surface_movie,
-                                               realw* deltat_f) {}
+                                               realw* deltat_f) {} 
 
 void FC_FUNC_(compute_kernels_hess_cuda,
               COMPUTE_KERNELS_HESS_CUDA)(long* Mesh_pointer,
-                                         realw* deltat_f) {}
+                                         realw* deltat_f) {} 
 
 
 //
@@ -230,7 +230,7 @@
 void FC_FUNC_(compute_stacey_acoustic_cuda,
               COMPUTE_STACEY_ACOUSTIC_CUDA)(long* Mesh_pointer_f,
                                             realw* absorb_potential,
-                                            int* itype) {}
+                                            int* itype) {} 
 
 
 //
@@ -240,7 +240,7 @@
 void FC_FUNC_(compute_stacey_elastic_cuda,
               COMPUTE_STACEY_ELASTIC_CUDA)(long* Mesh_pointer_f,
                                                 realw* absorb_field,
-                                                int* itype) {}
+                                                int* itype) {} 
 
 
 //
@@ -248,10 +248,10 @@
 //
 
 void FC_FUNC_(initialize_cuda_device,
-              INITIALIZE_CUDA_DEVICE)(int* myrank_f,int* ncuda_devices) {
+              INITIALIZE_CUDA_DEVICE)(int* myrank_f,int* ncuda_devices) { 
  fprintf(stderr,"ERROR: GPU_MODE enabled without GPU/CUDA Support. To enable GPU support, reconfigure with --with-cuda flag.\n");
  exit(1);
-}
+} 
 
 
 //
@@ -265,7 +265,7 @@
                                              realw* deltatover2_F,
                                              realw* b_deltat_F,
                                              realw* b_deltatsqover2_F,
-                                             realw* b_deltatover2_F) {}
+                                             realw* b_deltatover2_F) {} 
 
 void FC_FUNC_(it_update_displacement_cm_cuda,
               IT_UPDATE_DISPLACMENT_CM_CUDA)(long* Mesh_pointer_f,
@@ -274,7 +274,7 @@
                                              realw* deltatover2_F,
                                              realw* b_deltat_F,
                                              realw* b_deltatsqover2_F,
-                                             realw* b_deltatover2_F) {}
+                                             realw* b_deltatover2_F) {} 
 
 void FC_FUNC_(it_update_displacement_oc_cuda,
               IT_UPDATE_DISPLACEMENT_OC_cuda)(long* Mesh_pointer_f,
@@ -283,55 +283,55 @@
                                                realw* deltatover2_F,
                                                realw* b_deltat_F,
                                                realw* b_deltatsqover2_F,
-                                               realw* b_deltatover2_F) {}
+                                               realw* b_deltatover2_F) {} 
 
 void FC_FUNC_(kernel_3_a_cuda,
               KERNEL_3_A_CUDA)(long* Mesh_pointer,
                                realw* deltatover2_F,
                                int* SIMULATION_TYPE_f,
                                realw* b_deltatover2_F,
-                               int* NCHUNKS_VAL) {}
+                               int* NCHUNKS_VAL) {} 
 
 void FC_FUNC_(kernel_3_b_cuda,
               KERNEL_3_B_CUDA)(long* Mesh_pointer,
                                realw* deltatover2_F,
                                int* SIMULATION_TYPE_f,
-                               realw* b_deltatover2_F) {}
+                               realw* b_deltatover2_F) {} 
 
 void FC_FUNC_(kernel_3_outer_core_cuda,
               KERNEL_3_OUTER_CORE_CUDA)(long* Mesh_pointer,
                                         realw* deltatover2_F,
                                         int* SIMULATION_TYPE_f,
-                                        realw* b_deltatover2_F) {}
+                                        realw* b_deltatover2_F) {} 
 
 
 //
 // src/cuda/noise_tomography_cuda.cu
 //
 
-void FC_FUNC_(fortranflush,FORTRANFLUSH)(int* rank){}
+void FC_FUNC_(fortranflush,FORTRANFLUSH)(int* rank){} 
 
-void FC_FUNC_(fortranprint,FORTRANPRINT)(int* id) {}
+void FC_FUNC_(fortranprint,FORTRANPRINT)(int* id) {} 
 
-void FC_FUNC_(fortranprintf,FORTRANPRINTF)(realw* val) {}
+void FC_FUNC_(fortranprintf,FORTRANPRINTF)(realw* val) {} 
 
-void FC_FUNC_(fortranprintd,FORTRANPRINTD)(double* val) {}
+void FC_FUNC_(fortranprintd,FORTRANPRINTD)(double* val) {} 
 
-void FC_FUNC_(make_displ_rand,MAKE_DISPL_RAND)(long* Mesh_pointer_f,realw* h_displ) {}
+void FC_FUNC_(make_displ_rand,MAKE_DISPL_RAND)(long* Mesh_pointer_f,realw* h_displ) {} 
 
 void FC_FUNC_(noise_transfer_surface_to_host,
               NOISE_TRANSFER_SURFACE_TO_HOST)(long* Mesh_pointer_f,
-                                              realw* h_noise_surface_movie) {}
+                                              realw* h_noise_surface_movie) {} 
 
 void FC_FUNC_(noise_add_source_master_rec_cu,
               NOISE_ADD_SOURCE_MASTER_REC_CU)(long* Mesh_pointer_f,
                                               int* it_f,
                                               int* irec_master_noise_f,
-                                              int* islice_selected_rec) {}
+                                              int* islice_selected_rec) {} 
 
 void FC_FUNC_(noise_add_surface_movie_cuda,
               NOISE_ADD_SURFACE_MOVIE_CUDA)(long* Mesh_pointer_f,
-                                            realw* h_noise_surface_movie) {}
+                                            realw* h_noise_surface_movie) {} 
 
 
 //
@@ -364,7 +364,6 @@
                                         int* GRAVITY_f,
                                         int* ROTATION_f,
                                         int* ATTENUATION_f,
-                                        int* ATTENUATION_NEW_f,
                                         int* USE_ATTENUATION_MIMIC_f,
                                         int* USE_3D_ATTENUATION_ARRAYS_f,
                                         int* COMPUTE_AND_STORE_STRAIN_f,
@@ -375,7 +374,7 @@
                                         int* ANISOTROPIC_KL_f,
                                         int* APPROXIMATE_HESS_KL_f,
                                         realw* deltat_f,
-                                        realw* b_deltat_f) {}
+                                        realw* b_deltat_f) {} 
 
 void FC_FUNC_(prepare_fields_rotation_device,
               PREPARE_FIELDS_ROTATION_DEVICE)(long* Mesh_pointer_f,
@@ -385,7 +384,7 @@
                                               realw* b_two_omega_earth_f,
                                               realw* b_A_array_rotation,
                                               realw* b_B_array_rotation,
-                                              int* NSPEC_OUTER_CORE_ROTATION) {}
+                                              int* NSPEC_OUTER_CORE_ROTATION) {} 
 
 void FC_FUNC_(prepare_fields_gravity_device,
               PREPARE_FIELDS_gravity_DEVICE)(long* Mesh_pointer_f,
@@ -399,7 +398,7 @@
                                              realw* minus_g_icb,
                                              realw* minus_g_cmb,
                                              double* RHO_BOTTOM_OC,
-                                             double* RHO_TOP_OC) {}
+                                             double* RHO_TOP_OC) {} 
 
 void FC_FUNC_(prepare_fields_attenuat_device,
               PREPARE_FIELDS_ATTENUAT_DEVICE)(long* Mesh_pointer_f,
@@ -428,7 +427,7 @@
                                                  realw* factor_common_inner_core,
                                                  realw* one_minus_sum_beta_inner_core,
                                                  realw* alphaval,realw* betaval,realw* gammaval,
-                                                 realw* b_alphaval,realw* b_betaval,realw* b_gammaval) {}
+                                                 realw* b_alphaval,realw* b_betaval,realw* b_gammaval) {} 
 
 void FC_FUNC_(prepare_fields_strain_device,
               PREPARE_FIELDS_STRAIN_DEVICE)(long* Mesh_pointer_f,
@@ -455,7 +454,7 @@
                                             realw* b_epsilondev_xz_inner_core,
                                             realw* b_epsilondev_yz_inner_core,
                                             realw* eps_trace_over_3_inner_core,
-                                            realw* b_eps_trace_over_3_inner_core) {}
+                                            realw* b_eps_trace_over_3_inner_core) {} 
 
 void FC_FUNC_(prepare_fields_absorb_device,
               PREPARE_FIELDS_ABSORB_DEVICE)(long* Mesh_pointer_f,
@@ -484,7 +483,7 @@
                                             int* ibelm_ymin_outer_core,int* ibelm_ymax_outer_core,
                                             realw* jacobian2D_xmin_outer_core, realw* jacobian2D_xmax_outer_core,
                                             realw* jacobian2D_ymin_outer_core, realw* jacobian2D_ymax_outer_core,
-                                            realw* vp_outer_core) {}
+                                            realw* vp_outer_core) {} 
 
 void FC_FUNC_(prepare_mpi_buffers_device,
               PREPARE_MPI_BUFFERS_DEVICE)(long* Mesh_pointer_f,
@@ -499,7 +498,7 @@
                                           int* num_interfaces_outer_core,
                                           int* max_nibool_interfaces_oc,
                                           int* nibool_interfaces_outer_core,
-                                          int* ibool_interfaces_outer_core){}
+                                          int* ibool_interfaces_outer_core){} 
 
 void FC_FUNC_(prepare_fields_noise_device,
               PREPARE_FIELDS_NOISE_DEVICE)(long* Mesh_pointer_f,
@@ -511,14 +510,14 @@
                                            realw* normal_y_noise,
                                            realw* normal_z_noise,
                                            realw* mask_noise,
-                                           realw* jacobian2D_top_crust_mantle) {}
+                                           realw* jacobian2D_top_crust_mantle) {} 
 
 void FC_FUNC_(prepare_oceans_device,
               PREPARE_OCEANS_DEVICE)(long* Mesh_pointer_f,
                                      int* npoin_oceans,
                                      int* h_iglob_ocean_load,
                                      realw* h_rmass_ocean_load_selected,
-                                     realw* h_normal_ocean_load) {}
+                                     realw* h_normal_ocean_load) {} 
 
 void FC_FUNC_(prepare_crust_mantle_device,
              PREPARE_CRUST_MANTLE_DEVICE)(long* Mesh_pointer_f,
@@ -551,7 +550,7 @@
                                           int* NCHUNKS_VAL,
                                           int* num_colors_outer,
                                           int* num_colors_inner,
-                                          int* num_elem_colors) {}
+                                          int* num_elem_colors) {} 
 
 void FC_FUNC_(prepare_outer_core_device,
               PREPARE_OUTER_CORE_DEVICE)(long* Mesh_pointer_f,
@@ -576,7 +575,7 @@
                                          int* h_ibelm_bottom_outer_core,
                                          int* num_colors_outer,
                                          int* num_colors_inner,
-                                         int* num_elem_colors) {}
+                                         int* num_elem_colors) {} 
 
 void FC_FUNC_(prepare_inner_core_device,
               PREPARE_INNER_CORE_DEVICE)(long* Mesh_pointer_f,
@@ -598,11 +597,11 @@
                                          int* h_ibelm_top_inner_core,
                                          int* num_colors_outer,
                                          int* num_colors_inner,
-                                         int* num_elem_colors) {}
+                                         int* num_elem_colors) {} 
 
 void FC_FUNC_(prepare_cleanup_device,
               PREPARE_CLEANUP_DEVICE)(long* Mesh_pointer_f,
-              int* NCHUNKS_VAL) {}
+              int* NCHUNKS_VAL) {} 
 
 
 //
@@ -610,88 +609,88 @@
 //
 
 void FC_FUNC_(transfer_fields_cm_to_device,
-              TRANSFER_FIELDS_CM_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_CM_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_fields_ic_to_device,
-              TRANSFER_FIELDS_IC_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_IC_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_fields_oc_to_device,
-              TRANSFER_FIELDS_OC_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_OC_TO_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_cm_to_device,
               TRANSFER_FIELDS_B_CM_TO_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                              long* Mesh_pointer_f) {}
+                                              long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_ic_to_device,
               TRANSFER_FIELDS_B_IC_TO_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                              long* Mesh_pointer_f) {}
+                                              long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_oc_to_device,
               TRANSFER_FIELDS_B_OC_TO_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                              long* Mesh_pointer_f) {}
+                                              long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_fields_cm_from_device,
-              TRANSFER_FIELDS_CM_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_CM_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_fields_ic_from_device,
-              TRANSFER_FIELDS_IC_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_IC_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_fields_oc_from_device,
-              TRANSFER_FIELDS_OC_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_FIELDS_OC_FROM_DEVICE)(int* size, realw* displ, realw* veloc, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_cm_from_device,
               TRANSFER_B_FIELDS_CM_FROM_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                                long* Mesh_pointer_f) {}
+                                                long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_ic_from_device,
               TRANSFER_B_FIELDS_IC_FROM_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                                long* Mesh_pointer_f) {}
+                                                long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_fields_oc_from_device,
               TRANSFER_B_FIELDS_OC_FROM_DEVICE)(int* size, realw* b_displ, realw* b_veloc, realw* b_accel,
-                                                long* Mesh_pointer_f) {}
+                                                long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_displ_cm_from_device,
-              TRANSFER_DISPL_CM_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_DISPL_CM_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_displ_cm_from_device,
-              TRANSFER_B_DISPL_CM_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_B_DISPL_CM_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_displ_ic_from_device,
-              TRANSFER_DISPL_IC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_DISPL_IC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_displ_ic_from_device,
-              TRANSFER_B_DISPL_IC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_B_DISPL_IC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_displ_oc_from_device,
-              TRANSFER_DISPL_OC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_DISPL_OC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_displ_oc_from_device,
-              TRANSFER_B_DISPL_OC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {}
+              TRANSFER_B_DISPL_OC_FROM_DEVICE)(int* size, realw* displ, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_veloc_cm_from_device,
-              TRANSFER_VELOC_CM_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {}
+              TRANSFER_VELOC_CM_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_veloc_ic_from_device,
-              TRANSFER_VELOC_IC_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {}
+              TRANSFER_VELOC_IC_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_veloc_oc_from_device,
-              TRANSFER_VELOC_OC_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {}
+              TRANSFER_VELOC_OC_FROM_DEVICE)(int* size, realw* veloc, long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_accel_cm_to_device,
-              TRANSFER_ACCEL_CM_TO_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_ACCEL_CM_TO_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_accel_cm_from_device,
-              TRANSFER_ACCEL_CM_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_ACCEL_CM_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_b_accel_cm_from_device,
-              TRANSFER_B_ACCEL_CM_FROM_DEVICE)(int* size, realw* b_accel,long* Mesh_pointer_f) {}
+              TRANSFER_B_ACCEL_CM_FROM_DEVICE)(int* size, realw* b_accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_accel_ic_from_device,
-              TRANSFER_ACCEL_IC_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_ACCEL_IC_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_accel_oc_from_device,
-              TRANSFER_ACCEL_OC_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {}
+              TRANSFER_ACCEL_OC_FROM_DEVICE)(int* size, realw* accel,long* Mesh_pointer_f) {} 
 
 void FC_FUNC_(transfer_strain_cm_from_device,
               TRANSFER_STRAIN_CM_FROM_DEVICE)(long* Mesh_pointer,
@@ -700,7 +699,7 @@
                                                   realw* epsilondev_yy,
                                                   realw* epsilondev_xy,
                                                   realw* epsilondev_xz,
-                                                  realw* epsilondev_yz) {}
+                                                  realw* epsilondev_yz) {} 
 
 void FC_FUNC_(transfer_b_strain_cm_to_device,
               TRANSFER_B_STRAIN_CM_TO_DEVICE)(long* Mesh_pointer,
@@ -708,7 +707,7 @@
                                               realw* epsilondev_yy,
                                               realw* epsilondev_xy,
                                               realw* epsilondev_xz,
-                                              realw* epsilondev_yz) {}
+                                              realw* epsilondev_yz) {} 
 
 void FC_FUNC_(transfer_strain_ic_from_device,
               TRANSFER_STRAIN_IC_FROM_DEVICE)(long* Mesh_pointer,
@@ -717,7 +716,7 @@
                                               realw* epsilondev_yy,
                                               realw* epsilondev_xy,
                                               realw* epsilondev_xz,
-                                              realw* epsilondev_yz) {}
+                                              realw* epsilondev_yz) {} 
 
 void FC_FUNC_(transfer_b_strain_ic_to_device,
               TRANSFER_B_STRAIN_IC_TO_DEVICE)(long* Mesh_pointer,
@@ -725,7 +724,7 @@
                                               realw* epsilondev_yy,
                                               realw* epsilondev_xy,
                                               realw* epsilondev_xz,
-                                              realw* epsilondev_yz) {}
+                                              realw* epsilondev_yz) {} 
 
 void FC_FUNC_(transfer_b_rmemory_cm_to_device,
               TRANSFER_B_RMEMORY_CM_TO_DEVICE)(long* Mesh_pointer,
@@ -733,7 +732,7 @@
                                               realw* b_R_yy,
                                               realw* b_R_xy,
                                               realw* b_R_xz,
-                                              realw* b_R_yz) {}
+                                              realw* b_R_yz) {} 
 
 void FC_FUNC_(transfer_b_rmemory_ic_to_device,
               TRANSFER_B_RMEMORY_IC_TO_DEVICE)(long* Mesh_pointer,
@@ -741,17 +740,17 @@
                                               realw* b_R_yy,
                                               realw* b_R_xy,
                                               realw* b_R_xz,
-                                              realw* b_R_yz) {}
+                                              realw* b_R_yz) {} 
 
 void FC_FUNC_(transfer_rotation_from_device,
               TRANSFER_ROTATION_FROM_DEVICE)(long* Mesh_pointer,
                                              realw* A_array_rotation,
-                                             realw* B_array_rotation) {}
+                                             realw* B_array_rotation) {} 
 
 void FC_FUNC_(transfer_b_rotation_to_device,
               TRANSFER_B_ROTATION_TO_DEVICE)(long* Mesh_pointer,
                                               realw* A_array_rotation,
-                                              realw* B_array_rotation) {}
+                                              realw* B_array_rotation) {} 
 
 void FC_FUNC_(transfer_kernels_cm_to_host,
               TRANSFER_KERNELS_CM_TO_HOST)(long* Mesh_pointer,
@@ -759,30 +758,30 @@
                                            realw* h_alpha_kl,
                                            realw* h_beta_kl,
                                            realw* h_cijkl_kl,
-                                           int* NSPEC) {}
+                                           int* NSPEC) {} 
 
 void FC_FUNC_(transfer_kernels_ic_to_host,
               TRANSFER_KERNELS_IC_TO_HOST)(long* Mesh_pointer,
                                            realw* h_rho_kl,
                                            realw* h_alpha_kl,
                                            realw* h_beta_kl,
-                                           int* NSPEC) {}
+                                           int* NSPEC) {} 
 
 void FC_FUNC_(transfer_kernels_oc_to_host,
               TRANSFER_KERNELS_OC_TO_HOST)(long* Mesh_pointer,
                                            realw* h_rho_kl,
                                            realw* h_alpha_kl,
-                                           int* NSPEC) {}
+                                           int* NSPEC) {} 
 
 void FC_FUNC_(transfer_kernels_noise_to_host,
               TRANSFER_KERNELS_NOISE_TO_HOST)(long* Mesh_pointer,
                                               realw* h_Sigma_kl,
-                                              int* NSPEC) {}
+                                              int* NSPEC) {} 
 
 void FC_FUNC_(transfer_kernels_hess_cm_tohost,
               TRANSFER_KERNELS_HESS_CM_TOHOST)(long* Mesh_pointer,
                                               realw* h_hess_kl,
-                                              int* NSPEC) {}
+                                              int* NSPEC) {} 
 
 
 //
@@ -802,5 +801,5 @@
                                                int* number_receiver_global,
                                                int* ispec_selected_rec,
                                                int* ispec_selected_source,
-                                               int* ibool) {}
+                                               int* ibool) {} 
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/transfer_fields_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/transfer_fields_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/transfer_fields_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/write_seismograms_cuda.cu
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/write_seismograms_cuda.cu	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/cuda/write_seismograms_cuda.cu	2013-08-26 11:20:57 UTC (rev 22730)
@@ -7,7 +7,7 @@
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !    Princeton University, USA and University of Pau / CNRS / INRIA
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_missing_nodes.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_missing_nodes.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_missing_nodes.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -32,10 +32,10 @@
 
   subroutine add_missing_nodes(offset_x,offset_y,offset_z)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision, dimension(NGNOD) :: offset_x,offset_y,offset_z
 
 ! list of corners defining the edges and the faces

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -99,12 +99,11 @@
   subroutine add_topography_gll(myrank,xstore,ystore,zstore,ispec,nspec, &
                                 ibathy_topo)
 
+  use constants
   use meshfem3D_par,only: R220
 
   implicit none
 
-  include "constants.h"
-
   ! input parameters
   integer:: myrank
   integer:: ispec,nspec

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_410_650.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_410_650.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_410_650.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,12 +27,11 @@
 
   subroutine add_topography_410_650(myrank,xelm,yelm,zelm)
 
+  use constants
   use meshfem3D_par,only: R220,R400,R670,R771
 
   implicit none
 
-  include "constants.h"
-
   integer myrank
 
   double precision xelm(NGNOD)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_cmb.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_cmb.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_cmb.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,10 +27,10 @@
 
   subroutine add_topography_cmb(myrank,xelm,yelm,zelm,RTOPDDOUBLEPRIME,RCMB)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer myrank
 
   double precision xelm(NGNOD)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_icb.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_icb.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/add_topography_icb.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,10 +27,10 @@
 
   subroutine add_topography_icb(myrank,xelm,yelm,zelm,RICB,RCMB)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer myrank
 
   double precision xelm(NGNOD)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_central_cube_mesh.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_central_cube_mesh.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_central_cube_mesh.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -37,8 +37,6 @@
 
   ! this version of the routine is based on blocking MPI calls
 
-  use mpi
-
   implicit none
 
   include 'constants.h'
@@ -74,9 +72,6 @@
 
   real(kind=CUSTOM_REAL), dimension(NGLOB_INNER_CORE) :: array_central_cube
 
-  ! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE), ier
-
   ! mask
   logical, dimension(NGLOB_INNER_CORE) :: mask
 
@@ -91,9 +86,7 @@
 
   ! receive buffers from slices
     sender = sender_from_slices_to_cube(imsg)
-    call MPI_RECV(buffer_slices, &
-                ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-                itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
   ! copy buffer in 2D array for each slice
     buffer_all_cube_from_slices(imsg,:,1:ndim_assemble) = buffer_slices(:,1:ndim_assemble)
@@ -121,16 +114,12 @@
 
     ! send buffer to central cube
     receiver = receiver_cube_from_slices
-    call MPI_SEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-                 MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver,itag)
 
     ! in case NPROC_XI == 1, the other chunks exchange all bottom points with
     ! CHUNK_AB **and** CHUNK_AB_ANTIPODE
     if(NPROC_XI==1) then
-      call MPI_SEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-                   MPI_DOUBLE_PRECISION, &
-                   addressing(CHUNK_AB_ANTIPODE,0,iproc_eta), &
-                   itag,MPI_COMM_WORLD,ier)
+      call send_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,addressing(CHUNK_AB_ANTIPODE,0,iproc_eta),itag)
     endif
 
   endif  ! end sending info to central cube
@@ -154,9 +143,8 @@
 
     sender = sender_from_slices_to_cube(nb_msgs_theor_in_cube)
 
-    call MPI_SENDRECV(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-        itag,buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,&
-        MPI_DOUBLE_PRECISION,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver_cube_from_slices,itag, &
+                     buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
    buffer_all_cube_from_slices(nb_msgs_theor_in_cube,:,1:ndim_assemble) = buffer_slices2(:,1:ndim_assemble)
 
@@ -268,17 +256,12 @@
   if(ichunk /= CHUNK_AB .and. ichunk /= CHUNK_AB_ANTIPODE) then
     ! receive buffers from slices
     sender = receiver_cube_from_slices
-    call MPI_RECV(buffer_slices, &
-                ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-                itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
     ! in case NPROC_XI == 1, the other chunks exchange all bottom points with
     ! CHUNK_AB **and** CHUNK_AB_ANTIPODE
     if(NPROC_XI==1) then
-      call MPI_RECV(buffer_slices2, &
-                  ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION, &
-                  addressing(CHUNK_AB_ANTIPODE,0,iproc_eta), &
-                  itag,MPI_COMM_WORLD,msg_status,ier)
+      call recv_dp(buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,addressing(CHUNK_AB_ANTIPODE,0,iproc_eta),itag)
 
       buffer_slices = buffer_slices + buffer_slices2
     endif
@@ -320,8 +303,7 @@
 
   ! send buffers to slices
     receiver = sender_from_slices_to_cube(imsg)
-    call MPI_SEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver,itag)
 
    enddo
    endif

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_scalar_mesh.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_scalar_mesh.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_scalar_mesh.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -44,13 +44,10 @@
 
 ! this version of the routine is based on blocking MPI calls
 
-  use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-  include "precision.h"
-
   integer myrank,nglob,NCHUNKS
 
 ! array to assemble
@@ -90,13 +87,12 @@
 ! communication pattern for corners between chunks
   integer, dimension(NCORNERSCHUNKS) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
 
-! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE)
+  integer :: ipoin,ipoin2D,ipoin1D
+  integer :: sender,receiver
+  integer :: imsg,imsg_loop
+  integer :: icount_faces,npoin2D_chunks
 
-  integer ipoin,ipoin2D,ipoin1D
-  integer sender,receiver,ier
-  integer imsg,imsg_loop
-  integer icount_faces,npoin2D_chunks
+  integer, external :: null_process
 
 ! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
@@ -123,18 +119,17 @@
 
     ! send messages forward along each row
     if(iproc_xi == 0) then
-      sender = MPI_PROC_NULL
+      sender = null_process()
     else
       sender = addressing(ichunk,iproc_xi - 1,iproc_eta)
     endif
     if(iproc_xi == NPROC_XI-1) then
-      receiver = MPI_PROC_NULL
+      receiver = null_process()
     else
       receiver = addressing(ichunk,iproc_xi + 1,iproc_eta)
     endif
-    call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_xi(2),CUSTOM_MPI_TYPE,receiver, &
-          itag2,buffer_received_faces_scalar,npoin2D_xi(1),CUSTOM_MPI_TYPE,sender, &
-          itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_cr(buffer_send_faces_scalar,npoin2D_xi(2),receiver,itag2, &
+                     buffer_received_faces_scalar,npoin2D_xi(1),sender,itag)
 
     ! all slices add the buffer received to the contributions on the left face
     if(iproc_xi > 0) then
@@ -153,18 +148,17 @@
 
     ! send messages backward along each row
     if(iproc_xi == NPROC_XI-1) then
-      sender = MPI_PROC_NULL
+      sender = null_process()
     else
       sender = addressing(ichunk,iproc_xi + 1,iproc_eta)
     endif
     if(iproc_xi == 0) then
-      receiver = MPI_PROC_NULL
+      receiver = null_process()
     else
       receiver = addressing(ichunk,iproc_xi - 1,iproc_eta)
     endif
-    call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_xi(1),CUSTOM_MPI_TYPE,receiver, &
-          itag2,buffer_received_faces_scalar,npoin2D_xi(2),CUSTOM_MPI_TYPE,sender, &
-          itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_cr(buffer_send_faces_scalar,npoin2D_xi(1),receiver,itag2, &
+                     buffer_received_faces_scalar,npoin2D_xi(2),sender,itag)
 
     ! all slices copy the buffer received to the contributions on the right face
     if(iproc_xi < NPROC_XI-1) then
@@ -189,18 +183,17 @@
 
     ! send messages forward along each row
     if(iproc_eta == 0) then
-      sender = MPI_PROC_NULL
+      sender = null_process()
     else
       sender = addressing(ichunk,iproc_xi,iproc_eta - 1)
     endif
     if(iproc_eta == NPROC_ETA-1) then
-      receiver = MPI_PROC_NULL
+      receiver = null_process()
     else
       receiver = addressing(ichunk,iproc_xi,iproc_eta + 1)
     endif
-    call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_eta(2),CUSTOM_MPI_TYPE,receiver, &
-      itag2,buffer_received_faces_scalar,npoin2D_eta(1),CUSTOM_MPI_TYPE,sender, &
-      itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_cr(buffer_send_faces_scalar,npoin2D_eta(2),receiver,itag2, &
+                     buffer_received_faces_scalar,npoin2D_eta(1),sender,itag)
 
     ! all slices add the buffer received to the contributions on the left face
     if(iproc_eta > 0) then
@@ -219,18 +212,17 @@
 
     ! send messages backward along each row
     if(iproc_eta == NPROC_ETA-1) then
-      sender = MPI_PROC_NULL
+      sender = null_process()
     else
       sender = addressing(ichunk,iproc_xi,iproc_eta + 1)
     endif
     if(iproc_eta == 0) then
-      receiver = MPI_PROC_NULL
+      receiver = null_process()
     else
       receiver = addressing(ichunk,iproc_xi,iproc_eta - 1)
     endif
-    call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_eta(1),CUSTOM_MPI_TYPE,receiver, &
-      itag2,buffer_received_faces_scalar,npoin2D_eta(2),CUSTOM_MPI_TYPE,sender, &
-      itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_cr(buffer_send_faces_scalar,npoin2D_eta(1),receiver,itag2, &
+                     buffer_received_faces_scalar,npoin2D_eta(2),sender,itag)
 
     ! all slices copy the buffer received to the contributions on the right face
     if(iproc_eta < NPROC_ETA-1) then
@@ -267,9 +259,8 @@
       if(myrank==iprocto_faces(imsg) .and. imsg_type(imsg) == imsg_loop) then
         sender = iprocfrom_faces(imsg)
         npoin2D_chunks = npoin2D_faces(icount_faces)
-        call MPI_RECV(buffer_received_faces_scalar, &
-                  npoin2D_chunks,CUSTOM_MPI_TYPE,sender, &
-                  itag,MPI_COMM_WORLD,msg_status,ier)
+        call recv_cr(buffer_received_faces_scalar,npoin2D_chunks,sender,itag)
+
         do ipoin2D=1,npoin2D_chunks
           array_val(iboolfaces(ipoin2D,icount_faces)) = &
              array_val(iboolfaces(ipoin2D,icount_faces)) + buffer_received_faces_scalar(ipoin2D)
@@ -289,8 +280,7 @@
         do ipoin2D=1,npoin2D_chunks
           buffer_send_faces_scalar(ipoin2D) = array_val(iboolfaces(ipoin2D,icount_faces))
         enddo
-        call MPI_SEND(buffer_send_faces_scalar,npoin2D_chunks, &
-                  CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+        call send_cr(buffer_send_faces_scalar,npoin2D_chunks,receiver,itag)
       endif
     enddo
 
@@ -308,9 +298,8 @@
       if(myrank==iprocfrom_faces(imsg) .and. imsg_type(imsg) == imsg_loop) then
         sender = iprocto_faces(imsg)
         npoin2D_chunks = npoin2D_faces(icount_faces)
-        call MPI_RECV(buffer_received_faces_scalar, &
-                  npoin2D_chunks,CUSTOM_MPI_TYPE,sender, &
-                  itag,MPI_COMM_WORLD,msg_status,ier)
+        call recv_cr(buffer_received_faces_scalar,npoin2D_chunks,sender,itag)
+
         do ipoin2D=1,npoin2D_chunks
           array_val(iboolfaces(ipoin2D,icount_faces)) = buffer_received_faces_scalar(ipoin2D)
         enddo
@@ -329,8 +318,7 @@
         do ipoin2D=1,npoin2D_chunks
           buffer_send_faces_scalar(ipoin2D) = array_val(iboolfaces(ipoin2D,icount_faces))
         enddo
-        call MPI_SEND(buffer_send_faces_scalar,npoin2D_chunks, &
-                  CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+        call send_cr(buffer_send_faces_scalar,npoin2D_chunks,receiver,itag)
       endif
     enddo
 
@@ -360,8 +348,8 @@
 
       ! receive from worker #1 and add to local array
       sender = iproc_worker1_corners(imsg)
-      call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-            CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+      call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
       do ipoin1D=1,NGLOB1D_RADIAL
         array_val(iboolcorner(ipoin1D,icount_corners)) = array_val(iboolcorner(ipoin1D,icount_corners)) + &
                  buffer_recv_chunkcorn_scalar(ipoin1D)
@@ -370,8 +358,8 @@
       ! receive from worker #2 and add to local array
       if(NCHUNKS /= 2) then
         sender = iproc_worker2_corners(imsg)
-        call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-              CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+        call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
         do ipoin1D=1,NGLOB1D_RADIAL
           array_val(iboolcorner(ipoin1D,icount_corners)) = array_val(iboolcorner(ipoin1D,icount_corners)) + &
                    buffer_recv_chunkcorn_scalar(ipoin1D)
@@ -388,8 +376,7 @@
       do ipoin1D=1,NGLOB1D_RADIAL
         buffer_send_chunkcorn_scalar(ipoin1D) = array_val(iboolcorner(ipoin1D,icount_corners))
       enddo
-      call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-                receiver,itag,MPI_COMM_WORLD,ier)
+      call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
 
     endif
 
@@ -403,8 +390,8 @@
 
       ! receive from master and copy to local array
       sender = iproc_master_corners(imsg)
-      call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-            CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+      call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
       do ipoin1D=1,NGLOB1D_RADIAL
         array_val(iboolcorner(ipoin1D,icount_corners)) = buffer_recv_chunkcorn_scalar(ipoin1D)
       enddo
@@ -420,14 +407,12 @@
 
       ! send to worker #1
       receiver = iproc_worker1_corners(imsg)
-      call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-                receiver,itag,MPI_COMM_WORLD,ier)
+      call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
 
       ! send to worker #2
       if(NCHUNKS /= 2) then
         receiver = iproc_worker2_corners(imsg)
-        call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-                  receiver,itag,MPI_COMM_WORLD,ier)
+        call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
       endif
 
     endif
@@ -447,10 +432,10 @@
 
 ! blocking send/receive
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: NGLOB_AB
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_vector_mesh.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_vector_mesh.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/assemble_MPI_vector_mesh.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,10 @@
                         nibool_interfaces,ibool_interfaces, &
                         my_neighbours)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: NGLOB_AB
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/calc_jacobian.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/calc_jacobian.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/calc_jacobian.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -46,10 +46,10 @@
                                 etaxstore,etaystore,etazstore, &
                                 gammaxstore,gammaystore,gammazstore)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   ! input parameter
   integer::myrank,ispec,nspec
 
@@ -243,10 +243,10 @@
                                 xelm2D,yelm2D,zelm2D,xigll,yigll,&
                                 jacobian2D,normal,NGLLA,NGLLB,NSPEC2DMAX_AB)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   ! input parameters
   integer::myrank,ispecb,NSPEC2DMAX_AB,NGLLA,NGLLB
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_area.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_area.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_area.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_coordinates_grid.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_coordinates_grid.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_coordinates_grid.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,10 @@
                r_top,r_bottom,ner,ilayer,ichunk,rotation_matrix,NCHUNKS,&
                INCLUDE_CENTRAL_CUBE,NUMBER_OF_MESH_LAYERS)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision, dimension(NGNOD) :: xelm,yelm,zelm,offset_x,offset_y,offset_z
 
 ! rotation matrix from Euler angles
@@ -283,10 +283,10 @@
                   xgrid_central_cube,ygrid_central_cube,zgrid_central_cube, &
                   iproc_xi,iproc_eta,NPROC_XI,NPROC_ETA,nx_central_cube,ny_central_cube,nz_central_cube,radius_cube)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: ix,iy,iz,iproc_xi,iproc_eta,NPROC_XI,NPROC_ETA,nx_central_cube,ny_central_cube,nz_central_cube
 
   double precision :: xgrid_central_cube,ygrid_central_cube,zgrid_central_cube,radius_cube

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_element_properties.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_element_properties.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_element_properties.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -298,10 +298,10 @@
   subroutine compute_element_GLL_locations(xelm,yelm,zelm,ispec,nspec, &
                                       xstore,ystore,zstore,shape3D)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: ispec,nspec
 
   double precision,dimension(NGNOD) :: xelm,yelm,zelm

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_volumes.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_volumes.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/compute_volumes.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,10 @@
                             etaxstore,etaystore,etazstore,gammaxstore,gammaystore,gammazstore, &
                             NSPEC2D_BOTTOM,jacobian2D_bottom,NSPEC2D_TOP,jacobian2D_top)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision :: volume_local,area_local_bottom,area_local_top
 
   integer :: nspec

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_MPI_interfaces.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_MPI_interfaces.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_MPI_interfaces.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -541,10 +541,10 @@
   use meshfem3D_par,only: &
     xstore,ystore,zstore,ibool
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: nspec,nglob
 
   ! global mesh points

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_addressing.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_addressing.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_addressing.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,10 @@
                         addressing,ichunk_slice,iproc_xi_slice,iproc_eta_slice, &
                         OUTPUT_FILES)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: myrank,NCHUNKS,NPROC,NPROC_ETA,NPROC_XI,NPROCTOT
 
   integer, dimension(NCHUNKS,0:NPROC_XI-1,0:NPROC_ETA-1) :: addressing

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube_buffers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube_buffers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_central_cube_buffers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -44,12 +44,10 @@
                    receiver_cube_from_slices,sender_from_slices_to_cube,ibool_central_cube, &
                    buffer_slices,buffer_slices2,buffer_all_cube_from_slices)
 
-  use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-
   integer, intent(in) :: myrank,iproc_xi,iproc_eta,ichunk, &
        NPROC_XI,NPROC_ETA,NCHUNKS,NSPEC_INNER_CORE,NGLOB_INNER_CORE, &
        NSPEC2DMAX_XMIN_XMAX_INNER_CORE,NSPEC2DMAX_YMIN_YMAX_INNER_CORE,NSPEC2D_BOTTOM_INNER_CORE
@@ -83,15 +81,12 @@
         buffer_all_cube_from_slices
 
   ! local variables below
-  integer i,j,k,ispec,ispec2D,iglob,ier
+  integer i,j,k,ispec,ispec2D,iglob
   integer sender,receiver,imsg,ipoin,iproc_xi_loop
 
   double precision x_target,y_target,z_target
   double precision x_current,y_current,z_current
 
-  ! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE)
-
   integer :: nproc_xi_half_floor,nproc_xi_half_ceil
 
   if( mod(NPROC_XI,2) /= 0 ) then
@@ -281,9 +276,7 @@
 
     ! receive buffers from slices
     sender = sender_from_slices_to_cube(imsg)
-    call MPI_RECV(buffer_slices, &
-              NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,sender,itag)
 
     ! copy buffer in 2D array for each slice
     buffer_all_cube_from_slices(imsg,:,:) = buffer_slices(:,:)
@@ -314,16 +307,12 @@
 
     ! send buffer to central cube
     receiver = receiver_cube_from_slices
-    call MPI_SEND(buffer_slices,NDIM*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,receiver,itag)
 
     ! in case NPROC_XI == 1, the other chunks exchange all bottom points with
     ! CHUNK_AB **and** CHUNK_AB_ANTIPODE
     if(NPROC_XI==1) then
-      call MPI_SEND(buffer_slices,NDIM*npoin2D_cube_from_slices, &
-                   MPI_DOUBLE_PRECISION, &
-                   addressing(CHUNK_AB_ANTIPODE,0,iproc_eta), &
-                   itag,MPI_COMM_WORLD,ier)
+      call send_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,addressing(CHUNK_AB_ANTIPODE,0,iproc_eta),itag)
     endif
 
   endif  ! end sending info to central cube
@@ -353,9 +342,8 @@
 
     sender = sender_from_slices_to_cube(nb_msgs_theor_in_cube)
 
-    call MPI_SENDRECV(buffer_slices,NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-        itag,buffer_slices2,NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,receiver_cube_from_slices,itag, &
+                     buffer_slices2,NDIM*npoin2D_cube_from_slices,sender,itag)
 
     buffer_all_cube_from_slices(nb_msgs_theor_in_cube,:,:) = buffer_slices2(:,:)
 
@@ -561,10 +549,10 @@
 !--- compute number of messages to expect in cube as well as their size
 !--- take into account vertical sides and bottom side
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, intent(in) :: iproc_xi,iproc_eta,ichunk,NPROC_XI,NPROC_ETA,NSPEC2D_BOTTOM_INNER_CORE
 
   integer, intent(out) :: nb_msgs_theor_in_cube,npoin2D_cube_from_slices

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_chunk_buffers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_chunk_buffers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_chunk_buffers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -51,10 +51,10 @@
     nspec2D_xmin,nspec2D_xmax,nspec2D_ymin,nspec2D_ymax, &
     ibelm_xmin,ibelm_xmax,ibelm_ymin,ibelm_ymax
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: iregion_code
   integer :: nspec
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_doubling_elements.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_doubling_elements.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_doubling_elements.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_mass_matrices.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_mass_matrices.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_mass_matrices.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_meshes.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_meshes.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_meshes.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -461,7 +461,8 @@
   use meshfem3D_par,only: &
     NCHUNKS,NUMCORNERS_SHARED,NUMFACES_SHARED, &
     NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-    NGLOB1D_RADIAL,NGLOB1D_RADIAL_CORNER
+    NGLOB1D_RADIAL,NGLOB1D_RADIAL_CORNER, &
+    ATT1,ATT2,ATT3
 
   use meshfem3D_models_par,only: &
     ATTENUATION,ANISOTROPIC_INNER_CORE,ANISOTROPIC_3D_MANTLE, &
@@ -487,25 +488,12 @@
     T_c_source = AM_V%QT_c_source
     tau_s(:)   = AM_V%Qtau_s(:)
     nspec_att = nspec
-
-    ! note: to save memory, one can set USE_3D_ATTENUATION_ARRAYS to .false. which
-    !          will create attenuation arrays storing only 1 point per element
-    !          (otherwise, 3D attenuation arrays will be defined for all GLL points)
-    if( USE_3D_ATTENUATION_ARRAYS ) then
-      ! attenuation arrays are fully 3D
-      allocate(Qmu_store(NGLLX,NGLLY,NGLLZ,nspec_att), &
-              tau_e_store(N_SLS,NGLLX,NGLLY,NGLLZ,nspec_att),stat=ier)
-    else
-      ! save some memory in case of 1D attenuation models
-      allocate(Qmu_store(1,1,1,nspec_att), &
-              tau_e_store(N_SLS,1,1,1,nspec_att),stat=ier)
-    endif
   else
     ! allocates dummy size arrays
     nspec_att = 1
-    allocate(Qmu_store(1,1,1,nspec_att), &
-            tau_e_store(N_SLS,1,1,1,nspec_att),stat=ier)
   endif
+  allocate(Qmu_store(ATT1,ATT2,ATT3,nspec_att), &
+          tau_e_store(N_SLS,ATT1,ATT2,ATT3,nspec_att),stat=ier)
   if(ier /= 0) stop 'error in allocate 1'
 
   ! array with model density
@@ -1200,7 +1188,7 @@
   use create_regions_mesh_par2
 
   ! Modules for temporary AVS/DX data
-  use AVS_DX_global_mod
+!  use AVS_DX_global_mod
 
   implicit none
 
@@ -1211,13 +1199,14 @@
   ! arrays used for AVS or DX files
   integer, dimension(:), allocatable :: num_ibool_AVS_DX
   logical, dimension(:), allocatable :: mask_ibool
+  integer :: ier
+
   ! structures used for ADIOS AVS/DX files
-  type(avs_dx_global_t) :: avs_dx_global_vars
+!  type(avs_dx_global_t) :: avs_dx_global_vars
+!  character(len=150) :: reg_name, outputname, group_name
+!  integer :: comm, sizeprocs
+!  integer(kind=8) :: adios_group, group_size_inc, adios_totalsize, adios_handle
 
-  character(len=150) :: reg_name, outputname, group_name
-  integer :: comm, sizeprocs, ier
-  integer(kind=8) :: adios_group, group_size_inc, adios_totalsize, adios_handle
-
   ! arrays num_ibool_AVS_DX and mask_ibool used to save memory
   ! allocate memory for arrays
   allocate(num_ibool_AVS_DX(npointot), &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regions_mesh_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regular_elements.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regular_elements.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/create_regular_elements.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/define_superbrick.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/define_superbrick.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/define_superbrick.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,10 @@
 
   subroutine define_superbrick(x_superbrick,y_superbrick,z_superbrick,ibool_superbrick,iboun_sb)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, dimension(NGNOD_EIGHT_CORNERS,NSPEC_DOUBLING_SUPERBRICK) :: ibool_superbrick
   double precision, dimension(NGLOB_DOUBLING_SUPERBRICK) :: x_superbrick,y_superbrick,z_superbrick
   logical, dimension(NSPEC_DOUBLING_SUPERBRICK,6) :: iboun_sb
@@ -658,10 +658,10 @@
 
   subroutine define_superbrick_one_layer(x_superbrick,y_superbrick,z_superbrick,ibool_superbrick,iboun_sb)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, dimension(NGNOD_EIGHT_CORNERS,NSPEC_DOUBLING_SUPERBRICK) :: ibool_superbrick
   double precision, dimension(NGLOB_DOUBLING_SUPERBRICK) :: x_superbrick,y_superbrick,z_superbrick
   logical, dimension(NSPEC_DOUBLING_SUPERBRICK,6) :: iboun_sb
@@ -1204,10 +1204,10 @@
 
   subroutine define_basic_doubling_brick(x_superbrick,y_superbrick,z_superbrick,ibool_superbrick,iboun_sb,case_num)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, dimension(NGNOD_EIGHT_CORNERS,NSPEC_DOUBLING_SUPERBRICK) :: ibool_superbrick
   double precision, dimension(NGLOB_DOUBLING_SUPERBRICK) :: x_superbrick,y_superbrick,z_superbrick
   logical, dimension(NSPEC_DOUBLING_SUPERBRICK,6) :: iboun_sb

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/finalize_mesher.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/finalize_mesher.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/finalize_mesher.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -98,52 +98,43 @@
     write(IMAIN,*)
 
     ! evaluate the amount of static memory needed by the solver
-    call memory_eval(OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE, &
-                   TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,TOPOGRAPHY, &
-                   ONE_CRUST,doubling_index,this_region_has_a_doubling,NCHUNKS, &
-                   ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                   ratio_sampling_array,NPROCTOT, &
-                   NSPEC,nglob,SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD, &
-                   NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
-                   NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
-                   NSPEC_INNER_CORE_ATTENUATION, &
-                   NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
-                   NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
-                   NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
-                   NSPEC_CRUST_MANTLE_ADJOINT, &
-                   NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
-                   NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
-                   NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
-                   NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-                   NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
-                   NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                   static_memory_size)
+    call memory_eval(doubling_index,this_region_has_a_doubling, &
+                     ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+                     ratio_sampling_array,NPROCTOT, &
+                     NSPEC,NGLOB, &
+                     NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
+                     NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
+                     NSPEC_INNER_CORE_ATTENUATION, &
+                     NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
+                     NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
+                     NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
+                     NSPEC_CRUST_MANTLE_ADJOINT, &
+                     NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
+                     NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
+                     NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
+                     NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
+                     NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
+                     NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+                     static_memory_size)
 
     ! create include file for the solver
-    call save_header_file(NSPEC,nglob,NEX_XI,NEX_ETA,NPROC,NPROCTOT, &
-                    TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-                    ELLIPTICITY,GRAVITY,ROTATION, &
-                    OCEANS,ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D, &
-                    ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,NCHUNKS, &
-                    INCLUDE_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES,&
-                    CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,NSOURCES,NSTEP, &
-                    static_memory_size, &
-                    NSPEC2D_TOP,NSPEC2D_BOTTOM, &
-                    NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
-                    NPROC_XI,NPROC_ETA, &
-                    NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
-                    NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
-                    NSPEC_INNER_CORE_ATTENUATION, &
-                    NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
-                    NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
-                    NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
-                    NSPEC_CRUST_MANTLE_ADJOINT, &
-                    NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
-                    NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
-                    NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
-                    NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-                    NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
-                    SIMULATION_TYPE,SAVE_FORWARD,MOVIE_VOLUME)
+    call save_header_file(NSPEC,NGLOB,NPROC,NPROCTOT, &
+                          NSOURCES, &
+                          static_memory_size, &
+                          NSPEC2D_TOP,NSPEC2D_BOTTOM, &
+                          NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
+                          NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
+                          NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
+                          NSPEC_INNER_CORE_ATTENUATION, &
+                          NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
+                          NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
+                          NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
+                          NSPEC_CRUST_MANTLE_ADJOINT, &
+                          NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
+                          NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
+                          NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
+                          NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
+                          NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION )
 
   endif   ! end of section executed by main process only
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/fix_non_blocking_flags.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/fix_non_blocking_flags.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/fix_non_blocking_flags.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_1D_buffers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_1D_buffers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_1D_buffers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_eta.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_eta.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_eta.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_xi.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_xi.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_cutplanes_xi.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_interfaces.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_interfaces.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_MPI_interfaces.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_absorb_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_ellipticity.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_ellipticity.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_ellipticity.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_global.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_global.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_global.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_boundaries.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_boundaries.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_boundaries.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_discontinuities.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_discontinuities.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_jacobian_discontinuities.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_model.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_model.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -322,7 +322,7 @@
         endif ! of CUSTOM_REAL
 
         if(ATTENUATION) then
-          if(USE_3D_ATTENUATION_ARRAYS) then
+          if(ATTENUATION_3D .or. ATTENUATION_1D_WITH_3D_STORAGE) then
             tau_e_store(:,i,j,k,ispec) = tau_e(:)
             Qmu_store(i,j,k,ispec)     = Qmu
           else

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_perm_color.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_perm_color.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_perm_color.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape2D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape2D.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape2D.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape3D.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/get_shape3D.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/heap_sort.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/heap_sort.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/heap_sort.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_layers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_layers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_layers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_mesher.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_mesher.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/initialize_mesher.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -33,7 +33,6 @@
   implicit none
 
   ! local parameters
-  integer, external :: err_occurred
   ! timing
   double precision, external :: wtime
 
@@ -65,87 +64,88 @@
 
   if (myrank==0) then
     ! reads the parameter file and computes additional parameters
-    call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-          TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-          ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-          ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-          MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-          PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-          ATTENUATION,ATTENUATION_NEW,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-          INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-          LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-          SIMULATION_TYPE,SAVE_FORWARD, &
-          NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-          NSPEC,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
-          NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-          NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-          ratio_sampling_array, ner, doubling_index,r_bottom,r_top,&
-          this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
-          HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-          DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-          WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
-          USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+    call read_compute_parameters()
+!          MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!          TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!          ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!          ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!          MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!          PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!          ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!          INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!          LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!          SIMULATION_TYPE,SAVE_FORWARD, &
+!          NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!          NSPEC,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
+!          NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!          NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!          ratio_sampling_array, ner, doubling_index,r_bottom,r_top,&
+!          this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
+!          HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!          DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!          WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
+!          USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+!
 
-    if(err_occurred() /= 0) &
-      call exit_MPI(myrank,'an error occurred while reading the parameter file')
+!    ! ADIOS_ENABLED: parameter is optional, may not be in the Par_file
+!    call read_adios_parameters(ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, &
+!        ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
+!        ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
 
-    ! ADIOS_ENABLED: parameter is optional, may not be in the Par_file
-    call read_adios_parameters(ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, &
-        ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
-        ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
-
   endif
 
   ! distributes parameters from master to all processes
-  call broadcast_compute_parameters(myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-                RMOHO_FICTITIOUS_IN_MESHER, &
-                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
-                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
-                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-                this_region_has_a_doubling,rmins,rmaxs, &
-                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
-                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
-                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
-                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
-                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-                ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+  call broadcast_computed_parameters()
+!                myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!                RMOHO_FICTITIOUS_IN_MESHER, &
+!                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
+!                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
+!                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!                NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!                this_region_has_a_doubling,rmins,rmaxs, &
+!                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
+!                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
+!                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+!                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
+!                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!                ATTENUATION,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+!
   ! broadcasts optional ADIOS_ENABLED
-  call broadcast_adios_parameters(myrank,ADIOS_ENABLED, &
-      ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
-      ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
+!  call broadcast_adios_parameters(myrank,ADIOS_ENABLED, &
+!                                  ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
+!                                  ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
 
   ! check that the code is running with the requested number of processes
   if(sizeprocs /= NPROCTOT) call exit_MPI(myrank,'wrong number of MPI processes')

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/lgndr.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/lgndr.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/lgndr.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_models.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_models.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_models.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -77,7 +77,7 @@
     case(REFERENCE_MODEL_1066A)
       call model_1066a_broadcast(myrank,CRUSTAL)
 
-    case( REFERENCE_MODEL_AK135)
+    case( REFERENCE_MODEL_AK135F_NO_MUD)
       call model_ak135_broadcast(myrank,CRUSTAL)
 
     case(REFERENCE_MODEL_1DREF)
@@ -290,7 +290,7 @@
       ! 1066A (by Gilbert & Dziewonski) - pure isotropic model, used in 1D model mode only
       call model_1066a(r_prem,rho,vp,vs,Qkappa,Qmu,iregion_code)
 
-    case(REFERENCE_MODEL_AK135)
+    case(REFERENCE_MODEL_AK135F_NO_MUD)
       ! AK135 (by Kennett et al. ) - pure isotropic model, used in 1D model mode only
       call model_ak135(r_prem,rho,vp,vs,Qkappa,Qmu,iregion_code)
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_par.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_par.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/meshfem3D_par.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,12 +27,6 @@
 !
 ! United States and French Government Sponsorship Acknowledged.
 
-  module constants
-
-  include "constants.h"
-
-  end module constants
-
 !
 !-------------------------------------------------------------------------------------------------
 !
@@ -47,6 +41,18 @@
 
   use constants
 
+  use shared_input_parameters,only: &
+    ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+    ATTENUATION,ATTENUATION_1D_WITH_3D_STORAGE, &
+    USE_FULL_TISO_MANTLE
+
+  use shared_compute_parameters, only: &
+    REFERENCE_1D_MODEL,THREE_D_MODEL, &
+    HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
+    ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+    ATTENUATION_3D, &
+    ANISOTROPIC_INNER_CORE
+
   implicit none
 
 ! model_attenuation_variables
@@ -121,18 +127,14 @@
   integer :: nspl
 
 ! model parameter and flags
-  integer :: REFERENCE_1D_MODEL,THREE_D_MODEL
+!  integer :: REFERENCE_1D_MODEL,THREE_D_MODEL
+!  logical :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS
+!  logical :: HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY
+!  logical :: ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE
+!  logical :: ATTENUATION,ATTENUATION_3D
+!  logical :: ANISOTROPIC_INNER_CORE
 
-  logical :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS
 
-  logical :: HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY
-
-  logical :: ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE
-
-  logical :: ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D
-
-  logical :: ANISOTROPIC_INNER_CORE
-
 ! to create a reference model based on 1D_REF but with 3D crust and 410/660 topography
   logical,parameter :: USE_1D_REFERENCE = .false.
 
@@ -150,6 +152,8 @@
 
   use constants
 
+  use shared_parameters
+
   implicit none
 
   ! correct number of spectral elements in each block depending on chunk type
@@ -181,49 +185,46 @@
   integer, dimension(:,:,:), allocatable :: addressing
 
   ! parameters read from parameter file
-  integer :: MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN, &
-          NCHUNKS,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer :: MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN, &
+!          NCHUNKS,SIMULATION_TYPE, &
+!          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision :: DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-          RMOHO_FICTITIOUS_IN_MESHER
+!  double precision :: DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!          RMOHO_FICTITIOUS_IN_MESHER
 
-  logical :: MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical :: MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) :: OUTPUT_FILES
-  character(len=150) :: LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) :: OUTPUT_FILES
+!  character(len=150) :: LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
   ! parameters deduced from parameters read from file
-  integer :: NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer :: NPROC,NPROCTOT
+!  integer :: NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
-  ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP,NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               NGLOB
+  integer :: NSOURCES
 
+
   ! computed in read_compute_parameters
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
   ! memory size of all the static arrays
   double precision :: static_memory_size
@@ -251,9 +252,9 @@
   ! 1 -> min, 2 -> max
   integer, dimension(MAX_NUM_REGIONS,NB_SQUARE_EDGES_ONEDIR) :: NSPEC2D_XI_FACE,NSPEC2D_ETA_FACE
 
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
 
   ! arrays with the mesh in double precision
   double precision, dimension(:,:,:,:), allocatable :: xstore,ystore,zstore
@@ -268,9 +269,9 @@
   ! ADIOS
   !-----------------------------------------------------------------
 
-  logical :: ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, &
-      ADIOS_FOR_ARRAYS_SOLVER, ADIOS_FOR_SOLVER_MESHFILES, &
-      ADIOS_FOR_AVS_DX
+!  logical :: ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, &
+!      ADIOS_FOR_ARRAYS_SOLVER, ADIOS_FOR_SOLVER_MESHFILES, &
+!      ADIOS_FOR_AVS_DX
 
   end module meshfem3D_par
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1066a.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1066a.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1066a.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1dref.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1dref.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_1dref.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ak135.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ak135.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ak135.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -54,7 +54,7 @@
   module model_ak135_par
 
   ! number of layers in DATA/ak135/ak135.dat
-  integer, parameter :: NR_AK135 = 136
+  integer, parameter :: NR_AK135F_NO_MUD = 136
 
   ! model_ak135_variables
   double precision, dimension(:), allocatable :: &
@@ -84,12 +84,12 @@
   integer :: ier
 
   ! allocates model arrays
-  allocate(Mak135_V_radius_ak135(NR_AK135), &
-          Mak135_V_density_ak135(NR_AK135), &
-          Mak135_V_vp_ak135(NR_AK135), &
-          Mak135_V_vs_ak135(NR_AK135), &
-          Mak135_V_Qkappa_ak135(NR_AK135), &
-          Mak135_V_Qmu_ak135(NR_AK135), &
+  allocate(Mak135_V_radius_ak135(NR_AK135F_NO_MUD), &
+          Mak135_V_density_ak135(NR_AK135F_NO_MUD), &
+          Mak135_V_vp_ak135(NR_AK135F_NO_MUD), &
+          Mak135_V_vs_ak135(NR_AK135F_NO_MUD), &
+          Mak135_V_Qkappa_ak135(NR_AK135F_NO_MUD), &
+          Mak135_V_Qmu_ak135(NR_AK135F_NO_MUD), &
           stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'error allocating Mak135_V arrays')
 
@@ -129,7 +129,7 @@
   r = x * R_EARTH
 
   i = 1
-  do while(r >= Mak135_V_radius_ak135(i) .and. i /= NR_AK135)
+  do while(r >= Mak135_V_radius_ak135(i) .and. i /= NR_AK135F_NO_MUD)
     i = i + 1
   enddo
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_inner_core.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_inner_core.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_inner_core.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -109,7 +109,7 @@
       vs0 = 3.62980
       rho0 = 13.429030
 
-    case(REFERENCE_MODEL_AK135)
+    case(REFERENCE_MODEL_AK135F_NO_MUD)
       ! values at center
       vp0 = 11.26220
       vs0 = 3.667800

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_mantle.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_aniso_mantle.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -58,7 +58,6 @@
 ! standard routine to setup model
 
   use model_aniso_mantle_par
-  use mpi
 
   implicit none
 
@@ -79,9 +78,9 @@
   if(myrank == 0) call read_aniso_mantle_model()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(AMM_V_npar1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(AMM_V_beta,14*34*37*73,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(AMM_V_pro,47,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(AMM_V_npar1,1)
+  call bcast_all_dp(AMM_V_beta,14*34*37*73)
+  call bcast_all_dp(AMM_V_pro,47)
 
   end subroutine model_aniso_mantle_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_atten3D_QRFSI12.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_atten3D_QRFSI12.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_atten3D_QRFSI12.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -68,7 +68,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_atten3D_QRFSI12_par
 
   implicit none
@@ -92,10 +91,10 @@
   if(myrank == 0) call read_atten_model_3D_QRFSI12()
 
   ! broadcasts to all processes
-  call MPI_BCAST(QRFSI12_Q_dqmu,          NKQ*NSQ,MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(QRFSI12_Q_spknt,             NKQ,MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(QRFSI12_Q_refdepth, NDEPTHS_REFQ,MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(QRFSI12_Q_refqmu,   NDEPTHS_REFQ,MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
+  call bcast_all_dp(QRFSI12_Q_dqmu,          NKQ*NSQ)
+  call bcast_all_dp(QRFSI12_Q_spknt,             NKQ)
+  call bcast_all_dp(QRFSI12_Q_refdepth, NDEPTHS_REFQ)
+  call bcast_all_dp(QRFSI12_Q_refqmu,   NDEPTHS_REFQ)
 
   ! user output
   if(myrank == 0) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_attenuation.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_attenuation.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_attenuation.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -64,8 +64,6 @@
 
 ! standard routine to setup model
 
-  use mpi
-
   implicit none
 
   include "constants.h"
@@ -97,16 +95,17 @@
   integer :: myrank
   integer :: ier
 
-  allocate(AM_V%Qtau_s(N_SLS))
+  allocate(AM_V%Qtau_s(N_SLS),stat=ier)
+  if( ier /= 0 ) call exit_mpi(myrank,'error allocating Qtau_s array')
 
   ! master process determines period ranges
   if(myrank == 0) call read_attenuation_model(MIN_ATTENUATION_PERIOD, MAX_ATTENUATION_PERIOD, AM_V)
 
   ! broadcasts to all others
-  call MPI_BCAST(AM_V%min_period,  1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(AM_V%max_period,  1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(AM_V%QT_c_source, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
-  call MPI_BCAST(AM_V%Qtau_s,   N_SLS, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ier)
+  call bcast_all_dp(AM_V%min_period,  1)
+  call bcast_all_dp(AM_V%max_period,  1)
+  call bcast_all_dp(AM_V%QT_c_source, 1)
+  call bcast_all_dp(AM_V%Qtau_s,   N_SLS)
 
   end subroutine model_attenuation_broadcast
 
@@ -171,7 +170,7 @@
     NR_REF,Mref_V_radius_ref,Mref_V_Qmu_ref
 
   use model_ak135_par, only: &
-    NR_AK135,Mak135_V_radius_ak135,Mak135_V_Qmu_ak135
+    NR_AK135F_NO_MUD,Mak135_V_radius_ak135,Mak135_V_Qmu_ak135
 
   use model_1066a_par, only: &
     NR_1066A,M1066a_V_radius_1066a,M1066a_V_Qmu_1066a
@@ -255,10 +254,10 @@
     AM_V%Qn = 12
   else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_IASP91) then
     AM_V%Qn = 12
-  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135) then
+  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135F_NO_MUD) then
     ! redefines "pure" 1D model without crustal modification
     call define_model_ak135(.FALSE.)
-    AM_V%Qn = NR_AK135
+    AM_V%Qn = NR_AK135F_NO_MUD
   else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_1066A) then
     ! redefines "pure" 1D model without crustal modification
     call define_model_1066a(.FALSE.)
@@ -291,7 +290,7 @@
   else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_IASP91) then
      AM_V%Qr(:)     = (/    0.0d0,     RICB,  RICB,  RCMB,    RCMB,    R670,    R670,    R220,   R220,   R120,    R120, R_EARTH /)
      AM_V%Qmu(:)    = (/   84.6d0,   84.6d0, 0.0d0, 0.0d0, 312.0d0, 312.0d0, 143.0d0, 143.0d0, 80.0d0, 80.0d0, 600.0d0, 600.0d0 /)
-  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135) then
+  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135F_NO_MUD) then
      AM_V%Qr(:)     = Mak135_V_radius_ak135(:)
      AM_V%Qmu(:)    = Mak135_V_Qmu_ak135(:)
   else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_1066A) then
@@ -315,7 +314,7 @@
 
   ! re-defines 1D models with crustal modification if necessary
   if( CRUSTAL ) then
-    if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135) then
+    if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135F_NO_MUD) then
       ! redefines 1D model with crustal modification
       call define_model_ak135(CRUSTAL)
     else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_1066A) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crust.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crust.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -58,7 +58,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_crust_par
 
   implicit none
@@ -80,13 +79,14 @@
   if(myrank == 0) call read_crust_model()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(thlr,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocp,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocs,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(dens,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(abbreviation,NCAP_CRUST*NCAP_CRUST,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(code,2*NKEYS_CRUST,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(thlr,NKEYS_CRUST*NLAYERS_CRUST)
+  call bcast_all_dp(velocp,NKEYS_CRUST*NLAYERS_CRUST)
+  call bcast_all_dp(velocs,NKEYS_CRUST*NLAYERS_CRUST)
+  call bcast_all_dp(dens,NKEYS_CRUST*NLAYERS_CRUST)
 
+  call bcast_all_ch(abbreviation,NCAP_CRUST*NCAP_CRUST)
+  call bcast_all_ch(code,2*NKEYS_CRUST)
+
   end subroutine model_crust_broadcast
 
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crustmaps.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crustmaps.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_crustmaps.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -62,7 +62,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_crustmaps_par
 
   implicit none
@@ -97,28 +96,24 @@
   if(myrank == 0) call read_general_crustmap()
 
   ! broadcasts values to all processes
-  call MPI_BCAST(thickness,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP, &
-    MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocp,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP, &
-    MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocs,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP, &
-    MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(density,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP, &
-    MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(thickness,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocp,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocs,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP)
+  call bcast_all_dp(density,180*360*CRUSTMAP_RESOLUTION*CRUSTMAP_RESOLUTION*NLAYERS_CRUSTMAP)
 
   ! north pole
-  call MPI_BCAST(thicknessnp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(densitynp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocpnp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocsnp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(densitynp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(thicknessnp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(densitynp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocpnp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocsnp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(densitynp,NLAYERS_CRUSTMAP)
 
   ! south pole
-  call MPI_BCAST(thicknesssp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(densitysp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocpsp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(velocssp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(densitysp,NLAYERS_CRUSTMAP,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(thicknesssp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(densitysp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocpsp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(velocssp,NLAYERS_CRUSTMAP)
+  call bcast_all_dp(densitysp,NLAYERS_CRUSTMAP)
 
   end subroutine model_crustmaps_broadcast
 
@@ -189,6 +184,8 @@
 
   subroutine read_general_crustmap_layer(var,var_letter,ind)
 
+  use model_crustmaps_par,only: CRUSTMAP_RESOLUTION
+
   implicit none
   include "constants.h"
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_epcrust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_epcrust.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_epcrust.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -61,7 +61,6 @@
 
   subroutine model_epcrust_broadcast(myrank)
 
-  use mpi
   use model_epcrust_par
 
   implicit none
@@ -85,20 +84,13 @@
   if(myrank == 0) call read_epcrust_model()
 
   ! broadcast EPCRUST model
-  call MPI_BCAST(lon_ep,EPCRUST_NLON*EPCRUST_NLAT, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(lat_ep,EPCRUST_NLON*EPCRUST_NLAT, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(topo_ep,EPCRUST_NLON*EPCRUST_NLAT, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(thickness_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(vp_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(vs_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(rho_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER, &
-                MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(lon_ep,EPCRUST_NLON*EPCRUST_NLAT)
+  call bcast_all_dp(lat_ep,EPCRUST_NLON*EPCRUST_NLAT)
+  call bcast_all_dp(topo_ep,EPCRUST_NLON*EPCRUST_NLAT)
+  call bcast_all_dp(thickness_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER)
+  call bcast_all_dp(vp_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER)
+  call bcast_all_dp(vs_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER)
+  call bcast_all_dp(rho_ep,EPCRUST_NLON*EPCRUST_NLAT*EPCRUST_NLAYER)
 
   end subroutine model_epcrust_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_eucrust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_eucrust.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_eucrust.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -51,7 +51,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_eucrust_par
 
   implicit none
@@ -65,7 +64,7 @@
   if( myrank == 0 ) call read_EuCrust()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(num_eucrust,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(num_eucrust,1)
 
   ! allocates on all other processes
   if( myrank /= 0 ) then
@@ -80,13 +79,13 @@
     if( ier /= 0 ) call exit_MPI(myrank,'error allocating EUcrust arrays')
   endif
 
-  call MPI_BCAST(eucrust_lat(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_lon(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_vp_uppercrust(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_vp_lowercrust(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_mohodepth(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_basement(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eucrust_ucdepth(1:num_eucrust),num_eucrust,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(eucrust_lat(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_lon(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_vp_uppercrust(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_vp_lowercrust(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_mohodepth(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_basement(1:num_eucrust),num_eucrust)
+  call bcast_all_dp(eucrust_ucdepth(1:num_eucrust),num_eucrust)
 
   end subroutine model_eucrust_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gapp2.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gapp2.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gapp2.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -53,7 +53,6 @@
 ! standard routine to setup model
 
   use gapp2_mantle_model_constants
-  use mpi
 
   implicit none
 
@@ -73,17 +72,19 @@
   if(myrank == 0) call read_mantle_gapmodel()
 
   ! master process broadcasts data to all processes
-  call MPI_BCAST( dep,mr+1,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(dep1,mr1+1,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( vp1,mr1+1,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( vp3,ma*mo*mr,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( nnr,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( nr1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(  no,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(  na,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( dela,1,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST( delo,1,MPI_REAL,0,MPI_COMM_WORLD,ier)
+  call bcast_all_r( dep,mr+1)
+  call bcast_all_r(dep1,mr1+1)
+  call bcast_all_r( vp1,mr1+1)
+  call bcast_all_r( vp3,ma*mo*mr)
 
+  call bcast_all_i( nnr,1)
+  call bcast_all_i( nr1,1)
+  call bcast_all_i(  no,1)
+  call bcast_all_i(  na,1)
+
+  call bcast_all_r( dela,1)
+  call bcast_all_r( delo,1)
+
   end subroutine model_gapp2_broadcast
 
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gll.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gll.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_gll.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -38,12 +38,11 @@
 ! standard routine to setup model
 
   use meshfem3D_models_par,only: TRANSVERSE_ISOTROPY
-  use mpi
 
   implicit none
 
   include "constants.h"
-  include "precision.h"
+!  include "precision.h"
 
   ! GLL model_variables
   type model_gll_variables
@@ -72,17 +71,21 @@
   ! differs for isotropic model or transverse isotropic models
   if( .not. TRANSVERSE_ISOTROPY ) then
     ! isotropic model
-    allocate( MGLL_V%vp_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
-    allocate( MGLL_V%vs_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
+    allocate( MGLL_V%vp_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), &
+              MGLL_V%vs_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), stat=ier)
+    if( ier /= 0 ) call exit_MPI(myrank,'error allocating vp_new,.. arrays')
   else
     ! transverse isotropic model
-    allocate( MGLL_V%vpv_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
-    allocate( MGLL_V%vph_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
-    allocate( MGLL_V%vsv_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
-    allocate( MGLL_V%vsh_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
-    allocate( MGLL_V%eta_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
+    allocate( MGLL_V%vpv_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), &
+              MGLL_V%vph_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), &
+              MGLL_V%vsv_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), &
+              MGLL_V%vsh_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), &
+              MGLL_V%eta_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), stat=ier)
+    if( ier /= 0 ) call exit_MPI(myrank,'error allocating vpv_new,.. arrays')
+
   endif
-  allocate( MGLL_V%rho_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)) )
+  allocate( MGLL_V%rho_new(NGLLX,NGLLY,NGLLZ,NSPEC(IREGION_CRUST_MANTLE)), stat=ier)
+  if( ier /= 0 ) call exit_MPI(myrank,'error allocating rho_new,.. arrays')
 
   ! reads in model files for each process
   call read_gll_model(myrank,MGLL_V,NSPEC)
@@ -98,24 +101,24 @@
     ! Vs
     max = maxval( MGLL_V%vs_new )
     min = minval( MGLL_V%vs_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vs new min/max: ',min_all,max_all
     endif
     ! Vp
     max = maxval( MGLL_V%vp_new )
     min = minval( MGLL_V%vp_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vp new min/max: ',min_all,max_all
     endif
     ! density
     max = maxval( MGLL_V%rho_new )
     min = minval( MGLL_V%rho_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  rho new min/max: ',min_all,max_all
       write(IMAIN,*)
@@ -131,48 +134,48 @@
     ! Vsv
     max = maxval( MGLL_V%vsv_new )
     min = minval( MGLL_V%vsv_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vsv new min/max: ',min_all,max_all
     endif
     ! Vsh
     max = maxval( MGLL_V%vsh_new )
     min = minval( MGLL_V%vsh_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vsh new min/max: ',min_all,max_all
     endif
     ! Vpv
     max = maxval( MGLL_V%vpv_new )
     min = minval( MGLL_V%vpv_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vpv new min/max: ',min_all,max_all
     endif
     ! Vph
     max = maxval( MGLL_V%vph_new )
     min = minval( MGLL_V%vph_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  vph new min/max: ',min_all,max_all
     endif
     ! density
     max = maxval( MGLL_V%rho_new )
     min = minval( MGLL_V%rho_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  rho new min/max: ',min_all,max_all
     endif
     ! eta
     max = maxval( MGLL_V%eta_new )
     min = minval( MGLL_V%eta_new )
-    call mpi_reduce(max, max_all, 1, CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
-    call mpi_reduce(min, min_all, 1, CUSTOM_MPI_TYPE, MPI_MIN, 0, MPI_COMM_WORLD,ier)
+    call max_all_cr(max, max_all)
+    call min_all_cr(min, min_all)
     if( myrank == 0 ) then
       write(IMAIN,*) '  eta new min/max: ',min_all,max_all
       write(IMAIN,*)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_heterogen_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_heterogen_mantle.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_heterogen_mantle.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -49,7 +49,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_heterogen_mantle_par
 
   implicit none
@@ -74,7 +73,7 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(HMM_rho_in,N_R*N_THETA*N_PHI,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(HMM_rho_in,N_R*N_THETA*N_PHI)
 
   if(myrank == 0) then
      write(IMAIN,*) 'model_heterogen_mantle is broadcast.'

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_iasp91.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_iasp91.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_iasp91.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp1d.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp1d.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp1d.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp3d.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp3d.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_jp3d.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -125,7 +125,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_jp3d_par
 
   implicit none
@@ -155,61 +154,66 @@
   if(myrank == 0) call read_jp3d_iso_zhao_model()
 
   ! JP3DM_V
-  call MPI_BCAST(JP3DM_NPA,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_NRA,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_NHA,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_NPB,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_NRB,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_NHB,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PNA,MPA,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RNA,MRA,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HNA,MHA,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PNB,MPB,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RNB,MRB,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HNB,MHB,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_VELAP,MPA*MRA*MHA,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_VELBP,MPB*MRB*MHB,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PN,51,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RRN,63,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_DEPA,51*63,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_DEPB,51*63,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_DEPC,51*63,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IPLOCA,MKA,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IRLOCA,MKA,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IHLOCA,MKA,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IPLOCB,MKB,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IRLOCB,MKB,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IHLOCB,MKB,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PLA,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RLA,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HLA,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PLB,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RLB,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HLB,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IP,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_JP,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_KP,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_IP1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_JP1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_KP1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_WV,8,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_P,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_R,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_H,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PF,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RF,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HF,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PF1,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RF1,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HF1,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_PD,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RD,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_HD,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_VP,29,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_VS,29,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_RA,29,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(JP3DM_DEPJ,29,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(JP3DM_NPA,1)
+  call bcast_all_i(JP3DM_NRA,1)
+  call bcast_all_i(JP3DM_NHA,1)
+  call bcast_all_i(JP3DM_NPB,1)
+  call bcast_all_i(JP3DM_NRB,1)
+  call bcast_all_i(JP3DM_NHB,1)
 
+  call bcast_all_dp(JP3DM_PNA,MPA)
+  call bcast_all_dp(JP3DM_RNA,MRA)
+  call bcast_all_dp(JP3DM_HNA,MHA)
+  call bcast_all_dp(JP3DM_PNB,MPB)
+  call bcast_all_dp(JP3DM_RNB,MRB)
+  call bcast_all_dp(JP3DM_HNB,MHB)
+  call bcast_all_dp(JP3DM_VELAP,MPA*MRA*MHA)
+  call bcast_all_dp(JP3DM_VELBP,MPB*MRB*MHB)
+  call bcast_all_dp(JP3DM_PN,51)
+  call bcast_all_dp(JP3DM_RRN,63)
+  call bcast_all_dp(JP3DM_DEPA,51*63)
+  call bcast_all_dp(JP3DM_DEPB,51*63)
+  call bcast_all_dp(JP3DM_DEPC,51*63)
+
+  call bcast_all_i(JP3DM_IPLOCA,MKA)
+  call bcast_all_i(JP3DM_IRLOCA,MKA)
+  call bcast_all_i(JP3DM_IHLOCA,MKA)
+  call bcast_all_i(JP3DM_IPLOCB,MKB)
+  call bcast_all_i(JP3DM_IRLOCB,MKB)
+  call bcast_all_i(JP3DM_IHLOCB,MKB)
+
+  call bcast_all_dp(JP3DM_PLA,1)
+  call bcast_all_dp(JP3DM_RLA,1)
+  call bcast_all_dp(JP3DM_HLA,1)
+  call bcast_all_dp(JP3DM_PLB,1)
+  call bcast_all_dp(JP3DM_RLB,1)
+  call bcast_all_dp(JP3DM_HLB,1)
+
+  call bcast_all_i(JP3DM_IP,1)
+  call bcast_all_i(JP3DM_JP,1)
+  call bcast_all_i(JP3DM_KP,1)
+  call bcast_all_i(JP3DM_IP1,1)
+  call bcast_all_i(JP3DM_JP1,1)
+  call bcast_all_i(JP3DM_KP1,1)
+
+  call bcast_all_dp(JP3DM_WV,8)
+  call bcast_all_dp(JP3DM_P,1)
+  call bcast_all_dp(JP3DM_R,1)
+  call bcast_all_dp(JP3DM_H,1)
+  call bcast_all_dp(JP3DM_PF,1)
+  call bcast_all_dp(JP3DM_RF,1)
+  call bcast_all_dp(JP3DM_HF,1)
+  call bcast_all_dp(JP3DM_PF1,1)
+  call bcast_all_dp(JP3DM_RF1,1)
+  call bcast_all_dp(JP3DM_HF1,1)
+  call bcast_all_dp(JP3DM_PD,1)
+  call bcast_all_dp(JP3DM_RD,1)
+  call bcast_all_dp(JP3DM_HD,1)
+  call bcast_all_dp(JP3DM_VP,29)
+  call bcast_all_dp(JP3DM_VS,29)
+  call bcast_all_dp(JP3DM_RA,29)
+  call bcast_all_dp(JP3DM_DEPJ,29)
+
   end subroutine model_jp3d_broadcast
 
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ppm.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ppm.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_ppm.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -96,7 +96,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_ppm_par
 
   implicit none
@@ -104,32 +103,32 @@
   include "constants.h"
 
   integer :: myrank
-  integer :: ier
 
   ! upper mantle structure
   if(myrank == 0) call read_model_ppm()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(PPM_num_v,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_num_latperlon,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_num_lonperdepth,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(PPM_num_v,1)
+  call bcast_all_i(PPM_num_latperlon,1)
+  call bcast_all_i(PPM_num_lonperdepth,1)
   if( myrank /= 0 ) then
     allocate(PPM_lat(PPM_num_v),PPM_lon(PPM_num_v),PPM_depth(PPM_num_v),PPM_dvs(PPM_num_v))
   endif
-  call MPI_BCAST(PPM_dvs(1:PPM_num_v),PPM_num_v,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_lat(1:PPM_num_v),PPM_num_v,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_lon(1:PPM_num_v),PPM_num_v,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_depth(1:PPM_num_v),PPM_num_v,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_maxlat,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_minlat,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_maxlon,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_minlon,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_maxdepth,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_mindepth,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_dlat,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_dlon,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(PPM_ddepth,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
 
+  call bcast_all_dp(PPM_dvs(1:PPM_num_v),PPM_num_v)
+  call bcast_all_dp(PPM_lat(1:PPM_num_v),PPM_num_v)
+  call bcast_all_dp(PPM_lon(1:PPM_num_v),PPM_num_v)
+  call bcast_all_dp(PPM_depth(1:PPM_num_v),PPM_num_v)
+  call bcast_all_dp(PPM_maxlat,1)
+  call bcast_all_dp(PPM_minlat,1)
+  call bcast_all_dp(PPM_maxlon,1)
+  call bcast_all_dp(PPM_minlon,1)
+  call bcast_all_dp(PPM_maxdepth,1)
+  call bcast_all_dp(PPM_mindepth,1)
+  call bcast_all_dp(PPM_dlat,1)
+  call bcast_all_dp(PPM_dlon,1)
+  call bcast_all_dp(PPM_ddepth,1)
+
   end subroutine model_ppm_broadcast
 
 !
@@ -508,14 +507,12 @@
 
 ! smooth model parameters
 
-  use mpi
   use model_ppm_par,only: &
     PPM_maxlat,PPM_maxlon,PPM_minlat,PPM_minlon,PPM_maxdepth,PPM_mindepth
 
   implicit none
 
   include "constants.h"
-  include "precision.h"
 
   integer :: myrank, nproc_xi, nproc_eta
 
@@ -551,7 +548,7 @@
   integer, parameter :: NSLICES = 3
   integer ,parameter :: NSLICES2 = NSLICES * NSLICES
 
-  integer :: sizeprocs, ier, ixi, ieta
+  integer :: sizeprocs, ixi, ieta
   integer :: islice(NSLICES2), islice0(NSLICES2), nums
 
   real(kind=CUSTOM_REAL) :: sigma_h, sigma_h2, sigma_h3, sigma_v, sigma_v2, sigma_v3
@@ -595,6 +592,8 @@
   real(kind=CUSTOM_REAL) radius,theta,phi,lat,lon,r_depth,margin_v,margin_h
   real(kind=CUSTOM_REAL) dist_h,dist_v
 
+  double precision,external :: wtime
+
 !----------------------------------------------------------------------------------------------------
   ! smoothing parameters
   logical,parameter:: GAUSS_SMOOTHING = .false. ! set to true to use this smoothing routine
@@ -752,7 +751,7 @@
   deallocate(xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz)
 
   if (myrank == 0) write(IMAIN, *) 'distributing locations, jacobians and model values ...'
-  call mpi_barrier(MPI_COMM_WORLD,ier)
+  call sync_all()
 
   ! get location/jacobian info from slices
   allocate( slice_x(NGLLX,NGLLY,NGLLZ,NSPEC,nums))
@@ -767,10 +766,10 @@
       z(:,:,:,:) = zstore(:,:,:,:)
     endif
     ! every process broadcasts its info
-    call MPI_BCAST(x,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(y,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(z,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(jacobian,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
+    call bcast_all_cr(x,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(y,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(z,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(jacobian,NGLLX*NGLLY*NGLLZ*NSPEC)
 
     ! only relevant process info gets stored
     do ii=1,nums
@@ -811,15 +810,15 @@
       ! one should add the c**store and tau_* arrays here as well
     endif
     ! every process broadcasts its info
-    call MPI_BCAST(ks_rho,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_kv,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_kh,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_muv,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_muh,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_eta,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_dvp,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_rhovp,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(ks_rhovs,NGLLX*NGLLY*NGLLZ*NSPEC,CUSTOM_MPI_TYPE,rank,MPI_COMM_WORLD,ier)
+    call bcast_all_cr(ks_rho,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_kv,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_kh,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_muv,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_muh,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_eta,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_dvp,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_rhovp,NGLLX*NGLLY*NGLLZ*NSPEC)
+    call bcast_all_cr(ks_rhovs,NGLLX*NGLLY*NGLLZ*NSPEC)
 
     ! only relevant process info gets stored
     do ii=1,nums
@@ -838,9 +837,8 @@
   enddo
 
   ! get the global maximum value of the original kernel file
-  !call mpi_barrier(MPI_COMM_WORLD,ier)
-  !call mpi_reduce(maxval(abs(muvstore(:,:,:,:))), max_old, 1, &
-  !              CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
+  !call sync_all()
+  !call max_all_cr(maxval(abs(muvstore(:,:,:,:))), max_old)
 
   if (myrank == 0) write(IMAIN, *) 'start looping over elements and points for smoothing ...'
 
@@ -857,7 +855,7 @@
 
   bk(:,:,:,:) = 0.0_CUSTOM_REAL
   do ii = 1, nums
-    if (myrank == 0) starttime = MPI_WTIME()
+    if (myrank == 0) starttime = wtime()
     if (myrank == 0) write(IMAIN, *) '  slice number = ', ii
 
     ! read in the topology, jacobian, calculate center of elements
@@ -891,7 +889,7 @@
     ! loop over elements to be smoothed in the current slice
     do ispec = 1, nspec
 
-      if (myrank == 0 .and. mod(ispec,100) == 0 ) write(IMAIN, *) '    ispec ', ispec,' sec:',MPI_WTIME()-starttime
+      if (myrank == 0 .and. mod(ispec,100) == 0 ) write(IMAIN, *) '    ispec ', ispec,' sec:',wtime()-starttime
 
       ! --- only double loop over the elements in the search radius ---
       do ispec2 = 1, nspec
@@ -1045,15 +1043,14 @@
   !if (myrank == 0) write(IMAIN, *) 'Maximum data value before smoothing = ', max_old
 
   ! the maximum value for the smoothed kernel
-  !call mpi_barrier(MPI_COMM_WORLD,ier)
-  !call mpi_reduce(maxval(abs(muvstore(:,:,:,:))), max_new, 1, &
-  !           CUSTOM_MPI_TYPE, MPI_MAX, 0, MPI_COMM_WORLD,ier)
+  !call sync_all()
+  !call max_all_cr(maxval(abs(muvstore(:,:,:,:))), max_new)
 
   !if (myrank == 0) then
   !  write(IMAIN, *) 'Maximum data value after smoothing = ', max_new
   !  write(IMAIN, *)
   !endif
-  !call MPI_BARRIER(MPI_COMM_WORLD,ier)
+  !call sync_all()
 
   end subroutine
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s20rts.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s20rts.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s20rts.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -61,7 +61,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_s20rts_par
 
   implicit none
@@ -88,13 +87,13 @@
   if(myrank == 0) call read_model_s20rts()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(S20RTS_V_dvs_a,(NK_20+1)*(NS_20+1)*(NS_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_dvs_b,(NK_20+1)*(NS_20+1)*(NS_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_dvp_a,(NK_20+1)*(NS_20+1)*(NS_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_dvp_b,(NK_20+1)*(NS_20+1)*(NS_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_spknt,NK_20+1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_qq0,(NK_20+1)*(NK_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S20RTS_V_qq,3*(NK_20+1)*(NK_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(S20RTS_V_dvs_a,(NK_20+1)*(NS_20+1)*(NS_20+1))
+  call bcast_all_dp(S20RTS_V_dvs_b,(NK_20+1)*(NS_20+1)*(NS_20+1))
+  call bcast_all_dp(S20RTS_V_dvp_a,(NK_20+1)*(NS_20+1)*(NS_20+1))
+  call bcast_all_dp(S20RTS_V_dvp_b,(NK_20+1)*(NS_20+1)*(NS_20+1))
+  call bcast_all_dp(S20RTS_V_spknt,NK_20+1)
+  call bcast_all_dp(S20RTS_V_qq0,(NK_20+1)*(NK_20+1))
+  call bcast_all_dp(S20RTS_V_qq,3*(NK_20+1)*(NK_20+1))
 
   end subroutine model_s20rts_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s362ani.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s362ani.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s362ani.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -83,7 +83,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_s362ani_par
 
   implicit none
@@ -117,27 +116,33 @@
   if(myrank == 0) call read_model_s362ani(THREE_D_MODEL,THREE_D_MODEL_S362ANI,THREE_D_MODEL_S362WMANI, &
                           THREE_D_MODEL_S362ANI_PREM,THREE_D_MODEL_S29EA)
 
-  call MPI_BCAST(numker,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(numhpa,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ihpa,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(lmxhpa,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(itypehpa,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ihpakern,maxker,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(numcoe,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ivarkern,maxker,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(itpspl,maxcoe*maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(numker,1)
+  call bcast_all_i(numhpa,1)
+  call bcast_all_i(ihpa,1)
+  call bcast_all_i(lmxhpa,maxhpa)
+  call bcast_all_i(itypehpa,maxhpa)
+  call bcast_all_i(ihpakern,maxker)
+  call bcast_all_i(numcoe,maxhpa)
+  call bcast_all_i(ivarkern,maxker)
+  call bcast_all_i(itpspl,maxcoe*maxhpa)
 
-  call MPI_BCAST(xlaspl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(xlospl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(radspl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(coe,maxcoe*maxker,MPI_REAL,0,MPI_COMM_WORLD,ier)
+  call bcast_all_r(xlaspl,maxcoe*maxhpa)
+  call bcast_all_r(xlospl,maxcoe*maxhpa)
+  call bcast_all_r(radspl,maxcoe*maxhpa)
+  call bcast_all_r(coe,maxcoe*maxker)
 
-  call MPI_BCAST(hsplfl,80*maxhpa,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(dskker,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(kerstr,80,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(refmdl,80,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(varstr,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  !call MPI_BCAST(hsplfl,80*maxhpa,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(hsplfl,80*maxhpa)
 
+  !call MPI_BCAST(dskker,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(dskker,40*maxker)
+
+  call bcast_all_ch(kerstr,80)
+  call bcast_all_ch(refmdl,80)
+
+  !call MPI_BCAST(varstr,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(varstr,40*maxker)
+
   end subroutine model_s362ani_broadcast
 
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s40rts.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s40rts.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_s40rts.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -67,7 +67,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_s40rts_par
 
   implicit none
@@ -93,13 +92,13 @@
   if(myrank == 0) call read_model_s40rts()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(S40RTS_V_dvs_a,(NK_20+1)*(NS_40+1)*(NS_40+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_dvs_b,(NK_20+1)*(NS_40+1)*(NS_40+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_dvp_a,(NK_20+1)*(NS_40+1)*(NS_40+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_dvp_b,(NK_20+1)*(NS_40+1)*(NS_40+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_spknt,NK_20+1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_qq0,(NK_20+1)*(NK_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(S40RTS_V_qq,3*(NK_20+1)*(NK_20+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(S40RTS_V_dvs_a,(NK_20+1)*(NS_40+1)*(NS_40+1))
+  call bcast_all_dp(S40RTS_V_dvs_b,(NK_20+1)*(NS_40+1)*(NS_40+1))
+  call bcast_all_dp(S40RTS_V_dvp_a,(NK_20+1)*(NS_40+1)*(NS_40+1))
+  call bcast_all_dp(S40RTS_V_dvp_b,(NK_20+1)*(NS_40+1)*(NS_40+1))
+  call bcast_all_dp(S40RTS_V_spknt,NK_20+1)
+  call bcast_all_dp(S40RTS_V_qq0,(NK_20+1)*(NK_20+1))
+  call bcast_all_dp(S40RTS_V_qq,3*(NK_20+1)*(NK_20+1))
 
   end subroutine model_s40rts_broadcast
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea1d.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea1d.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea1d.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -103,8 +103,7 @@
   double precision :: r,frac,scaleval
   integer :: i
 
-!! DK DK implementation of model sea1d below and its radii in
-!! DK DK subroutine read_parameter_file.f90 has not been thoroughly
+!! DK DK implementation of model sea1d below and its radii has not been thoroughly
 !! DK DK checked yet
 
 ! compute real physical radius in meters

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea99_s.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea99_s.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/model_sea99_s.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -63,7 +63,6 @@
 
 ! standard routine to setup model
 
-  use mpi
   use model_sea99_s_par
 
   implicit none
@@ -84,16 +83,16 @@
   if(myrank == 0) call read_sea99_s_model()
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(sea99_ndep,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(sea99_nlat,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(sea99_nlon,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(sea99_ddeg,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(alatmin,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(alatmax,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(alonmin,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(alonmax,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(sea99_vs,100*100*100,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(sea99_depth,100,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(sea99_ndep,1)
+  call bcast_all_i(sea99_nlat,1)
+  call bcast_all_i(sea99_nlon,1)
+  call bcast_all_dp(sea99_ddeg,1)
+  call bcast_all_dp(alatmin,1)
+  call bcast_all_dp(alatmax,1)
+  call bcast_all_dp(alonmin,1)
+  call bcast_all_i(alonmax,1)
+  call bcast_all_i(sea99_vs,100*100*100)
+  call bcast_all_i(sea99_depth,100)
 
   end subroutine model_sea99_s_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/moho_stretching.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/moho_stretching.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/moho_stretching.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -32,67 +32,89 @@
 	$(EMPTY_MACRO)
 
 meshfem3D_OBJECTS = \
-	$O/meshfem3D.o \
-	$O/meshfem3D_models.o \
-	$O/add_missing_nodes.o \
-	$O/add_topography.o \
-	$O/add_topography_410_650.o \
-	$O/add_topography_cmb.o \
-	$O/add_topography_icb.o \
-	$O/calc_jacobian.o \
-	$O/compute_coordinates_grid.o \
-	$O/compute_element_properties.o \
-	$O/create_central_cube.o \
-	$O/create_chunk_buffers.o \
-	$O/create_doubling_elements.o \
-	$O/create_mass_matrices.o \
-	$O/create_regions_mesh.o \
-	$O/get_perm_color.o \
-	$O/create_regular_elements.o \
-	$O/define_superbrick.o \
-	$O/get_absorb.o \
-	$O/get_ellipticity.o \
-	$O/get_global.o \
-	$O/get_jacobian_boundaries.o \
-	$O/get_jacobian_discontinuities.o \
-	$O/get_model.o \
-	$O/get_MPI_1D_buffers.o \
-	$O/get_MPI_cutplanes_eta.o \
-	$O/get_MPI_cutplanes_xi.o \
-	$O/get_shape2D.o \
-	$O/get_shape3D.o \
-	$O/lgndr.o \
-	$O/model_sea99_s.o \
-	$O/model_1066a.o \
-	$O/model_ak135.o \
-	$O/model_aniso_inner_core.o \
-	$O/model_aniso_mantle.o \
-	$O/model_atten3D_QRFSI12.o \
-	$O/model_attenuation.o \
-	$O/model_crust.o \
-	$O/model_eucrust.o \
-	$O/model_epcrust.o \
-	$O/model_crustmaps.o \
-	$O/model_gll.o \
-	$O/model_heterogen_mantle.o \
-	$O/model_iasp91.o \
-	$O/model_jp1d.o \
-	$O/model_jp3d.o \
-	$O/model_ppm.o \
-	$O/model_gapp2.o \
-	$O/model_1dref.o \
-	$O/model_s20rts.o \
-	$O/model_s40rts.o \
-	$O/model_s362ani.o \
-	$O/model_sea1d.o \
-	$O/moho_stretching.o \
-	$O/save_arrays_solver.o \
-	$O/sort_array_coordinates.o \
-	$O/stretching_function.o \
-	$O/write_AVS_DX_global_chunks_data.o \
-	$O/write_AVS_DX_global_data.o \
-	$O/write_AVS_DX_global_faces_data.o \
-	$O/write_AVS_DX_surface_data.o \
+	$O/meshfem3D_par.check.o \
+	$O/meshfem3D.check.o \
+	$O/meshfem3D_models.check.o \
+	$O/add_missing_nodes.check.o \
+	$O/add_topography.check.o \
+	$O/add_topography_410_650.check.o \
+	$O/add_topography_cmb.check.o \
+	$O/add_topography_icb.check.o \
+	$O/assemble_MPI_central_cube_mesh.check.o \
+	$O/assemble_MPI_scalar_mesh.check.o \
+	$O/assemble_MPI_vector_mesh.check.o \
+	$O/calc_jacobian.check.o \
+	$O/compute_area.check.o \
+	$O/compute_coordinates_grid.check.o \
+	$O/compute_element_properties.check.o \
+	$O/compute_volumes.check.o \
+	$O/create_addressing.check.o \
+	$O/create_central_cube.check.o \
+	$O/create_central_cube_buffers.check.o \
+	$O/create_chunk_buffers.check.o \
+	$O/create_doubling_elements.check.o \
+	$O/create_mass_matrices.check.o \
+	$O/create_meshes.check.o \
+	$O/create_MPI_interfaces.check.o \
+	$O/create_regions_mesh.check.o \
+	$O/create_regular_elements.check.o \
+	$O/define_superbrick.check.o \
+	$O/finalize_mesher.check.o \
+	$O/fix_non_blocking_flags.check.o \
+	$O/get_absorb.check.o \
+	$O/get_ellipticity.check.o \
+	$O/get_global.check.o \
+	$O/get_jacobian_boundaries.check.o \
+	$O/get_jacobian_discontinuities.check.o \
+	$O/get_model.check.o \
+	$O/get_MPI_1D_buffers.check.o \
+	$O/get_MPI_cutplanes_eta.check.o \
+	$O/get_MPI_cutplanes_xi.check.o \
+	$O/get_MPI_interfaces.check.o \
+	$O/get_perm_color.check.o \
+	$O/get_shape2D.check.o \
+	$O/get_shape3D.check.o \
+	$O/heap_sort.check.o \
+	$O/initialize_layers.check.o \
+	$O/initialize_mesher.check.o \
+	$O/lgndr.check.o \
+	$O/model_1dref.check.o \
+	$O/model_1066a.check.o \
+	$O/model_ak135.check.o \
+	$O/model_sea1d.check.o \
+	$O/model_aniso_inner_core.check.o \
+	$O/model_aniso_mantle.check.o \
+	$O/model_atten3D_QRFSI12.check.o \
+	$O/model_attenuation.check.o \
+	$O/model_crust.check.o \
+	$O/model_crustmaps.check.o \
+	$O/model_eucrust.check.o \
+	$O/model_epcrust.check.o \
+	$O/model_gapp2.check.o \
+	$O/model_gll.check.o \
+	$O/model_heterogen_mantle.check.o \
+	$O/model_iasp91.check.o \
+	$O/model_jp1d.check.o \
+	$O/model_jp3d.check.o \
+	$O/model_ppm.check.o \
+	$O/model_s20rts.check.o \
+	$O/model_s40rts.check.o \
+	$O/model_s362ani.check.o \
+	$O/model_sea99_s.check.o \
+	$O/moho_stretching.check.o \
+	$O/save_arrays_solver.check.o \
+	$O/setup_color_perm.check.o \
+	$O/setup_counters.check.o \
+	$O/setup_inner_outer.check.o \
+	$O/setup_model.check.o \
+	$O/setup_MPI_interfaces.check.o \
+	$O/sort_array_coordinates.check.o \
+	$O/stretching_function.check.o \
+	$O/test_MPI_interfaces.check.o \
+	$O/write_AVS_DX_global_chunks_data.check.o \
+	$O/write_AVS_DX_global_data.check.o \
+	$O/write_AVS_DX_global_faces_data.check.o \
+	$O/write_AVS_DX_surface_data.check.o \
 	$(EMPTY_MACRO)
 
 meshfem3D_MODULES = \
@@ -103,44 +125,72 @@
 
 # These files come from the shared directory
 meshfem3D_SHARED_OBJECTS = \
-	$O/auto_ner.o \
-	$O/broadcast_computed_parameters.o \
-	$O/calendar.o \
-	$O/count_number_of_sources.o \
-	$O/create_name_database.o \
-	$O/euler_angles.o \
-	$O/exit_mpi.o \
-	$O/force_ftz.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/gll_library.o \
-	$O/hex_nodes.o \
-	$O/intgrl.o \
-	$O/lagrange_poly.o \
-	$O/make_ellipticity.o \
-	$O/make_gravity.o \
-	$O/memory_eval.o \
-	$O/model_prem.o \
-	$O/model_topo_bathy.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
-	$O/save_header_file.o \
-	$O/spline_routines.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/broadcast_computed_parameters.shared.o \
+	$O/calendar.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_number_of_sources.shared.o \
+	$O/count_points.shared.o \
+	$O/create_name_database.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/euler_angles.shared.o \
+	$O/exit_mpi.sharedmpi.o \
+	$O/force_ftz.cc.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/gll_library.shared.o \
+	$O/hex_nodes.shared.o \
+	$O/intgrl.shared.o \
+	$O/lagrange_poly.shared.o \
+	$O/make_ellipticity.shared.o \
+	$O/make_gravity.shared.o \
+	$O/memory_eval.shared.o \
+	$O/model_prem.shared.o \
+	$O/model_topo_bathy.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
+	$O/save_header_file.shared.o \
+	$O/spline_routines.shared.o \
+	$O/write_VTK_file.shared.o \
 	$(EMPTY_MACRO)
 
+XMESHFEM_OBJECTS = $(meshfem3D_SHARED_OBJECTS) $(meshfem3D_OBJECTS)
+
+###
+### ADIOS
+###
+
+adios_OBJECTS = \
+  $O/adios_helpers.shared.o \
+  $O/adios_manager.shared.o \
+	$(EMPTY_MACRO)
+
+adios_STUBS = \
+	$O/adios_method_stubs.shared.o \
+	$(EMPTY_MACRO)
+
+# conditional adios linking
+ifeq ($(ADIOS),yes)
+XMESHFEM_OBJECTS += $(adios_OBJECTS)
+else
+XMESHFEM_OBJECTS += $(adios_STUBS)
+endif
+
 #######################################
 
 ####
 #### rules for executables
 ####
 
-${E}/xmeshfem3D: $(meshfem3D_OBJECTS) $(meshfem3D_SHARED_OBJECTS)
+${E}/xmeshfem3D: $(XMESHFEM_OBJECTS)
 ## use MPI here
-	${MPIFCCOMPILE_CHECK} -o ${E}/xmeshfem3D $(meshfem3D_OBJECTS) $(meshfem3D_SHARED_OBJECTS) $(MPILIBS)
+	${MPIFCCOMPILE_CHECK} -o ${E}/xmeshfem3D $(XMESHFEM_OBJECTS) $(MPILIBS)
 
 #######################################
 
@@ -152,193 +202,15 @@
 #### rule for each .o file below
 ####
 
-###
-### meshfem3D objects
-###
+$O/%.check.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/add_missing_nodes.o: ${SETUP}/constants.h $S/add_missing_nodes.f90
-	${FCCOMPILE_CHECK} -c -o $O/add_missing_nodes.o ${FCFLAGS_f90} $S/add_missing_nodes.f90
+$O/%.check.o: $S/%.F90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/add_topography.o: ${SETUP}/constants.h $S/add_topography.f90
-	${FCCOMPILE_CHECK} -c -o $O/add_topography.o ${FCFLAGS_f90} $S/add_topography.f90
+$O/%.checkmpi.o: $S/%.f90 ${SETUP}/constants.h
+	${MPIFCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/add_topography_410_650.o: ${SETUP}/constants.h $S/add_topography_410_650.f90
-	${FCCOMPILE_CHECK} -c -o $O/add_topography_410_650.o ${FCFLAGS_f90} $S/add_topography_410_650.f90
+$O/%.checkmpi.o: $S/%.F90 ${SETUP}/constants.h
+	${MPIFCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/add_topography_cmb.o: ${SETUP}/constants.h $S/add_topography_cmb.f90
-	${FCCOMPILE_CHECK} -c -o $O/add_topography_cmb.o ${FCFLAGS_f90} $S/add_topography_cmb.f90
-
-$O/add_topography_icb.o: ${SETUP}/constants.h $S/add_topography_icb.f90
-	${FCCOMPILE_CHECK} -c -o $O/add_topography_icb.o ${FCFLAGS_f90} $S/add_topography_icb.f90
-
-$O/calc_jacobian.o: ${SETUP}/constants.h $S/calc_jacobian.f90
-	${FCCOMPILE_CHECK} -c -o $O/calc_jacobian.o ${FCFLAGS_f90} $S/calc_jacobian.f90
-
-$O/compute_coordinates_grid.o: ${SETUP}/constants.h $S/compute_coordinates_grid.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_coordinates_grid.o ${FCFLAGS_f90} $S/compute_coordinates_grid.f90
-
-$O/compute_element_properties.o: ${SETUP}/constants.h $S/compute_element_properties.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/compute_element_properties.o ${FCFLAGS_f90} $S/compute_element_properties.f90
-
-$O/create_central_cube.o: ${SETUP}/constants.h $S/create_central_cube.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/create_central_cube.o ${FCFLAGS_f90} $S/create_central_cube.f90
-
-$O/create_doubling_elements.o: ${SETUP}/constants.h $S/create_doubling_elements.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/create_doubling_elements.o ${FCFLAGS_f90} $S/create_doubling_elements.f90
-
-$O/create_mass_matrices.o: ${SETUP}/constants.h $S/create_mass_matrices.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/create_mass_matrices.o ${FCFLAGS_f90} $S/create_mass_matrices.f90
-
-$O/create_regions_mesh.o: ${SETUP}/constants.h $S/create_regions_mesh.F90 $O/meshfem3D_models.o
-	${MPIFCCOMPILE_CHECK} -c -o $O/create_regions_mesh.o ${FCFLAGS_f90} $S/create_regions_mesh.F90
-
-$O/get_perm_color.o: ${SETUP}/constants.h $S/get_perm_color.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_perm_color.o ${FCFLAGS_f90} $S/get_perm_color.f90
-
-$O/create_regular_elements.o: ${SETUP}/constants.h $S/create_regular_elements.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/create_regular_elements.o ${FCFLAGS_f90} $S/create_regular_elements.f90
-
-$O/define_superbrick.o: ${SETUP}/constants.h $S/define_superbrick.f90
-	${FCCOMPILE_CHECK} -c -o $O/define_superbrick.o ${FCFLAGS_f90} $S/define_superbrick.f90
-
-$O/get_absorb.o: ${SETUP}/constants.h $S/get_absorb.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_absorb.o ${FCFLAGS_f90} $S/get_absorb.f90
-
-$O/get_ellipticity.o: ${SETUP}/constants.h $S/get_ellipticity.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_ellipticity.o ${FCFLAGS_f90} $S/get_ellipticity.f90
-
-$O/get_global.o: ${SETUP}/constants.h $S/get_global.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_global.o ${FCFLAGS_f90} $S/get_global.f90
-
-$O/get_jacobian_boundaries.o: ${SETUP}/constants.h $S/get_jacobian_boundaries.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_jacobian_boundaries.o ${FCFLAGS_f90} $S/get_jacobian_boundaries.f90
-
-$O/get_jacobian_discontinuities.o: ${SETUP}/constants.h $S/get_jacobian_discontinuities.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_jacobian_discontinuities.o ${FCFLAGS_f90} $S/get_jacobian_discontinuities.f90
-
-$O/get_model.o: ${SETUP}/constants.h $S/get_model.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/get_model.o ${FCFLAGS_f90} $S/get_model.f90
-
-$O/get_MPI_1D_buffers.o: ${SETUP}/constants.h $S/get_MPI_1D_buffers.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_MPI_1D_buffers.o ${FCFLAGS_f90} $S/get_MPI_1D_buffers.f90
-
-$O/get_MPI_cutplanes_xi.o: ${SETUP}/constants.h $S/get_MPI_cutplanes_xi.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_MPI_cutplanes_xi.o ${FCFLAGS_f90} $S/get_MPI_cutplanes_xi.f90
-
-$O/get_MPI_cutplanes_eta.o: ${SETUP}/constants.h $S/get_MPI_cutplanes_eta.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_MPI_cutplanes_eta.o ${FCFLAGS_f90} $S/get_MPI_cutplanes_eta.f90
-
-$O/get_shape2D.o: ${SETUP}/constants.h $S/get_shape2D.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_shape2D.o ${FCFLAGS_f90} $S/get_shape2D.f90
-
-$O/get_shape3D.o: ${SETUP}/constants.h $S/get_shape3D.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_shape3D.o ${FCFLAGS_f90} $S/get_shape3D.f90
-
-$O/lgndr.o: ${SETUP}/constants.h $S/lgndr.f90
-	${FCCOMPILE_CHECK} -c -o $O/lgndr.o ${FCFLAGS_f90} $S/lgndr.f90
-
-$O/model_iasp91.o: ${SETUP}/constants.h $S/model_iasp91.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_iasp91.o ${FCFLAGS_f90} $S/model_iasp91.f90
-
-$O/model_1066a.o: ${SETUP}/constants.h $S/model_1066a.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_1066a.o ${FCFLAGS_f90} $S/model_1066a.f90
-
-$O/model_ak135.o: ${SETUP}/constants.h $S/model_ak135.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_ak135.o ${FCFLAGS_f90} $S/model_ak135.f90
-
-$O/model_aniso_inner_core.o: ${SETUP}/constants.h $S/model_aniso_inner_core.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_aniso_inner_core.o ${FCFLAGS_f90} $S/model_aniso_inner_core.f90
-
-$O/model_1dref.o: ${SETUP}/constants.h $S/model_1dref.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_1dref.o ${FCFLAGS_f90} $S/model_1dref.f90
-
-$O/model_jp1d.o: ${SETUP}/constants.h $S/model_jp1d.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_jp1d.o ${FCFLAGS_f90} $S/model_jp1d.f90
-
-$O/model_sea1d.o: ${SETUP}/constants.h $S/model_sea1d.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_sea1d.o ${FCFLAGS_f90} $S/model_sea1d.f90
-
-$O/moho_stretching.o: ${SETUP}/constants.h $S/moho_stretching.f90 $O/meshfem3D_models.o
-	${FCCOMPILE_CHECK} -c -o $O/moho_stretching.o ${FCFLAGS_f90} $S/moho_stretching.f90
-
-$O/save_arrays_solver.o: ${SETUP}/constants.h $S/save_arrays_solver.f90
-	${FCCOMPILE_CHECK} -c -o $O/save_arrays_solver.o ${FCFLAGS_f90} $S/save_arrays_solver.f90
-
-$O/sort_array_coordinates.o: ${SETUP}/constants.h $S/sort_array_coordinates.f90
-	${FCCOMPILE_CHECK} -c -o $O/sort_array_coordinates.o ${FCFLAGS_f90} $S/sort_array_coordinates.f90
-
-$O/stretching_function.o: ${SETUP}/constants.h $S/stretching_function.f90
-	${FCCOMPILE_CHECK} -c -o $O/stretching_function.o ${FCFLAGS_f90} $S/stretching_function.f90
-
-$O/write_AVS_DX_global_faces_data.o: ${SETUP}/constants.h $S/write_AVS_DX_global_faces_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/write_AVS_DX_global_faces_data.o ${FCFLAGS_f90} $S/write_AVS_DX_global_faces_data.f90
-
-$O/write_AVS_DX_global_chunks_data.o: ${SETUP}/constants.h $S/write_AVS_DX_global_chunks_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/write_AVS_DX_global_chunks_data.o ${FCFLAGS_f90} $S/write_AVS_DX_global_chunks_data.f90
-
-$O/write_AVS_DX_surface_data.o: ${SETUP}/constants.h $S/write_AVS_DX_surface_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/write_AVS_DX_surface_data.o ${FCFLAGS_f90} $S/write_AVS_DX_surface_data.f90
-
-$O/write_AVS_DX_global_data.o: ${SETUP}/constants.h $S/write_AVS_DX_global_data.f90
-	${FCCOMPILE_CHECK} -c -o $O/write_AVS_DX_global_data.o ${FCFLAGS_f90} $S/write_AVS_DX_global_data.f90
-
-##
-## meshfem3D objects with mpi compilation
-##
-$O/create_chunk_buffers.o: ${SETUP}/constants.h $S/create_chunk_buffers.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/create_chunk_buffers.o ${FCFLAGS_f90} $S/create_chunk_buffers.f90
-
-$O/meshfem3D.o: ${SETUP}/constants.h $S/meshfem3D.f90 $O/meshfem3D_models.o
-	${MPIFCCOMPILE_CHECK} -c -o $O/meshfem3D.o ${FCFLAGS_f90} $S/meshfem3D.f90
-
-$O/meshfem3D_models.o: ${SETUP}/constants.h $S/meshfem3D_models.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/meshfem3D_models.o ${FCFLAGS_f90} $S/meshfem3D_models.f90
-
-$O/model_aniso_mantle.o: ${SETUP}/constants.h $S/model_aniso_mantle.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_aniso_mantle.o ${FCFLAGS_f90} $S/model_aniso_mantle.f90
-
-$O/model_atten3D_QRFSI12.o: ${SETUP}/constants.h $S/model_atten3D_QRFSI12.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_atten3D_QRFSI12.o ${FCFLAGS_f90} $S/model_atten3D_QRFSI12.f90
-
-$O/model_attenuation.o: ${SETUP}/constants.h $S/model_attenuation.f90 $O/model_ak135.o $O/model_1066a.o $O/model_1dref.o
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_attenuation.o ${FCFLAGS_f90} $S/model_attenuation.f90
-
-$O/model_crust.o: ${SETUP}/constants.h $S/model_crust.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_crust.o ${FCFLAGS_f90} $S/model_crust.f90
-
-$O/model_eucrust.o: ${SETUP}/constants.h $S/model_eucrust.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_eucrust.o ${FCFLAGS_f90} $S/model_eucrust.f90
-
-$O/model_epcrust.o: ${SETUP}/constants.h $S/model_epcrust.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_epcrust.o ${FCFLAGS_f90} $S/model_epcrust.f90
-
-$O/model_crustmaps.o: ${SETUP}/constants.h $S/model_crustmaps.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_crustmaps.o ${FCFLAGS_f90} $S/model_crustmaps.f90
-
-$O/model_gll.o: ${SETUP}/constants.h $S/model_gll.f90 $O/meshfem3D_models.o
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_gll.o ${FCFLAGS_f90} $S/model_gll.f90
-
-$O/model_heterogen_mantle.o: ${SETUP}/constants.h $S/model_heterogen_mantle.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_heterogen_mantle.o ${FCFLAGS_f90} $S/model_heterogen_mantle.f90
-
-$O/model_jp3d.o: ${SETUP}/constants.h $S/model_jp3d.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_jp3d.o ${FCFLAGS_f90} $S/model_jp3d.f90
-
-$O/model_ppm.o: ${SETUP}/constants.h $S/model_ppm.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_ppm.o ${FCFLAGS_f90} $S/model_ppm.f90
-
-$O/model_gapp2.o: ${SETUP}/constants.h $S/model_gapp2.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_gapp2.o ${FCFLAGS_f90} $S/model_gapp2.f90
-
-$O/model_s20rts.o: ${SETUP}/constants.h $S/model_s20rts.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_s20rts.o ${FCFLAGS_f90} $S/model_s20rts.f90
-
-$O/model_s40rts.o: ${SETUP}/constants.h $S/model_s40rts.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_s40rts.o ${FCFLAGS_f90} $S/model_s40rts.f90
-
-$O/model_s362ani.o: ${SETUP}/constants.h $S/model_s362ani.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_s362ani.o ${FCFLAGS_f90} $S/model_s362ani.f90
-
-$O/model_sea99_s.o: ${SETUP}/constants.h $S/model_sea99_s.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_sea99_s.o ${FCFLAGS_f90} $S/model_sea99_s.f90
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -329,7 +329,7 @@
   use constants
 
   use meshfem3D_models_par,only: &
-    TRANSVERSE_ISOTROPY,ATTENUATION
+    TRANSVERSE_ISOTROPY,ATTENUATION,ATTENUATION_3D,ATTENUATION_1D_WITH_3D_STORAGE
 
   use create_regions_mesh_par2,only: &
     rhostore,kappavstore,kappahstore,muvstore,muhstore,eta_anisostore, &
@@ -424,7 +424,7 @@
     ! saves Qmu_store to full custom_real array
     ! uses temporary array
     allocate(temp_store(NGLLX,NGLLY,NGLLZ,nspec))
-    if (USE_3D_ATTENUATION_ARRAYS) then
+    if( ATTENUATION_3D .or. ATTENUATION_1D_WITH_3D_STORAGE ) then
       ! attenuation arrays are fully 3D
       if(CUSTOM_REAL == SIZE_REAL) then
         temp_store(:,:,:,:) = sngl(Qmu_store(:,:,:,:))

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver_adios.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver_adios.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/save_arrays_solver_adios.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -1038,7 +1038,7 @@
   use constants
 
   use meshfem3D_models_par,only: &
-    TRANSVERSE_ISOTROPY,ATTENUATION
+    TRANSVERSE_ISOTROPY,ATTENUATION,ATTENUATION_3D,ATTENUATION_1D_WITH_3D_STORAGE
 
   use create_regions_mesh_par2,only: &
     rhostore,kappavstore,kappahstore,muvstore,muhstore,eta_anisostore, &
@@ -1208,7 +1208,7 @@
     ! saves Qmu_store to full custom_real array
     ! uses temporary array
     allocate(temp_store(NGLLX,NGLLY,NGLLZ,nspec))
-    if (USE_3D_ATTENUATION_ARRAYS) then
+    if (ATTENUATION_3D .or. ATTENUATION_1D_WITH_3D_STORAGE) then
       ! attenuation arrays are fully 3D
       if(CUSTOM_REAL == SIZE_REAL) then
         temp_store(:,:,:,:) = sngl(Qmu_store(:,:,:,:))

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_MPI_interfaces.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_MPI_interfaces.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_MPI_interfaces.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_color_perm.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_color_perm.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_color_perm.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -600,7 +600,8 @@
 
   use meshfem3D_models_par,only: &
     TRANSVERSE_ISOTROPY,HETEROGEN_3D_MANTLE,ANISOTROPIC_3D_MANTLE, &
-    ANISOTROPIC_INNER_CORE,ATTENUATION,SAVE_BOUNDARY_MESH
+    ANISOTROPIC_INNER_CORE,ATTENUATION,SAVE_BOUNDARY_MESH, &
+    ATTENUATION_3D,ATTENUATION_1D_WITH_3D_STORAGE
 
   use meshfem3D_par,only: &
     ABSORBING_CONDITIONS, &
@@ -854,7 +855,7 @@
 
   ! attenuation arrays
   if (ATTENUATION) then
-    if (USE_3D_ATTENUATION_ARRAYS) then
+    if (ATTENUATION_3D .or. ATTENUATION_1D_WITH_3D_STORAGE) then
       allocate(temp_array_dble(NGLLX,NGLLY,NGLLZ,nspec))
       allocate(temp_array_dble_sls(N_SLS,NGLLX,NGLLY,NGLLZ,nspec))
       call permute_elements_dble(Qmu_store,temp_array_dble,perm,nspec)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_counters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_counters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_counters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_inner_outer.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_inner_outer.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_inner_outer.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_model.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/setup_model.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/sort_array_coordinates.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/sort_array_coordinates.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/sort_array_coordinates.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/stretching_function.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/stretching_function.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/stretching_function.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/test_MPI_interfaces.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/test_MPI_interfaces.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/test_MPI_interfaces.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -150,32 +150,19 @@
     ! collects from other processes
     do iproc=1,NPROCTOT-1
       ! gets number of interfaces
-      !call MPI_RECV(inum,1,MPI_INTEGER,iproc,itag,MPI_COMM_WORLD,msg_status,ier)
       call recv_singlei(inum,iproc,itag)
       dummy_i(iproc) = inum
       if( inum > 0 ) then
-        !call MPI_RECV(test_interfaces(1:inum,iproc),inum, &
-        !              MPI_INTEGER,iproc,itag,MPI_COMM_WORLD,msg_status,ier)
         call recv_i(test_interfaces(1:inum,iproc),inum,iproc,itag)
-
-        !call MPI_RECV(test_interfaces_nibool(1:inum,iproc),inum, &
-        !              MPI_INTEGER,iproc,itag,MPI_COMM_WORLD,msg_status,ier)
         call recv_i(test_interfaces_nibool(1:inum,iproc),inum,iproc,itag)
       endif
     enddo
   else
     ! sends infos to master process
-    !call MPI_SEND(num_interfaces,1,MPI_INTEGER,0,itag,MPI_COMM_WORLD,ier)
     call send_singlei(num_interfaces,0,itag)
     if( num_interfaces > 0 ) then
-      !call MPI_SEND(my_neighbours(1:num_interfaces),num_interfaces, &
-      !              MPI_INTEGER,0,itag,MPI_COMM_WORLD,ier)
       call send_i(my_neighbours(1:num_interfaces),num_interfaces,0,itag)
-
-      !call MPI_SEND(nibool_interfaces(1:num_interfaces),num_interfaces, &
-      !              MPI_INTEGER,0,itag,MPI_COMM_WORLD,ier)
       call send_i(nibool_interfaces(1:num_interfaces),num_interfaces,0,itag)
-
     endif
   endif
   call sync_all()

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_chunks_data_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -52,7 +52,7 @@
     RICB,RCMB,RTOPDDOUBLEPRIME,R600,R670,R220,R771,R400,R120,R80,RMOHO, &
     RMIDDLE_CRUST,ROCEAN,iregion_code, &
     group_size_inc, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
 
   implicit none
@@ -1003,7 +1003,7 @@
 !===============================================================================
 subroutine write_AVS_DX_global_chunks_data_adios(adios_handle, myrank, &
     sizeprocs, avs_dx_adios, ISOTROPIC_3D_MANTLE)
-  use mpi
+
   use adios_write_mod
   implicit none
   !--- Arguments

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_data_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -56,7 +56,7 @@
 !! \param avs_dx_adios The structure holding the data to be allocated
 subroutine define_AVS_DX_global_data_adios(adios_group, myrank, nspec, ibool, &
     npointot, mask_ibool, group_size_inc, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
   implicit none
   include "constants.h"
@@ -166,7 +166,7 @@
 subroutine prepare_AVS_DX_global_data_adios(adios_handle, myrank, &
     nspec, ibool, idoubling, xstore, ystore, zstore, num_ibool_AVS_DX, &
     mask_ibool, npointot, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
 
   implicit none
@@ -339,7 +339,7 @@
 !! \avs_dx_adios Structure with the data that have to be wrtten
 subroutine write_AVS_DX_global_data_adios(adios_handle, myrank, &
     sizeprocs, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
   implicit none
   !--- Arguments

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_global_faces_data_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -56,7 +56,7 @@
     RICB,RCMB,RTOPDDOUBLEPRIME,R600,R670,R220,R771,R400,R120,R80,RMOHO, &
     RMIDDLE_CRUST,ROCEAN,iregion_code, &
     group_size_inc, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
 
   implicit none
@@ -699,7 +699,7 @@
 !===============================================================================
 subroutine write_AVS_DX_global_faces_data_adios(adios_handle, myrank, &
     sizeprocs, avs_dx_adios, ISOTROPIC_3D_MANTLE)
-  use mpi
+
   use adios_write_mod
   implicit none
   !--- Arguments

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/meshfem3D/write_AVS_DX_surface_data_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -50,7 +50,7 @@
     RICB,RCMB,RTOPDDOUBLEPRIME,R600,R670,R220,R771,R400,R120,R80,RMOHO, &
     RMIDDLE_CRUST,ROCEAN,iregion_code, &
     group_size_inc, avs_dx_adios)
-  use mpi
+
   use adios_write_mod
 
   implicit none
@@ -451,7 +451,7 @@
 !===============================================================================
 subroutine write_AVS_DX_surfaces_data_adios(adios_handle, myrank, &
     sizeprocs, avs_dx_adios, ISOTROPIC_3D_MANTLE)
-  use mpi
+
   use adios_write_mod
   implicit none
   !--- Arguments

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_helpers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_helpers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_helpers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_manager.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_manager.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_manager.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_method_stubs.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_method_stubs.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/adios_method_stubs.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -0,0 +1,86 @@
+!=====================================================================
+!
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
+!          --------------------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!                        Princeton University, USA
+!             and CNRS / INRIA / University of Pau, France
+! (c) Princeton University and CNRS / INRIA / University of Pau
+!                            August 2013
+!
+! 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.
+!
+!=====================================================================
+
+
+! placeholders for non-adios compilation
+
+! for xmeshfem3D compilation
+
+  subroutine adios_cleanup()
+  end subroutine
+
+  subroutine adios_setup()
+  end subroutine
+
+  subroutine crm_save_mesh_files_adios()
+  end subroutine
+
+  subroutine get_absorb_adios()
+  end subroutine
+
+  subroutine save_arrays_solver_adios()
+  end subroutine
+
+  subroutine save_mpi_arrays_adios()
+  end subroutine
+
+
+! for xspecfem3D compilation
+
+  subroutine read_arrays_solver_adios()
+  end subroutine
+
+  subroutine read_attenuation_adios()
+  end subroutine
+
+  subroutine read_forward_arrays_adios()
+  end subroutine
+
+  subroutine read_intermediate_forward_arrays_adios()
+  end subroutine
+
+  subroutine read_mesh_databases_coupling_adios()
+  end subroutine
+
+  subroutine read_mesh_databases_mpi_cm_adios()
+  end subroutine
+
+  subroutine read_mesh_databases_mpi_ic_adios()
+  end subroutine
+
+  subroutine read_mesh_databases_mpi_oc_adios()
+  end subroutine
+
+  subroutine read_mesh_databases_stacey_adios()
+  end subroutine
+
+  subroutine save_forward_arrays_adios()
+  end subroutine
+
+  subroutine save_intermediate_forward_arrays_adios()
+  end subroutine
+

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/auto_ner.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/auto_ner.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/auto_ner.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/broadcast_computed_parameters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/broadcast_computed_parameters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/broadcast_computed_parameters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,110 +25,117 @@
 !
 !=====================================================================
 
-  subroutine broadcast_computed_parameters(myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-                RMOHO_FICTITIOUS_IN_MESHER, &
-                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
-                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
-                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-                this_region_has_a_doubling,rmins,rmaxs, &
-                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
-                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
-                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
-                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
-                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-                ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+  subroutine broadcast_computed_parameters()
+!                myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!                RMOHO_FICTITIOUS_IN_MESHER, &
+!                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
+!                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
+!                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!                NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!                this_region_has_a_doubling,rmins,rmaxs, &
+!                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
+!                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
+!                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+!                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
+!                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!                ATTENUATION,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+!
 
-  use mpi
+  use constants
+  use shared_parameters
 
   implicit none
 
-  include "constants.h"
-  include "precision.h"
-
   integer myrank
 
   ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-          RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!          RMOHO_FICTITIOUS_IN_MESHER
 
-  logical MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT,&
-          OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,&
-          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE
+!  logical MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT,&
+!          OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,&
+!          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
+  ! local parameters
+  integer :: NSOURCES
+
   ! parameters to be computed based upon parameters above read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+!  integer :: NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA
 
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-      NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-      NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-      NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!      NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!      NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!      NGLOB
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ratio_sampling_array,ner
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ratio_sampling_array,ner
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
 
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
 
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
-  integer ratio_divide_central_cube
+!  integer ratio_divide_central_cube
 
   ! for the cut doublingbrick improvement
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
   ! mesh model parameters
-  integer REFERENCE_1D_MODEL,THREE_D_MODEL
+!  integer REFERENCE_1D_MODEL,THREE_D_MODEL
 
-  logical ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
-    HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
-    ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-    ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ANISOTROPIC_INNER_CORE
+!  logical ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+!    HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
+!    ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!    ATTENUATION,ATTENUATION_3D,ANISOTROPIC_INNER_CORE
 
-  ! local parameters
-  double precision, dimension(31) :: bcast_double_precision
-  integer, dimension(39) :: bcast_integer
-  logical, dimension(36) :: bcast_logical
-  integer ier
+  ! broadcast parameter arrays
+  integer, parameter :: nparam_dp = 32
+  double precision, dimension(nparam_dp) :: bcast_double_precision
 
+  integer, parameter :: nparam_i = 45
+  integer, dimension(nparam_i) :: bcast_integer
+
+  integer, parameter :: nparam_l = 54
+  logical, dimension(nparam_l) :: bcast_logical
+
   ! master process prepares broadcasting arrays
   if (myrank==0) then
     ! count the total number of sources in the CMTSOLUTION file
@@ -146,7 +153,8 @@
             NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,&
             SIMULATION_TYPE,REFERENCE_1D_MODEL,THREE_D_MODEL,NPROC,NPROCTOT, &
             NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube,&
-            MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NSOURCES,NOISE_TOMOGRAPHY/)
+            MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NSOURCES,NOISE_TOMOGRAPHY, &
+            NT_DUMP_ATTENUATION,ATT1,ATT2,ATT3,ATT4,ATT5/)
 
     bcast_logical = (/TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
             CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
@@ -157,49 +165,60 @@
             CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
             HONOR_1D_SPHERICAL_MOHO,MOVIE_COARSE, &
             OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,&
-            ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE,ATTENUATION_NEW/)
+            ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
+            SAVE_REGULAR_KL,PARTIAL_PHYS_DISPERSION_ONLY,UNDO_ATTENUATION, &
+            USE_LDDRK,INCREASE_CFL_FOR_LDDRK,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL, &
+            USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK, &
+            GPU_MODE, &
+            ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
+            ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_SOLVER_MESHFILES,ADIOS_FOR_AVS_DX,&
+            EXACT_MASS_MATRIX_FOR_ROTATION,ATTENUATION_1D_WITH_3D_STORAGE/)
 
     bcast_double_precision = (/DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
             CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
             RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
             R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
             MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,&
-            RMOHO_FICTITIOUS_IN_MESHER /)
+            RMOHO_FICTITIOUS_IN_MESHER,RATIO_BY_WHICH_TO_INCREASE_IT /)
   endif
 
   ! broadcasts the information read on the master to the nodes
-  call MPI_BCAST(bcast_integer,39,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(bcast_double_precision,31,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(bcast_logical,36,MPI_LOGICAL,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(bcast_integer,nparam_i)
+  call bcast_all_dp(bcast_double_precision,nparam_dp)
+  call bcast_all_l(bcast_logical,nparam_l)
 
   ! broadcasts non-single value parameters
-  call MPI_BCAST(LOCAL_PATH,150,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(LOCAL_TMP_PATH,150,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(MODEL,150,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ner,MAX_NUMBER_OF_MESH_LAYERS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ratio_sampling_array,MAX_NUMBER_OF_MESH_LAYERS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(doubling_index,MAX_NUMBER_OF_MESH_LAYERS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(r_bottom,MAX_NUMBER_OF_MESH_LAYERS,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(r_top,MAX_NUMBER_OF_MESH_LAYERS,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(rmins,MAX_NUMBER_OF_MESH_LAYERS,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(rmaxs,MAX_NUMBER_OF_MESH_LAYERS,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(this_region_has_a_doubling,MAX_NUMBER_OF_MESH_LAYERS,MPI_LOGICAL,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2D_XI,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2D_ETA,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2DMAX_XMIN_XMAX,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2DMAX_YMIN_YMAX,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2D_BOTTOM,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC2D_TOP,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NSPEC1D_RADIAL,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NGLOB1D_RADIAL,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NGLOB2DMAX_XMIN_XMAX,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NGLOB2DMAX_YMIN_YMAX,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(NGLOB,MAX_NUM_REGIONS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(DIFF_NSPEC1D_RADIAL,NB_SQUARE_CORNERS*NB_CUT_CASE,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(DIFF_NSPEC2D_ETA,NB_SQUARE_EDGES_ONEDIR*NB_CUT_CASE,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(DIFF_NSPEC2D_XI,NB_SQUARE_EDGES_ONEDIR*NB_CUT_CASE,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(LOCAL_PATH,150)
+  call bcast_all_ch(LOCAL_TMP_PATH,150)
+  call bcast_all_ch(MODEL,150)
 
+  call bcast_all_i(ner,MAX_NUMBER_OF_MESH_LAYERS)
+  call bcast_all_i(ratio_sampling_array,MAX_NUMBER_OF_MESH_LAYERS)
+  call bcast_all_i(doubling_index,MAX_NUMBER_OF_MESH_LAYERS)
+
+  call bcast_all_dp(r_bottom,MAX_NUMBER_OF_MESH_LAYERS)
+  call bcast_all_dp(r_top,MAX_NUMBER_OF_MESH_LAYERS)
+  call bcast_all_dp(rmins,MAX_NUMBER_OF_MESH_LAYERS)
+  call bcast_all_dp(rmaxs,MAX_NUMBER_OF_MESH_LAYERS)
+
+  call bcast_all_l(this_region_has_a_doubling,MAX_NUMBER_OF_MESH_LAYERS)
+
+  call bcast_all_i(NSPEC,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2D_XI,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2D_ETA,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2DMAX_XMIN_XMAX,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2DMAX_YMIN_YMAX,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2D_BOTTOM,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC2D_TOP,MAX_NUM_REGIONS)
+  call bcast_all_i(NSPEC1D_RADIAL,MAX_NUM_REGIONS)
+  call bcast_all_i(NGLOB1D_RADIAL,MAX_NUM_REGIONS)
+  call bcast_all_i(NGLOB2DMAX_XMIN_XMAX,MAX_NUM_REGIONS)
+  call bcast_all_i(NGLOB2DMAX_YMIN_YMAX,MAX_NUM_REGIONS)
+  call bcast_all_i(NGLOB,MAX_NUM_REGIONS)
+  call bcast_all_i(DIFF_NSPEC1D_RADIAL,NB_SQUARE_CORNERS*NB_CUT_CASE)
+  call bcast_all_i(DIFF_NSPEC2D_ETA,NB_SQUARE_EDGES_ONEDIR*NB_CUT_CASE)
+  call bcast_all_i(DIFF_NSPEC2D_XI,NB_SQUARE_EDGES_ONEDIR*NB_CUT_CASE)
+
   ! non-master processes set their parameters
   if (myrank /= 0) then
 
@@ -244,6 +263,12 @@
     MOVIE_STOP = bcast_integer(37)
     NSOURCES = bcast_integer(38)
     NOISE_TOMOGRAPHY = bcast_integer(39)
+    NT_DUMP_ATTENUATION = bcast_integer(40)
+    ATT1 = bcast_integer(41)
+    ATT2 = bcast_integer(42)
+    ATT3 = bcast_integer(43)
+    ATT4 = bcast_integer(44)
+    ATT5 = bcast_integer(45)
 
     ! logicals
     TRANSVERSE_ISOTROPY = bcast_logical(1)
@@ -281,7 +306,25 @@
     ROTATE_SEISMOGRAMS_RT= bcast_logical(33)
     WRITE_SEISMOGRAMS_BY_MASTER= bcast_logical(34)
     USE_BINARY_FOR_LARGE_FILE= bcast_logical(35)
-    ATTENUATION_NEW = bcast_logical(36)
+    SAVE_REGULAR_KL = bcast_logical(36)
+    PARTIAL_PHYS_DISPERSION_ONLY = bcast_logical(37)
+    UNDO_ATTENUATION = bcast_logical(38)
+    USE_LDDRK = bcast_logical(39)
+    INCREASE_CFL_FOR_LDDRK = bcast_logical(40)
+    ANISOTROPIC_KL = bcast_logical(41)
+    SAVE_TRANSVERSE_KL_ONLY = bcast_logical(42)
+    APPROXIMATE_HESS_KL = bcast_logical(43)
+    USE_FULL_TISO_MANTLE = bcast_logical(44)
+    SAVE_SOURCE_MASK = bcast_logical(45)
+    GPU_MODE = bcast_logical(46)
+    ADIOS_ENABLED = bcast_logical(47)
+    ADIOS_FOR_FORWARD_ARRAYS = bcast_logical(48)
+    ADIOS_FOR_MPI_ARRAYS = bcast_logical(49)
+    ADIOS_FOR_ARRAYS_SOLVER = bcast_logical(50)
+    ADIOS_FOR_SOLVER_MESHFILES = bcast_logical(51)
+    ADIOS_FOR_AVS_DX = bcast_logical(52)
+    EXACT_MASS_MATRIX_FOR_ROTATION = bcast_logical(53)
+    ATTENUATION_1D_WITH_3D_STORAGE = bcast_logical(54)
 
     ! double precisions
     DT = bcast_double_precision(1)
@@ -315,6 +358,7 @@
     MOVIE_NORTH = bcast_double_precision(29)
     MOVIE_SOUTH = bcast_double_precision(30)
     RMOHO_FICTITIOUS_IN_MESHER = bcast_double_precision(31)
+    RATIO_BY_WHICH_TO_INCREASE_IT = bcast_double_precision(32)
 
   endif
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/calendar.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/calendar.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/calendar.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_elements.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_elements.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_elements.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -42,12 +42,10 @@
                         tmp_sum_nglob2D_xi, tmp_sum_nglob2D_eta,divider,nglob_edges_h,&
                         nglob_edge_v,to_remove)
 
+  use constants
 
   implicit none
 
-  include "constants.h"
-
-
   ! parameters to be computed based upon parameters above read from file
   integer NPROC,NEX_XI,NEX_ETA,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_number_of_sources.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_number_of_sources.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_number_of_sources.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,10 @@
 ! count the total number of sources in the CMTSOLUTION file
 ! there are NLINES_PER_CMTSOLUTION_SOURCE lines per source in that file
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, intent(out) :: NSOURCES
 
   integer ios,icounter

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_points.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_points.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/count_points.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -46,11 +46,10 @@
 !!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+  use constants
 
   implicit none
 
-  include "constants.h"
-
 ! parameters read from parameter file
 
 ! parameters to be computed based upon parameters above read from file

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_name_database.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_name_database.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_name_database.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_serial_name_database.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_serial_name_database.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/create_serial_name_database.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,10 @@
 
 ! create name of the database for serial codes (AVS_DX and codes to check buffers)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer iproc,iregion_code,NPROCTOT
 
 ! name of the database file

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/define_all_layers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/define_all_layers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/define_all_layers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -47,11 +47,10 @@
 !!!!!!  definition of general mesh parameters below
 !!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  use constants
 
   implicit none
 
-  include "constants.h"
-
   ! parameters read from parameter file
   integer NER_CRUST,NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
           NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/euler_angles.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/euler_angles.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/euler_angles.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -29,10 +29,10 @@
 
   subroutine euler_angles(rotation_matrix,CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision rotation_matrix(3,3)
   double precision CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/exit_mpi.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/exit_mpi.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/exit_mpi.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,17 +25,20 @@
 !
 !=====================================================================
 
+!-------------------------------------------------------------------------------------------------
+!
 ! end the simulation and exit MPI
+!
+!-------------------------------------------------------------------------------------------------
 
 ! version with rank number printed in the error message
   subroutine exit_MPI(myrank,error_msg)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-
   ! identifier for error message file
   integer, parameter :: IERROR = 30
 
@@ -84,11 +87,10 @@
   subroutine exit_MPI_without_rank(error_msg)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-
   character(len=*) error_msg
 
   integer :: ier
@@ -111,10 +113,10 @@
 
   subroutine flush_IMAIN()
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   ! only master process writes out to main output file
   ! file I/O in Fortran is buffered by default
   !
@@ -192,16 +194,51 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+  integer function null_process()
+
+  use mpi
+
+  implicit none
+
+  null_process = MPI_PROC_NULL
+
+  end function null_process
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine test_request(request,flag_result_test)
+
+  use mpi
+
+  implicit none
+
+  integer :: request
+  logical :: flag_result_test
+
+  ! MPI status of messages to be received
+  integer :: msg_status(MPI_STATUS_SIZE)
+
+  integer :: ier
+
+  call MPI_TEST(request,flag_result_test,msg_status,ier)
+
+  end subroutine test_request
+!
+!-------------------------------------------------------------------------------------------------
+!
+
   subroutine irecv_cr(recvbuf, recvcount, dest, recvtag, req)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
-  integer recvcount, dest, recvtag, req
+  integer :: recvcount, dest, recvtag, req
   real(kind=CUSTOM_REAL), dimension(recvcount) :: recvbuf
 
   integer ier
@@ -215,13 +252,33 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+  subroutine irecv_dp(recvbuf, recvcount, dest, recvtag, req)
+
+  use mpi
+
+  implicit none
+
+  integer :: recvcount, dest, recvtag, req
+  double precision, dimension(recvcount) :: recvbuf
+
+  integer :: ier
+
+  call MPI_IRECV(recvbuf(1),recvcount,MPI_DOUBLE_PRECISION,dest,recvtag, &
+                  MPI_COMM_WORLD,req,ier)
+
+  end subroutine irecv_dp
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
   subroutine isend_cr(sendbuf, sendcount, dest, sendtag, req)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
   integer sendcount, dest, sendtag, req
@@ -238,6 +295,26 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+  subroutine isend_dp(sendbuf, sendcount, dest, sendtag, req)
+
+  use mpi
+
+  implicit none
+
+  integer :: sendcount, dest, sendtag, req
+  double precision, dimension(sendcount) :: sendbuf
+
+  integer :: ier
+
+  call MPI_ISEND(sendbuf(1),sendcount,MPI_DOUBLE_PRECISION,dest,sendtag, &
+                  MPI_COMM_WORLD,req,ier)
+
+  end subroutine isend_dp
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
   subroutine wait_req(req)
 
   use mpi
@@ -278,14 +355,10 @@
 
   implicit none
 
-  include "constants.h"
-  include "precision.h"
-
   integer:: sendbuf, recvbuf
   integer ier
 
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER, &
-                  MPI_MIN,0,MPI_COMM_WORLD,ier)
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MIN,0,MPI_COMM_WORLD,ier)
 
   end subroutine min_all_i
 
@@ -293,20 +366,36 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine max_all_i(sendbuf, recvbuf)
+  subroutine min_all_cr(sendbuf, recvbuf)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
+  real(kind=CUSTOM_REAL) :: sendbuf, recvbuf
+  integer :: ier
+
+  call MPI_REDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MIN,0,MPI_COMM_WORLD,ier)
+
+  end subroutine min_all_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine max_all_i(sendbuf, recvbuf)
+
+  use mpi
+
+  implicit none
+
   integer :: sendbuf, recvbuf
   integer :: ier
 
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER, &
-                  MPI_MAX,0,MPI_COMM_WORLD,ier)
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_MAX,0,MPI_COMM_WORLD,ier)
 
   end subroutine max_all_i
 
@@ -317,17 +406,16 @@
   subroutine max_all_cr(sendbuf, recvbuf)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
   real(kind=CUSTOM_REAL) :: sendbuf, recvbuf
   integer :: ier
 
-  call MPI_REDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE, &
-                  MPI_MAX,0,MPI_COMM_WORLD,ier)
+  call MPI_REDUCE(sendbuf,recvbuf,1,CUSTOM_MPI_TYPE,MPI_MAX,0,MPI_COMM_WORLD,ier)
 
   end subroutine max_all_cr
 
@@ -344,8 +432,7 @@
   integer :: sendbuf, recvbuf
   integer :: ier
 
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER, &
-                  MPI_SUM,0,MPI_COMM_WORLD,ier)
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_INTEGER,MPI_SUM,0,MPI_COMM_WORLD,ier)
 
   end subroutine sum_all_i
 
@@ -359,11 +446,10 @@
 
   implicit none
 
-  double precision sendbuf, recvbuf
-  integer ier
+  double precision :: sendbuf, recvbuf
+  integer :: ier
 
-  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION, &
-                  MPI_SUM,0,MPI_COMM_WORLD,ier)
+  call MPI_REDUCE(sendbuf,recvbuf,1,MPI_DOUBLE_PRECISION,MPI_SUM,0,MPI_COMM_WORLD,ier)
 
   end subroutine sum_all_dp
 
@@ -380,7 +466,7 @@
   integer :: iproc
   integer :: buffer
 
-  integer ier
+  integer :: ier
 
   call MPI_BCAST(buffer,1,MPI_INTEGER,iproc,MPI_COMM_WORLD,ier)
 
@@ -398,7 +484,7 @@
 
   integer :: buffer
 
-  integer ier
+  integer :: ier
 
   call MPI_BCAST(buffer,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
 
@@ -408,7 +494,129 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+  subroutine bcast_all_i(buffer, count)
 
+  use :: mpi
+
+  implicit none
+
+  integer :: count
+  integer, dimension(count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_i
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine bcast_all_cr(buffer, count)
+
+  use :: mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: count
+  real(kind=CUSTOM_REAL), dimension(count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine bcast_all_r(buffer, count)
+
+  use :: mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: count
+  real, dimension(count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,MPI_REAL,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_r
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine bcast_all_dp(buffer, count)
+
+  use :: mpi
+
+  implicit none
+
+  integer :: count
+  double precision, dimension(count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_dp
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine bcast_all_ch(buffer, count)
+
+  use :: mpi
+
+  implicit none
+
+  integer :: count
+  character(len=count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_ch
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine bcast_all_l(buffer, count)
+
+  use :: mpi
+
+  implicit none
+
+  integer :: count
+  logical,dimension(count) :: buffer
+
+  integer :: ier
+
+  call MPI_BCAST(buffer,count,MPI_LOGICAL,0,MPI_COMM_WORLD,ier)
+
+  end subroutine bcast_all_l
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+
   subroutine recv_singlei(recvbuf, dest, recvtag)
 
   use mpi
@@ -453,16 +661,66 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+
+  subroutine recv_cr(recvbuf, recvcount, dest, recvtag)
+
+  use mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: dest,recvtag
+  integer :: recvcount
+  real(kind=CUSTOM_REAL),dimension(recvcount) :: recvbuf
+
+  ! MPI status of messages to be received
+  integer :: msg_status(MPI_STATUS_SIZE)
+  integer :: ier
+
+  call MPI_RECV(recvbuf,recvcount,CUSTOM_MPI_TYPE,dest,recvtag,MPI_COMM_WORLD,msg_status,ier)
+
+  end subroutine recv_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+
+  subroutine recv_dp(recvbuf, recvcount, dest, recvtag)
+
+  use mpi
+
+  implicit none
+
+  integer :: dest,recvtag
+  integer :: recvcount
+  double precision,dimension(recvcount) :: recvbuf
+
+  ! MPI status of messages to be received
+  integer :: msg_status(MPI_STATUS_SIZE)
+  integer :: ier
+
+  call MPI_RECV(recvbuf,recvcount,MPI_DOUBLE_PRECISION,dest,recvtag,MPI_COMM_WORLD,msg_status,ier)
+
+  end subroutine recv_dp
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
   subroutine send_i(sendbuf, sendcount, dest, sendtag)
 
   use mpi
 
   implicit none
 
-  integer dest,sendtag
-  integer sendcount
+  integer :: dest,sendtag
+  integer :: sendcount
   integer,dimension(sendcount):: sendbuf
-  integer ier
+  integer :: ier
 
   call MPI_SEND(sendbuf,sendcount,MPI_INTEGER,dest,sendtag,MPI_COMM_WORLD,ier)
 
@@ -486,18 +744,118 @@
 
   end subroutine send_singlei
 
+
 !
 !-------------------------------------------------------------------------------------------------
 !
 
+  subroutine send_cr(sendbuf, sendcount, dest, sendtag)
+
+  use mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: dest,sendtag
+  integer :: sendcount
+  real(kind=CUSTOM_REAL),dimension(sendcount):: sendbuf
+  integer :: ier
+
+  call MPI_SEND(sendbuf,sendcount,CUSTOM_MPI_TYPE,dest,sendtag,MPI_COMM_WORLD,ier)
+
+  end subroutine send_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine send_dp(sendbuf, sendcount, dest, sendtag)
+
+  use mpi
+
+  implicit none
+
+  integer :: dest,sendtag
+  integer :: sendcount
+  double precision,dimension(sendcount):: sendbuf
+  integer :: ier
+
+  call MPI_SEND(sendbuf,sendcount,MPI_DOUBLE_PRECISION,dest,sendtag,MPI_COMM_WORLD,ier)
+
+  end subroutine send_dp
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine sendrecv_cr(sendbuf, sendcount, dest, sendtag, &
+                         recvbuf, recvcount, source, recvtag)
+
+  use mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: sendcount, recvcount, dest, sendtag, source, recvtag
+  real(kind=CUSTOM_REAL), dimension(sendcount) :: sendbuf
+  real(kind=CUSTOM_REAL), dimension(recvcount) :: recvbuf
+
+! MPI status of messages to be received
+  integer :: msg_status(MPI_STATUS_SIZE)
+
+  integer :: ier
+
+  call MPI_SENDRECV(sendbuf,sendcount,CUSTOM_MPI_TYPE,dest,sendtag, &
+                    recvbuf,recvcount,CUSTOM_MPI_TYPE,source,recvtag, &
+                    MPI_COMM_WORLD,msg_status,ier)
+
+  end subroutine sendrecv_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine sendrecv_dp(sendbuf, sendcount, dest, sendtag, &
+                         recvbuf, recvcount, source, recvtag)
+
+  use mpi
+
+  implicit none
+
+  integer :: sendcount, recvcount, dest, sendtag, source, recvtag
+  double precision, dimension(sendcount) :: sendbuf
+  double precision, dimension(recvcount) :: recvbuf
+
+! MPI status of messages to be received
+  integer :: msg_status(MPI_STATUS_SIZE)
+
+  integer :: ier
+
+  call MPI_SENDRECV(sendbuf,sendcount,MPI_DOUBLE_PRECISION,dest,sendtag, &
+                    recvbuf,recvcount,MPI_DOUBLE_PRECISION,source,recvtag, &
+                    MPI_COMM_WORLD,msg_status,ier)
+
+  end subroutine sendrecv_dp
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+
+
   subroutine world_size(size)
 
   use mpi
 
   implicit none
 
-  integer size
-  integer ier
+  integer :: size
+  integer :: ier
 
   call MPI_COMM_SIZE(MPI_COMM_WORLD,size,ier)
 
@@ -513,8 +871,8 @@
 
   implicit none
 
-  integer rank
-  integer ier
+  integer :: rank
+  integer :: ier
 
   call MPI_COMM_RANK(MPI_COMM_WORLD,rank,ier)
 
@@ -530,11 +888,11 @@
 
   implicit none
 
-  integer sendcnt, recvcount, NPROC
+  integer :: sendcnt, recvcount, NPROC
   integer, dimension(sendcnt) :: sendbuf
   integer, dimension(recvcount,0:NPROC-1) :: recvbuf
 
-  integer ier
+  integer :: ier
 
   call MPI_GATHER(sendbuf,sendcnt,MPI_INTEGER, &
                   recvbuf,recvcount,MPI_INTEGER, &
@@ -546,13 +904,61 @@
 !-------------------------------------------------------------------------------------------------
 !
 
+  subroutine gather_all_cr(sendbuf, sendcnt, recvbuf, recvcount, NPROC)
+
+  use mpi
+  use constants
+
+  implicit none
+
+  include "precision.h"
+
+  integer :: sendcnt, recvcount, NPROC
+  real(kind=CUSTOM_REAL), dimension(sendcnt) :: sendbuf
+  real(kind=CUSTOM_REAL), dimension(recvcount,0:NPROC-1) :: recvbuf
+
+  integer :: ier
+
+  call MPI_GATHER(sendbuf,sendcnt,CUSTOM_MPI_TYPE, &
+                  recvbuf,recvcount,CUSTOM_MPI_TYPE, &
+                  0,MPI_COMM_WORLD,ier)
+
+  end subroutine gather_all_cr
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  subroutine gather_all_dp(sendbuf, sendcnt, recvbuf, recvcount, NPROC)
+
+  use mpi
+
+  implicit none
+
+  integer :: sendcnt, recvcount, NPROC
+  double precision, dimension(sendcnt) :: sendbuf
+  double precision, dimension(recvcount,0:NPROC-1) :: recvbuf
+
+  integer :: ier
+
+  call MPI_GATHER(sendbuf,sendcnt,MPI_DOUBLE_PRECISION, &
+                  recvbuf,recvcount,MPI_DOUBLE_PRECISION, &
+                  0,MPI_COMM_WORLD,ier)
+
+  end subroutine gather_all_dp
+
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
   subroutine gatherv_all_i(sendbuf, sendcnt, recvbuf, recvcount, recvoffset,recvcounttot, NPROC)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
   integer :: sendcnt,recvcounttot,NPROC
@@ -575,10 +981,10 @@
   subroutine gatherv_all_cr(sendbuf, sendcnt, recvbuf, recvcount, recvoffset,recvcounttot, NPROC)
 
   use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
   include "precision.h"
 
   integer :: sendcnt,recvcounttot,NPROC

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/force_ftz.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/force_ftz.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/force_ftz.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
 /*
  !=====================================================================
  !
- !          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+ !          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
  !          --------------------------------------------------
  !
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !                        Princeton University, USA
  !             and CNRS / INRIA / University of Pau, France
  ! (c) Princeton University and CNRS / INRIA / University of Pau
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_model_parameters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_model_parameters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_model_parameters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -201,8 +201,8 @@
       REFERENCE_1D_MODEL = REFERENCE_MODEL_IASP91
     else if(MODEL_ROOT == '1D_1066a') then
       REFERENCE_1D_MODEL = REFERENCE_MODEL_1066A
-    else if(MODEL_ROOT == '1D_ak135') then
-      REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135
+    else if(MODEL_ROOT == '1D_ak135f_no_mud') then
+      REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135F_NO_MUD
     else if(MODEL_ROOT == '1D_jp3d') then
       REFERENCE_1D_MODEL = REFERENCE_MODEL_JP1D
     else if(MODEL_ROOT == '1D_sea99') then
@@ -237,8 +237,8 @@
       REFERENCE_1D_MODEL = REFERENCE_MODEL_IASP91
     else if(MODEL_ROOT == '1D_1066a_onecrust') then
       REFERENCE_1D_MODEL = REFERENCE_MODEL_1066A
-    else if(MODEL_ROOT == '1D_ak135_onecrust') then
-      REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135
+    else if(MODEL_ROOT == '1D_ak135f_no_mud_onecrust') then
+      REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135F_NO_MUD
     else
       stop 'reference 1D Earth model unknown'
     endif
@@ -364,7 +364,7 @@
     TRANSVERSE_ISOTROPY = .true. ! to use transverse isotropic PREM 1D ref model
     ! CRUSTAL = .true. ! with 3D crust: depends on 3D mantle reference model
     ! THREE_D_MODEL = 0 ! for default crustal model
-    ! REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135
+    ! REFERENCE_1D_MODEL = REFERENCE_MODEL_AK135F_NO_MUD
     ! TRANSVERSE_ISOTROPY = .false. ! for AK135 ref model
 
   else if(MODEL_ROOT == 'heterogen') then
@@ -446,16 +446,12 @@
 
   ! checks that IASP91, AK135, 1066A, JP1D or SEA1D is isotropic
   if((REFERENCE_1D_MODEL == REFERENCE_MODEL_IASP91 .or. &
-      REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135 .or. &
+      REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135F_NO_MUD .or. &
       REFERENCE_1D_MODEL == REFERENCE_MODEL_1066A .or. &
       REFERENCE_1D_MODEL == REFERENCE_MODEL_JP1D .or. &
       REFERENCE_1D_MODEL == REFERENCE_MODEL_SEA1D) .and. TRANSVERSE_ISOTROPY) &
         stop 'models IASP91, AK135, 1066A, JP1D and SEA1D are currently isotropic'
 
-  ! checks that 3D attenuation models use 3D arrays
-  if( ATTENUATION_3D .and. ( .not. USE_3D_ATTENUATION_ARRAYS )) then
-    stop '3D attenuation models need 3D attenuation arrays'
-  endif
 
   end subroutine get_model_parameters_flags
 
@@ -554,7 +550,7 @@
     RHO_TOP_OC = 9900.2379 / RHOAV
     RHO_BOTTOM_OC = 12168.6383 / RHOAV
 
-  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135) then
+  else if(REFERENCE_1D_MODEL == REFERENCE_MODEL_AK135F_NO_MUD) then
 
 !! DK DK values below entirely checked and fixed by Dimitri Komatitsch in December 2012.
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_timestep_and_layers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_timestep_and_layers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_timestep_and_layers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_value_parameters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_value_parameters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/get_value_parameters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/gll_library.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/gll_library.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/gll_library.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/hex_nodes.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/hex_nodes.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/hex_nodes.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/intgrl.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/intgrl.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/intgrl.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/lagrange_poly.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/lagrange_poly.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/lagrange_poly.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_ellipticity.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_ellipticity.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_ellipticity.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_gravity.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_gravity.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/make_gravity.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/memory_eval.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/memory_eval.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/memory_eval.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,12 +27,10 @@
 
 ! compute the approximate amount of static memory needed to run the solver
 
-  subroutine memory_eval(OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE, &
-                         TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,TOPOGRAPHY, &
-                         ONE_CRUST,doubling_index,this_region_has_a_doubling,NCHUNKS, &
+  subroutine memory_eval(doubling_index,this_region_has_a_doubling, &
                          ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
                          ratio_sampling_array,NPROCTOT, &
-                         NSPEC,NGLOB,SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD, &
+                         NSPEC,NGLOB, &
                          NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
                          NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
                          NSPEC_INNER_CORE_ATTENUATION, &
@@ -48,19 +46,24 @@
                          NSPEC2D_BOTTOM,NSPEC2D_TOP, &
                          static_memory_size)
 
+  use shared_parameters,only: ATT1,ATT2,ATT3, &
+    APPROXIMATE_HESS_KL,ANISOTROPIC_KL,NOISE_TOMOGRAPHY, &
+    USE_LDDRK,EXACT_MASS_MATRIX_FOR_ROTATION, &
+    OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE, &
+    TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,TOPOGRAPHY, &
+    ONE_CRUST,NCHUNKS, &
+    SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD
+
   implicit none
 
   include "constants.h"
 
   ! input
-  logical, intent(in) :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-             ROTATION,TOPOGRAPHY, &
-             ATTENUATION,ONE_CRUST,OCEANS,ABSORBING_CONDITIONS, &
-             MOVIE_VOLUME,SAVE_FORWARD
   integer, dimension(MAX_NUM_REGIONS), intent(in) :: NSPEC, NGLOB, &
             NSPEC2D_BOTTOM,NSPEC2D_TOP
 
-  integer, intent(in) :: NCHUNKS,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,SIMULATION_TYPE
+  integer, intent(in) :: NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+
   integer, dimension(MAX_NUMBER_OF_MESH_LAYERS), intent(in) :: doubling_index
   logical, dimension(MAX_NUMBER_OF_MESH_LAYERS), intent(in) :: this_region_has_a_doubling
   integer, dimension(MAX_NUMBER_OF_MESH_LAYERS), intent(in) :: ner,ratio_sampling_array
@@ -85,6 +88,10 @@
   ! local variables
   integer :: ilayer,NUMBER_OF_MESH_LAYERS,ner_without_doubling,ispec_aniso
 
+  integer :: NSPEC_CRUST_MANTLE_ADJOINT_HESS,NSPEC_CRUST_MANTLE_ADJOINT_NOISE, &
+             NSPEC_CRUST_MANTLE_ADJOINT_ANISO_KL, &
+             NGLOB_XY_CM,NGLOB_XY_IC
+
   ! generate the elements in all the regions of the mesh
   ispec_aniso = 0
 
@@ -271,24 +278,14 @@
     3.d0*dble(NDIM)*NGLOB(IREGION_CRUST_MANTLE)*dble(CUSTOM_REAL)
 
   ! attenuation arrays
-  if( USE_3D_ATTENUATION_ARRAYS ) then
-    ! one_minus_sum_beta_crust_mantle, factor_scale_crust_mantle
-    static_memory_size = static_memory_size +  &
-      2.d0*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
+  ! one_minus_sum_beta_crust_mantle, factor_scale_crust_mantle
+  static_memory_size = static_memory_size +  &
+      2.d0*dble(ATT1)*dble(ATT2)*dble(ATT3)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
 
-    ! factor_common_crust_mantle
-    static_memory_size = static_memory_size +  &
-      dble(N_SLS)*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
-  else
-    ! one_minus_sum_beta_crust_mantle, factor_scale_crust_mantle
-    static_memory_size = static_memory_size +  &
-      2.d0*dble(1)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
+  ! factor_common_crust_mantle
+  static_memory_size = static_memory_size +  &
+      dble(N_SLS)*dble(ATT1)*dble(ATT2)*dble(ATT3)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
 
-    ! factor_common_crust_mantle
-    static_memory_size = static_memory_size +  &
-      dble(N_SLS)*dble(1)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
-  endif
-
   ! R_memory_crust_mantle (R_xx, R_yy, ..)
   static_memory_size = static_memory_size +  &
     5.d0*dble(N_SLS)*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ATTENUATION*dble(CUSTOM_REAL)
@@ -343,24 +340,14 @@
     3.d0*dble(NDIM)*NGLOB(IREGION_INNER_CORE)*dble(CUSTOM_REAL)
 
   ! attenuation arrays
-  if( USE_3D_ATTENUATION_ARRAYS ) then
-    ! one_minus_sum_beta_inner_core, factor_scale_inner_core
-    static_memory_size = static_memory_size +  &
-      2.d0*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
+  ! one_minus_sum_beta_inner_core, factor_scale_inner_core
+  static_memory_size = static_memory_size +  &
+    2.d0*dble(ATT1)*dble(ATT2)*dble(ATT3)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
 
-    ! factor_common_inner_core
-    static_memory_size = static_memory_size +  &
-      dble(N_SLS)*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
-  else
-    ! one_minus_sum_beta_inner_core, factor_scale_inner_core
-    static_memory_size = static_memory_size +  &
-      2.d0*dble(1)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
+  ! factor_common_inner_core
+  static_memory_size = static_memory_size +  &
+    dble(N_SLS)*dble(ATT1)*dble(ATT2)*dble(ATT3)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
 
-    ! factor_common_inner_core
-    static_memory_size = static_memory_size +  &
-      dble(N_SLS)*dble(1)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
-  endif
-
   ! R_memory_inner_core
   static_memory_size = static_memory_size +  &
     5.d0*dble(N_SLS)*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_INNER_CORE_ATTENUATION*dble(CUSTOM_REAL)
@@ -414,6 +401,7 @@
   static_memory_size = static_memory_size + &
     3.d0*NR*dble(SIZE_DOUBLE)
 
+  ! OCEANS
   ! rmass_ocean_load
   static_memory_size = static_memory_size + &
     NGLOB_CRUST_MANTLE_OCEANS*dble(CUSTOM_REAL)
@@ -488,5 +476,65 @@
   static_memory_size = static_memory_size + &
     2.d0*dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_OUTER_CORE_ROT_ADJOINT*dble(CUSTOM_REAL)
 
+  ! cijkl_kl_crust_mantle (full anisotropic kernels with 21 coefficients)
+  if(ANISOTROPIC_KL) then
+    NSPEC_CRUST_MANTLE_ADJOINT_ANISO_KL = NSPEC_CRUST_MANTLE_ADJOINT
+  else
+    NSPEC_CRUST_MANTLE_ADJOINT_ANISO_KL = 1
+  endif
+  static_memory_size = static_memory_size + 21.d0* &
+      dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ADJOINT_ANISO_KL*dble(CUSTOM_REAL)
+
+  ! hess_kl_crust_mantle
+  if(APPROXIMATE_HESS_KL) then
+    NSPEC_CRUST_MANTLE_ADJOINT_HESS = NSPEC_CRUST_MANTLE_ADJOINT
+  else
+    NSPEC_CRUST_MANTLE_ADJOINT_HESS = 1
+  endif
+  static_memory_size = static_memory_size + &
+      dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ADJOINT_HESS*dble(CUSTOM_REAL)
+
+  ! Sigma_kl_crust_mantle
+  if(NOISE_TOMOGRAPHY > 0) then
+    NSPEC_CRUST_MANTLE_ADJOINT_NOISE = NSPEC_CRUST_MANTLE_ADJOINT
+  else
+    NSPEC_CRUST_MANTLE_ADJOINT_NOISE = 1
+  endif
+  static_memory_size = static_memory_size + &
+      dble(NGLLX)*dble(NGLLY)*dble(NGLLZ)*NSPEC_CRUST_MANTLE_ADJOINT_NOISE*dble(CUSTOM_REAL)
+
+  ! in the case of Stacey boundary conditions, add C*delta/2 contribution to the mass matrix
+  ! on the Stacey edges for the crust_mantle and outer_core regions but not for the inner_core region
+  ! thus the mass matrix must be replaced by three mass matrices including the "C" damping matrix
+  !
+  ! if absorbing_conditions are not set or if NCHUNKS=6, only one mass matrix is needed
+  ! for the sake of performance, only "rmassz" array will be filled and "rmassx" & "rmassy" will be fictitious / unused
+  NGLOB_XY_CM = 1
+  NGLOB_XY_IC = 1
+  if(NCHUNKS /= 6 .and. ABSORBING_CONDITIONS .and. .not. USE_LDDRK) then
+     NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
+  else
+     NGLOB_XY_CM = 1
+  endif
+
+  if(.not. USE_LDDRK .and. EXACT_MASS_MATRIX_FOR_ROTATION) then
+    if(ROTATION) then
+      NGLOB_XY_CM = NGLOB(IREGION_CRUST_MANTLE)
+      NGLOB_XY_IC = NGLOB(IREGION_INNER_CORE)
+    endif
+  endif
+
+  ! rmassx_crust_mantle,rmassy_crust_mantle for EXACT_MASS_MATRIX_FOR_ROTATION and/or ABSORBING_CONDITIONS
+  static_memory_size = static_memory_size + 2.d0*NGLOB_XY_CM*4.d0*dble(CUSTOM_REAL)
+
+  ! b_rmassx_crust_mantle,b_rmassy_crust_mantle for EXACT_MASS_MATRIX_FOR_ROTATION and/or ABSORBING_CONDITIONS
+  static_memory_size = static_memory_size + 2.d0*NGLOB_XY_CM*4.d0*dble(CUSTOM_REAL)
+
+  ! rmassx_inner_core,rmassy_inner_core for EXACT_MASS_MATRIX_FOR_ROTATION and/or ABSORBING_CONDITIONS
+  static_memory_size = static_memory_size + 2.d0*NGLOB_XY_IC*4.d0*dble(CUSTOM_REAL)
+
+  ! b_rmassx_inner_core,b_rmassy_inner_core for EXACT_MASS_MATRIX_FOR_ROTATION and/or ABSORBING_CONDITIONS
+  static_memory_size = static_memory_size + 2.d0*NGLOB_XY_IC*4.d0*dble(CUSTOM_REAL)
+
   end subroutine memory_eval
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_prem.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_prem.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_prem.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_topo_bathy.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_topo_bathy.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/model_topo_bathy.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -37,8 +37,6 @@
 
 ! standard routine to setup model
 
-  use mpi
-
   implicit none
 
   include "constants.h"
@@ -50,9 +48,6 @@
 
   character(len=150) :: LOCAL_PATH
 
-  ! local parameters
-  integer :: ier
-
   if(myrank == 0) then
     ! user output
     write(IMAIN,*)
@@ -64,7 +59,7 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(ibathy_topo,NX_BATHY*NY_BATHY,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(ibathy_topo,NX_BATHY*NY_BATHY)
 
   end subroutine model_topo_bathy_broadcast
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/param_reader.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/param_reader.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/param_reader.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
 /*
  !=====================================================================
  !
- !          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+ !          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
  !          --------------------------------------------------
  !
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !                        Princeton University, USA
  !             and CNRS / INRIA / University of Pau, France
  ! (c) Princeton University and CNRS / INRIA / University of Pau
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_compute_parameters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_compute_parameters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_compute_parameters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,104 +25,68 @@
 !
 !=====================================================================
 
-  subroutine read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-                        NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-                        NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-                        NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-                        NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-                        NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-                        NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-                        ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-                        CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-                        RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-                        R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-                        MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,&
-                        MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-                        TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-                        ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-                        ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-                        MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-                        PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-                        ATTENUATION,ATTENUATION_NEW,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-                        INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-                        LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                        SIMULATION_TYPE,SAVE_FORWARD, &
-                        NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                        NSPEC,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
-                        NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                        NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-                        ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-                        this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-                        OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                        ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
-                        HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-                        DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-                        WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,&
-                        USE_BINARY_FOR_LARGE_FILE,EMULATE_ONLY,NOISE_TOMOGRAPHY)
 
-  implicit none
+  subroutine read_compute_parameters()
+!                        MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!                        NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!                        NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!                        NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!                        NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!                        NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!                        NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!                        ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!                        CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!                        RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!                        R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!                        MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,&
+!                        MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!                        TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!                        ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!                        ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!                        MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!                        PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!                        ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!                        INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!                        LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                        SIMULATION_TYPE,SAVE_FORWARD, &
+!                        NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!                        NSPEC,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
+!                        NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!                        NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!                        ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!                        this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!                        OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                        ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
+!                        HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!                        DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!                        WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,&
+!                        USE_BINARY_FOR_LARGE_FILE,EMULATE_ONLY,NOISE_TOMOGRAPHY)
+!
 
-  include "constants.h"
+  use constants
+  use shared_parameters
 
-! parameters read from parameter file
-  integer NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-          NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read,NOISE_TOMOGRAPHY
+  implicit none
 
-  double precision ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
-          HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM, &
-          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,&
-          MOVIE_SOUTH_DEG,RECORD_LENGTH_IN_MINUTES
+  ! local parameters
 
-  logical ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
-         MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-         RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-         SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW, &
-         ABSORBING_CONDITIONS,SAVE_FORWARD, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
-         SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
-
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
-
-! parameters to be computed based upon parameters above read from file
-  integer NSTEP,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,REFERENCE_1D_MODEL,THREE_D_MODEL
-
-  double precision DT,ROCEAN,RMIDDLE_CRUST,RMOHO,R80,R120,R220,R400, &
-          R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS, &
-          RMOHO_FICTITIOUS_IN_MESHER,R80_FICTITIOUS_IN_MESHER
-
-  double precision MOVIE_TOP,MOVIE_BOTTOM,MOVIE_EAST,MOVIE_WEST,&
-          MOVIE_NORTH,MOVIE_SOUTH
-
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ONE_CRUST,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-          ATTENUATION_3D,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-          EMULATE_ONLY
-
   integer NEX_MAX
 
   double precision ELEMENT_WIDTH
 
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-      NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-      NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-      NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!      NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX
 
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!      NGLOB
+
   integer nblocks_xi,nblocks_eta
 
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
 
   integer :: ielem,elem_doubling_mantle,elem_doubling_middle_outer_core,elem_doubling_bottom_outer_core
   double precision :: DEPTH_SECOND_DOUBLING_REAL,DEPTH_THIRD_DOUBLING_REAL, &
@@ -130,43 +94,54 @@
 
 ! honor PREM Moho or not
 ! doing so drastically reduces the stability condition and therefore the time step
-  logical :: HONOR_1D_SPHERICAL_MOHO,CASE_3D
+!  logical :: HONOR_1D_SPHERICAL_MOHO,CASE_3D
 
   integer :: ifirst_region, ilast_region, iter_region, iter_layer, doubling, padding, tmp_sum, tmp_sum_xi, tmp_sum_eta
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
   integer ::  NUMBER_OF_MESH_LAYERS,layer_offset,nspec2D_xi_sb,nspec2D_eta_sb, &
               nb_lay_sb, nspec_sb, nglob_vol, nglob_surf, nglob_edge
 
 ! for the cut doublingbrick improvement
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+
   integer :: last_doubling_layer, cut_doubling, nglob_int_surf_xi, nglob_int_surf_eta,nglob_ext_surf,&
               normal_doubling, nglob_center_edge, nglob_corner_edge, nglob_border_edge
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+
   integer :: tmp_sum_nglob2D_xi, tmp_sum_nglob2D_eta,divider,nglob_edges_h,nglob_edge_v,to_remove
+  integer, external :: err_occurred
 
   ! reads in Par_file values
-  call read_parameter_file(OUTPUT_FILES, &
-                          LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                          NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
-                          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
-                          NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-                          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-                          NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read, &
-                          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-                          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
-                          HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,RECORD_LENGTH_IN_MINUTES, &
-                          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,&
-                          ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
-                          MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-                          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-                          SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW,ABSORBING_CONDITIONS,SAVE_FORWARD, &
-                          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER, &
-                          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,NOISE_TOMOGRAPHY)
+  call read_parameter_file()
+!                          OUTPUT_FILES, &
+!                          LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                          NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
+!                          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
+!                          NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!                          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!                          NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read, &
+!                          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+!                          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
+!                          HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,RECORD_LENGTH_IN_MINUTES, &
+!                          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,&
+!                          ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
+!                          MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!                          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!                          SAVE_MESH_FILES,ATTENUATION,ABSORBING_CONDITIONS,SAVE_FORWARD, &
+!                          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER, &
+!                          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,NOISE_TOMOGRAPHY)
+!
 
+  if(err_occurred() /= 0) then
+    stop 'an error occurred while reading the parameter file'
+  endif
+
   ! converts values to radians
   MOVIE_EAST = MOVIE_EAST_DEG * DEGREES_TO_RADIANS
   MOVIE_WEST = MOVIE_WEST_DEG * DEGREES_TO_RADIANS
@@ -230,9 +205,7 @@
 ! if doing benchmark runs to measure scaling of the code for a limited number of time steps only
   if (DO_BENCHMARK_RUN_ONLY) NSTEP = NSTEP_FOR_BENCHMARK
 
-!<YANGL
   if ( NOISE_TOMOGRAPHY /= 0 )   NSTEP = 2*NSTEP-1   ! time steps needs to be doubled, due to +/- branches
-!>YANGL
 
   ! subsets used to save seismograms must not be larger than the whole time series,
   ! otherwise we waste memory
@@ -248,7 +221,7 @@
   call rcp_check_parameters(NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
                         NCHUNKS,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
                         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES, &
-                        ATTENUATION,ATTENUATION_NEW,ABSORBING_CONDITIONS, &
+                        ATTENUATION,ABSORBING_CONDITIONS, &
                         INCLUDE_CENTRAL_CUBE,OUTPUT_SEISMOS_SAC_ALPHANUM)
 
   ! check that mesh can be coarsened in depth three or four times
@@ -344,6 +317,28 @@
                         last_doubling_layer, cut_doubling, nglob_int_surf_xi, nglob_int_surf_eta,nglob_ext_surf,&
                         normal_doubling, nglob_center_edge, nglob_corner_edge, nglob_border_edge)
 
+  if(ATTENUATION) then
+!! DK DK July 2013: to save a huge amount of memory, when 3D attenuation is off it is sufficient to save a single point
+!! DK DK July 2013: per spectral element because the Q attenuation factor is then constant per layer of the geological model
+    if(ATTENUATION_3D .or. ATTENUATION_1D_WITH_3D_STORAGE) then
+      ATT1     = NGLLX
+      ATT2     = NGLLY
+      ATT3     = NGLLZ
+    else
+      ATT1     = 1
+      ATT2     = 1
+      ATT3     = 1
+    endif
+    ATT4     = NSPEC(IREGION_CRUST_MANTLE)
+    ATT5     = NSPEC(IREGION_INNER_CORE)
+  else
+     ATT1 = 1
+     ATT2 = 1
+     ATT3 = 1
+     ATT4 = 1
+     ATT5 = 1
+  endif
+
   end subroutine read_compute_parameters
 
 !
@@ -353,7 +348,7 @@
   subroutine rcp_check_parameters(NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA, &
                         NCHUNKS,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
                         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES, &
-                        ATTENUATION,ATTENUATION_NEW,ABSORBING_CONDITIONS, &
+                        ATTENUATION,ABSORBING_CONDITIONS, &
                         INCLUDE_CENTRAL_CUBE,OUTPUT_SEISMOS_SAC_ALPHANUM)
 
   implicit none
@@ -364,7 +359,7 @@
 
   double precision ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES
 
-  logical ATTENUATION,ATTENUATION_NEW,ABSORBING_CONDITIONS, &
+  logical ATTENUATION,ABSORBING_CONDITIONS, &
           INCLUDE_CENTRAL_CUBE,OUTPUT_SEISMOS_SAC_ALPHANUM
 
 ! checks parameters
@@ -386,9 +381,6 @@
   if(ABSORBING_CONDITIONS .and. NCHUNKS == 3) &
     stop 'absorbing conditions not supported for three chunks yet'
 
-  if(ATTENUATION_NEW .and. .not. ATTENUATION) &
-    stop 'need ATTENUATION to use ATTENUATION_NEW'
-
   if (OUTPUT_SEISMOS_SAC_ALPHANUM .and. (mod(NTSTEP_BETWEEN_OUTPUT_SEISMOS,5)/=0)) &
     stop 'if OUTPUT_SEISMOS_SAC_ALPHANUM = .true. then NTSTEP_BETWEEN_OUTPUT_SEISMOS must be a multiple of 5, check the Par_file'
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_parameter_file.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_parameter_file.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_parameter_file.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -33,52 +33,55 @@
 !!!!!! VERY IMPORTANT
 !!!!!! VERY IMPORTANT
 
-  subroutine read_parameter_file(OUTPUT_FILES, &
-                                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                                NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
-                                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
-                                NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-                                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-                                NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read, &
-                                ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-                                CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
-                                HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,RECORD_LENGTH_IN_MINUTES, &
-                                MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,&
-                                ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
-                                MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-                                RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-                                SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW,ABSORBING_CONDITIONS,SAVE_FORWARD, &
-                                OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
-                                SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,NOISE_TOMOGRAPHY)
+  subroutine read_parameter_file()
+!                                OUTPUT_FILES, &
+!                                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                                NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
+!                                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS, &
+!                                NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!                                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!                                NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read, &
+!                                ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+!                                CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
+!                                HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,RECORD_LENGTH_IN_MINUTES, &
+!                                MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,&
+!                                ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
+!                                MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!                                RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!                                SAVE_MESH_FILES,ATTENUATION,ABSORBING_CONDITIONS,SAVE_FORWARD, &
+!                                OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
+!                                SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,NOISE_TOMOGRAPHY)
+!
+  use shared_input_parameters
 
   implicit none
 
   include "constants.h"
 
   ! parameters read from parameter file
-  integer NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-          NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read,NOISE_TOMOGRAPHY
-
-  double precision ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
-          HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM, &
-          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,&
-          MOVIE_SOUTH_DEG,RECORD_LENGTH_IN_MINUTES
-
-  logical ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
-         MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-         RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-         SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW, &
-         ABSORBING_CONDITIONS,SAVE_FORWARD, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
-         SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
-
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
-
+!  integer NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!          NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read,NOISE_TOMOGRAPHY
+!
+!  double precision ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+!          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,&
+!          HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM, &
+!          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,&
+!          MOVIE_SOUTH_DEG,RECORD_LENGTH_IN_MINUTES
+!
+!  logical ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,&
+!         MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!         RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!         SAVE_MESH_FILES,ATTENUATION, &
+!         ABSORBING_CONDITIONS,SAVE_FORWARD, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
+!         SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!
 ! local variables
   integer :: ierr
 
@@ -98,16 +101,28 @@
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: SAVE_FORWARD'
   call read_value_integer(NCHUNKS, 'mesher.NCHUNKS', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NCHUNKS'
-  call read_value_double_precision(ANGULAR_WIDTH_XI_IN_DEGREES, 'mesher.ANGULAR_WIDTH_XI_IN_DEGREES', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ANGULAR_WIDTH_XI...'
-  call read_value_double_precision(ANGULAR_WIDTH_ETA_IN_DEGREES, 'mesher.ANGULAR_WIDTH_ETA_IN_DEGREES', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ANGULAR_WIDTH_ETA...'
-  call read_value_double_precision(CENTER_LATITUDE_IN_DEGREES, 'mesher.CENTER_LATITUDE_IN_DEGREES', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: CENTER_LATITUDE...'
-  call read_value_double_precision(CENTER_LONGITUDE_IN_DEGREES, 'mesher.CENTER_LONGITUDE_IN_DEGREES', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: CENTER_LONGITUDE...'
-  call read_value_double_precision(GAMMA_ROTATION_AZIMUTH, 'mesher.GAMMA_ROTATION_AZIMUTH', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: GAMMA_ROTATION...'
+
+  if( NCHUNKS == 6 ) then
+    ! global simulations
+    ANGULAR_WIDTH_XI_IN_DEGREES = 90.d0
+    ANGULAR_WIDTH_ETA_IN_DEGREES = 90.d0
+    CENTER_LATITUDE_IN_DEGREES = 0.d0
+    CENTER_LONGITUDE_IN_DEGREES = 0.d0
+    GAMMA_ROTATION_AZIMUTH = 0.d0
+  else
+    ! 1/2-chunk simulations
+    call read_value_double_precision(ANGULAR_WIDTH_XI_IN_DEGREES, 'mesher.ANGULAR_WIDTH_XI_IN_DEGREES', ierr)
+    if (ierr /= 0) stop 'an error occurred while reading the parameter file: ANGULAR_WIDTH_XI...'
+    call read_value_double_precision(ANGULAR_WIDTH_ETA_IN_DEGREES, 'mesher.ANGULAR_WIDTH_ETA_IN_DEGREES', ierr)
+    if (ierr /= 0) stop 'an error occurred while reading the parameter file: ANGULAR_WIDTH_ETA...'
+    call read_value_double_precision(CENTER_LATITUDE_IN_DEGREES, 'mesher.CENTER_LATITUDE_IN_DEGREES', ierr)
+    if (ierr /= 0) stop 'an error occurred while reading the parameter file: CENTER_LATITUDE...'
+    call read_value_double_precision(CENTER_LONGITUDE_IN_DEGREES, 'mesher.CENTER_LONGITUDE_IN_DEGREES', ierr)
+    if (ierr /= 0) stop 'an error occurred while reading the parameter file: CENTER_LONGITUDE...'
+    call read_value_double_precision(GAMMA_ROTATION_AZIMUTH, 'mesher.GAMMA_ROTATION_AZIMUTH', ierr)
+    if (ierr /= 0) stop 'an error occurred while reading the parameter file: GAMMA_ROTATION...'
+  endif
+
   ! number of elements at the surface along the two sides of the first chunk
   call read_value_integer(NEX_XI_read, 'mesher.NEX_XI', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NEX_XI'
@@ -117,6 +132,8 @@
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NPROC_XI'
   call read_value_integer(NPROC_ETA_read, 'mesher.NPROC_ETA', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NPROC_ETA'
+
+  ! physical parameters
   call read_value_logical(OCEANS, 'model.OCEANS', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: OCEANS'
   call read_value_logical(ELLIPTICITY, 'model.ELLIPTICITY', ierr)
@@ -129,15 +146,38 @@
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: ROTATION'
   call read_value_logical(ATTENUATION, 'model.ATTENUATION', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: ATTENUATION'
-  call read_value_logical(ATTENUATION_NEW, 'model.ATTENUATION_NEW', ierr)
-  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ATTENUATION_NEW'
+
   call read_value_logical(ABSORBING_CONDITIONS, 'solver.ABSORBING_CONDITIONS', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: ABSORBING_CONDITIONS'
+
   ! define the velocity model
   call read_value_string(MODEL, 'model.MODEL', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: MODEL'
   call read_value_double_precision(RECORD_LENGTH_IN_MINUTES, 'solver.RECORD_LENGTH_IN_MINUTES', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: RECORD_LENGTH_IN_MINUTES'
+  call read_value_logical(ATTENUATION_1D_WITH_3D_STORAGE, 'solver.ATTENUATION_1D_WITH_3D_STORAGE', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ATTENUATION_1D_WITH_3D_STORAGE'
+  call read_value_logical(PARTIAL_PHYS_DISPERSION_ONLY, 'solver.PARTIAL_PHYS_DISPERSION_ONLY', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: PARTIAL_PHYS_DISPERSION_ONLY'
+  call read_value_logical(UNDO_ATTENUATION, 'solver.UNDO_ATTENUATION', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: UNDO_ATTENUATION'
+  call read_value_integer(NT_DUMP_ATTENUATION, 'solver.NT_DUMP_ATTENUATION', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: NT_DUMP_ATTENUATION'
+
+  call read_value_logical(EXACT_MASS_MATRIX_FOR_ROTATION, 'solver.EXACT_MASS_MATRIX_FOR_ROTATION', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: EXACT_MASS_MATRIX_FOR_ROTATION'
+! ignore EXACT_MASS_MATRIX_FOR_ROTATION if rotation is not included in the simulations
+  if(.not. ROTATION) EXACT_MASS_MATRIX_FOR_ROTATION = .false.
+
+  ! low-memory runge-kutta time scheme
+  call read_value_logical(USE_LDDRK, 'solver.USE_LDDRK', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: USE_LDDRK'
+  call read_value_logical(INCREASE_CFL_FOR_LDDRK, 'solver.INCREASE_CFL_FOR_LDDRK', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: INCREASE_CFL_FOR_LDDRK'
+  call read_value_double_precision(RATIO_BY_WHICH_TO_INCREASE_IT, 'solver.RATIO_BY_WHICH_TO_INCREASE_IT', ierr)
+
+
+  ! movie options
   call read_value_logical(MOVIE_SURFACE, 'solver.MOVIE_SURFACE', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: MOVIE_SURFACE'
   call read_value_logical(MOVIE_VOLUME, 'solver.MOVIE_VOLUME', ierr)
@@ -166,6 +206,8 @@
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: MOVIE_START'
   call read_value_integer(MOVIE_STOP, 'solver.MOVIE_STOP', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: MOVIE_STOP'
+
+  ! run checkpointing
   call read_value_logical(SAVE_MESH_FILES, 'mesher.SAVE_MESH_FILES', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: SAVE_MESH_FILES'
   call read_value_integer(NUMBER_OF_RUNS, 'solver.NUMBER_OF_RUNS', ierr)
@@ -174,12 +216,16 @@
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NUMBER_OF_THIS_RUN'
   call read_value_string(LOCAL_PATH, 'LOCAL_PATH', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: LOCAL_PATH'
+  call read_value_string(LOCAL_TMP_PATH, 'LOCAL_TMP_PATH', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: LOCAL_TMP_PATH'
   call read_value_integer(NTSTEP_BETWEEN_OUTPUT_INFO, 'solver.NTSTEP_BETWEEN_OUTPUT_INFO', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NTSTEP_BETWEEN_OUTPUT_INFO'
   call read_value_integer(NTSTEP_BETWEEN_OUTPUT_SEISMOS, 'solver.NTSTEP_BETWEEN_OUTPUT_SEISMOS', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: NTSTEP_BETWEEN_OUTPUT_SEISMOS'
   call read_value_integer(NTSTEP_BETWEEN_READ_ADJSRC, 'solver.NTSTEP_BETWEEN_READ_ADJSRC', ierr)
   if (ierr /= 0) return
+
+  ! seismogram output
   call read_value_logical(OUTPUT_SEISMOS_ASCII_TEXT, 'solver.OUTPUT_SEISMOS_ASCII_TEXT', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: OUTPUT_SIESMOS_ASCII_TEXT'
   call read_value_logical(OUTPUT_SEISMOS_SAC_ALPHANUM, 'solver.OUTPUT_SEISMOS_SAC_ALPHANUM', ierr)
@@ -199,21 +245,80 @@
   call read_value_logical(PRINT_SOURCE_TIME_FUNCTION, 'solver.PRINT_SOURCE_TIME_FUNCTION', ierr)
   if (ierr /= 0) stop 'an error occurred while reading the parameter file: PRINT_SOURCE_TIME_FUNCTION'
 
-  ! closes parameter file
-  call close_parameter_file()
+  ! adjoint kernels
+  call read_value_logical(ANISOTROPIC_KL, 'solver.ANISOTROPIC_KL', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ANISOTROPIC_KL'
+  call read_value_logical(SAVE_TRANSVERSE_KL_ONLY, 'solver.SAVE_TRANSVERSE_KL_ONLY', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: SAVE_TRANSVERSE_KL_ONLY'
+  call read_value_logical(APPROXIMATE_HESS_KL, 'solver.APPROXIMATE_HESS_KL', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: APPROXIMATE_HESS_KL'
+  call read_value_logical(USE_FULL_TISO_MANTLE, 'solver.USE_FULL_TISO_MANTLE', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: USE_FULL_TISO_MANTLE'
+  call read_value_logical(SAVE_SOURCE_MASK, 'solver.SAVE_SOURCE_MASK', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: SAVE_SOURCE_MASK'
+  call read_value_logical(SAVE_REGULAR_KL, 'solver.SAVE_REGULAR_KL', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: SAVE_REGULAR_KL'
 
-  ! optional parameters:
+  ! gpu simulations
+  call read_value_logical(GPU_MODE, 'solver.GPU_MODE', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: GPU_MODE'
 
-  ! initializes
-  LOCAL_TMP_PATH = LOCAL_PATH
+  ! ADIO file format output
+  call read_value_logical(ADIOS_ENABLED, 'solver.ADIOS_ENABLED', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_ENABLED'
+!! DK DK July 2013: temporary, the time for Matthieu Lefebvre to merge his ADIOS implementation
+  if(ADIOS_ENABLED) stop 'ADIOS support not implemented yet'
 
-  ! opens file Par_file
-  call open_parameter_file()
+  call read_value_logical(ADIOS_FOR_FORWARD_ARRAYS, 'solver.ADIOS_FOR_FORWARD_ARRAYS', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_FOR_FORWARD_ARRAYS'
+  call read_value_logical(ADIOS_FOR_MPI_ARRAYS, 'solver.ADIOS_FOR_MPI_ARRAYS', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_FOR_MPI_ARRAYS'
+  call read_value_logical(ADIOS_FOR_ARRAYS_SOLVER, 'solver.ADIOS_FOR_ARRAYS_SOLVER', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_FOR_ARRAYS_SOLVER'
+  call read_value_logical(ADIOS_FOR_SOLVER_MESHFILES, 'solver.ADIOS_FOR_SOLVER_MESHFILES', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_FOR_SOLVER_MESHFILES'
+  call read_value_logical(ADIOS_FOR_AVS_DX, 'solver.ADIOS_FOR_AVS_DX', ierr)
+  if (ierr /= 0) stop 'an error occurred while reading the parameter file: ADIOS_FOR_AVS_DX'
 
-  call read_value_string(LOCAL_TMP_PATH, 'LOCAL_TMP_PATH')
-  call read_value_clear_err()
 
-  ! close parameter file
+
+  ! closes parameter file
   call close_parameter_file()
 
+  ! optional parameters:
+!  ! initializes
+!  LOCAL_TMP_PATH = LOCAL_PATH
+!  ! opens file Par_file
+!  call open_parameter_file()
+!  call read_value_string(LOCAL_TMP_PATH, 'LOCAL_TMP_PATH')
+!  call read_value_clear_err()
+!  ! close parameter file
+!  call close_parameter_file()
+
   end subroutine read_parameter_file
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+! unused...
+!
+!  subroutine read_gpu_mode(GPU_MODE)
+!
+!  implicit none
+!  include "constants.h"
+!
+!  logical :: GPU_MODE
+!
+!  ! initializes flags
+!  GPU_MODE = .false.
+!
+!  ! opens file Par_file
+!  call open_parameter_file()
+!
+!  call read_value_logical(GPU_MODE, 'solver.GPU_MODE')
+!
+!  ! close parameter file
+!  call close_parameter_file()
+!
+!  end subroutine read_gpu_mode
+!

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_value_parameters.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_value_parameters.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/read_value_parameters.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -114,8 +114,31 @@
 
   end subroutine close_parameter_file
 
+
 !--------------------
 
+  integer function err_occurred()
+
+  integer ierr
+  common /param_err_common/ ierr
+
+  err_occurred = ierr
+
+  end function err_occurred
+
+!--------------------
+
+  subroutine read_value_clear_err()
+
+  integer ierr
+  common /param_err_common/ ierr
+
+  ierr = 0
+
+  end subroutine read_value_clear_err
+
+!--------------------
+
 !
 ! unused routines:
 !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/reduce.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/reduce.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/reduce.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rthetaphi_xyz.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rthetaphi_xyz.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rthetaphi_xyz.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -32,37 +32,52 @@
 	$(EMPTY_MACRO)
 
 shared_OBJECTS = \
-	$O/auto_ner.o \
-	$O/broadcast_computed_parameters.o \
-	$O/calendar.o \
-	$O/count_number_of_sources.o \
-	$O/create_name_database.o \
-	$O/create_serial_name_database.o \
-	$O/euler_angles.o \
-	$O/exit_mpi.o \
-	$O/force_ftz.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/gll_library.o \
-	$O/hex_nodes.o \
-	$O/intgrl.o \
-	$O/lagrange_poly.o \
-	$O/make_ellipticity.o \
-	$O/make_gravity.o \
-	$O/memory_eval.o \
-	$O/model_prem.o \
-	$O/model_topo_bathy.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
-	$O/save_header_file.o \
-	$O/spline_routines.o \
-	$O/write_c_binary.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/broadcast_computed_parameters.shared.o \
+	$O/calendar.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_number_of_sources.shared.o \
+	$O/count_points.shared.o \
+	$O/create_name_database.shared.o \
+	$O/create_serial_name_database.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/euler_angles.shared.o \
+	$O/exit_mpi.sharedmpi.o \
+	$O/force_ftz.cc.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/gll_library.shared.o \
+	$O/hex_nodes.shared.o \
+	$O/intgrl.shared.o \
+	$O/lagrange_poly.shared.o \
+	$O/make_ellipticity.shared.o \
+	$O/make_gravity.shared.o \
+	$O/memory_eval.shared.o \
+	$O/model_prem.shared.o \
+	$O/model_topo_bathy.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
+	$O/save_header_file.shared.o \
+	$O/spline_routines.shared.o \
+	$O/write_c_binary.cc.o \
 	$(EMPTY_MACRO)
 
+ADIOS_OBJECTS = \
+  $O/adios_helpers.shared.o \
+  $O/adios_manager.shared.o \
+	$(EMPTY_MACRO)
+
+ADIOS_STUBS = \
+	$O/adios_method_stubs.shared.o \
+	$(EMPTY_MACRO)
+
+
 #######################################
 
 ## compilation directories
@@ -76,95 +91,15 @@
 ##
 ## shared
 ##
-$O/auto_ner.o: ${SETUP}/constants.h $S/auto_ner.f90
-	${FCCOMPILE_CHECK} -c -o $O/auto_ner.o ${FCFLAGS_f90} $S/auto_ner.f90
+$O/%.shared.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/broadcast_computed_parameters.o: ${SETUP}/constants.h $S/broadcast_computed_parameters.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/broadcast_computed_parameters.o ${FCFLAGS_f90} $S/broadcast_computed_parameters.f90
+$O/%.shared.o: $S/%.F90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/calendar.o: $S/calendar.f90
-	${FCCOMPILE_CHECK} -c -o $O/calendar.o ${FCFLAGS_f90} $S/calendar.f90
+$O/%.sharedmpi.o: $S/%.f90 ${SETUP}/constants.h
+	${MPIFCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/count_number_of_sources.o: ${SETUP}/constants.h $S/count_number_of_sources.f90
-	${FCCOMPILE_CHECK} -c -o $O/count_number_of_sources.o ${FCFLAGS_f90} $S/count_number_of_sources.f90
+$O/%.cc.o: $S/%.c ${SETUP}/config.h
+	${CC} -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 
 
-$O/create_name_database.o: ${SETUP}/constants.h $S/create_name_database.f90
-	${FCCOMPILE_CHECK} -c -o $O/create_name_database.o ${FCFLAGS_f90} $S/create_name_database.f90
-
-$O/create_serial_name_database.o: ${SETUP}/constants.h $S/create_serial_name_database.f90
-	${FCCOMPILE_CHECK} -c -o $O/create_serial_name_database.o ${FCFLAGS_f90} $S/create_serial_name_database.f90
-
-$O/euler_angles.o: ${SETUP}/constants.h $S/euler_angles.f90
-	${FCCOMPILE_CHECK} -c -o $O/euler_angles.o ${FCFLAGS_f90} $S/euler_angles.f90
-
-### C compilation
-$O/force_ftz.o: $S/force_ftz.c ${SETUP}/config.h
-	${CC} -c $(CPPFLAGS) $(CFLAGS) -o $O/force_ftz.o $S/force_ftz.c
-
-$O/get_model_parameters.o: ${SETUP}/constants.h $S/get_model_parameters.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_model_parameters.o ${FCFLAGS_f90} $S/get_model_parameters.f90
-
-$O/get_value_parameters.o: ${SETUP}/constants.h $S/get_value_parameters.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_value_parameters.o ${FCFLAGS_f90} $S/get_value_parameters.f90
-
-$O/gll_library.o: ${SETUP}/constants.h $S/gll_library.f90
-	${FCCOMPILE_CHECK} -c -o $O/gll_library.o ${FCFLAGS_f90} $S/gll_library.f90
-
-$O/hex_nodes.o: ${SETUP}/constants.h $S/hex_nodes.f90
-	${FCCOMPILE_CHECK} -c -o $O/hex_nodes.o ${FCFLAGS_f90} $S/hex_nodes.f90
-
-$O/intgrl.o: ${SETUP}/constants.h $S/intgrl.f90
-	${FCCOMPILE_CHECK} -c -o $O/intgrl.o ${FCFLAGS_f90} $S/intgrl.f90
-
-$O/lagrange_poly.o: ${SETUP}/constants.h $S/lagrange_poly.f90
-	${FCCOMPILE_CHECK} -c -o $O/lagrange_poly.o ${FCFLAGS_f90} $S/lagrange_poly.f90
-
-$O/make_ellipticity.o: ${SETUP}/constants.h $S/make_ellipticity.f90
-	${FCCOMPILE_CHECK} -c -o $O/make_ellipticity.o ${FCFLAGS_f90} $S/make_ellipticity.f90
-
-$O/make_gravity.o: ${SETUP}/constants.h $S/make_gravity.f90
-	${FCCOMPILE_CHECK} -c -o $O/make_gravity.o ${FCFLAGS_f90} $S/make_gravity.f90
-
-$O/memory_eval.o: ${SETUP}/constants.h $S/memory_eval.f90
-	${FCCOMPILE_CHECK} -c -o $O/memory_eval.o ${FCFLAGS_f90} $S/memory_eval.f90
-
-$O/model_prem.o: ${SETUP}/constants.h $S/model_prem.f90
-	${FCCOMPILE_CHECK} -c -o $O/model_prem.o ${FCFLAGS_f90} $S/model_prem.f90
-
-$O/param_reader.o: $S/param_reader.c ${SETUP}/config.h
-	${CC} -c $(CPPFLAGS) $(CFLAGS) -o $O/param_reader.o $S/param_reader.c
-
-$O/read_compute_parameters.o: ${SETUP}/constants.h $S/read_compute_parameters.f90
-	${FCCOMPILE_CHECK} -c -o $O/read_compute_parameters.o ${FCFLAGS_f90} $S/read_compute_parameters.f90
-
-$O/read_parameter_file.o: ${SETUP}/constants.h $S/read_parameter_file.f90
-	${FCCOMPILE_CHECK} -c -o $O/read_parameter_file.o ${FCFLAGS_f90} $S/read_parameter_file.f90
-
-$O/read_value_parameters.o: ${SETUP}/constants.h $S/read_value_parameters.f90
-	${FCCOMPILE_CHECK} -c -o $O/read_value_parameters.o ${FCFLAGS_f90} $S/read_value_parameters.f90
-
-$O/reduce.o: ${SETUP}/constants.h $S/reduce.f90
-	${FCCOMPILE_CHECK} -c -o $O/reduce.o ${FCFLAGS_f90} $S/reduce.f90
-
-$O/rthetaphi_xyz.o: ${SETUP}/constants.h $S/rthetaphi_xyz.f90
-	${FCCOMPILE_CHECK} -c -o $O/rthetaphi_xyz.o ${FCFLAGS_f90} $S/rthetaphi_xyz.f90
-
-$O/save_header_file.o: ${SETUP}/constants.h $S/save_header_file.F90
-	${FCCOMPILE_CHECK} -c -o $O/save_header_file.o ${FCFLAGS_f90} $S/save_header_file.F90
-
-$O/spline_routines.o: ${SETUP}/constants.h $S/spline_routines.f90
-	${FCCOMPILE_CHECK} -c -o $O/spline_routines.o ${FCFLAGS_f90} $S/spline_routines.f90
-
-### C compilation
-$O/write_c_binary.o: $S/write_c_binary.c ${SETUP}/config.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $O/write_c_binary.o $S/write_c_binary.c
-
-##
-## shared objects with mpi compilation
-##
-$O/exit_mpi.o: ${SETUP}/constants.h $S/exit_mpi.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/exit_mpi.o ${FCFLAGS_f90} $S/exit_mpi.f90
-
-$O/model_topo_bathy.o: ${SETUP}/constants.h $S/model_topo_bathy.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/model_topo_bathy.o ${FCFLAGS_f90} $S/model_topo_bathy.f90
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/save_header_file.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/save_header_file.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/save_header_file.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,30 +27,23 @@
 
 ! save header file OUTPUT_FILES/values_from_mesher.h
 
-  subroutine save_header_file(NSPEC,NGLOB,NEX_XI,NEX_ETA,NPROC,NPROCTOT, &
-                        TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-                        ELLIPTICITY,GRAVITY,ROTATION, &
-                        OCEANS,ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D, &
-                        ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,NCHUNKS, &
-                        INCLUDE_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES, &
-                        CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,NSOURCES,NSTEP,&
-                        static_memory_size, &
-                        NSPEC2D_TOP,NSPEC2D_BOTTOM, &
-                        NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
-                        NPROC_XI,NPROC_ETA, &
-                        NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
-                        NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
-                        NSPEC_INNER_CORE_ATTENUATION, &
-                        NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
-                        NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
-                        NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
-                        NSPEC_CRUST_MANTLE_ADJOINT, &
-                        NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
-                        NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
-                        NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
-                        NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-                        NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
-                        MOVIE_VOLUME)
+  subroutine save_header_file(NSPEC,NGLOB,NPROC,NPROCTOT, &
+                              NSOURCES, &
+                              static_memory_size, &
+                              NSPEC2D_TOP,NSPEC2D_BOTTOM, &
+                              NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX, &
+                              NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
+                              NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
+                              NSPEC_INNER_CORE_ATTENUATION, &
+                              NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
+                              NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
+                              NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
+                              NSPEC_CRUST_MANTLE_ADJOINT, &
+                              NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
+                              NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
+                              NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
+                              NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
+                              NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION )
 
 !
 ! ****************************************************************************************************
@@ -62,26 +55,36 @@
 ! ****************************************************************************************************
 !
 
+  use shared_parameters,only: TOPOGRAPHY, &
+    TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+    ELLIPTICITY,GRAVITY,ROTATION, &
+    OCEANS,ATTENUATION,ATTENUATION_3D, &
+    ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,NCHUNKS, &
+    INCLUDE_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES, &
+    CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH, &
+    NSTEP,NEX_XI,NEX_ETA, &
+    NPROC_XI,NPROC_ETA, &
+    SAVE_REGULAR_KL,NOISE_TOMOGRAPHY, &
+    APPROXIMATE_HESS_KL,ANISOTROPIC_KL,PARTIAL_PHYS_DISPERSION_ONLY, &
+    SAVE_SOURCE_MASK,ABSORBING_CONDITIONS,USE_LDDRK,EXACT_MASS_MATRIX_FOR_ROTATION, &
+    ATTENUATION_1D_WITH_3D_STORAGE, &
+    ATT1,ATT2,ATT3,ATT4,ATT5, &
+    MOVIE_VOLUME
+
   implicit none
 
   include "constants.h"
 
   integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NGLOB
 
-  integer NEX_XI,NEX_ETA,NPROC,NPROCTOT,NCHUNKS,NSOURCES,NSTEP
+  integer :: NPROC,NPROCTOT,NSOURCES
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          ELLIPTICITY,GRAVITY,ROTATION,OCEANS,ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,INCLUDE_CENTRAL_CUBE
 
-  double precision ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES, &
-          CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH
-
   ! static memory size needed by the solver
   double precision :: static_memory_size
 
   integer, dimension(MAX_NUM_REGIONS) :: &
         NSPEC2D_TOP,NSPEC2D_BOTTOM,NSPEC2DMAX_YMIN_YMAX,NSPEC2DMAX_XMIN_XMAX
-  integer :: NPROC_XI,NPROC_ETA
 
   integer :: NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
          NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
@@ -97,7 +100,7 @@
          NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
          NSPEC2D_MOHO, NSPEC2D_400, NSPEC2D_670, NSPEC2D_CMB, NSPEC2D_ICB
 
-  logical :: MOVIE_VOLUME
+  integer :: NGLOB_XY_CM, NGLOB_XY_IC
 
   ! local parameters
   double precision :: subtract_central_cube_elems,subtract_central_cube_points
@@ -110,7 +113,6 @@
   double precision rotation_matrix(3,3)
   double precision vector_ori(3),vector_rotated(3)
   double precision r_corner,theta_corner,phi_corner,lat,long,colat_corner
-  integer :: ATT1,ATT2,ATT3,ATT4,ATT5
   integer :: ier
   character(len=150) HEADER_FILE
 
@@ -406,13 +408,6 @@
   endif
   write(IOUT,*)
 
-  if(ATTENUATION_NEW) then
-    write(IOUT,*) 'logical, parameter :: ATTENUATION_NEW_VAL = .true.'
-  else
-    write(IOUT,*) 'logical, parameter :: ATTENUATION_NEW_VAL = .false.'
-  endif
-  write(IOUT,*)
-
   if(ATTENUATION_3D) then
     write(IOUT,*) 'logical, parameter :: ATTENUATION_3D_VAL = .true.'
   else
@@ -464,49 +459,17 @@
     write(IOUT,*) 'logical, parameter :: PARTIAL_PHYS_DISPERSION_ONLY_VAL = .false.'
   endif
 
-  write(IOUT,*) 'integer, parameter :: NGLOB1D_RADIAL_CM = ',NGLOB1D_RADIAL(IREGION_CRUST_MANTLE)
-  write(IOUT,*) 'integer, parameter :: NGLOB1D_RADIAL_OC = ',NGLOB1D_RADIAL(IREGION_OUTER_CORE)
-  write(IOUT,*) 'integer, parameter :: NGLOB1D_RADIAL_IC = ',NGLOB1D_RADIAL(IREGION_INNER_CORE)
-
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_XMIN_XMAX_CM = ',NGLOB2DMAX_XMIN_XMAX(IREGION_CRUST_MANTLE)
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_XMIN_XMAX_OC = ',NGLOB2DMAX_XMIN_XMAX(IREGION_OUTER_CORE)
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_XMIN_XMAX_IC = ',NGLOB2DMAX_XMIN_XMAX(IREGION_INNER_CORE)
-
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_YMIN_YMAX_CM = ',NGLOB2DMAX_YMIN_YMAX(IREGION_CRUST_MANTLE)
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_YMIN_YMAX_OC = ',NGLOB2DMAX_YMIN_YMAX(IREGION_OUTER_CORE)
-  write(IOUT,*) 'integer, parameter :: NGLOB2DMAX_YMIN_YMAX_IC = ',NGLOB2DMAX_YMIN_YMAX(IREGION_INNER_CORE)
-
   write(IOUT,*) 'integer, parameter :: NPROC_XI_VAL = ',NPROC_XI
   write(IOUT,*) 'integer, parameter :: NPROC_ETA_VAL = ',NPROC_ETA
   write(IOUT,*) 'integer, parameter :: NCHUNKS_VAL = ',NCHUNKS
   write(IOUT,*) 'integer, parameter :: NPROCTOT_VAL = ',NPROCTOT
   write(IOUT,*)
 
-  if(ATTENUATION) then
-     if(USE_3D_ATTENUATION_ARRAYS) then
-        att1 = NGLLX
-        att2 = NGLLY
-        att3 = NGLLZ
-     else
-        att1 = 1
-        att2 = 1
-        att3 = 1
-     endif
-     att4 = NSPEC(IREGION_CRUST_MANTLE)
-     att5 = NSPEC(IREGION_INNER_CORE)
-  else
-     att1 = 1
-     att2 = 1
-     att3 = 1
-     att4 = 1
-     att5 = 1
-  endif
-
-  write(IOUT,*) 'integer, parameter :: ATT1 = ',att1
-  write(IOUT,*) 'integer, parameter :: ATT2 = ',att2
-  write(IOUT,*) 'integer, parameter :: ATT3 = ',att3
-  write(IOUT,*) 'integer, parameter :: ATT4 = ',att4
-  write(IOUT,*) 'integer, parameter :: ATT5 = ',att5
+  write(IOUT,*) 'integer, parameter :: ATT1_VAL = ',ATT1
+  write(IOUT,*) 'integer, parameter :: ATT2_VAL = ',ATT2
+  write(IOUT,*) 'integer, parameter :: ATT3_VAL = ',ATT3
+  write(IOUT,*) 'integer, parameter :: ATT4_VAL = ',ATT4
+  write(IOUT,*) 'integer, parameter :: ATT5_VAL = ',ATT5
   write(IOUT,*)
 
   write(IOUT,*) 'integer, parameter :: NSPEC2DMAX_XMIN_XMAX_CM = ',NSPEC2DMAX_XMIN_XMAX(IREGION_CRUST_MANTLE)

Added: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/shared_par.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/shared_par.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/shared_par.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -0,0 +1,203 @@
+!=====================================================================
+!
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
+!          --------------------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!                        Princeton University, USA
+!             and CNRS / INRIA / University of Pau, France
+! (c) Princeton University and CNRS / INRIA / University of Pau
+!                            August 2013
+!
+! 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.
+!
+!=====================================================================
+
+  module constants
+
+  include "constants.h"
+
+  end module constants
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  module shared_input_parameters
+
+! holds input parameters given in DATA/Par_file
+
+  implicit none
+
+  ! parameters read from parameter file
+
+  ! seismograms
+  integer :: NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,NTSTEP_BETWEEN_FRAMES, &
+             NTSTEP_BETWEEN_OUTPUT_INFO
+  double precision :: RECORD_LENGTH_IN_MINUTES
+  logical :: RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION
+  logical :: OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+             ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
+             SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+
+  ! checkpointing/restart
+  integer :: NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN
+
+  ! simulation parameters
+  integer :: NCHUNKS,SIMULATION_TYPE
+  integer :: NEX_XI_read,NEX_ETA_read,NPROC_XI_read,NPROC_ETA_read
+  integer :: NOISE_TOMOGRAPHY
+
+  double precision :: ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+                      CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH
+  logical :: SAVE_MESH_FILES,SAVE_FORWARD
+
+  ! movies
+  integer :: MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP
+  double precision :: HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM, &
+          MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,&
+          MOVIE_SOUTH_DEG
+  logical :: MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE
+
+  ! physical parameters
+  logical :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+             ATTENUATION
+
+  logical :: ABSORBING_CONDITIONS
+
+  ! file directories
+  character(len=150) :: OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+
+  ! attenuation parameters
+  logical :: UNDO_ATTENUATION,PARTIAL_PHYS_DISPERSION_ONLY,ATTENUATION_1D_WITH_3D_STORAGE
+  integer :: NT_DUMP_ATTENUATION
+
+  ! ldd runge-kutta time scheme
+  logical :: USE_LDDRK,INCREASE_CFL_FOR_LDDRK
+  double precision :: RATIO_BY_WHICH_TO_INCREASE_IT
+
+  logical :: EXACT_MASS_MATRIX_FOR_ROTATION
+
+  ! adjoint kernels
+  logical :: SAVE_REGULAR_KL,ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY,APPROXIMATE_HESS_KL,USE_FULL_TISO_MANTLE,SAVE_SOURCE_MASK
+
+  ! gpu simulations
+  logical :: GPU_MODE
+
+  ! adios file output
+  logical :: ADIOS_ENABLED,ADIOS_FOR_FORWARD_ARRAYS, &
+             ADIOS_FOR_MPI_ARRAYS,ADIOS_FOR_ARRAYS_SOLVER,ADIOS_FOR_SOLVER_MESHFILES, &
+             ADIOS_FOR_AVS_DX
+
+  end module shared_input_parameters
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  module shared_compute_parameters
+
+  ! parameters to be computed based upon parameters above read from file
+
+  use constants,only: MAX_NUM_REGIONS,MAX_NUMBER_OF_MESH_LAYERS, &
+    NB_SQUARE_CORNERS,NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE
+
+  implicit none
+
+  ! parameters deduced from parameters read from file
+  integer :: NPROC,NPROCTOT
+  integer :: NPROC_XI,NPROC_ETA
+
+
+  ! number of time steps
+  integer :: NSTEP
+  double precision :: DT
+
+  ! number of elements
+  integer :: NEX_PER_PROC_XI,NEX_PER_PROC_ETA
+  integer :: NER_CRUST, &
+             NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+             NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+             NER_TOP_CENTRAL_CUBE_ICB, &
+             NEX_XI,NEX_ETA
+
+
+  ! attenuation
+  integer :: MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD
+  integer :: ATT1,ATT2,ATT3,ATT4,ATT5
+
+  ! radii of layers
+  double precision :: ROCEAN,RMIDDLE_CRUST,RMOHO,R80,R120,R220,R400, &
+                      R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+                      R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS, &
+                      RMOHO_FICTITIOUS_IN_MESHER,R80_FICTITIOUS_IN_MESHER
+
+  ! movies
+  double precision :: MOVIE_TOP,MOVIE_BOTTOM,MOVIE_EAST,MOVIE_WEST,&
+                      MOVIE_NORTH,MOVIE_SOUTH
+  ! model flags
+  integer :: REFERENCE_1D_MODEL,THREE_D_MODEL
+  logical :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+             CRUSTAL,ONE_CRUST,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE
+  logical :: ATTENUATION_3D
+  logical :: INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE
+  logical :: EMULATE_ONLY
+
+
+! honor PREM Moho or not
+! doing so drastically reduces the stability condition and therefore the time step
+  logical :: HONOR_1D_SPHERICAL_MOHO,CASE_3D
+
+  ! this for all the regions
+  integer, dimension(MAX_NUM_REGIONS) :: NSPEC
+  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2D_XI,NSPEC2D_ETA
+  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX
+  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2D_BOTTOM,NSPEC2D_TOP
+  integer, dimension(MAX_NUM_REGIONS) :: NSPEC1D_RADIAL
+
+  integer, dimension(MAX_NUM_REGIONS) :: NGLOB
+  integer, dimension(MAX_NUM_REGIONS) :: NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX
+  integer, dimension(MAX_NUM_REGIONS) :: NGLOB1D_RADIAL
+
+  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+
+  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+
+  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+
+  integer :: ratio_divide_central_cube
+
+  ! for the cut doublingbrick improvement
+  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+
+  end module shared_compute_parameters
+
+!
+!-------------------------------------------------------------------------------------------------
+!
+
+  module shared_parameters
+
+  use shared_input_parameters
+  use shared_compute_parameters
+
+  implicit none
+
+  end module shared_parameters
+

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/spline_routines.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/spline_routines.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/spline_routines.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_VTK_file.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_VTK_file.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_VTK_file.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -421,14 +421,10 @@
 
 ! outputs single file for all processes
 
-  use mpi
-
   implicit none
 
   include "constants.h"
 
-  include "precision.h"
-
   integer :: myrank,NPROCTOT
 
   integer ::nspec,nglob
@@ -480,17 +476,16 @@
   endif
 
   ! gather info on master proc
-  call MPI_GATHER(xstore_dummy,nglob,CUSTOM_MPI_TYPE,store_val_x_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(ystore_dummy,nglob,CUSTOM_MPI_TYPE,store_val_y_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(zstore_dummy,nglob,CUSTOM_MPI_TYPE,store_val_z_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
+  call gather_all_cr(xstore_dummy,nglob,store_val_x_all,nglob,NPROCTOT)
+  call gather_all_cr(ystore_dummy,nglob,store_val_y_all,nglob,NPROCTOT)
+  call gather_all_cr(zstore_dummy,nglob,store_val_z_all,nglob,NPROCTOT)
 
-  call MPI_GATHER(glob_data(1,:),nglob,CUSTOM_MPI_TYPE,store_val_ux_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(glob_data(2,:),nglob,CUSTOM_MPI_TYPE,store_val_uy_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(glob_data(3,:),nglob,CUSTOM_MPI_TYPE,store_val_uz_all,nglob,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
+  call gather_all_cr(glob_data(1,:),nglob,store_val_ux_all,nglob,NPROCTOT)
+  call gather_all_cr(glob_data(2,:),nglob,store_val_uy_all,nglob,NPROCTOT)
+  call gather_all_cr(glob_data(3,:),nglob,store_val_uz_all,nglob,NPROCTOT)
 
-  call MPI_GATHER(ibool,NGLLX*NGLLY*NGLLZ*nspec,MPI_INTEGER,ibool_all, &
-                  NGLLX*NGLLY*NGLLZ*nspec,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(idoubling,nspec,MPI_INTEGER,idoubling_all,nspec,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call gather_all_i(ibool,NGLLX*NGLLY*NGLLZ*nspec,ibool_all,NGLLX*NGLLY*NGLLZ*nspec,NPROCTOT)
+  call gather_all_i(idoubling,nspec,idoubling_all,nspec,NPROCTOT)
 
 
   if( myrank == 0 ) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_c_binary.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_c_binary.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/shared/write_c_binary.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
 /*
  !=====================================================================
  !
- !          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+ !          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
  !          --------------------------------------------------
  !
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !                        Princeton University, USA
  !             and CNRS / INRIA / University of Pau, France
  ! (c) Princeton University and CNRS / INRIA / University of Pau
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/Makefile	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/Makefile	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,8 +30,6 @@
     receiver_cube_from_slices,ibool_inner_core,idoubling_inner_core, &
     ibelm_bottom_inner_core,NSPEC2D_BOTTOM_INNER_CORE,vector_assemble,ndim_assemble,iphase_CC)
 
-  use mpi
-
   implicit none
 
   include 'constants.h'
@@ -71,7 +69,6 @@
 ! therefore NPROC_XI+4 is always large enough
   integer, dimension(NPROC_XI_VAL+4), save :: request_send_array,request_receive_array
   logical :: flag_result_test
-  integer, dimension(MPI_STATUS_SIZE) :: msg_status
   integer :: ier
 
 ! mask
@@ -88,9 +85,8 @@
     do imsg = 1,nb_msgs_theor_in_cube-1
 ! receive buffers from slices
       sender = sender_from_slices_to_cube(imsg)
-      call MPI_IRECV(buffer_all_cube_from_slices(1,1,imsg), &
-                ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-                itag,MPI_COMM_WORLD,request_receive_array(imsg),ier)
+      call irecv_dp(buffer_all_cube_from_slices(1,1,imsg),ndim_assemble*npoin2D_cube_from_slices, &
+                    sender,itag,request_receive_array(imsg))
     enddo
   endif
 
@@ -111,8 +107,9 @@
     enddo
 ! send buffer to central cube
     receiver = receiver_cube_from_slices
-    call MPI_ISEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,request_send,ier)
+    call isend_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
+                  receiver,itag,request_send)
+
  endif  ! end sending info to central cube
 
   iphase_CC = iphase_CC + 1
@@ -123,13 +120,13 @@
   if(iphase_CC == 2) then
 
   if(ichunk /= CHUNK_AB .and. ichunk /= CHUNK_AB_ANTIPODE) then
-    call MPI_TEST(request_send,flag_result_test,msg_status,ier)
+    call test_request(request_send,flag_result_test)
     if(.not. flag_result_test) return ! exit if message not sent yet
   endif
 
   if(ichunk == CHUNK_AB .or. ichunk == CHUNK_AB_ANTIPODE) then
     do imsg = 1,nb_msgs_theor_in_cube-1
-      call MPI_TEST(request_receive_array(imsg),flag_result_test,msg_status,ier)
+      call test_request(request_receive_array(imsg),flag_result_test)
       if(.not. flag_result_test) return ! exit if message not received yet
     enddo
   endif
@@ -149,17 +146,15 @@
       endif
     enddo
     sender = sender_from_slices_to_cube(nb_msgs_theor_in_cube)
-!   call MPI_SENDRECV(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-!       itag,buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,&
-!       MPI_DOUBLE_PRECISION,sender,itag,MPI_COMM_WORLD,msg_status,ier)
 
-    call MPI_IRECV(buffer_all_cube_from_slices(1,1,nb_msgs_theor_in_cube), &
-        ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender,itag,MPI_COMM_WORLD,request_receive,ier)
+    call irecv_dp(buffer_all_cube_from_slices(1,1,nb_msgs_theor_in_cube),ndim_assemble*npoin2D_cube_from_slices, &
+                  sender,itag,request_receive)
+
 !! DK DK this merged with previous statement
 !   buffer_all_cube_from_slices(:,:,nb_msgs_theor_in_cube) = buffer_slices2(:,:)
 
-    call MPI_ISEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-        itag,MPI_COMM_WORLD,request_send,ier)
+    call isend_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
+                  receiver_cube_from_slices,itag,request_send)
   endif
 
   iphase_CC = iphase_CC + 1
@@ -173,9 +168,9 @@
 
   if(ichunk == CHUNK_AB .or. ichunk == CHUNK_AB_ANTIPODE) then
 
-    call MPI_TEST(request_send,flag_result_test,msg_status,ier)
+    call test_request(request_send,flag_result_test)
     if(.not. flag_result_test) return ! exit if message not sent yet
-    call MPI_TEST(request_receive,flag_result_test,msg_status,ier)
+    call test_request(request_receive,flag_result_test)
     if(.not. flag_result_test) return ! exit if message not received yet
 
     do idimension = 1,ndim_assemble
@@ -243,9 +238,9 @@
   if(ichunk /= CHUNK_AB .and. ichunk /= CHUNK_AB_ANTIPODE) then
 ! receive buffers from slices
   sender = receiver_cube_from_slices
-  call MPI_IRECV(buffer_slices, &
-              ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-              itag,MPI_COMM_WORLD,request_receive,ier)
+  call irecv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
+              sender,itag,request_receive)
+
 ! for bottom elements in contact with central cube from the slices side
 !   ipoin = 0
 !   do ispec2D = 1,NSPEC2D_BOTTOM_INNER_CORE
@@ -273,8 +268,8 @@
     do imsg = 1,nb_msgs_theor_in_cube-1
 ! send buffers to slices
       receiver = sender_from_slices_to_cube(imsg)
-      call MPI_ISEND(buffer_all_cube_from_slices(1,1,imsg),ndim_assemble*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,request_send_array(imsg),ier)
+      call isend_dp(buffer_all_cube_from_slices(1,1,imsg),ndim_assemble*npoin2D_cube_from_slices, &
+                    receiver,itag,request_send_array(imsg))
     enddo
   endif
 
@@ -287,13 +282,13 @@
 
   if(ichunk == CHUNK_AB .or. ichunk == CHUNK_AB_ANTIPODE) then
     do imsg = 1,nb_msgs_theor_in_cube-1
-      call MPI_TEST(request_send_array(imsg),flag_result_test,msg_status,ier)
+      call test_request(request_send_array(imsg),flag_result_test)
       if(.not. flag_result_test) return ! exit if message not sent yet
     enddo
   endif
 
   if(ichunk /= CHUNK_AB .and. ichunk /= CHUNK_AB_ANTIPODE) then
-    call MPI_TEST(request_receive,flag_result_test,msg_status,ier)
+    call test_request(request_receive,flag_result_test)
     if(.not. flag_result_test) return ! exit if message not received yet
   endif
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube_block.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube_block.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_central_cube_block.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -32,8 +32,6 @@
 
 ! this version of the routine is based on blocking MPI calls
 
-  use mpi
-
   implicit none
 
   include 'constants.h'
@@ -62,9 +60,6 @@
 
   real(kind=CUSTOM_REAL), dimension(NGLOB_INNER_CORE) :: array_central_cube
 
-! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE), ier
-
 ! mask
   logical, dimension(NGLOB_INNER_CORE) :: mask
 
@@ -79,9 +74,7 @@
 
 ! receive buffers from slices
     sender = sender_from_slices_to_cube(imsg)
-    call MPI_RECV(buffer_slices, &
-                ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-                itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
 ! copy buffer in 2D array for each slice
     buffer_all_cube_from_slices(imsg,:,1:ndim_assemble) = buffer_slices(:,1:ndim_assemble)
@@ -110,8 +103,7 @@
 
 ! send buffer to central cube
     receiver = receiver_cube_from_slices
-    call MPI_SEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver,itag)
 
  endif  ! end sending info to central cube
 
@@ -134,9 +126,8 @@
 
     sender = sender_from_slices_to_cube(nb_msgs_theor_in_cube)
 
-    call MPI_SENDRECV(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-        itag,buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,&
-        MPI_DOUBLE_PRECISION,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver_cube_from_slices,itag, &
+                     buffer_slices2,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
    buffer_all_cube_from_slices(nb_msgs_theor_in_cube,:,1:ndim_assemble) = buffer_slices2(:,1:ndim_assemble)
 
@@ -212,9 +203,7 @@
 
 ! receive buffers from slices
   sender = receiver_cube_from_slices
-  call MPI_RECV(buffer_slices, &
-              ndim_assemble*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+  call recv_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,sender,itag)
 
 ! for bottom elements in contact with central cube from the slices side
     ipoin = 0
@@ -253,8 +242,7 @@
 
 ! send buffers to slices
     receiver = sender_from_slices_to_cube(imsg)
-    call MPI_SEND(buffer_slices,ndim_assemble*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,ndim_assemble*npoin2D_cube_from_slices,receiver,itag)
 
    enddo
    endif

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -36,10 +36,10 @@
 
 ! blocking send/receive
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: nglob
 
@@ -131,10 +131,10 @@
 
 ! non-blocking MPI send
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: nglob
   integer :: num_interfaces,max_nibool_interfaces
@@ -192,10 +192,10 @@
 
 ! waits for send/receiver to be completed and assembles contributions
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: nglob
   integer :: num_interfaces,max_nibool_interfaces
@@ -242,7 +242,7 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine assemble_MPI_scalar_send_cuda(NPROC, &
+  subroutine assemble_MPI_scalar_send_cuda(Mesh_pointer,NPROC, &
                                           buffer_send_scalar,buffer_recv_scalar, &
                                           num_interfaces,max_nibool_interfaces, &
                                           nibool_interfaces, &
@@ -255,11 +255,12 @@
   ! sends data
   ! note: assembling data already filled into buffer_send_scalar array
 
-  use constants_solver
-  use specfem_par,only: Mesh_pointer
+  use constants
 
   implicit none
 
+  integer(kind=8) :: Mesh_pointer
+
   integer :: NPROC
   integer :: num_interfaces,max_nibool_interfaces
 
@@ -304,7 +305,7 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine assemble_MPI_scalar_write_cuda(NPROC, &
+  subroutine assemble_MPI_scalar_write_cuda(Mesh_pointer,NPROC, &
                                             buffer_recv_scalar, &
                                             num_interfaces,max_nibool_interfaces, &
                                             request_send_scalar,request_recv_scalar, &
@@ -312,11 +313,12 @@
 
 ! waits for send/receiver to be completed and assembles contributions
 
-  use constants_solver
-  use specfem_par,only: Mesh_pointer
+  use constants
 
   implicit none
 
+  integer(kind=8) :: Mesh_pointer
+
   integer :: NPROC
 
   integer :: num_interfaces,max_nibool_interfaces

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar_block.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar_block.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_scalar_block.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -45,13 +45,10 @@
 
 ! this version of the routine is based on blocking MPI calls
 
-  use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-  include "precision.h"
-
   integer myrank,nglob,NCHUNKS
 
 ! array to assemble
@@ -91,14 +88,13 @@
 ! communication pattern for corners between chunks
   integer, dimension(NCORNERSCHUNKS) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
 
-! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE)
-
   integer ipoin,ipoin2D,ipoin1D
   integer sender,receiver,ier
   integer imsg,imsg_loop
   integer icount_faces,npoin2D_chunks
 
+  integer, external :: null_process
+
 ! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
 ! check flag to see if we need to assemble (might be turned off when debugging)
@@ -124,18 +120,17 @@
 
 ! send messages forward along each row
   if(iproc_xi == 0) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi - 1,iproc_eta)
   endif
   if(iproc_xi == NPROC_XI-1) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi + 1,iproc_eta)
   endif
-  call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_xi(2),CUSTOM_MPI_TYPE,receiver, &
-        itag2,buffer_received_faces_scalar,npoin2D_xi(1),CUSTOM_MPI_TYPE,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_scalar,npoin2D_xi(2),receiver,itag2, &
+                   buffer_received_faces_scalar,npoin2D_xi(1),sender,itag)
 
 ! all slices add the buffer received to the contributions on the left face
   if(iproc_xi > 0) then
@@ -154,18 +149,17 @@
 
 ! send messages backward along each row
   if(iproc_xi == NPROC_XI-1) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi + 1,iproc_eta)
   endif
   if(iproc_xi == 0) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi - 1,iproc_eta)
   endif
-  call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_xi(1),CUSTOM_MPI_TYPE,receiver, &
-        itag2,buffer_received_faces_scalar,npoin2D_xi(2),CUSTOM_MPI_TYPE,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_scalar,npoin2D_xi(1),receiver,itag2, &
+                   buffer_received_faces_scalar,npoin2D_xi(2),sender,itag)
 
 ! all slices copy the buffer received to the contributions on the right face
   if(iproc_xi < NPROC_XI-1) then
@@ -190,18 +184,17 @@
 
 ! send messages forward along each row
   if(iproc_eta == 0) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi,iproc_eta - 1)
   endif
   if(iproc_eta == NPROC_ETA-1) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi,iproc_eta + 1)
   endif
-  call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_eta(2),CUSTOM_MPI_TYPE,receiver, &
-    itag2,buffer_received_faces_scalar,npoin2D_eta(1),CUSTOM_MPI_TYPE,sender, &
-    itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_scalar,npoin2D_eta(2),receiver,itag2, &
+                   buffer_received_faces_scalar,npoin2D_eta(1),sender,itag)
 
 ! all slices add the buffer received to the contributions on the left face
   if(iproc_eta > 0) then
@@ -220,18 +213,17 @@
 
 ! send messages backward along each row
   if(iproc_eta == NPROC_ETA-1) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi,iproc_eta + 1)
   endif
   if(iproc_eta == 0) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi,iproc_eta - 1)
   endif
-  call MPI_SENDRECV(buffer_send_faces_scalar,npoin2D_eta(1),CUSTOM_MPI_TYPE,receiver, &
-    itag2,buffer_received_faces_scalar,npoin2D_eta(2),CUSTOM_MPI_TYPE,sender, &
-    itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_scalar,npoin2D_eta(1),receiver,itag2, &
+                   buffer_received_faces_scalar,npoin2D_eta(2),sender,itag)
 
 ! all slices copy the buffer received to the contributions on the right face
   if(iproc_eta < NPROC_ETA-1) then
@@ -268,9 +260,8 @@
   if(myrank==iprocto_faces(imsg) .and. imsg_type(imsg) == imsg_loop) then
     sender = iprocfrom_faces(imsg)
     npoin2D_chunks = npoin2D_faces(icount_faces)
-    call MPI_RECV(buffer_received_faces_scalar, &
-              npoin2D_chunks,CUSTOM_MPI_TYPE,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_received_faces_scalar,npoin2D_chunks,sender,itag)
+
     do ipoin2D=1,npoin2D_chunks
       array_val(iboolfaces(ipoin2D,icount_faces)) = &
          array_val(iboolfaces(ipoin2D,icount_faces)) + buffer_received_faces_scalar(ipoin2D)
@@ -290,8 +281,7 @@
     do ipoin2D=1,npoin2D_chunks
       buffer_send_faces_scalar(ipoin2D) = array_val(iboolfaces(ipoin2D,icount_faces))
     enddo
-    call MPI_SEND(buffer_send_faces_scalar,npoin2D_chunks, &
-              CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_faces_scalar,npoin2D_chunks,receiver,itag)
   endif
   enddo
 
@@ -309,9 +299,8 @@
   if(myrank==iprocfrom_faces(imsg) .and. imsg_type(imsg) == imsg_loop) then
     sender = iprocto_faces(imsg)
     npoin2D_chunks = npoin2D_faces(icount_faces)
-    call MPI_RECV(buffer_received_faces_scalar, &
-              npoin2D_chunks,CUSTOM_MPI_TYPE,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_received_faces_scalar,npoin2D_chunks,sender,itag)
+
     do ipoin2D=1,npoin2D_chunks
       array_val(iboolfaces(ipoin2D,icount_faces)) = buffer_received_faces_scalar(ipoin2D)
     enddo
@@ -330,8 +319,7 @@
     do ipoin2D=1,npoin2D_chunks
       buffer_send_faces_scalar(ipoin2D) = array_val(iboolfaces(ipoin2D,icount_faces))
     enddo
-    call MPI_SEND(buffer_send_faces_scalar,npoin2D_chunks, &
-              CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_faces_scalar,npoin2D_chunks,receiver,itag)
   endif
   enddo
 
@@ -361,8 +349,8 @@
 
 ! receive from worker #1 and add to local array
     sender = iproc_worker1_corners(imsg)
-    call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
     do ipoin1D=1,NGLOB1D_RADIAL
       array_val(iboolcorner(ipoin1D,icount_corners)) = array_val(iboolcorner(ipoin1D,icount_corners)) + &
                buffer_recv_chunkcorn_scalar(ipoin1D)
@@ -371,8 +359,8 @@
 ! receive from worker #2 and add to local array
   if(NCHUNKS /= 2) then
     sender = iproc_worker2_corners(imsg)
-    call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
     do ipoin1D=1,NGLOB1D_RADIAL
       array_val(iboolcorner(ipoin1D,icount_corners)) = array_val(iboolcorner(ipoin1D,icount_corners)) + &
                buffer_recv_chunkcorn_scalar(ipoin1D)
@@ -389,8 +377,7 @@
     do ipoin1D=1,NGLOB1D_RADIAL
       buffer_send_chunkcorn_scalar(ipoin1D) = array_val(iboolcorner(ipoin1D,icount_corners))
     enddo
-    call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-              receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
 
   endif
 
@@ -404,8 +391,8 @@
 
 ! receive from master and copy to local array
     sender = iproc_master_corners(imsg)
-    call MPI_RECV(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_scalar,NGLOB1D_RADIAL,sender,itag)
+
     do ipoin1D=1,NGLOB1D_RADIAL
       array_val(iboolcorner(ipoin1D,icount_corners)) = buffer_recv_chunkcorn_scalar(ipoin1D)
     enddo
@@ -421,14 +408,12 @@
 
 ! send to worker #1
     receiver = iproc_worker1_corners(imsg)
-    call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-              receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
 
 ! send to worker #2
   if(NCHUNKS /= 2) then
     receiver = iproc_worker2_corners(imsg)
-    call MPI_SEND(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,CUSTOM_MPI_TYPE, &
-              receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_scalar,NGLOB1D_RADIAL,receiver,itag)
   endif
 
   endif

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -41,10 +41,10 @@
 
 ! sends data
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: nglob
 
@@ -106,7 +106,7 @@
 ! check: MP_CSS_INTERRUPT environment variable on IBM systems
 
 
-  subroutine assemble_MPI_vector_send_cuda(NPROC, &
+  subroutine assemble_MPI_vector_send_cuda(Mesh_pointer,NPROC, &
                                           buffer_send_vector,buffer_recv_vector, &
                                           num_interfaces,max_nibool_interfaces, &
                                           nibool_interfaces, &
@@ -116,11 +116,12 @@
 
   ! sends data
   ! note: array to assemble already filled into buffer_send_vector array
-  use constants_solver
-  use specfem_par,only: Mesh_pointer
+  use constants
 
   implicit none
 
+  integer(kind=8) :: Mesh_pointer
+
   integer :: NPROC
 
   integer :: num_interfaces,max_nibool_interfaces
@@ -179,10 +180,10 @@
 
 ! waits for data to receive and assembles
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: NPROC
   integer :: nglob
 
@@ -233,7 +234,7 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine assemble_MPI_vector_write_cuda(NPROC, &
+  subroutine assemble_MPI_vector_write_cuda(Mesh_pointer,NPROC, &
                                             buffer_recv_vector, &
                                             num_interfaces,max_nibool_interfaces, &
                                             request_send_vector,request_recv_vector, &
@@ -241,11 +242,12 @@
 
 ! waits for data to receive and assembles
 
-  use constants_solver
-  use specfem_par,only: Mesh_pointer
+  use constants
 
   implicit none
 
+  integer(kind=8) :: Mesh_pointer
+
   integer :: NPROC
 
   integer :: num_interfaces,max_nibool_interfaces

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector_block.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector_block.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/assemble_MPI_vector_block.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -51,16 +51,10 @@
 
 ! this version of the routine is based on blocking MPI calls
 
-  use mpi
+  use constants_solver
 
   implicit none
 
-  include "constants.h"
-  include "precision.h"
-
-! include values created by the mesher
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   integer myrank,NCHUNKS
 
 ! the two arrays to assemble
@@ -109,9 +103,6 @@
 ! communication pattern for corners between chunks
   integer, dimension(NCORNERSCHUNKS) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
 
-! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE)
-
   integer ipoin,ipoin2D,ipoin1D
   integer sender,receiver,ier
   integer imsg,imsg_loop
@@ -119,6 +110,9 @@
 
   integer :: NGLOB1D_RADIAL_all,ioffset
   integer, dimension(NB_SQUARE_EDGES_ONEDIR) :: npoin2D_xi_all,npoin2D_eta_all
+
+  integer, external :: null_process
+
 ! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 
 ! check flag to see if we need to assemble (might be turned off when debugging)
@@ -159,19 +153,18 @@
 
 ! send messages forward along each row
   if(iproc_xi == 0) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi - 1,iproc_eta)
   endif
   if(iproc_xi == NPROC_XI-1) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi + 1,iproc_eta)
   endif
 
-  call MPI_SENDRECV(buffer_send_faces_vector,NDIM*npoin2D_xi_all(2),CUSTOM_MPI_TYPE,receiver, &
-        itag2,buffer_received_faces_vector,NDIM*npoin2D_xi_all(1),CUSTOM_MPI_TYPE,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_vector,NDIM*npoin2D_xi_all(2),receiver,itag2, &
+                   buffer_received_faces_vector,NDIM*npoin2D_xi_all(1),sender,itag)
 
 ! all slices add the buffer received to the contributions on the left face
   if(iproc_xi > 0) then
@@ -217,18 +210,17 @@
 
 ! send messages backward along each row
   if(iproc_xi == NPROC_XI-1) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi + 1,iproc_eta)
   endif
   if(iproc_xi == 0) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi - 1,iproc_eta)
   endif
-  call MPI_SENDRECV(buffer_send_faces_vector,NDIM*npoin2D_xi_all(1),CUSTOM_MPI_TYPE,receiver, &
-        itag2,buffer_received_faces_vector,NDIM*npoin2D_xi_all(2),CUSTOM_MPI_TYPE,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_vector,NDIM*npoin2D_xi_all(1),receiver,itag2, &
+                   buffer_received_faces_vector,NDIM*npoin2D_xi_all(2),sender,itag)
 
 ! all slices copy the buffer received to the contributions on the right face
   if(iproc_xi < NPROC_XI-1) then
@@ -275,18 +267,17 @@
 
 ! send messages forward along each row
   if(iproc_eta == 0) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi,iproc_eta - 1)
   endif
   if(iproc_eta == NPROC_ETA-1) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi,iproc_eta + 1)
   endif
-  call MPI_SENDRECV(buffer_send_faces_vector,NDIM*npoin2D_eta_all(2),CUSTOM_MPI_TYPE,receiver, &
-    itag2,buffer_received_faces_vector,NDIM*npoin2D_eta_all(1),CUSTOM_MPI_TYPE,sender, &
-    itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_vector,NDIM*npoin2D_eta_all(2),receiver,itag2, &
+                   buffer_received_faces_vector,NDIM*npoin2D_eta_all(1),sender,itag)
 
 ! all slices add the buffer received to the contributions on the left face
   if(iproc_eta > 0) then
@@ -332,18 +323,17 @@
 
 ! send messages backward along each row
   if(iproc_eta == NPROC_ETA-1) then
-    sender = MPI_PROC_NULL
+    sender = null_process()
   else
     sender = addressing(ichunk,iproc_xi,iproc_eta + 1)
   endif
   if(iproc_eta == 0) then
-    receiver = MPI_PROC_NULL
+    receiver = null_process()
   else
     receiver = addressing(ichunk,iproc_xi,iproc_eta - 1)
   endif
-  call MPI_SENDRECV(buffer_send_faces_vector,NDIM*npoin2D_eta_all(1),CUSTOM_MPI_TYPE,receiver, &
-    itag2,buffer_received_faces_vector,NDIM*npoin2D_eta_all(2),CUSTOM_MPI_TYPE,sender, &
-    itag,MPI_COMM_WORLD,msg_status,ier)
+  call sendrecv_cr(buffer_send_faces_vector,NDIM*npoin2D_eta_all(1),receiver,itag2, &
+                   buffer_received_faces_vector,NDIM*npoin2D_eta_all(2),sender,itag)
 
 ! all slices copy the buffer received to the contributions on the right face
   if(iproc_eta < NPROC_ETA-1) then
@@ -397,8 +387,7 @@
 ! the buffer for the inner core starts right after the buffer for the crust and mantle
     ioffset = npoin2D_faces_crust_mantle(icount_faces)
 
-    call MPI_RECV(buffer_received_faces_vector,NDIM*npoin2D_chunks_all,CUSTOM_MPI_TYPE,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_received_faces_vector,NDIM*npoin2D_chunks_all,sender,itag)
 
     do ipoin2D = 1,npoin2D_faces_crust_mantle(icount_faces)
       accel_crust_mantle(1,iboolfaces_crust_mantle(ipoin2D,icount_faces)) = &
@@ -448,7 +437,7 @@
       buffer_send_faces_vector(3,ioffset + ipoin2D) = accel_inner_core(3,iboolfaces_inner_core(ipoin2D,icount_faces))
     enddo
 
-    call MPI_SEND(buffer_send_faces_vector,NDIM*npoin2D_chunks_all,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_faces_vector,NDIM*npoin2D_chunks_all,receiver,itag)
 
   endif
   enddo
@@ -474,8 +463,7 @@
 ! the buffer for the inner core starts right after the buffer for the crust and mantle
     ioffset = npoin2D_faces_crust_mantle(icount_faces)
 
-    call MPI_RECV(buffer_received_faces_vector,NDIM*npoin2D_chunks_all,CUSTOM_MPI_TYPE,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_received_faces_vector,NDIM*npoin2D_chunks_all,sender,itag)
 
     do ipoin2D = 1,npoin2D_faces_crust_mantle(icount_faces)
       accel_crust_mantle(1,iboolfaces_crust_mantle(ipoin2D,icount_faces)) = buffer_received_faces_vector(1,ipoin2D)
@@ -519,7 +507,7 @@
       buffer_send_faces_vector(3,ioffset + ipoin2D) = accel_inner_core(3,iboolfaces_inner_core(ipoin2D,icount_faces))
     enddo
 
-    call MPI_SEND(buffer_send_faces_vector,NDIM*npoin2D_chunks_all,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_faces_vector,NDIM*npoin2D_chunks_all,receiver,itag)
 
   endif
   enddo
@@ -558,8 +546,7 @@
 ! receive from worker #1 and add to local array
     sender = iproc_worker1_corners(imsg)
 
-    call MPI_RECV(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,sender,itag)
 
     do ipoin1D = 1,NGLOB1D_RADIAL_crust_mantle
       accel_crust_mantle(1,iboolcorner_crust_mantle(ipoin1D,icount_corners)) = &
@@ -590,8 +577,7 @@
 
     sender = iproc_worker2_corners(imsg)
 
-    call MPI_RECV(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,sender,itag)
 
     do ipoin1D = 1,NGLOB1D_RADIAL_crust_mantle
       accel_crust_mantle(1,iboolcorner_crust_mantle(ipoin1D,icount_corners)) = &
@@ -639,7 +625,7 @@
       buffer_send_chunkcorn_vector(3,ioffset + ipoin1D) = accel_inner_core(3,iboolcorner_inner_core(ipoin1D,icount_corners))
     enddo
 
-    call MPI_SEND(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,receiver,itag)
 
   endif
 
@@ -654,8 +640,7 @@
 ! receive from master and copy to local array
     sender = iproc_master_corners(imsg)
 
-    call MPI_RECV(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all, &
-          CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_cr(buffer_recv_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,sender,itag)
 
     do ipoin1D = 1,NGLOB1D_RADIAL_crust_mantle
       accel_crust_mantle(1,iboolcorner_crust_mantle(ipoin1D,icount_corners)) = buffer_recv_chunkcorn_vector(1,ipoin1D)
@@ -688,12 +673,12 @@
 
 ! send to worker #1
     receiver = iproc_worker1_corners(imsg)
-    call MPI_SEND(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,receiver,itag)
 
 ! send to worker #2
   if(NCHUNKS /= 2) then
     receiver = iproc_worker2_corners(imsg)
-    call MPI_SEND(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_cr(buffer_send_chunkcorn_vector,NDIM*NGLOB1D_RADIAL_all,receiver,itag)
 
   endif
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/check_simulation_stability.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/check_simulation_stability.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/check_simulation_stability.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -34,7 +34,7 @@
                           myrank)
 
   use constants_solver
-  use specfem_par,only: GPU_MODE,Mesh_pointer
+  use specfem_par,only: GPU_MODE,Mesh_pointer,COMPUTE_AND_STORE_STRAIN
 
   implicit none
 
@@ -149,7 +149,7 @@
     call max_all_cr(b_Ufluidnorm,b_Ufluidnorm_all)
   endif
 
-  if (COMPUTE_AND_STORE_STRAIN_VAL) then
+  if (COMPUTE_AND_STORE_STRAIN) then
     if( .not. GPU_MODE) then
       ! on CPU
       Strain_norm = maxval(abs(eps_trace_over_3_crust_mantle))
@@ -183,7 +183,7 @@
       write(IMAIN,*) 'Max non-dimensional potential Ufluid in fluid in all slices for back prop.= ',b_Ufluidnorm_all
     endif
 
-    if(COMPUTE_AND_STORE_STRAIN_VAL) then
+    if(COMPUTE_AND_STORE_STRAIN) then
       write(IMAIN,*) 'Max of strain, eps_trace_over_3_crust_mantle =',Strain_norm_all
       write(IMAIN,*) 'Max of strain, epsilondev_crust_mantle  =',Strain2_norm_all
     endif

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_spectrum.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_spectrum.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_spectrum.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,10 +27,10 @@
 
   double precision function comp_source_spectrum(om,hdur)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision om,hdur
 
   comp_source_spectrum = dexp(-0.25d0*(om*hdur/SOURCE_DECAY_MIMIC_TRIANGLE)**2)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_time_function.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_time_function.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/comp_source_time_function.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,10 +27,10 @@
 
   double precision function comp_source_time_function(t,hdur)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision t,hdur
 
   double precision, external :: netlib_specfun_erf
@@ -46,10 +46,10 @@
 
   double precision function comp_source_time_function_rickr(t,f0)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   double precision t,f0
 
   ! ricker

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_add_sources.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_add_sources.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_add_sources.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_adj_source_frechet.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_adj_source_frechet.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_adj_source_frechet.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_arrays_source.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_arrays_source.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_arrays_source.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -31,10 +31,10 @@
                                    xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
                                    xigll,yigll,zigll)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: sourcearray
 
   double precision :: xi_source,eta_source,gamma_source

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_boundary_kernel.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_boundary_kernel.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_boundary_kernel.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_coupling.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_coupling.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_coupling.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -32,11 +32,10 @@
                                        wgllwgll_xy,ibool_outer_core,ibelm_top_outer_core, &
                                        SIMULATION_TYPE,nspec2D_top)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: &
     displ_crust_mantle
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE_ADJOINT) :: &
@@ -131,11 +130,10 @@
                             wgllwgll_xy,ibool_outer_core,ibelm_bottom_outer_core, &
                             SIMULATION_TYPE,nspec_bottom)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE) :: &
     displ_inner_core
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE_ADJOINT) :: &
@@ -233,11 +231,10 @@
                             RHO_TOP_OC,minus_g_cmb, &
                             SIMULATION_TYPE,nspec_bottom)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: &
     displ_crust_mantle,accel_crust_mantle
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE_ADJOINT) :: &
@@ -339,11 +336,10 @@
                             RHO_BOTTOM_OC,minus_g_icb, &
                             SIMULATION_TYPE,nspec2D_top)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE) :: &
     displ_inner_core,accel_inner_core
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE_ADJOINT) :: &
@@ -442,11 +438,10 @@
                             SIMULATION_TYPE,nspec_top, &
                             ABSORBING_CONDITIONS)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: accel_crust_mantle
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE_ADJOINT) :: b_accel_crust_mantle
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_element.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_element.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_element.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -42,14 +42,11 @@
                     tempz1_att,tempz2_att,tempz3_att, &
                     epsilondev_loc,rho_s_H,is_backward_field)
 
+  use constants_solver
+  use specfem_par,only: COMPUTE_AND_STORE_STRAIN
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec
 
@@ -170,7 +167,7 @@
         duzdxl_plus_duxdzl = duzdxl + duxdzl
         duzdyl_plus_duydzl = duzdyl + duydzl
 
-        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
+        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN ) then
            ! temporary variables used for fixing attenuation in a consistent way
            duxdxl_att = xixl*tempx1_att(i,j,k) + etaxl*tempx2_att(i,j,k) + gammaxl*tempx3_att(i,j,k)
            duxdyl_att = xiyl*tempx1_att(i,j,k) + etayl*tempx2_att(i,j,k) + gammayl*tempx3_att(i,j,k)
@@ -204,7 +201,7 @@
            epsilondev_loc(5,i,j,k) = 0.5_CUSTOM_REAL * duzdyl_plus_duydzl_att
         else
            ! compute deviatoric strain
-           if (COMPUTE_AND_STORE_STRAIN_VAL) then
+           if (COMPUTE_AND_STORE_STRAIN) then
               templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
               if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
                  ispec_strain = 1
@@ -230,14 +227,13 @@
         mul = muvstore(i,j,k,ispec)
 
         ! use unrelaxed parameters if attenuation
-        if(ATTENUATION_VAL) then
+        if(ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
           ! precompute terms for attenuation if needed
-          if( USE_3D_ATTENUATION_ARRAYS ) then
-            one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
-          else
-            one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
-          endif
+          one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
           mul = mul * one_minus_sum_beta_use
+        else if( ATTENUATION_VAL ) then
+          one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
+          mul = mul * one_minus_sum_beta_use
         endif
 
         lambdalplus2mul = kappal + FOUR_THIRDS * mul
@@ -253,7 +249,7 @@
         sigma_yz = mul*duzdyl_plus_duydzl
 
         ! subtract memory variables if attenuation
-        if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. )  ) then
+        if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
 !daniel: att - debug update
 !          call compute_element_att_mem_up_cm(ispec,i,j,k, &
@@ -429,14 +425,11 @@
 
 ! this routine is optimized for NGLLX = NGLLY = NGLLZ = 5 using the Deville et al. (2002) inlined matrix-matrix products
 
+  use constants_solver
+  use specfem_par,only: COMPUTE_AND_STORE_STRAIN
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec
 
@@ -573,7 +566,7 @@
         duzdxl_plus_duxdzl = duzdxl + duxdzl
         duzdyl_plus_duydzl = duzdyl + duydzl
 
-        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
+        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN ) then
            ! temporary variables used for fixing attenuation in a consistent way
            duxdxl_att = xixl*tempx1_att(i,j,k) + etaxl*tempx2_att(i,j,k) + gammaxl*tempx3_att(i,j,k)
            duxdyl_att = xiyl*tempx1_att(i,j,k) + etayl*tempx2_att(i,j,k) + gammayl*tempx3_att(i,j,k)
@@ -607,7 +600,7 @@
            epsilondev_loc(5,i,j,k) = 0.5_CUSTOM_REAL * duzdyl_plus_duydzl_att
         else
            ! compute deviatoric strain
-           if (COMPUTE_AND_STORE_STRAIN_VAL) then
+           if (COMPUTE_AND_STORE_STRAIN) then
               templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
               if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
                  ispec_strain = 1
@@ -641,15 +634,15 @@
 
         ! use unrelaxed parameters if attenuation
         ! eta does not need to be shifted since it is a ratio
-        if(ATTENUATION_VAL) then
+        if(ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
           ! precompute terms for attenuation if needed
-          if( USE_3D_ATTENUATION_ARRAYS ) then
-            one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
-          else
-            one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
-          endif
+          one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
           muvl = muvl * one_minus_sum_beta_use
           muhl = muhl * one_minus_sum_beta_use
+        else if( ATTENUATION_VAL ) then
+          one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
+          muvl = muvl * one_minus_sum_beta_use
+          muhl = muhl * one_minus_sum_beta_use
         endif
 
         rhovpvsq = kappavl + FOUR_THIRDS * muvl  !!! that is C
@@ -841,7 +834,7 @@
                  c45*duzdxl_plus_duxdzl + c44*duzdyl_plus_duydzl + c34*duzdzl
 
         ! subtract memory variables if attenuation
-        if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. )  ) then
+        if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
           ! note: Fortran passes pointers to array location, thus R_memory(1,1,...) is fine
           call compute_element_att_stress(R_xx(1,i,j,k,ispec), &
@@ -1004,14 +997,11 @@
                     tempz1_att,tempz2_att,tempz3_att, &
                     epsilondev_loc,rho_s_H,is_backward_field)
 
+  use constants_solver
+  use specfem_par,only: COMPUTE_AND_STORE_STRAIN
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec
 
@@ -1137,7 +1127,7 @@
         duzdxl_plus_duxdzl = duzdxl + duxdzl
         duzdyl_plus_duydzl = duzdyl + duydzl
 
-        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
+        if ( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN ) then
            ! temporary variables used for fixing attenuation in a consistent way
            duxdxl_att = xixl*tempx1_att(i,j,k) + etaxl*tempx2_att(i,j,k) + gammaxl*tempx3_att(i,j,k)
            duxdyl_att = xiyl*tempx1_att(i,j,k) + etayl*tempx2_att(i,j,k) + gammayl*tempx3_att(i,j,k)
@@ -1171,7 +1161,7 @@
            epsilondev_loc(5,i,j,k) = 0.5_CUSTOM_REAL * duzdyl_plus_duydzl_att
         else
            ! compute deviatoric strain
-           if (COMPUTE_AND_STORE_STRAIN_VAL) then
+           if (COMPUTE_AND_STORE_STRAIN) then
               templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
               if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
                  ispec_strain = 1
@@ -1214,13 +1204,9 @@
         c56 = c56store(i,j,k,ispec)
         c66 = c66store(i,j,k,ispec)
 
-        if(ATTENUATION_VAL) then
+        if(ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
           ! precompute terms for attenuation if needed
-          if( USE_3D_ATTENUATION_ARRAYS ) then
-            minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
-          else
-            minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
-          endif
+          minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
           !mul = c44
           mul = c44 * minus_sum_beta
           c11 = c11 + FOUR_THIRDS * mul ! * minus_sum_beta * mul
@@ -1232,6 +1218,19 @@
           c44 = c44 + mul
           c55 = c55 + mul
           c66 = c66 + mul
+        else if( ATTENUATION_VAL ) then
+          minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
+          !mul = c44
+          mul = c44 * minus_sum_beta
+          c11 = c11 + FOUR_THIRDS * mul ! * minus_sum_beta * mul
+          c12 = c12 - TWO_THIRDS * mul
+          c13 = c13 - TWO_THIRDS * mul
+          c22 = c22 + FOUR_THIRDS * mul
+          c23 = c23 - TWO_THIRDS * mul
+          c33 = c33 + FOUR_THIRDS * mul
+          c44 = c44 + mul
+          c55 = c55 + mul
+          c66 = c66 + mul
         endif
 
         sigma_xx = c11*duxdxl + c16*duxdyl_plus_duydxl + c12*duydyl + &
@@ -1253,7 +1252,7 @@
                  c45*duzdxl_plus_duxdzl + c44*duzdyl_plus_duydzl + c34*duzdzl
 
         ! subtract memory variables if attenuation
-        if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+        if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
           ! note: Fortran passes pointers to array location, thus R_memory(1,1,...) is fine
           call compute_element_att_stress(R_xx(1,i,j,k,ispec), &
@@ -1401,14 +1400,10 @@
   subroutine compute_element_att_stress(R_xx_loc,R_yy_loc,R_xy_loc,R_xz_loc,R_yz_loc, &
                                        sigma_xx,sigma_yy,sigma_zz,sigma_xy,sigma_xz,sigma_yz)
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! attenuation
   ! memory variables for attenuation
   ! memory variables R_ij are stored at the local rather than global level
@@ -1466,14 +1461,10 @@
 ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
 ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec
 
@@ -1512,7 +1503,7 @@
   do i_SLS = 1,N_SLS
 
     ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-    if( USE_3D_ATTENUATION_ARRAYS ) then
+    if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
       if(ANISOTROPIC_3D_MANTLE_VAL) then
         factor_common_c44_muv(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * c44store(:,:,:,ispec)
       else
@@ -1572,14 +1563,10 @@
 ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
 ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec
 
@@ -1615,7 +1602,7 @@
 
   do i_SLS = 1,N_SLS
     ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-    if( USE_3D_ATTENUATION_ARRAYS ) then
+    if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
       factor_common_use(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * muvstore(:,:,:,ispec)
     else
       factor_common_use(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * muvstore(:,:,:,ispec)
@@ -1662,14 +1649,10 @@
 
   use specfem_par_crustmantle,only: factor_common=>factor_common_crust_mantle
 
+  use constants_solver
+
   implicit none
 
-  include "constants.h"
-
-  ! include values created by the mesher
-  ! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! element id
   integer :: ispec,i,j,k
 
@@ -1729,7 +1712,7 @@
     endif
 
     ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-    if( USE_3D_ATTENUATION_ARRAYS ) then
+    if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
       factor_common_c44_muv = factor_common(i_SLS,i,j,k,ispec) * c44_muv
     else
       factor_common_c44_muv = factor_common(i_SLS,1,1,1,ispec) * c44_muv

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_acoustic.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_acoustic.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_acoustic.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -190,7 +190,7 @@
       else
         ! on GPU
         ! outer core
-        call assemble_MPI_scalar_send_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_scalar_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                                 buffer_send_scalar_outer_core,buffer_recv_scalar_outer_core, &
                                 num_interfaces_outer_core,max_nibool_interfaces_oc, &
                                 nibool_interfaces_outer_core,&
@@ -213,7 +213,7 @@
         else
           ! on GPU
           ! outer core
-          call assemble_MPI_scalar_send_cuda(NPROCTOT_VAL, &
+          call assemble_MPI_scalar_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                                 b_buffer_send_scalar_outer_core,b_buffer_recv_scalar_outer_core, &
                                 num_interfaces_outer_core,max_nibool_interfaces_oc, &
                                 nibool_interfaces_outer_core,&
@@ -236,7 +236,7 @@
                                 request_send_scalar_oc,request_recv_scalar_oc)
       else
         ! on GPU
-        call assemble_MPI_scalar_write_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_scalar_write_cuda(Mesh_pointer,NPROCTOT_VAL, &
                                 buffer_recv_scalar_outer_core, &
                                 num_interfaces_outer_core,max_nibool_interfaces_oc, &
                                 request_send_scalar_oc,request_recv_scalar_oc, &
@@ -255,7 +255,7 @@
                                 b_request_send_scalar_oc,b_request_recv_scalar_oc)
         else
           ! on GPU
-          call assemble_MPI_scalar_write_cuda(NPROCTOT_VAL, &
+          call assemble_MPI_scalar_write_cuda(Mesh_pointer,NPROCTOT_VAL, &
                                 b_buffer_recv_scalar_outer_core, &
                                 num_interfaces_outer_core,max_nibool_interfaces_oc, &
                                 b_request_send_scalar_oc,b_request_recv_scalar_oc, &

Deleted: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,959 +0,0 @@
-!=====================================================================
-!
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
-!          --------------------------------------------------
-!
-!          Main authors: Dimitri Komatitsch and Jeroen Tromp
-!                        Princeton University, USA
-!             and CNRS / INRIA / University of Pau, France
-! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
-!
-! 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.
-!
-!=====================================================================
-
-  subroutine compute_forces_crust_mantle(NSPEC,NGLOB,NSPEC_ATT, &
-                                        deltat, &
-                                        displ_crust_mantle, &
-                                        veloc_crust_mantle, &
-                                        accel_crust_mantle, &
-                                        phase_is_inner, &
-                                        R_xx,R_yy,R_xy,R_xz,R_yz, &
-                                        epsilondev_xx,epsilondev_yy,epsilondev_xy, &
-                                        epsilondev_xz,epsilondev_yz, &
-                                        epsilon_trace_over_3, &
-                                        alphaval,betaval,gammaval, &
-                                        factor_common,vx,vy,vz,vnspec)
-
-  use constants_solver
-
-  use specfem_par,only: &
-    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-    minus_gravity_table,density_table,minus_deriv_gravity_table
-
-  use specfem_par_crustmantle,only: &
-    xstore => xstore_crust_mantle,ystore => ystore_crust_mantle,zstore => zstore_crust_mantle, &
-    xix => xix_crust_mantle,xiy => xiy_crust_mantle,xiz => xiz_crust_mantle, &
-    etax => etax_crust_mantle,etay => etay_crust_mantle,etaz => etaz_crust_mantle, &
-    gammax => gammax_crust_mantle,gammay => gammay_crust_mantle,gammaz => gammaz_crust_mantle, &
-    kappavstore => kappavstore_crust_mantle,kappahstore => kappahstore_crust_mantle, &
-    muvstore => muvstore_crust_mantle,muhstore => muhstore_crust_mantle, &
-    eta_anisostore => eta_anisostore_crust_mantle, &
-    c11store => c11store_crust_mantle,c12store => c12store_crust_mantle,c13store => c13store_crust_mantle, &
-    c14store => c14store_crust_mantle,c15store => c15store_crust_mantle,c16store => c16store_crust_mantle, &
-    c22store => c22store_crust_mantle,c23store => c23store_crust_mantle,c24store => c24store_crust_mantle, &
-    c25store => c25store_crust_mantle,c26store => c26store_crust_mantle,c33store => c33store_crust_mantle, &
-    c34store => c34store_crust_mantle,c35store => c35store_crust_mantle,c36store => c36store_crust_mantle, &
-    c44store => c44store_crust_mantle,c45store => c45store_crust_mantle,c46store => c46store_crust_mantle, &
-    c55store => c55store_crust_mantle,c56store => c56store_crust_mantle,c66store => c66store_crust_mantle, &
-    ibool => ibool_crust_mantle, &
-    ispec_is_tiso => ispec_is_tiso_crust_mantle, &
-    one_minus_sum_beta => one_minus_sum_beta_crust_mantle, &
-    phase_ispec_inner => phase_ispec_inner_crust_mantle, &
-    nspec_outer => nspec_outer_crust_mantle, &
-    nspec_inner => nspec_inner_crust_mantle
-
-  implicit none
-
-  integer :: NSPEC,NGLOB,NSPEC_ATT
-
-  ! time step
-  real(kind=CUSTOM_REAL) :: deltat
-
-  ! displacement, velocity and acceleration
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: displ_crust_mantle
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: veloc_crust_mantle
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: accel_crust_mantle
-
-  ! variable sized array variables
-  integer :: vx,vy,vz,vnspec
-
-  ! memory variables for attenuation
-  ! memory variables R_ij are stored at the local rather than global level
-  ! to allow for optimization of cache access by compiler
-  real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_ATT) :: R_xx,R_yy,R_xy,R_xz,R_yz
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
-    epsilondev_xx,epsilondev_yy,epsilondev_xy,epsilondev_xz,epsilondev_yz
-  real(kind=CUSTOM_REAL),dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: epsilon_trace_over_3
-
-  ! [alpha,beta,gamma]val reduced to N_SLS and factor_common to N_SLS*NUM_NODES
-  real(kind=CUSTOM_REAL), dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
-  real(kind=CUSTOM_REAL), dimension(N_SLS) :: alphaval,betaval,gammaval
-
-  ! inner/outer element run flag
-  logical :: phase_is_inner
-
-  ! local parameters
-
-  ! for attenuation
-  real(kind=CUSTOM_REAL) one_minus_sum_beta_use,minus_sum_beta
-  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ)   :: factor_common_c44_muv
-  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
-    tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3
-
-  integer ispec,iglob,ispec_strain
-  integer i,j,k,l
-  integer i_SLS
-
-  ! the 21 coefficients for an anisotropic medium in reduced notation
-  real(kind=CUSTOM_REAL) c11,c22,c33,c44,c55,c66,c12,c13,c23,c14,c24,c34,c15,c25,c35,c45,c16,c26,c36,c46,c56
-
-  real(kind=CUSTOM_REAL) rhovphsq,sinphifour,cosphisq,sinphisq,costhetasq,rhovsvsq,sinthetasq, &
-        cosphifour,costhetafour,rhovpvsq,sinthetafour,rhovshsq,cosfourphi, &
-        costwotheta,cosfourtheta,sintwophisq,costheta,sinphi,sintheta,cosphi, &
-        sintwotheta,costwophi,sintwophi,costwothetasq,costwophisq,phi,theta
-
-  real(kind=CUSTOM_REAL) two_rhovsvsq,two_rhovshsq ! two_rhovpvsq,two_rhovphsq
-  real(kind=CUSTOM_REAL) four_rhovsvsq,four_rhovshsq ! four_rhovpvsq,four_rhovphsq,
-
-  real(kind=CUSTOM_REAL) twoetaminone,etaminone,eta_aniso
-  real(kind=CUSTOM_REAL) two_eta_aniso,four_eta_aniso,six_eta_aniso
-
-  real(kind=CUSTOM_REAL) xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl
-  real(kind=CUSTOM_REAL) duxdxl,duxdyl,duxdzl,duydxl,duydyl,duydzl,duzdxl,duzdyl,duzdzl
-
-  real(kind=CUSTOM_REAL) duxdxl_plus_duydyl,duxdxl_plus_duzdzl,duydyl_plus_duzdzl
-  real(kind=CUSTOM_REAL) duxdyl_plus_duydxl,duzdxl_plus_duxdzl,duzdyl_plus_duydzl
-
-  real(kind=CUSTOM_REAL) sigma_xx,sigma_yy,sigma_zz,sigma_xy,sigma_xz,sigma_yz
-
-  real(kind=CUSTOM_REAL) hp1,hp2,hp3
-  real(kind=CUSTOM_REAL) fac1,fac2,fac3
-  real(kind=CUSTOM_REAL) lambdal,mul,lambdalplus2mul
-  real(kind=CUSTOM_REAL) kappal,kappavl,kappahl,muvl,muhl
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: sum_terms
-
-  real(kind=CUSTOM_REAL) tempx1l,tempx2l,tempx3l
-  real(kind=CUSTOM_REAL) tempy1l,tempy2l,tempy3l
-  real(kind=CUSTOM_REAL) tempz1l,tempz2l,tempz3l
-
-  real(kind=CUSTOM_REAL) tempx1l_att,tempx2l_att,tempx3l_att
-  real(kind=CUSTOM_REAL) tempy1l_att,tempy2l_att,tempy3l_att
-  real(kind=CUSTOM_REAL) tempz1l_att,tempz2l_att,tempz3l_att
-
-  real(kind=CUSTOM_REAL) duxdxl_att,duxdyl_att,duxdzl_att,duydxl_att
-  real(kind=CUSTOM_REAL) duydyl_att,duydzl_att,duzdxl_att,duzdyl_att,duzdzl_att;
-  real(kind=CUSTOM_REAL) duxdyl_plus_duydxl_att,duzdxl_plus_duxdzl_att,duzdyl_plus_duydzl_att;
-
-  ! for gravity
-  integer int_radius
-  real(kind=CUSTOM_REAL) sigma_yx,sigma_zx,sigma_zy
-  double precision radius,rho,minus_g,minus_dg
-  double precision minus_g_over_radius,minus_dg_plus_g_over_radius
-  double precision cos_theta,sin_theta,cos_phi,sin_phi
-  double precision cos_theta_sq,sin_theta_sq,cos_phi_sq,sin_phi_sq
-  double precision factor,sx_l,sy_l,sz_l,gxl,gyl,gzl
-  double precision Hxxl,Hyyl,Hzzl,Hxyl,Hxzl,Hyzl
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: rho_s_H
-
-!  integer :: computed_elements
-  integer :: num_elements,ispec_p
-  integer :: iphase
-
-! ****************************************************
-!   big loop over all spectral elements in the solid
-! ****************************************************
-
-!  computed_elements = 0
-  if( .not. phase_is_inner ) then
-    iphase = 1
-    num_elements = nspec_outer
-  else
-    iphase = 2
-    num_elements = nspec_inner
-  endif
-
-  do ispec_p = 1,num_elements
-
-    ispec = phase_ispec_inner(ispec_p,iphase)
-
-    ! only compute element which belong to current phase (inner or outer elements)
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempx2l = 0._CUSTOM_REAL
-          tempx3l = 0._CUSTOM_REAL
-
-          tempy1l = 0._CUSTOM_REAL
-          tempy2l = 0._CUSTOM_REAL
-          tempy3l = 0._CUSTOM_REAL
-
-          tempz1l = 0._CUSTOM_REAL
-          tempz2l = 0._CUSTOM_REAL
-          tempz3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            hp1 = hprime_xx(i,l)
-            iglob = ibool(l,j,k,ispec)
-            tempx1l = tempx1l + displ_crust_mantle(1,iglob)*hp1
-            tempy1l = tempy1l + displ_crust_mantle(2,iglob)*hp1
-            tempz1l = tempz1l + displ_crust_mantle(3,iglob)*hp1
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-            hp2 = hprime_yy(j,l)
-            iglob = ibool(i,l,k,ispec)
-            tempx2l = tempx2l + displ_crust_mantle(1,iglob)*hp2
-            tempy2l = tempy2l + displ_crust_mantle(2,iglob)*hp2
-            tempz2l = tempz2l + displ_crust_mantle(3,iglob)*hp2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-            hp3 = hprime_zz(k,l)
-            iglob = ibool(i,j,l,ispec)
-            tempx3l = tempx3l + displ_crust_mantle(1,iglob)*hp3
-            tempy3l = tempy3l + displ_crust_mantle(2,iglob)*hp3
-            tempz3l = tempz3l + displ_crust_mantle(3,iglob)*hp3
-          enddo
-
-          if( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
-             ! temporary variables used for fixing attenuation in a consistent way
-
-             tempx1l_att = tempx1l
-             tempx2l_att = tempx2l
-             tempx3l_att = tempx3l
-
-             tempy1l_att = tempy1l
-             tempy2l_att = tempy2l
-             tempy3l_att = tempy3l
-
-             tempz1l_att = tempz1l
-             tempz2l_att = tempz2l
-             tempz3l_att = tempz3l
-
-             if(ATTENUATION_NEW_VAL) then
-                ! takes new routines
-                ! use first order Taylor expansion of displacement for local storage of stresses
-                ! at this current time step, to fix attenuation in a consistent way
-                do l=1,NGLLX
-                   hp1 = hprime_xx(i,l)
-                   iglob = ibool(l,j,k,ispec)
-                   tempx1l_att = tempx1l_att + deltat*veloc_crust_mantle(1,iglob)*hp1
-                   tempy1l_att = tempy1l_att + deltat*veloc_crust_mantle(2,iglob)*hp1
-                   tempz1l_att = tempz1l_att + deltat*veloc_crust_mantle(3,iglob)*hp1
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-                   hp2 = hprime_yy(j,l)
-                   iglob = ibool(i,l,k,ispec)
-                   tempx2l_att = tempx2l_att + deltat*veloc_crust_mantle(1,iglob)*hp2
-                   tempy2l_att = tempy2l_att + deltat*veloc_crust_mantle(2,iglob)*hp2
-                   tempz2l_att = tempz2l_att + deltat*veloc_crust_mantle(3,iglob)*hp2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-                   hp3 = hprime_zz(k,l)
-                   iglob = ibool(i,j,l,ispec)
-                   tempx3l_att = tempx3l_att + deltat*veloc_crust_mantle(1,iglob)*hp3
-                   tempy3l_att = tempy3l_att + deltat*veloc_crust_mantle(2,iglob)*hp3
-                   tempz3l_att = tempz3l_att + deltat*veloc_crust_mantle(3,iglob)*hp3
-                enddo
-             endif
-          endif
-
-!         get derivatives of ux, uy and uz with respect to x, y and z
-
-          xixl = xix(i,j,k,ispec)
-          xiyl = xiy(i,j,k,ispec)
-          xizl = xiz(i,j,k,ispec)
-          etaxl = etax(i,j,k,ispec)
-          etayl = etay(i,j,k,ispec)
-          etazl = etaz(i,j,k,ispec)
-          gammaxl = gammax(i,j,k,ispec)
-          gammayl = gammay(i,j,k,ispec)
-          gammazl = gammaz(i,j,k,ispec)
-
-! compute the jacobian
-          jacobianl = 1._CUSTOM_REAL / (xixl*(etayl*gammazl-etazl*gammayl) &
-                        - xiyl*(etaxl*gammazl-etazl*gammaxl) &
-                        + xizl*(etaxl*gammayl-etayl*gammaxl))
-
-          duxdxl = xixl*tempx1l + etaxl*tempx2l + gammaxl*tempx3l
-          duxdyl = xiyl*tempx1l + etayl*tempx2l + gammayl*tempx3l
-          duxdzl = xizl*tempx1l + etazl*tempx2l + gammazl*tempx3l
-
-          duydxl = xixl*tempy1l + etaxl*tempy2l + gammaxl*tempy3l
-          duydyl = xiyl*tempy1l + etayl*tempy2l + gammayl*tempy3l
-          duydzl = xizl*tempy1l + etazl*tempy2l + gammazl*tempy3l
-
-          duzdxl = xixl*tempz1l + etaxl*tempz2l + gammaxl*tempz3l
-          duzdyl = xiyl*tempz1l + etayl*tempz2l + gammayl*tempz3l
-          duzdzl = xizl*tempz1l + etazl*tempz2l + gammazl*tempz3l
-
-! precompute some sums to save CPU time
-          duxdxl_plus_duydyl = duxdxl + duydyl
-          duxdxl_plus_duzdzl = duxdxl + duzdzl
-          duydyl_plus_duzdzl = duydyl + duzdzl
-          duxdyl_plus_duydxl = duxdyl + duydxl
-          duzdxl_plus_duxdzl = duzdxl + duxdzl
-          duzdyl_plus_duydzl = duzdyl + duydzl
-
-          if( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
-             ! temporary variables used for fixing attenuation in a consistent way
-             duxdxl_att = xixl*tempx1l_att + etaxl*tempx2l_att + gammaxl*tempx3l_att
-             duxdyl_att = xiyl*tempx1l_att + etayl*tempx2l_att + gammayl*tempx3l_att
-             duxdzl_att = xizl*tempx1l_att + etazl*tempx2l_att + gammazl*tempx3l_att
-
-             duydxl_att = xixl*tempy1l_att + etaxl*tempy2l_att + gammaxl*tempy3l_att
-             duydyl_att = xiyl*tempy1l_att + etayl*tempy2l_att + gammayl*tempy3l_att
-             duydzl_att = xizl*tempy1l_att + etazl*tempy2l_att + gammazl*tempy3l_att
-
-             duzdxl_att = xixl*tempz1l_att + etaxl*tempz2l_att + gammaxl*tempz3l_att
-             duzdyl_att = xiyl*tempz1l_att + etayl*tempz2l_att + gammayl*tempz3l_att
-             duzdzl_att = xizl*tempz1l_att + etazl*tempz2l_att + gammazl*tempz3l_att
-
-             ! precompute some sums to save CPU time
-             duxdyl_plus_duydxl_att = duxdyl_att + duydxl_att
-             duzdxl_plus_duxdzl_att = duzdxl_att + duxdzl_att
-             duzdyl_plus_duydzl_att = duzdyl_att + duydzl_att
-
-             ! compute deviatoric strain
-             if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
-                ispec_strain = 1
-             else
-                ispec_strain = ispec
-             endif
-             epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl_att + duydyl_att + duzdzl_att)
-             epsilondev_loc(1,i,j,k) = duxdxl_att - epsilon_trace_over_3(i,j,k,ispec_strain)
-             epsilondev_loc(2,i,j,k) = duydyl_att - epsilon_trace_over_3(i,j,k,ispec_strain)
-             epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl_att
-             epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl_att
-             epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl_att
-          else
-             ! compute deviatoric strain
-             if (COMPUTE_AND_STORE_STRAIN_VAL) then
-                if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
-                   ispec_strain = 1
-                else
-                   ispec_strain = ispec
-                endif
-                epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl + duydyl + duzdzl)
-                epsilondev_loc(1,i,j,k) = duxdxl - epsilon_trace_over_3(i,j,k,ispec_strain)
-                epsilondev_loc(2,i,j,k) = duydyl - epsilon_trace_over_3(i,j,k,ispec_strain)
-                epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
-                epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
-                epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
-             endif
-          endif
-
-          ! precompute terms for attenuation if needed
-          if( ATTENUATION_VAL ) then
-            if( USE_3D_ATTENUATION_ARRAYS ) then
-              one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
-            else
-              one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
-            endif
-            minus_sum_beta =  one_minus_sum_beta_use - 1.0_CUSTOM_REAL
-          endif
-
-          !
-          ! compute either isotropic or anisotropic elements
-          !
-
-          if(ANISOTROPIC_3D_MANTLE_VAL) then
-
-            c11 = c11store(i,j,k,ispec)
-            c12 = c12store(i,j,k,ispec)
-            c13 = c13store(i,j,k,ispec)
-            c14 = c14store(i,j,k,ispec)
-            c15 = c15store(i,j,k,ispec)
-            c16 = c16store(i,j,k,ispec)
-            c22 = c22store(i,j,k,ispec)
-            c23 = c23store(i,j,k,ispec)
-            c24 = c24store(i,j,k,ispec)
-            c25 = c25store(i,j,k,ispec)
-            c26 = c26store(i,j,k,ispec)
-            c33 = c33store(i,j,k,ispec)
-            c34 = c34store(i,j,k,ispec)
-            c35 = c35store(i,j,k,ispec)
-            c36 = c36store(i,j,k,ispec)
-            c44 = c44store(i,j,k,ispec)
-            c45 = c45store(i,j,k,ispec)
-            c46 = c46store(i,j,k,ispec)
-            c55 = c55store(i,j,k,ispec)
-            c56 = c56store(i,j,k,ispec)
-            c66 = c66store(i,j,k,ispec)
-
-            if(ATTENUATION_VAL) then
-              mul = c44
-              c11 = c11 + FOUR_THIRDS * minus_sum_beta * mul
-              c12 = c12 - TWO_THIRDS * minus_sum_beta * mul
-              c13 = c13 - TWO_THIRDS * minus_sum_beta * mul
-              c22 = c22 + FOUR_THIRDS * minus_sum_beta * mul
-              c23 = c23 - TWO_THIRDS * minus_sum_beta * mul
-              c33 = c33 + FOUR_THIRDS * minus_sum_beta * mul
-              c44 = c44 + minus_sum_beta * mul
-              c55 = c55 + minus_sum_beta * mul
-              c66 = c66 + minus_sum_beta * mul
-            endif
-
-            sigma_xx = c11*duxdxl + c16*duxdyl_plus_duydxl + c12*duydyl + &
-                       c15*duzdxl_plus_duxdzl + c14*duzdyl_plus_duydzl + c13*duzdzl
-
-            sigma_yy = c12*duxdxl + c26*duxdyl_plus_duydxl + c22*duydyl + &
-                       c25*duzdxl_plus_duxdzl + c24*duzdyl_plus_duydzl + c23*duzdzl
-
-            sigma_zz = c13*duxdxl + c36*duxdyl_plus_duydxl + c23*duydyl + &
-                       c35*duzdxl_plus_duxdzl + c34*duzdyl_plus_duydzl + c33*duzdzl
-
-            sigma_xy = c16*duxdxl + c66*duxdyl_plus_duydxl + c26*duydyl + &
-                       c56*duzdxl_plus_duxdzl + c46*duzdyl_plus_duydzl + c36*duzdzl
-
-            sigma_xz = c15*duxdxl + c56*duxdyl_plus_duydxl + c25*duydyl + &
-                       c55*duzdxl_plus_duxdzl + c45*duzdyl_plus_duydzl + c35*duzdzl
-
-            sigma_yz = c14*duxdxl + c46*duxdyl_plus_duydxl + c24*duydyl + &
-                       c45*duzdxl_plus_duxdzl + c44*duzdyl_plus_duydzl + c34*duzdzl
-
-          else
-
-          ! do not use transverse isotropy except if element is between d220 and Moho
-!            if(.not. (TRANSVERSE_ISOTROPY_VAL .and. (idoubling(ispec)==IFLAG_220_80 .or. idoubling(ispec)==IFLAG_80_MOHO))) then
-
-            if( .not. ispec_is_tiso(ispec) ) then
-
-              ! isotropic element
-
-              ! layer with no transverse isotropy, use kappav and muv
-              kappal = kappavstore(i,j,k,ispec)
-              mul = muvstore(i,j,k,ispec)
-
-              ! use unrelaxed parameters if attenuation
-              if(ATTENUATION_VAL) mul = mul * one_minus_sum_beta_use
-
-              lambdalplus2mul = kappal + FOUR_THIRDS * mul
-              lambdal = lambdalplus2mul - 2.*mul
-
-              ! compute stress sigma
-
-              sigma_xx = lambdalplus2mul*duxdxl + lambdal*duydyl_plus_duzdzl
-              sigma_yy = lambdalplus2mul*duydyl + lambdal*duxdxl_plus_duzdzl
-              sigma_zz = lambdalplus2mul*duzdzl + lambdal*duxdxl_plus_duydyl
-
-              sigma_xy = mul*duxdyl_plus_duydxl
-              sigma_xz = mul*duzdxl_plus_duxdzl
-              sigma_yz = mul*duzdyl_plus_duydzl
-
-            else
-
-              ! transverse isotropic element
-
-              ! use Kappa and mu from transversely isotropic model
-              kappavl = kappavstore(i,j,k,ispec)
-              muvl = muvstore(i,j,k,ispec)
-
-              kappahl = kappahstore(i,j,k,ispec)
-              muhl = muhstore(i,j,k,ispec)
-
-              ! use unrelaxed parameters if attenuation
-              ! eta does not need to be shifted since it is a ratio
-              if(ATTENUATION_VAL) then
-                muvl = muvl * one_minus_sum_beta_use
-                muhl = muhl * one_minus_sum_beta_use
-              endif
-
-              rhovpvsq = kappavl + FOUR_THIRDS * muvl  !!! that is C
-              rhovphsq = kappahl + FOUR_THIRDS * muhl  !!! that is A
-
-              rhovsvsq = muvl  !!! that is L
-              rhovshsq = muhl  !!! that is N
-
-              eta_aniso = eta_anisostore(i,j,k,ispec)  !!! that is  F / (A - 2 L)
-
-              ! use mesh coordinates to get theta and phi
-              ! ystore and zstore contain theta and phi
-
-              iglob = ibool(i,j,k,ispec)
-              theta = ystore(iglob)
-              phi = zstore(iglob)
-
-              costheta = cos(theta)
-              sintheta = sin(theta)
-              cosphi = cos(phi)
-              sinphi = sin(phi)
-
-              costhetasq = costheta * costheta
-              sinthetasq = sintheta * sintheta
-              cosphisq = cosphi * cosphi
-              sinphisq = sinphi * sinphi
-
-              costhetafour = costhetasq * costhetasq
-              sinthetafour = sinthetasq * sinthetasq
-              cosphifour = cosphisq * cosphisq
-              sinphifour = sinphisq * sinphisq
-
-              costwotheta = cos(2.*theta)
-              sintwotheta = sin(2.*theta)
-              costwophi = cos(2.*phi)
-              sintwophi = sin(2.*phi)
-
-              cosfourtheta = cos(4.*theta)
-              cosfourphi = cos(4.*phi)
-
-              costwothetasq = costwotheta * costwotheta
-
-              costwophisq = costwophi * costwophi
-              sintwophisq = sintwophi * sintwophi
-
-              etaminone = eta_aniso - 1.
-              twoetaminone = 2. * eta_aniso - 1.
-
-              ! precompute some products to reduce the CPU time
-
-              two_eta_aniso = 2.*eta_aniso
-              four_eta_aniso = 4.*eta_aniso
-              six_eta_aniso = 6.*eta_aniso
-
-              !two_rhovpvsq = 2.*rhovpvsq
-              !two_rhovphsq = 2.*rhovphsq
-              two_rhovsvsq = 2.*rhovsvsq
-              two_rhovshsq = 2.*rhovshsq
-
-              !four_rhovpvsq = 4.*rhovpvsq
-              !four_rhovphsq = 4.*rhovphsq
-              four_rhovsvsq = 4.*rhovsvsq
-              four_rhovshsq = 4.*rhovshsq
-
-              ! the 21 anisotropic coefficients computed using Mathematica
-
-             c11 = rhovphsq*sinphifour + 2.*cosphisq*sinphisq* &
-               (rhovphsq*costhetasq + (eta_aniso*rhovphsq + two_rhovsvsq - two_eta_aniso*rhovsvsq)* &
-                  sinthetasq) + cosphifour* &
-               (rhovphsq*costhetafour + 2.*(eta_aniso*rhovphsq + two_rhovsvsq - two_eta_aniso*rhovsvsq)* &
-                  costhetasq*sinthetasq + rhovpvsq*sinthetafour)
-
-             c12 = ((rhovphsq - two_rhovshsq)*(3. + cosfourphi)*costhetasq)/4. - &
-              four_rhovshsq*cosphisq*costhetasq*sinphisq + &
-              (rhovphsq*(11. + 4.*costwotheta + cosfourtheta)*sintwophisq)/32. + &
-              eta_aniso*(rhovphsq - two_rhovsvsq)*(cosphifour + &
-                 2.*cosphisq*costhetasq*sinphisq + sinphifour)*sinthetasq + &
-              rhovpvsq*cosphisq*sinphisq*sinthetafour - &
-              rhovsvsq*sintwophisq*sinthetafour
-
-             c13 = (cosphisq*(rhovphsq + six_eta_aniso*rhovphsq + rhovpvsq - four_rhovsvsq - &
-                   12.*eta_aniso*rhovsvsq + (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq - &
-                      four_eta_aniso*rhovsvsq)*cosfourtheta))/8. + &
-              sinphisq*(eta_aniso*(rhovphsq - two_rhovsvsq)*costhetasq + &
-                 (rhovphsq - two_rhovshsq)*sinthetasq)
-
-             c14 = costheta*sinphi*((cosphisq* &
-                   (-rhovphsq + rhovpvsq + four_rhovshsq - four_rhovsvsq + &
-                     (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + four_rhovsvsq - &
-                        four_eta_aniso*rhovsvsq)*costwotheta))/2. + &
-                (etaminone*rhovphsq + 2.*(rhovshsq - eta_aniso*rhovsvsq))*sinphisq)* sintheta
-
-             c15 = cosphi*costheta*((cosphisq* (-rhovphsq + rhovpvsq + &
-                     (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq - four_eta_aniso*rhovsvsq)* &
-                      costwotheta))/2. + etaminone*(rhovphsq - two_rhovsvsq)*sinphisq)*sintheta
-
-             c16 = (cosphi*sinphi*(cosphisq* (-rhovphsq + rhovpvsq + &
-                     (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + four_rhovsvsq - &
-                        four_eta_aniso*rhovsvsq)*costwotheta) + &
-                  2.*etaminone*(rhovphsq - two_rhovsvsq)*sinphisq)*sinthetasq)/2.
-
-             c22 = rhovphsq*cosphifour + 2.*cosphisq*sinphisq* &
-               (rhovphsq*costhetasq + (eta_aniso*rhovphsq + two_rhovsvsq - two_eta_aniso*rhovsvsq)* &
-                  sinthetasq) + sinphifour* &
-               (rhovphsq*costhetafour + 2.*(eta_aniso*rhovphsq + two_rhovsvsq - two_eta_aniso*rhovsvsq)* &
-                  costhetasq*sinthetasq + rhovpvsq*sinthetafour)
-
-             c23 = ((rhovphsq + six_eta_aniso*rhovphsq + rhovpvsq - four_rhovsvsq - 12.*eta_aniso*rhovsvsq + &
-                   (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq - four_eta_aniso*rhovsvsq)* &
-                    cosfourtheta)*sinphisq)/8. + &
-              cosphisq*(eta_aniso*(rhovphsq - two_rhovsvsq)*costhetasq + &
-                 (rhovphsq - two_rhovshsq)*sinthetasq)
-
-             c24 = costheta*sinphi*(etaminone*(rhovphsq - two_rhovsvsq)*cosphisq + &
-                ((-rhovphsq + rhovpvsq + (twoetaminone*rhovphsq - rhovpvsq + &
-                        four_rhovsvsq - four_eta_aniso*rhovsvsq)*costwotheta)*sinphisq)/2.)*sintheta
-
-             c25 = cosphi*costheta*((etaminone*rhovphsq + 2.*(rhovshsq - eta_aniso*rhovsvsq))* &
-                 cosphisq + ((-rhovphsq + rhovpvsq + four_rhovshsq - four_rhovsvsq + &
-                     (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + four_rhovsvsq - &
-                        four_eta_aniso*rhovsvsq)*costwotheta)*sinphisq)/2.)*sintheta
-
-             c26 = (cosphi*sinphi*(2.*etaminone*(rhovphsq - two_rhovsvsq)*cosphisq + &
-                  (-rhovphsq + rhovpvsq + (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + four_rhovsvsq - &
-                        four_eta_aniso*rhovsvsq)*costwotheta)*sinphisq)*sinthetasq)/2.
-
-             c33 = rhovpvsq*costhetafour + 2.*(eta_aniso*(rhovphsq - two_rhovsvsq) + two_rhovsvsq)* &
-               costhetasq*sinthetasq + rhovphsq*sinthetafour
-
-             c34 = -((rhovphsq - rhovpvsq + (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq &
-                       - four_eta_aniso*rhovsvsq)*costwotheta)*sinphi*sintwotheta)/4.
-
-             c35 = -(cosphi*(rhovphsq - rhovpvsq + &
-                   (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq - four_eta_aniso*rhovsvsq)* &
-                    costwotheta)*sintwotheta)/4.
-
-             c36 = -((rhovphsq - rhovpvsq - four_rhovshsq + four_rhovsvsq + &
-                   (twoetaminone*rhovphsq - rhovpvsq + four_rhovsvsq - four_eta_aniso*rhovsvsq)* &
-                    costwotheta)*sintwophi*sinthetasq)/4.
-
-             c44 = cosphisq*(rhovsvsq*costhetasq + rhovshsq*sinthetasq) + &
-              sinphisq*(rhovsvsq*costwothetasq + &
-                 (rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq + four_eta_aniso*rhovsvsq)*costhetasq* sinthetasq)
-
-             c45 = ((rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq - two_rhovshsq - two_rhovsvsq + &
-                  four_eta_aniso*rhovsvsq + (rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq + &
-                     4.*etaminone*rhovsvsq)*costwotheta)*sintwophi*sinthetasq)/4.
-
-             c46 = -(cosphi*costheta*((rhovshsq - rhovsvsq)*cosphisq - &
-                  ((rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq - two_rhovshsq - two_rhovsvsq + &
-                       four_eta_aniso*rhovsvsq + (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + &
-                          four_rhovsvsq - four_eta_aniso*rhovsvsq)*costwotheta)*sinphisq)/2.)* sintheta)
-
-             c55 = sinphisq*(rhovsvsq*costhetasq + rhovshsq*sinthetasq) + &
-              cosphisq*(rhovsvsq*costwothetasq + &
-                 (rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq + four_eta_aniso*rhovsvsq)*costhetasq* sinthetasq)
-
-             c56 = costheta*sinphi*((cosphisq* &
-                   (rhovphsq - two_eta_aniso*rhovphsq + rhovpvsq - two_rhovshsq - two_rhovsvsq + &
-                     four_eta_aniso*rhovsvsq + (-rhovphsq + two_eta_aniso*rhovphsq - rhovpvsq + &
-                        four_rhovsvsq - four_eta_aniso*rhovsvsq)*costwotheta))/2. + &
-                (-rhovshsq + rhovsvsq)*sinphisq)*sintheta
-
-             c66 = rhovshsq*costwophisq*costhetasq - &
-              2.*(rhovphsq - two_rhovshsq)*cosphisq*costhetasq*sinphisq + &
-              (rhovphsq*(11. + 4.*costwotheta + cosfourtheta)*sintwophisq)/32. - &
-              (rhovsvsq*(-6. - 2.*cosfourphi + cos(4.*phi - 2.*theta) - 2.*costwotheta + &
-                   cos(2.*(2.*phi + theta)))*sinthetasq)/8. + &
-              rhovpvsq*cosphisq*sinphisq*sinthetafour - &
-              (eta_aniso*(rhovphsq - two_rhovsvsq)*sintwophisq*sinthetafour)/2.
-
-             ! general expression of stress tensor for full Cijkl with 21 coefficients
-
-             sigma_xx = c11*duxdxl + c16*duxdyl_plus_duydxl + c12*duydyl + &
-                       c15*duzdxl_plus_duxdzl + c14*duzdyl_plus_duydzl + c13*duzdzl
-
-             sigma_yy = c12*duxdxl + c26*duxdyl_plus_duydxl + c22*duydyl + &
-                       c25*duzdxl_plus_duxdzl + c24*duzdyl_plus_duydzl + c23*duzdzl
-
-             sigma_zz = c13*duxdxl + c36*duxdyl_plus_duydxl + c23*duydyl + &
-                       c35*duzdxl_plus_duxdzl + c34*duzdyl_plus_duydzl + c33*duzdzl
-
-             sigma_xy = c16*duxdxl + c66*duxdyl_plus_duydxl + c26*duydyl + &
-                       c56*duzdxl_plus_duxdzl + c46*duzdyl_plus_duydzl + c36*duzdzl
-
-             sigma_xz = c15*duxdxl + c56*duxdyl_plus_duydxl + c25*duydyl + &
-                       c55*duzdxl_plus_duxdzl + c45*duzdyl_plus_duydzl + c35*duzdzl
-
-             sigma_yz = c14*duxdxl + c46*duxdyl_plus_duydxl + c24*duydyl + &
-                       c45*duzdxl_plus_duxdzl + c44*duzdyl_plus_duydzl + c34*duzdzl
-
-            endif
-
-          endif   ! end of test whether isotropic or anisotropic element
-
-          ! subtract memory variables if attenuation
-          if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. ) ) then
-             do i_SLS = 1,N_SLS
-                R_xx_val = R_xx(i_SLS,i,j,k,ispec)
-                R_yy_val = R_yy(i_SLS,i,j,k,ispec)
-                sigma_xx = sigma_xx - R_xx_val
-                sigma_yy = sigma_yy - R_yy_val
-                sigma_zz = sigma_zz + R_xx_val + R_yy_val
-                sigma_xy = sigma_xy - R_xy(i_SLS,i,j,k,ispec)
-                sigma_xz = sigma_xz - R_xz(i_SLS,i,j,k,ispec)
-                sigma_yz = sigma_yz - R_yz(i_SLS,i,j,k,ispec)
-             enddo
-          endif
-
-          ! define symmetric components of sigma for gravity
-          sigma_yx = sigma_xy
-          sigma_zx = sigma_xz
-          sigma_zy = sigma_yz
-
-          ! compute non-symmetric terms for gravity
-          if(GRAVITY_VAL) then
-
-            ! use mesh coordinates to get theta and phi
-            ! x y and z contain r theta and phi
-
-            iglob = ibool(i,j,k,ispec)
-            radius = dble(xstore(iglob))
-            theta = ystore(iglob)
-            phi = zstore(iglob)
-
-            cos_theta = dcos(dble(theta))
-            sin_theta = dsin(dble(theta))
-            cos_phi = dcos(dble(phi))
-            sin_phi = dsin(dble(phi))
-
-            ! get g, rho and dg/dr=dg
-            ! spherical components of the gravitational acceleration
-            ! for efficiency replace with lookup table every 100 m in radial direction
-            int_radius = nint(radius * R_EARTH_KM * 10.d0)
-            minus_g = minus_gravity_table(int_radius)
-            minus_dg = minus_deriv_gravity_table(int_radius)
-            rho = density_table(int_radius)
-
-            ! Cartesian components of the gravitational acceleration
-            gxl = minus_g*sin_theta*cos_phi
-            gyl = minus_g*sin_theta*sin_phi
-            gzl = minus_g*cos_theta
-
-            ! Cartesian components of gradient of gravitational acceleration
-            ! obtained from spherical components
-
-            minus_g_over_radius = minus_g / radius
-            minus_dg_plus_g_over_radius = minus_dg - minus_g_over_radius
-
-            cos_theta_sq = cos_theta**2
-            sin_theta_sq = sin_theta**2
-            cos_phi_sq = cos_phi**2
-            sin_phi_sq = sin_phi**2
-
-            Hxxl = minus_g_over_radius*(cos_phi_sq*cos_theta_sq + sin_phi_sq) + cos_phi_sq*minus_dg*sin_theta_sq
-            Hyyl = minus_g_over_radius*(cos_phi_sq + cos_theta_sq*sin_phi_sq) + minus_dg*sin_phi_sq*sin_theta_sq
-            Hzzl = cos_theta_sq*minus_dg + minus_g_over_radius*sin_theta_sq
-            Hxyl = cos_phi*minus_dg_plus_g_over_radius*sin_phi*sin_theta_sq
-            Hxzl = cos_phi*cos_theta*minus_dg_plus_g_over_radius*sin_theta
-            Hyzl = cos_theta*minus_dg_plus_g_over_radius*sin_phi*sin_theta
-
-            iglob = ibool(i,j,k,ispec)
-
-            ! distinguish between single and double precision for reals
-            if(CUSTOM_REAL == SIZE_REAL) then
-
-              ! get displacement and multiply by density to compute G tensor
-              sx_l = rho * dble(displ_crust_mantle(1,iglob))
-              sy_l = rho * dble(displ_crust_mantle(2,iglob))
-              sz_l = rho * dble(displ_crust_mantle(3,iglob))
-
-              ! compute G tensor from s . g and add to sigma (not symmetric)
-              sigma_xx = sigma_xx + sngl(sy_l*gyl + sz_l*gzl)
-              sigma_yy = sigma_yy + sngl(sx_l*gxl + sz_l*gzl)
-              sigma_zz = sigma_zz + sngl(sx_l*gxl + sy_l*gyl)
-
-              sigma_xy = sigma_xy - sngl(sx_l * gyl)
-              sigma_yx = sigma_yx - sngl(sy_l * gxl)
-
-              sigma_xz = sigma_xz - sngl(sx_l * gzl)
-              sigma_zx = sigma_zx - sngl(sz_l * gxl)
-
-              sigma_yz = sigma_yz - sngl(sy_l * gzl)
-              sigma_zy = sigma_zy - sngl(sz_l * gyl)
-
-              ! precompute vector
-              factor = dble(jacobianl) * wgll_cube(i,j,k)
-              rho_s_H(1,i,j,k) = sngl(factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl))
-              rho_s_H(2,i,j,k) = sngl(factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl))
-              rho_s_H(3,i,j,k) = sngl(factor * (sx_l * Hxzl + sy_l * Hyzl + sz_l * Hzzl))
-
-            else
-
-              ! get displacement and multiply by density to compute G tensor
-              sx_l = rho * displ_crust_mantle(1,iglob)
-              sy_l = rho * displ_crust_mantle(2,iglob)
-              sz_l = rho * displ_crust_mantle(3,iglob)
-
-              ! compute G tensor from s . g and add to sigma (not symmetric)
-              sigma_xx = sigma_xx + sy_l*gyl + sz_l*gzl
-              sigma_yy = sigma_yy + sx_l*gxl + sz_l*gzl
-              sigma_zz = sigma_zz + sx_l*gxl + sy_l*gyl
-
-              sigma_xy = sigma_xy - sx_l * gyl
-              sigma_yx = sigma_yx - sy_l * gxl
-
-              sigma_xz = sigma_xz - sx_l * gzl
-              sigma_zx = sigma_zx - sz_l * gxl
-
-              sigma_yz = sigma_yz - sy_l * gzl
-              sigma_zy = sigma_zy - sz_l * gyl
-
-              ! precompute vector
-              factor = jacobianl * wgll_cube(i,j,k)
-              rho_s_H(1,i,j,k) = factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl)
-              rho_s_H(2,i,j,k) = factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl)
-              rho_s_H(3,i,j,k) = factor * (sx_l * Hxzl + sy_l * Hyzl + sz_l * Hzzl)
-
-            endif
-
-          endif  ! end of section with gravity terms
-
-          ! form dot product with test vector, non-symmetric form
-          tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl)
-          tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl)
-          tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl)
-
-          tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl)
-          tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl)
-          tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl)
-
-          tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl)
-          tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl)
-          tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl)
-
-        enddo ! NGLLX
-      enddo ! NGLLY
-    enddo ! NGLLZ
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempy1l = 0._CUSTOM_REAL
-          tempz1l = 0._CUSTOM_REAL
-
-          tempx2l = 0._CUSTOM_REAL
-          tempy2l = 0._CUSTOM_REAL
-          tempz2l = 0._CUSTOM_REAL
-
-          tempx3l = 0._CUSTOM_REAL
-          tempy3l = 0._CUSTOM_REAL
-          tempz3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            fac1 = hprimewgll_xx(l,i)
-            tempx1l = tempx1l + tempx1(l,j,k)*fac1
-            tempy1l = tempy1l + tempy1(l,j,k)*fac1
-            tempz1l = tempz1l + tempz1(l,j,k)*fac1
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-            fac2 = hprimewgll_yy(l,j)
-            tempx2l = tempx2l + tempx2(i,l,k)*fac2
-            tempy2l = tempy2l + tempy2(i,l,k)*fac2
-            tempz2l = tempz2l + tempz2(i,l,k)*fac2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-            fac3 = hprimewgll_zz(l,k)
-            tempx3l = tempx3l + tempx3(i,j,l)*fac3
-            tempy3l = tempy3l + tempy3(i,j,l)*fac3
-            tempz3l = tempz3l + tempz3(i,j,l)*fac3
-          enddo
-
-          fac1 = wgllwgll_yz(j,k)
-          fac2 = wgllwgll_xz(i,k)
-          fac3 = wgllwgll_xy(i,j)
-
-          sum_terms(1,i,j,k) = - (fac1*tempx1l + fac2*tempx2l + fac3*tempx3l)
-          sum_terms(2,i,j,k) = - (fac1*tempy1l + fac2*tempy2l + fac3*tempy3l)
-          sum_terms(3,i,j,k) = - (fac1*tempz1l + fac2*tempz2l + fac3*tempz3l)
-
-          if(GRAVITY_VAL) sum_terms(:,i,j,k) = sum_terms(:,i,j,k) + rho_s_H(:,i,j,k)
-
-        enddo ! NGLLX
-      enddo ! NGLLY
-    enddo ! NGLLZ
-
-    ! sum contributions from each element to the global mesh and add gravity terms
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-          iglob = ibool(i,j,k,ispec)
-          accel_crust_mantle(:,iglob) = accel_crust_mantle(:,iglob) + sum_terms(:,i,j,k)
-        enddo
-      enddo
-    enddo
-
-! update memory variables based upon the Runge-Kutta scheme
-! convention for attenuation
-! term in xx = 1
-! term in yy = 2
-! term in xy = 3
-! term in xz = 4
-! term in yz = 5
-! term in zz not computed since zero trace
-! This is because we only implement Q_\mu attenuation and not Q_\kappa.
-! Note that this does *NOT* imply that there is no attenuation for P waves
-! because for Q_\kappa = infinity one gets (see for instance Dahlen and Tromp (1998)
-! equation (9.59) page 350): Q_\alpha = Q_\mu * 3 * (V_p/V_s)^2 / 4
-! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
-! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
-
-    if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. )) then
-
-! use Runge-Kutta scheme to march in time
-      do i_SLS = 1,N_SLS
-
-! get coefficients for that standard linear solid
-! IMPROVE we use mu_v here even if there is some anisotropy
-! IMPROVE we should probably use an average value instead
-
-        ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-        if(USE_3D_ATTENUATION_ARRAYS) then
-          if(ANISOTROPIC_3D_MANTLE_VAL) then
-            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * c44store(:,:,:,ispec)
-          else
-            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * muvstore(:,:,:,ispec)
-          endif
-        else
-          if(ANISOTROPIC_3D_MANTLE_VAL) then
-            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * c44store(:,:,:,ispec)
-          else
-            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * muvstore(:,:,:,ispec)
-          endif
-        endif
-
-!        do i_memory = 1,5
-!          R_memory(i_memory,i_SLS,:,:,:,ispec) = alphaval(i_SLS) * &
-!                    R_memory(i_memory,i_SLS,:,:,:,ispec) + &
-!                    factor_common_c44_muv * &
-!                    (betaval(i_SLS) * epsilondev(i_memory,:,:,:,ispec) + &
-!                    gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
-!        enddo
-
-        R_xx(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xx(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xx(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(1,:,:,:))
-
-        R_yy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yy(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_yy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(2,:,:,:))
-
-        R_xy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xy(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(3,:,:,:))
-
-        R_xz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xz(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(4,:,:,:))
-
-        R_yz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yz(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_yz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(5,:,:,:))
-
-      enddo
-    endif
-
-    ! save deviatoric strain for Runge-Kutta scheme
-    if(COMPUTE_AND_STORE_STRAIN_VAL) then
-      !epsilondev(:,:,:,:,ispec) = epsilondev_loc(:,:,:,:)
-      do k=1,NGLLZ
-        do j=1,NGLLY
-          do i=1,NGLLX
-            epsilondev_xx(i,j,k,ispec) = epsilondev_loc(1,i,j,k)
-            epsilondev_yy(i,j,k,ispec) = epsilondev_loc(2,i,j,k)
-            epsilondev_xy(i,j,k,ispec) = epsilondev_loc(3,i,j,k)
-            epsilondev_xz(i,j,k,ispec) = epsilondev_loc(4,i,j,k)
-            epsilondev_yz(i,j,k,ispec) = epsilondev_loc(5,i,j,k)
-          enddo
-        enddo
-      enddo
-    endif
-
-  enddo   ! spectral element loop NSPEC_CRUST_MANTLE
-
-  end subroutine compute_forces_crust_mantle
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_Dev.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_Dev.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_Dev.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -44,7 +44,8 @@
 
   use specfem_par,only: &
     hprime_xx,hprime_xxT,hprimewgll_xx,hprimewgll_xxT,wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-    minus_gravity_table,density_table,minus_deriv_gravity_table
+    minus_gravity_table,density_table,minus_deriv_gravity_table, &
+    COMPUTE_AND_STORE_STRAIN
 
   use specfem_par_crustmantle,only: &
     xstore => xstore_crust_mantle,ystore => ystore_crust_mantle,zstore => zstore_crust_mantle, &
@@ -143,32 +144,6 @@
   equivalence(newtempy3,E2_mxm_m2_m1_5points)
   equivalence(newtempz3,E3_mxm_m2_m1_5points)
 
-  ! attenuation arrays
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
-    tempx1_att,tempx2_att,tempx3_att,tempy1_att,tempy2_att,tempy3_att,tempz1_att,tempz2_att,tempz3_att
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: dummyx_loc_att,dummyy_loc_att,dummyz_loc_att
-  real(kind=CUSTOM_REAL), dimension(NGLLX,m2) :: B1_m1_m2_5points_att,B2_m1_m2_5points_att,B3_m1_m2_5points_att
-  real(kind=CUSTOM_REAL), dimension(m1,m2) :: C1_m1_m2_5points_att,C2_m1_m2_5points_att,C3_m1_m2_5points_att
-
-  equivalence(dummyx_loc_att,B1_m1_m2_5points_att)
-  equivalence(dummyy_loc_att,B2_m1_m2_5points_att)
-  equivalence(dummyz_loc_att,B3_m1_m2_5points_att)
-  equivalence(tempx1_att,C1_m1_m2_5points_att)
-  equivalence(tempy1_att,C2_m1_m2_5points_att)
-  equivalence(tempz1_att,C3_m1_m2_5points_att)
-
-  real(kind=CUSTOM_REAL), dimension(m2,NGLLX) :: &
-    A1_mxm_m2_m1_5points_att,A2_mxm_m2_m1_5points_att,A3_mxm_m2_m1_5points_att
-  real(kind=CUSTOM_REAL), dimension(m2,m1) :: &
-    C1_mxm_m2_m1_5points_att,C2_mxm_m2_m1_5points_att,C3_mxm_m2_m1_5points_att
-
-  equivalence(dummyx_loc_att,A1_mxm_m2_m1_5points_att)
-  equivalence(dummyy_loc_att,A2_mxm_m2_m1_5points_att)
-  equivalence(dummyz_loc_att,A3_mxm_m2_m1_5points_att)
-  equivalence(tempx3_att,C1_mxm_m2_m1_5points_att)
-  equivalence(tempy3_att,C2_mxm_m2_m1_5points_att)
-  equivalence(tempz3_att,C3_mxm_m2_m1_5points_att)
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: sum_terms
 
   real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
@@ -182,6 +157,16 @@
   integer :: num_elements,ispec_p
   integer :: iphase
 
+! for LDDRK
+!  integer :: istage
+!  logical :: USE_LDDRK
+!  real(kind=CUSTOM_REAL), dimension(5,N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE_ATTENUATION) :: R_memory_lddrk
+!  real(kind=CUSTOM_REAL),dimension(N_SLS) :: tau_sigma_CUSTOM_REAL
+
+#ifdef FORCE_VECTORIZATION
+  integer :: ijk
+#endif
+
 ! ****************************************************
 !   big loop over all spectral elements in the solid
 ! ****************************************************
@@ -204,6 +189,15 @@
     ! subroutines adapted from Deville, Fischer and Mund, High-order methods
     ! for incompressible fluid flow, Cambridge University Press (2002),
     ! pages 386 and 389 and Figure 8.3.1
+
+#ifdef FORCE_VECTORIZATION
+    do ijk=1,NGLLCUBE
+      iglob = ibool(ijk,1,1,ispec)
+      dummyx_loc(ijk,1,1) = displ_crust_mantle(1,iglob)
+      dummyy_loc(ijk,1,1) = displ_crust_mantle(2,iglob)
+      dummyz_loc(ijk,1,1) = displ_crust_mantle(3,iglob)
+    enddo
+#else
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
@@ -214,41 +208,11 @@
         enddo
       enddo
     enddo
+#endif
 
-    if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-
-       if(ATTENUATION_NEW_VAL) then
-          ! takes new routines
-          ! use first order Taylor expansion of displacement for local storage of stresses
-          ! at this current time step, to fix attenuation in a consistent way
-
-          do k=1,NGLLZ
-             do j=1,NGLLY
-                do i=1,NGLLX
-                  iglob = ibool(i,j,k,ispec)
-                  dummyx_loc_att(i,j,k) = dummyx_loc(i,j,k) + deltat*veloc_crust_mantle(1,iglob)
-                  dummyy_loc_att(i,j,k) = dummyy_loc(i,j,k) + deltat*veloc_crust_mantle(2,iglob)
-                  dummyz_loc_att(i,j,k) = dummyz_loc(i,j,k) + deltat*veloc_crust_mantle(3,iglob)
-                enddo
-             enddo
-          enddo
-       else
-          ! takes old routines
-          do k=1,NGLLZ
-             do j=1,NGLLY
-                !do i=1,NGLLX
-                !  dummyx_loc_att(i,j,k) = dummyx_loc(i,j,k)
-                !  dummyy_loc_att(i,j,k) = dummyy_loc(i,j,k)
-                !  dummyz_loc_att(i,j,k) = dummyz_loc(i,j,k)
-                !enddo
-                dummyx_loc_att(:,j,k) = dummyx_loc(:,j,k)
-                dummyy_loc_att(:,j,k) = dummyy_loc(:,j,k)
-                dummyz_loc_att(:,j,k) = dummyz_loc(:,j,k)
-             enddo
-          enddo
-       endif
-    endif ! ATTENUATION_VAL
-
+    ! subroutines adapted from Deville, Fischer and Mund, High-order methods
+    ! for incompressible fluid flow, Cambridge University Press (2002),
+    ! pages 386 and 389 and Figure 8.3.1
     do j=1,m2
        do i=1,m1
           C1_m1_m2_5points(i,j) = hprime_xx(i,1)*B1_m1_m2_5points(1,j) + &
@@ -318,78 +282,6 @@
        enddo
     enddo
 
-    if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-       ! temporary variables used for fixing attenuation in a consistent way
-       do j=1,m2
-          do i=1,m1
-             C1_m1_m2_5points_att(i,j) = hprime_xx(i,1)*B1_m1_m2_5points_att(1,j) + &
-                                         hprime_xx(i,2)*B1_m1_m2_5points_att(2,j) + &
-                                         hprime_xx(i,3)*B1_m1_m2_5points_att(3,j) + &
-                                         hprime_xx(i,4)*B1_m1_m2_5points_att(4,j) + &
-                                         hprime_xx(i,5)*B1_m1_m2_5points_att(5,j)
-
-             C2_m1_m2_5points_att(i,j) = hprime_xx(i,1)*B2_m1_m2_5points_att(1,j) + &
-                                         hprime_xx(i,2)*B2_m1_m2_5points_att(2,j) + &
-                                         hprime_xx(i,3)*B2_m1_m2_5points_att(3,j) + &
-                                         hprime_xx(i,4)*B2_m1_m2_5points_att(4,j) + &
-                                         hprime_xx(i,5)*B2_m1_m2_5points_att(5,j)
-
-             C3_m1_m2_5points_att(i,j) = hprime_xx(i,1)*B3_m1_m2_5points_att(1,j) + &
-                                         hprime_xx(i,2)*B3_m1_m2_5points_att(2,j) + &
-                                         hprime_xx(i,3)*B3_m1_m2_5points_att(3,j) + &
-                                         hprime_xx(i,4)*B3_m1_m2_5points_att(4,j) + &
-                                         hprime_xx(i,5)*B3_m1_m2_5points_att(5,j)
-          enddo
-       enddo
-       ! temporary variables used for fixing attenuation in a consistent way
-       do j=1,m1
-          do i=1,m1
-             ! for efficiency it is better to leave this loop on k inside, it leads to slightly faster code
-             do k = 1,NGLLX
-                tempx2_att(i,j,k) = dummyx_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                                    dummyx_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                                    dummyx_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                                    dummyx_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                                    dummyx_loc_att(i,5,k)*hprime_xxT(5,j)
-
-                tempy2_att(i,j,k) = dummyy_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                                    dummyy_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                                    dummyy_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                                    dummyy_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                                    dummyy_loc_att(i,5,k)*hprime_xxT(5,j)
-
-                tempz2_att(i,j,k) = dummyz_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                                    dummyz_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                                    dummyz_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                                    dummyz_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                                    dummyz_loc_att(i,5,k)*hprime_xxT(5,j)
-             enddo
-          enddo
-       enddo
-       ! temporary variables used for fixing attenuation in a consistent way
-       do j=1,m1
-          do i=1,m2
-             C1_mxm_m2_m1_5points_att(i,j) = A1_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                                             A1_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                                             A1_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                                             A1_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                                             A1_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-
-             C2_mxm_m2_m1_5points_att(i,j) = A2_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                                             A2_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                                             A2_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                                             A2_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                                             A2_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-
-             C3_mxm_m2_m1_5points_att(i,j) = A3_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                                             A3_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                                             A3_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                                             A3_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                                             A3_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-          enddo
-       enddo
-    endif ! ATTENUATION_VAL
-
     !
     ! compute either isotropic, transverse isotropic or anisotropic elements
     !
@@ -409,10 +301,8 @@
             one_minus_sum_beta,vx,vy,vz,vnspec, &
             tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3, &
             dummyx_loc,dummyy_loc,dummyz_loc, &
-            tempx1_att,tempx2_att,tempx3_att, &
-            tempy1_att,tempy2_att,tempy3_att, &
-            tempz1_att,tempz2_att,tempz3_att, &
-            epsilondev_loc,rho_s_H,is_backward_field)
+            epsilondev_loc, &
+            rho_s_H,is_backward_field)
     else
        if(.not. ispec_is_tiso(ispec)) then
           ! isotropic element
@@ -428,10 +318,8 @@
                one_minus_sum_beta,vx,vy,vz,vnspec, &
                tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3, &
                dummyx_loc,dummyy_loc,dummyz_loc, &
-               tempx1_att,tempx2_att,tempx3_att, &
-               tempy1_att,tempy2_att,tempy3_att, &
-               tempz1_att,tempz2_att,tempz3_att, &
-               epsilondev_loc,rho_s_H,is_backward_field)
+               epsilondev_loc, &
+               rho_s_H,is_backward_field)
        else
           ! transverse isotropic element
           call compute_element_tiso(ispec, &
@@ -446,10 +334,8 @@
                one_minus_sum_beta,vx,vy,vz,vnspec, &
                tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3, &
                dummyx_loc,dummyy_loc,dummyz_loc, &
-               tempx1_att,tempx2_att,tempx3_att, &
-               tempy1_att,tempy2_att,tempy3_att, &
-               tempz1_att,tempz2_att,tempz3_att, &
-               epsilondev_loc,rho_s_H,is_backward_field)
+               epsilondev_loc, &
+               rho_s_H,is_backward_field)
        endif ! .not. ispec_is_tiso
     endif
 
@@ -525,6 +411,24 @@
       enddo
     enddo
 
+    ! sum contributions
+#ifdef FORCE_VECTORIZATION
+    do ijk=1,NGLLCUBE
+      fac1 = wgllwgll_yz_3D(ijk,1,1)
+      fac2 = wgllwgll_xz_3D(ijk,1,1)
+      fac3 = wgllwgll_xy_3D(ijk,1,1)
+      sum_terms(1,ijk,1,1) = - (fac1*newtempx1(ijk,1,1) + fac2*newtempx2(ijk,1,1) + fac3*newtempx3(ijk,1,1))
+      sum_terms(2,ijk,1,1) = - (fac1*newtempy1(ijk,1,1) + fac2*newtempy2(ijk,1,1) + fac3*newtempy3(ijk,1,1))
+      sum_terms(3,ijk,1,1) = - (fac1*newtempz1(ijk,1,1) + fac2*newtempz2(ijk,1,1) + fac3*newtempz3(ijk,1,1))
+    enddo
+
+    ! add gravity terms
+    if(GRAVITY_VAL) then
+      do ijk = 1,NDIM*NGLLCUBE
+        sum_terms(ijk,1,1,1) = sum_terms(ijk,1,1,1) + rho_s_H(ijk,1,1,1)
+      enddo
+    endif
+#else
     do k=1,NGLLZ
       do j=1,NGLLY
         fac1 = wgllwgll_yz(j,k)
@@ -537,22 +441,43 @@
           sum_terms(2,i,j,k) = - (fac1*newtempy1(i,j,k) + fac2*newtempy2(i,j,k) + fac3*newtempy3(i,j,k))
           sum_terms(3,i,j,k) = - (fac1*newtempz1(i,j,k) + fac2*newtempz2(i,j,k) + fac3*newtempz3(i,j,k))
 
+          ! add gravity terms
           if(GRAVITY_VAL) sum_terms(:,i,j,k) = sum_terms(:,i,j,k) + rho_s_H(:,i,j,k)
 
         enddo ! NGLLX
       enddo ! NGLLY
     enddo ! NGLLZ
+#endif
 
     ! sum contributions from each element to the global mesh and add gravity terms
+#ifdef FORCE_VECTORIZATION
+! we can force vectorization using a compiler directive here because we know that there is no dependency
+! inside a given spectral element, since all the global points of a local elements are different by definition
+! (only common points between different elements can be the same)
+! IBM, Portland PGI, and Intel and Cray syntax (Intel and Cray are the same)
+!IBM* ASSERT (NODEPS)
+!pgi$ ivdep
+!DIR$ IVDEP
+    do ijk = 1,NGLLCUBE
+      iglob = ibool(ijk,1,1,ispec)
+      ! do NOT use array syntax ":" for the three statements below otherwise most compilers
+      ! will not be able to vectorize the outer loop
+      accel_crust_mantle(1,iglob) = accel_crust_mantle(1,iglob) + sum_terms(1,ijk,1,1)
+      accel_crust_mantle(2,iglob) = accel_crust_mantle(2,iglob) + sum_terms(2,ijk,1,1)
+      accel_crust_mantle(3,iglob) = accel_crust_mantle(3,iglob) + sum_terms(3,ijk,1,1)
+    enddo
+#else
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
           iglob = ibool(i,j,k,ispec)
-          accel_crust_mantle(:,iglob) = accel_crust_mantle(:,iglob) + sum_terms(:,i,j,k)
+          accel_crust_mantle(1,iglob) = accel_crust_mantle(1,iglob) + sum_terms(1,i,j,k)
+          accel_crust_mantle(2,iglob) = accel_crust_mantle(2,iglob) + sum_terms(2,i,j,k)
+          accel_crust_mantle(3,iglob) = accel_crust_mantle(3,iglob) + sum_terms(3,i,j,k)
         enddo
       enddo
     enddo
-
+#endif
     ! update memory variables based upon the Runge-Kutta scheme
     ! convention for attenuation
     ! term in xx = 1
@@ -568,7 +493,7 @@
     ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
     ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
 
-    if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+    if( ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
       ! updates R_memory
       call compute_element_att_memory_cm(ispec,R_xx,R_yy,R_xy,R_xz,R_yz, &
                                          vx,vy,vz,vnspec,factor_common, &
@@ -581,13 +506,24 @@
     endif
 
     ! save deviatoric strain for Runge-Kutta scheme
-    if(COMPUTE_AND_STORE_STRAIN_VAL) then
+    if(COMPUTE_AND_STORE_STRAIN) then
+
+#ifdef FORCE_VECTORIZATION
+      do ijk = 1,NGLLCUBE
+        epsilondev_xx(ijk,1,1,ispec) = epsilondev_loc(1,ijk,1,1)
+        epsilondev_yy(ijk,1,1,ispec) = epsilondev_loc(2,ijk,1,1)
+        epsilondev_xy(ijk,1,1,ispec) = epsilondev_loc(3,ijk,1,1)
+        epsilondev_xz(ijk,1,1,ispec) = epsilondev_loc(4,ijk,1,1)
+        epsilondev_yz(ijk,1,1,ispec) = epsilondev_loc(5,ijk,1,1)
+      enddo
+#else
       epsilondev_xx(:,:,:,ispec) = epsilondev_loc(1,:,:,:)
       epsilondev_yy(:,:,:,ispec) = epsilondev_loc(2,:,:,:)
       epsilondev_xy(:,:,:,ispec) = epsilondev_loc(3,:,:,:)
       epsilondev_xz(:,:,:,ispec) = epsilondev_loc(4,:,:,:)
       epsilondev_yz(:,:,:,ispec) = epsilondev_loc(5,:,:,:)
     endif
+#endif
 
   enddo ! of spectral element loop NSPEC_CRUST_MANTLE
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_noDev.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_noDev.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_crust_mantle_noDev.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,111 +25,96 @@
 !
 !=====================================================================
 
-  subroutine compute_forces_crust_mantle(minus_gravity_table,density_table,minus_deriv_gravity_table, &
-          displ_crust_mantle,accel_crust_mantle,xstore,ystore,zstore, &
-          xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
-            is_on_a_slice_edge_crust_mantle,icall, &
-            accel_inner_core,ibool_inner_core,idoubling_inner_core, &
-            myrank,iproc_xi,iproc_eta,ichunk,addressing, &
-            iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle,iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle, &
-            npoin2D_faces_crust_mantle,npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-            iboolfaces_crust_mantle,iboolcorner_crust_mantle, &
-            iboolleft_xi_inner_core,iboolright_xi_inner_core,iboolleft_eta_inner_core,iboolright_eta_inner_core, &
-            npoin2D_faces_inner_core,npoin2D_xi_inner_core,npoin2D_eta_inner_core, &
-            iboolfaces_inner_core,iboolcorner_inner_core, &
-            iprocfrom_faces,iprocto_faces, &
-            iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-            buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-            buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector,iphase, &
-            nb_msgs_theor_in_cube,sender_from_slices_to_cube, &
-            npoin2D_cube_from_slices,buffer_all_cube_from_slices,buffer_slices,ibool_central_cube, &
-            receiver_cube_from_slices,ibelm_bottom_inner_core,NSPEC2D_BOTTOM_INNER_CORE,INCLUDE_CENTRAL_CUBE,iphase_CC, &
-          hprime_xx,hprime_yy,hprime_zz, &
-          hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-          wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-          kappavstore,kappahstore,muvstore,muhstore,eta_anisostore, &
-          c11store,c12store,c13store,c14store,c15store,c16store,c22store, &
-          c23store,c24store,c25store,c26store,c33store,c34store,c35store, &
-          c36store,c44store,c45store,c46store,c55store,c56store,c66store, &
-          ibool,ispec_is_tiso, &
-          R_memory,one_minus_sum_beta,deltat,veloc_crust_mantle, &
-          alphaval,betaval,gammaval,factor_common,vx,vy,vz,vnspec,PARTIAL_PHYS_DISPERSION_ONLY,&
-          istage,R_memory_lddrk,tau_sigma_CUSTOM_REAL)
+  subroutine compute_forces_crust_mantle(NSPEC,NGLOB,NSPEC_ATT, &
+                                        deltat, &
+                                        displ_crust_mantle, &
+                                        veloc_crust_mantle, &
+                                        accel_crust_mantle, &
+                                        phase_is_inner, &
+                                        R_xx,R_yy,R_xy,R_xz,R_yz, &
+                                        epsilondev_xx,epsilondev_yy,epsilondev_xy, &
+                                        epsilondev_xz,epsilondev_yz, &
+                                        epsilon_trace_over_3, &
+                                        alphaval,betaval,gammaval, &
+                                        factor_common,vx,vy,vz,vnspec)
 
-  implicit none
+  use constants_solver
 
-  include "constants.h"
+  use specfem_par,only: &
+    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
+    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
+    minus_gravity_table,density_table,minus_deriv_gravity_table, &
+    COMPUTE_AND_STORE_STRAIN
 
-! include values created by the mesher
-! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
+  use specfem_par_crustmantle,only: &
+    xstore => xstore_crust_mantle,ystore => ystore_crust_mantle,zstore => zstore_crust_mantle, &
+    xix => xix_crust_mantle,xiy => xiy_crust_mantle,xiz => xiz_crust_mantle, &
+    etax => etax_crust_mantle,etay => etay_crust_mantle,etaz => etaz_crust_mantle, &
+    gammax => gammax_crust_mantle,gammay => gammay_crust_mantle,gammaz => gammaz_crust_mantle, &
+    kappavstore => kappavstore_crust_mantle,kappahstore => kappahstore_crust_mantle, &
+    muvstore => muvstore_crust_mantle,muhstore => muhstore_crust_mantle, &
+    eta_anisostore => eta_anisostore_crust_mantle, &
+    c11store => c11store_crust_mantle,c12store => c12store_crust_mantle,c13store => c13store_crust_mantle, &
+    c14store => c14store_crust_mantle,c15store => c15store_crust_mantle,c16store => c16store_crust_mantle, &
+    c22store => c22store_crust_mantle,c23store => c23store_crust_mantle,c24store => c24store_crust_mantle, &
+    c25store => c25store_crust_mantle,c26store => c26store_crust_mantle,c33store => c33store_crust_mantle, &
+    c34store => c34store_crust_mantle,c35store => c35store_crust_mantle,c36store => c36store_crust_mantle, &
+    c44store => c44store_crust_mantle,c45store => c45store_crust_mantle,c46store => c46store_crust_mantle, &
+    c55store => c55store_crust_mantle,c56store => c56store_crust_mantle,c66store => c66store_crust_mantle, &
+    ibool => ibool_crust_mantle, &
+    ispec_is_tiso => ispec_is_tiso_crust_mantle, &
+    one_minus_sum_beta => one_minus_sum_beta_crust_mantle, &
+    phase_ispec_inner => phase_ispec_inner_crust_mantle, &
+    nspec_outer => nspec_outer_crust_mantle, &
+    nspec_inner => nspec_inner_crust_mantle
 
-! array with the local to global mapping per slice
-  logical, dimension(NSPEC_CRUST_MANTLE) :: ispec_is_tiso
+  implicit none
 
-! displacement and acceleration
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: displ_crust_mantle,accel_crust_mantle,veloc_crust_mantle
+  integer :: NSPEC,NGLOB,NSPEC_ATT
 
-! memory variables for attenuation
-! memory variables R_ij are stored at the local rather than global level
-! to allow for optimization of cache access by compiler
-  integer i_SLS,i_memory
-! variable sized array variables for one_minus_sum_beta and factor_common
-  integer vx, vy, vz, vnspec
+  ! time step
+  real(kind=CUSTOM_REAL) :: deltat
 
-  real(kind=CUSTOM_REAL) one_minus_sum_beta_use,minus_sum_beta,deltat
-  real(kind=CUSTOM_REAL), dimension(vx, vy, vz, vnspec) :: one_minus_sum_beta
+  ! displacement, velocity and acceleration
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: displ_crust_mantle
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: veloc_crust_mantle
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: accel_crust_mantle
 
-! for attenuation
-  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
-  real(kind=CUSTOM_REAL), dimension(5,N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE_ATTENUATION) :: R_memory
-  logical :: PARTIAL_PHYS_DISPERSION_ONLY
+  ! variable sized array variables
+  integer :: vx,vy,vz,vnspec
 
-! [alpha,beta,gamma]val reduced to N_SLS and factor_common to N_SLS*NUM_NODES
+  ! memory variables for attenuation
+  ! memory variables R_ij are stored at the local rather than global level
+  ! to allow for optimization of cache access by compiler
+  real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_ATT) :: R_xx,R_yy,R_xy,R_xz,R_yz
+
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
+    epsilondev_xx,epsilondev_yy,epsilondev_xy,epsilondev_xz,epsilondev_yz
+  real(kind=CUSTOM_REAL),dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: epsilon_trace_over_3
+
+  ! [alpha,beta,gamma]val reduced to N_SLS and factor_common to N_SLS*NUM_NODES
+  real(kind=CUSTOM_REAL), dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
   real(kind=CUSTOM_REAL), dimension(N_SLS) :: alphaval,betaval,gammaval
-  real(kind=CUSTOM_REAL), dimension(N_SLS, vx, vy, vz, vnspec) :: factor_common
-  real(kind=CUSTOM_REAL), dimension(NGLLX, NGLLY, NGLLZ) :: factor_common_c44_muv
 
-  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
-  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc_nplus1
+  ! inner/outer element run flag
+  logical :: phase_is_inner
 
-! arrays with mesh parameters per slice
-  integer, dimension(NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE) :: ibool
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE) :: &
-        xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz
+  ! local parameters
 
-! array with derivatives of Lagrange polynomials and precalculated products
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx,hprimewgll_xx
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLY) :: hprime_yy,hprimewgll_yy
-  real(kind=CUSTOM_REAL), dimension(NGLLZ,NGLLZ) :: hprime_zz,hprimewgll_zz
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY) :: wgllwgll_xy
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ) :: wgllwgll_xz
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLZ) :: wgllwgll_yz
+  ! for attenuation
+  real(kind=CUSTOM_REAL) one_minus_sum_beta_use,minus_sum_beta
+  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ)   :: factor_common_c44_muv
+  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
 
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
     tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3
 
-! x y and z contain r theta and phi
-  real(kind=CUSTOM_REAL), dimension(NGLOB_CRUST_MANTLE) :: xstore,ystore,zstore
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPECMAX_ISO_MANTLE) :: &
-        kappavstore,muvstore
-
-! store anisotropic properties only where needed to save memory
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPECMAX_TISO_MANTLE) :: &
-        kappahstore,muhstore,eta_anisostore
-
-! arrays for full anisotropy only when needed
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPECMAX_ANISO_MANTLE) :: &
-        c11store,c12store,c13store,c14store,c15store,c16store,c22store, &
-        c23store,c24store,c25store,c26store,c33store,c34store,c35store, &
-        c36store,c44store,c45store,c46store,c55store,c56store,c66store
-
   integer ispec,iglob,ispec_strain
   integer i,j,k,l
-  real(kind=CUSTOM_REAL) templ
+  integer i_SLS
 
-! the 21 coefficients for an anisotropic medium in reduced notation
+  ! the 21 coefficients for an anisotropic medium in reduced notation
   real(kind=CUSTOM_REAL) c11,c22,c33,c44,c55,c66,c12,c13,c23,c14,c24,c34,c15,c25,c35,c45,c16,c26,c36,c46,c56
 
   real(kind=CUSTOM_REAL) rhovphsq,sinphifour,cosphisq,sinphisq,costhetasq,rhovsvsq,sinthetasq, &
@@ -137,8 +122,8 @@
         costwotheta,cosfourtheta,sintwophisq,costheta,sinphi,sintheta,cosphi, &
         sintwotheta,costwophi,sintwophi,costwothetasq,costwophisq,phi,theta
 
-  real(kind=CUSTOM_REAL) two_rhovpvsq,two_rhovphsq,two_rhovsvsq,two_rhovshsq
-  real(kind=CUSTOM_REAL) four_rhovpvsq,four_rhovphsq,four_rhovsvsq,four_rhovshsq
+  real(kind=CUSTOM_REAL) two_rhovsvsq,two_rhovshsq ! two_rhovpvsq,two_rhovphsq
+  real(kind=CUSTOM_REAL) four_rhovsvsq,four_rhovshsq ! four_rhovpvsq,four_rhovphsq,
 
   real(kind=CUSTOM_REAL) twoetaminone,etaminone,eta_aniso
   real(kind=CUSTOM_REAL) two_eta_aniso,four_eta_aniso,six_eta_aniso
@@ -161,7 +146,7 @@
   real(kind=CUSTOM_REAL) tempy1l,tempy2l,tempy3l
   real(kind=CUSTOM_REAL) tempz1l,tempz2l,tempz3l
 
-! for gravity
+  ! for gravity
   integer int_radius
   real(kind=CUSTOM_REAL) sigma_yx,sigma_zx,sigma_zy
   double precision radius,rho,minus_g,minus_dg
@@ -170,118 +155,31 @@
   double precision cos_theta_sq,sin_theta_sq,cos_phi_sq,sin_phi_sq
   double precision factor,sx_l,sy_l,sz_l,gxl,gyl,gzl
   double precision Hxxl,Hyyl,Hzzl,Hxyl,Hxzl,Hyzl
-  double precision, dimension(NRAD_GRAVITY) :: minus_gravity_table,density_table,minus_deriv_gravity_table
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: rho_s_H
-  double precision, dimension(NGLLX,NGLLY,NGLLZ) :: wgll_cube
 
-! this for non blocking MPI
-  integer :: iphase,icall
+!  integer :: computed_elements
+  integer :: num_elements,ispec_p
+  integer :: iphase
 
-  integer :: computed_elements
-
-  logical, dimension(NSPEC_CRUST_MANTLE) :: is_on_a_slice_edge_crust_mantle
-
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE) :: accel_inner_core
-
-  integer, dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: ibool_inner_core
-
-  integer, dimension(NSPEC_INNER_CORE) :: idoubling_inner_core
-
-  integer :: ichunk,iproc_xi,iproc_eta,myrank
-
-  integer, dimension(NCHUNKS_VAL,0:NPROC_XI_VAL-1,0:NPROC_ETA_VAL-1) :: addressing
-
-  integer, dimension(NGLOB2DMAX_XMIN_XMAX_CM) :: iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle
-  integer, dimension(NGLOB2DMAX_YMIN_YMAX_CM) :: iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle
-
-  integer, dimension(NGLOB2DMAX_XMIN_XMAX_IC) :: iboolleft_xi_inner_core,iboolright_xi_inner_core
-  integer, dimension(NGLOB2DMAX_YMIN_YMAX_IC) :: iboolleft_eta_inner_core,iboolright_eta_inner_core
-
-  integer npoin2D_faces_crust_mantle(NUMFACES_SHARED)
-  integer npoin2D_faces_inner_core(NUMFACES_SHARED)
-
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR) :: npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-       npoin2D_xi_inner_core,npoin2D_eta_inner_core
-
-! communication pattern for faces between chunks
-  integer, dimension(NUMMSGS_FACES_VAL) :: iprocfrom_faces,iprocto_faces
-
-! communication pattern for corners between chunks
-  integer, dimension(NCORNERSCHUNKS_VAL) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
-
-  integer, dimension(NGLOB1D_RADIAL_CM,NUMCORNERS_SHARED) :: iboolcorner_crust_mantle
-  integer, dimension(NGLOB1D_RADIAL_IC,NUMCORNERS_SHARED) :: iboolcorner_inner_core
-
-  integer, dimension(NGLOB2DMAX_XY_CM_VAL,NUMFACES_SHARED) :: iboolfaces_crust_mantle
-  integer, dimension(NGLOB2DMAX_XY_IC_VAL,NUMFACES_SHARED) :: iboolfaces_inner_core
-
-  integer :: npoin2D_max_all_CM_IC
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin2D_max_all_CM_IC) :: buffer_send_faces,buffer_received_faces
-
-! size of buffers is the sum of two sizes because we handle two regions in the same MPI call
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB1D_RADIAL_CM + NGLOB1D_RADIAL_IC) :: &
-     buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector
-
-! for matching with central cube in inner core
-  integer nb_msgs_theor_in_cube, npoin2D_cube_from_slices,iphase_CC
-  integer, dimension(nb_msgs_theor_in_cube) :: sender_from_slices_to_cube
-  double precision, dimension(npoin2D_cube_from_slices,NDIM) :: buffer_slices
-  double precision, dimension(npoin2D_cube_from_slices,NDIM,nb_msgs_theor_in_cube) :: buffer_all_cube_from_slices
-  integer, dimension(nb_msgs_theor_in_cube,npoin2D_cube_from_slices):: ibool_central_cube
-  integer receiver_cube_from_slices
-  logical :: INCLUDE_CENTRAL_CUBE
-
-! local to global mapping
-  integer NSPEC2D_BOTTOM_INNER_CORE
-  integer, dimension(NSPEC2D_BOTTOM_INNER_CORE) :: ibelm_bottom_inner_core
-
-!for LDDRK
-  integer :: istage
-  real(kind=CUSTOM_REAL), dimension(5,N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE_ATTENUATION) :: R_memory_lddrk
-  real(kind=CUSTOM_REAL),dimension(N_SLS) :: tau_sigma_CUSTOM_REAL
-
 ! ****************************************************
 !   big loop over all spectral elements in the solid
 ! ****************************************************
 
-  computed_elements = 0
+!  computed_elements = 0
+  if( .not. phase_is_inner ) then
+    iphase = 1
+    num_elements = nspec_outer
+  else
+    iphase = 2
+    num_elements = nspec_inner
+  endif
 
-  do ispec = 1,NSPEC_CRUST_MANTLE
+  do ispec_p = 1,num_elements
 
-! hide communications by computing the edges first
-    if((icall == 2 .and. is_on_a_slice_edge_crust_mantle(ispec)) .or. &
-       (icall == 1 .and. .not. is_on_a_slice_edge_crust_mantle(ispec))) cycle
+    ispec = phase_ispec_inner(ispec_p,iphase)
 
-! process the non-blocking communications every ELEMENTS_NONBLOCKING elements
-    computed_elements = computed_elements + 1
-    if (icall == 2 .and. mod(computed_elements,ELEMENTS_NONBLOCKING_CM_IC) == 0) then
+    ! only compute element which belong to current phase (inner or outer elements)
 
-      if(iphase <= 7) call assemble_MPI_vector(myrank,accel_crust_mantle,accel_inner_core, &
-            iproc_xi,iproc_eta,ichunk,addressing, &
-            iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle,iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle, &
-            npoin2D_faces_crust_mantle,npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-            iboolfaces_crust_mantle,iboolcorner_crust_mantle, &
-            iboolleft_xi_inner_core,iboolright_xi_inner_core,iboolleft_eta_inner_core,iboolright_eta_inner_core, &
-            npoin2D_faces_inner_core,npoin2D_xi_inner_core,npoin2D_eta_inner_core, &
-            iboolfaces_inner_core,iboolcorner_inner_core, &
-            iprocfrom_faces,iprocto_faces, &
-            iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-            buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-            buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector, &
-            NUMMSGS_FACES_VAL,NCORNERSCHUNKS_VAL, &
-            NPROC_XI_VAL,NPROC_ETA_VAL,NGLOB1D_RADIAL_CM, &
-            NGLOB1D_RADIAL_IC,NCHUNKS_VAL,iphase)
-
-      if(INCLUDE_CENTRAL_CUBE) then
-          if(iphase > 7 .and. iphase_CC <= 4) &
-            call assemble_MPI_central_cube(ichunk,nb_msgs_theor_in_cube,sender_from_slices_to_cube, &
-                   npoin2D_cube_from_slices,buffer_all_cube_from_slices,buffer_slices,ibool_central_cube, &
-                   receiver_cube_from_slices,ibool_inner_core,idoubling_inner_core, &
-                   ibelm_bottom_inner_core,NSPEC2D_BOTTOM_IC,accel_inner_core,NDIM,iphase_CC)
-      endif
-
-    endif
-
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
@@ -359,36 +257,33 @@
           duzdxl_plus_duxdzl = duzdxl + duxdzl
           duzdyl_plus_duydzl = duzdyl + duydzl
 
-! compute deviatoric strain
-          if (COMPUTE_AND_STORE_STRAIN_VAL) then
+          ! compute deviatoric strain
+          if (COMPUTE_AND_STORE_STRAIN) then
             if(NSPEC_CRUST_MANTLE_STRAIN_ONLY == 1) then
               ispec_strain = 1
             else
               ispec_strain = ispec
             endif
-
-!ZN beware, here the expression differs from the strain used in memory variable equation (6) in D. Komatitsch and J. Tromp 1999,
-!ZN here Brian Savage uses the engineering strain which are epsilon = 1/2*(grad U + (grad U)^T),
-!ZN where U is the displacement vector and grad the gradient operator, i.e. there is a 1/2 factor difference between the two.
-!ZN Both expressions are fine, but we need to keep in mind that if we put the 1/2 factor here there we need to remove it
-!ZN from the expression in which we use the strain later in the code.
-            templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
-            epsilondev_loc(1,i,j,k) = duxdxl - templ
-            epsilondev_loc(2,i,j,k) = duydyl - templ
+            epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl + duydyl + duzdzl)
+            epsilondev_loc(1,i,j,k) = duxdxl - epsilon_trace_over_3(i,j,k,ispec_strain)
+            epsilondev_loc(2,i,j,k) = duydyl - epsilon_trace_over_3(i,j,k,ispec_strain)
             epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
             epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
             epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
           endif
 
           ! precompute terms for attenuation if needed
-          if(ATTENUATION_VAL) then
+          if( ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
             one_minus_sum_beta_use = one_minus_sum_beta(i,j,k,ispec)
-            minus_sum_beta =  one_minus_sum_beta_use - 1.0
+            minus_sum_beta =  one_minus_sum_beta_use - 1.0_CUSTOM_REAL
+          else if( ATTENUATION_VAL ) then
+            one_minus_sum_beta_use = one_minus_sum_beta(1,1,1,ispec)
+            minus_sum_beta =  one_minus_sum_beta_use - 1.0_CUSTOM_REAL
           endif
 
-        !
-        ! compute either isotropic or anisotropic elements
-        !
+          !
+          ! compute either isotropic or anisotropic elements
+          !
 
           if(ANISOTROPIC_3D_MANTLE_VAL) then
 
@@ -447,19 +342,24 @@
 
           else
 
-        ! do not use transverse isotropy except if element is between d220 and Moho
+          ! do not use transverse isotropy except if element is between d220 and Moho
+!            if(.not. (TRANSVERSE_ISOTROPY_VAL .and. (idoubling(ispec)==IFLAG_220_80 .or. idoubling(ispec)==IFLAG_80_MOHO))) then
+
             if( .not. ispec_is_tiso(ispec) ) then
-        ! layer with no transverse isotropy, use kappav and muv
+
+              ! isotropic element
+
+              ! layer with no transverse isotropy, use kappav and muv
               kappal = kappavstore(i,j,k,ispec)
               mul = muvstore(i,j,k,ispec)
 
-        ! use unrelaxed parameters if attenuation
+              ! use unrelaxed parameters if attenuation
               if(ATTENUATION_VAL) mul = mul * one_minus_sum_beta_use
 
               lambdalplus2mul = kappal + FOUR_THIRDS * mul
               lambdal = lambdalplus2mul - 2.*mul
 
-        ! compute stress sigma
+              ! compute stress sigma
 
               sigma_xx = lambdalplus2mul*duxdxl + lambdal*duydyl_plus_duzdzl
               sigma_yy = lambdalplus2mul*duydyl + lambdal*duxdxl_plus_duzdzl
@@ -471,15 +371,17 @@
 
             else
 
-        ! use Kappa and mu from transversely isotropic model
+              ! transverse isotropic element
+
+              ! use Kappa and mu from transversely isotropic model
               kappavl = kappavstore(i,j,k,ispec)
               muvl = muvstore(i,j,k,ispec)
 
               kappahl = kappahstore(i,j,k,ispec)
               muhl = muhstore(i,j,k,ispec)
 
-        ! use unrelaxed parameters if attenuation
-        ! eta does not need to be shifted since it is a ratio
+              ! use unrelaxed parameters if attenuation
+              ! eta does not need to be shifted since it is a ratio
               if(ATTENUATION_VAL) then
                 muvl = muvl * one_minus_sum_beta_use
                 muhl = muhl * one_minus_sum_beta_use
@@ -493,8 +395,8 @@
 
               eta_aniso = eta_anisostore(i,j,k,ispec)  !!! that is  F / (A - 2 L)
 
-        ! use mesh coordinates to get theta and phi
-        ! ystore and zstore contain theta and phi
+              ! use mesh coordinates to get theta and phi
+              ! ystore and zstore contain theta and phi
 
               iglob = ibool(i,j,k,ispec)
               theta = ystore(iglob)
@@ -531,23 +433,23 @@
               etaminone = eta_aniso - 1.
               twoetaminone = 2. * eta_aniso - 1.
 
-        ! precompute some products to reduce the CPU time
+              ! precompute some products to reduce the CPU time
 
               two_eta_aniso = 2.*eta_aniso
               four_eta_aniso = 4.*eta_aniso
               six_eta_aniso = 6.*eta_aniso
 
-              two_rhovpvsq = 2.*rhovpvsq
-              two_rhovphsq = 2.*rhovphsq
+              !two_rhovpvsq = 2.*rhovpvsq
+              !two_rhovphsq = 2.*rhovphsq
               two_rhovsvsq = 2.*rhovsvsq
               two_rhovshsq = 2.*rhovshsq
 
-              four_rhovpvsq = 4.*rhovpvsq
-              four_rhovphsq = 4.*rhovphsq
+              !four_rhovpvsq = 4.*rhovpvsq
+              !four_rhovphsq = 4.*rhovphsq
               four_rhovsvsq = 4.*rhovsvsq
               four_rhovshsq = 4.*rhovshsq
 
-        ! the 21 anisotropic coefficients computed using Mathematica
+              ! the 21 anisotropic coefficients computed using Mathematica
 
              c11 = rhovphsq*sinphifour + 2.*cosphisq*sinphisq* &
                (rhovphsq*costhetasq + (eta_aniso*rhovphsq + two_rhovsvsq - two_eta_aniso*rhovsvsq)* &
@@ -654,7 +556,7 @@
               rhovpvsq*cosphisq*sinphisq*sinthetafour - &
               (eta_aniso*(rhovphsq - two_rhovsvsq)*sintwophisq*sinthetafour)/2.
 
-        ! general expression of stress tensor for full Cijkl with 21 coefficients
+             ! general expression of stress tensor for full Cijkl with 21 coefficients
 
              sigma_xx = c11*duxdxl + c16*duxdyl_plus_duydxl + c12*duydyl + &
                        c15*duzdxl_plus_duxdzl + c14*duzdyl_plus_duydzl + c13*duzdzl
@@ -678,30 +580,30 @@
 
           endif   ! end of test whether isotropic or anisotropic element
 
-        ! subtract memory variables if attenuation
-          if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
-            do i_SLS = 1,N_SLS
-              R_xx_val = R_memory(1,i_SLS,i,j,k,ispec)
-              R_yy_val = R_memory(2,i_SLS,i,j,k,ispec)
-              sigma_xx = sigma_xx - R_xx_val
-              sigma_yy = sigma_yy - R_yy_val
-              sigma_zz = sigma_zz + R_xx_val + R_yy_val
-              sigma_xy = sigma_xy - R_memory(3,i_SLS,i,j,k,ispec)
-              sigma_xz = sigma_xz - R_memory(4,i_SLS,i,j,k,ispec)
-              sigma_yz = sigma_yz - R_memory(5,i_SLS,i,j,k,ispec)
-            enddo
+          ! subtract memory variables if attenuation
+          if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
+             do i_SLS = 1,N_SLS
+                R_xx_val = R_xx(i_SLS,i,j,k,ispec)
+                R_yy_val = R_yy(i_SLS,i,j,k,ispec)
+                sigma_xx = sigma_xx - R_xx_val
+                sigma_yy = sigma_yy - R_yy_val
+                sigma_zz = sigma_zz + R_xx_val + R_yy_val
+                sigma_xy = sigma_xy - R_xy(i_SLS,i,j,k,ispec)
+                sigma_xz = sigma_xz - R_xz(i_SLS,i,j,k,ispec)
+                sigma_yz = sigma_yz - R_yz(i_SLS,i,j,k,ispec)
+             enddo
           endif
 
-        ! define symmetric components of sigma for gravity
+          ! define symmetric components of sigma for gravity
           sigma_yx = sigma_xy
           sigma_zx = sigma_xz
           sigma_zy = sigma_yz
 
-        ! compute non-symmetric terms for gravity
+          ! compute non-symmetric terms for gravity
           if(GRAVITY_VAL) then
 
-        ! use mesh coordinates to get theta and phi
-        ! x y and z contain r theta and phi
+            ! use mesh coordinates to get theta and phi
+            ! x y and z contain r theta and phi
 
             iglob = ibool(i,j,k,ispec)
             radius = dble(xstore(iglob))
@@ -713,21 +615,21 @@
             cos_phi = dcos(dble(phi))
             sin_phi = dsin(dble(phi))
 
-        ! get g, rho and dg/dr=dg
-        ! spherical components of the gravitational acceleration
-        ! for efficiency replace with lookup table every 100 m in radial direction
+            ! get g, rho and dg/dr=dg
+            ! spherical components of the gravitational acceleration
+            ! for efficiency replace with lookup table every 100 m in radial direction
             int_radius = nint(radius * R_EARTH_KM * 10.d0)
             minus_g = minus_gravity_table(int_radius)
             minus_dg = minus_deriv_gravity_table(int_radius)
             rho = density_table(int_radius)
 
-        ! Cartesian components of the gravitational acceleration
+            ! Cartesian components of the gravitational acceleration
             gxl = minus_g*sin_theta*cos_phi
             gyl = minus_g*sin_theta*sin_phi
             gzl = minus_g*cos_theta
 
-        ! Cartesian components of gradient of gravitational acceleration
-        ! obtained from spherical components
+            ! Cartesian components of gradient of gravitational acceleration
+            ! obtained from spherical components
 
             minus_g_over_radius = minus_g / radius
             minus_dg_plus_g_over_radius = minus_dg - minus_g_over_radius
@@ -746,15 +648,15 @@
 
             iglob = ibool(i,j,k,ispec)
 
-        ! distinguish between single and double precision for reals
+            ! distinguish between single and double precision for reals
             if(CUSTOM_REAL == SIZE_REAL) then
 
-        ! get displacement and multiply by density to compute G tensor
+              ! get displacement and multiply by density to compute G tensor
               sx_l = rho * dble(displ_crust_mantle(1,iglob))
               sy_l = rho * dble(displ_crust_mantle(2,iglob))
               sz_l = rho * dble(displ_crust_mantle(3,iglob))
 
-        ! compute G tensor from s . g and add to sigma (not symmetric)
+              ! compute G tensor from s . g and add to sigma (not symmetric)
               sigma_xx = sigma_xx + sngl(sy_l*gyl + sz_l*gzl)
               sigma_yy = sigma_yy + sngl(sx_l*gxl + sz_l*gzl)
               sigma_zz = sigma_zz + sngl(sx_l*gxl + sy_l*gyl)
@@ -768,7 +670,7 @@
               sigma_yz = sigma_yz - sngl(sy_l * gzl)
               sigma_zy = sigma_zy - sngl(sz_l * gyl)
 
-        ! precompute vector
+              ! precompute vector
               factor = dble(jacobianl) * wgll_cube(i,j,k)
               rho_s_H(1,i,j,k) = sngl(factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl))
               rho_s_H(2,i,j,k) = sngl(factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl))
@@ -776,12 +678,12 @@
 
             else
 
-        ! get displacement and multiply by density to compute G tensor
+              ! get displacement and multiply by density to compute G tensor
               sx_l = rho * displ_crust_mantle(1,iglob)
               sy_l = rho * displ_crust_mantle(2,iglob)
               sz_l = rho * displ_crust_mantle(3,iglob)
 
-        ! compute G tensor from s . g and add to sigma (not symmetric)
+              ! compute G tensor from s . g and add to sigma (not symmetric)
               sigma_xx = sigma_xx + sy_l*gyl + sz_l*gzl
               sigma_yy = sigma_yy + sx_l*gxl + sz_l*gzl
               sigma_zz = sigma_zz + sx_l*gxl + sy_l*gyl
@@ -795,7 +697,7 @@
               sigma_yz = sigma_yz - sy_l * gzl
               sigma_zy = sigma_zy - sz_l * gyl
 
-        ! precompute vector
+              ! precompute vector
               factor = jacobianl * wgll_cube(i,j,k)
               rho_s_H(1,i,j,k) = factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl)
               rho_s_H(2,i,j,k) = factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl)
@@ -805,18 +707,18 @@
 
           endif  ! end of section with gravity terms
 
-        ! form dot product with test vector, non-symmetric form
-        tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl) ! this goes to accel_x
-        tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl) ! this goes to accel_y
-        tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl) ! this goes to accel_z
+          ! form dot product with test vector, non-symmetric form
+          tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl)
+          tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl)
+          tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl)
 
-        tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl) ! this goes to accel_x
-        tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl) ! this goes to accel_y
-        tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl) ! this goes to accel_z
+          tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl)
+          tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl)
+          tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl)
 
-        tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl) ! this goes to accel_x
-        tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl) ! this goes to accel_y
-        tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl) ! this goes to accel_z
+          tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl)
+          tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl)
+          tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl)
 
         enddo ! NGLLX
       enddo ! NGLLY
@@ -873,7 +775,7 @@
       enddo ! NGLLY
     enddo ! NGLLZ
 
-! sum contributions from each element to the global mesh and add gravity terms
+    ! sum contributions from each element to the global mesh and add gravity terms
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
@@ -900,50 +802,70 @@
 ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
 ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
 
-    if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+    if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
-       call compute_element_strain_att_noDev(ispec,NGLOB_CRUST_MANTLE,NSPEC_CRUST_MANTLE,displ_crust_mantle,veloc_crust_mantle,&
-                                             deltat,hprime_xx,hprime_yy,hprime_zz,ibool,&
-                                             xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz,epsilondev_loc_nplus1)
-
 ! use Runge-Kutta scheme to march in time
       do i_SLS = 1,N_SLS
-        do i_memory = 1,5
 
 ! get coefficients for that standard linear solid
 ! IMPROVE we use mu_v here even if there is some anisotropy
 ! IMPROVE we should probably use an average value instead
 
-          ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-
-          factor_common_c44_muv = factor_common(i_SLS,:,:,:,ispec)
+        ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
+        if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL) then
           if(ANISOTROPIC_3D_MANTLE_VAL) then
-            factor_common_c44_muv = factor_common_c44_muv * c44store(:,:,:,ispec)
+            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * c44store(:,:,:,ispec)
           else
-            factor_common_c44_muv = factor_common_c44_muv * muvstore(:,:,:,ispec)
+            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * muvstore(:,:,:,ispec)
           endif
+        else
+          if(ANISOTROPIC_3D_MANTLE_VAL) then
+            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * c44store(:,:,:,ispec)
+          else
+            factor_common_c44_muv(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * muvstore(:,:,:,ispec)
+          endif
+        endif
 
+!        do i_memory = 1,5
 !          R_memory(i_memory,i_SLS,:,:,:,ispec) = alphaval(i_SLS) * &
 !                    R_memory(i_memory,i_SLS,:,:,:,ispec) + &
 !                    factor_common_c44_muv * &
-!                    (betaval(i_SLS) * epsilondev_loc(i_memory,:,:,:) + &
-!                    gammaval(i_SLS) * epsilondev_loc_nplus1(i_memory,:,:,:))
+!                    (betaval(i_SLS) * epsilondev(i_memory,:,:,:,ispec) + &
+!                    gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
+!        enddo
 
-         if(USE_LDDRK)then
-           R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec) = ALPHA_LDDRK(istage) * R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec) + &
-                    deltat * (factor_common_c44_muv(:,:,:)*epsilondev_loc(i_memory,:,:,:) - &
-                              R_memory(i_memory,i_SLS,:,:,:,ispec)*(1._CUSTOM_REAL/tau_sigma_CUSTOM_REAL(i_SLS)))
-           R_memory(i_memory,i_SLS,:,:,:,ispec) = R_memory(i_memory,i_SLS,:,:,:,ispec) + &
-                                               BETA_LDDRK(istage) * R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec)
-         else
-           R_memory(i_memory,i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_memory(i_memory,i_SLS,:,:,:,ispec) &
-              + factor_common_c44_muv(:,:,:) &
-              * (betaval(i_SLS) * epsilondev_loc(i_memory,:,:,:) + gammaval(i_SLS) * epsilondev_loc_nplus1(i_memory,:,:,:))
-         endif
+        R_xx(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xx(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xx(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(1,:,:,:))
 
-        enddo
+        R_yy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yy(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_yy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(2,:,:,:))
+
+        R_xy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xy(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(3,:,:,:))
+
+        R_xz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xz(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(4,:,:,:))
+
+        R_yz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yz(i_SLS,:,:,:,ispec) + factor_common_c44_muv(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_yz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(5,:,:,:))
+
       enddo
+    endif
 
+    ! save deviatoric strain for Runge-Kutta scheme
+    if(COMPUTE_AND_STORE_STRAIN) then
+      !epsilondev(:,:,:,:,ispec) = epsilondev_loc(:,:,:,:)
+      do k=1,NGLLZ
+        do j=1,NGLLY
+          do i=1,NGLLX
+            epsilondev_xx(i,j,k,ispec) = epsilondev_loc(1,i,j,k)
+            epsilondev_yy(i,j,k,ispec) = epsilondev_loc(2,i,j,k)
+            epsilondev_xy(i,j,k,ispec) = epsilondev_loc(3,i,j,k)
+            epsilondev_xz(i,j,k,ispec) = epsilondev_loc(4,i,j,k)
+            epsilondev_yz(i,j,k,ispec) = epsilondev_loc(5,i,j,k)
+          enddo
+        enddo
+      enddo
     endif
 
   enddo   ! spectral element loop NSPEC_CRUST_MANTLE

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_elastic.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_elastic.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_elastic.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -383,7 +383,7 @@
       else
         ! on GPU
         ! crust mantle
-        call assemble_MPI_vector_send_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_vector_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                       buffer_send_vector_crust_mantle,buffer_recv_vector_crust_mantle, &
                       num_interfaces_crust_mantle,max_nibool_interfaces_cm, &
                       nibool_interfaces_crust_mantle,&
@@ -392,7 +392,7 @@
                       IREGION_CRUST_MANTLE, &
                       1) ! <-- 1 == fwd accel
         ! inner core
-        call assemble_MPI_vector_send_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_vector_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                       buffer_send_vector_inner_core,buffer_recv_vector_inner_core, &
                       num_interfaces_inner_core,max_nibool_interfaces_ic, &
                       nibool_interfaces_inner_core,&
@@ -426,7 +426,7 @@
         else
           ! on GPU
           ! crust mantle
-          call assemble_MPI_vector_send_cuda(NPROCTOT_VAL, &
+          call assemble_MPI_vector_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                       b_buffer_send_vector_cm,b_buffer_recv_vector_cm, &
                       num_interfaces_crust_mantle,max_nibool_interfaces_cm, &
                       nibool_interfaces_crust_mantle,&
@@ -435,7 +435,7 @@
                       IREGION_CRUST_MANTLE, &
                       3) ! <-- 3 == adjoint b_accel
           ! inner core
-          call assemble_MPI_vector_send_cuda(NPROCTOT_VAL, &
+          call assemble_MPI_vector_send_cuda(Mesh_pointer,NPROCTOT_VAL, &
                       b_buffer_send_vector_inner_core,b_buffer_recv_vector_inner_core, &
                       num_interfaces_inner_core,max_nibool_interfaces_ic, &
                       nibool_interfaces_inner_core,&
@@ -467,14 +467,14 @@
       else
         ! on GPU
         ! crust mantle
-        call assemble_MPI_vector_write_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_vector_write_cuda(Mesh_pointer,NPROCTOT_VAL, &
                             buffer_recv_vector_crust_mantle, &
                             num_interfaces_crust_mantle,max_nibool_interfaces_cm, &
                             request_send_vector_cm,request_recv_vector_cm, &
                             IREGION_CRUST_MANTLE, &
                             1) ! <-- 1 == fwd accel
         ! inner core
-        call assemble_MPI_vector_write_cuda(NPROCTOT_VAL, &
+        call assemble_MPI_vector_write_cuda(Mesh_pointer,NPROCTOT_VAL, &
                             buffer_recv_vector_inner_core, &
                             num_interfaces_inner_core,max_nibool_interfaces_ic, &
                             request_send_vector_ic,request_recv_vector_ic, &
@@ -506,14 +506,14 @@
         else
           ! on GPU
           ! crust mantle
-          call assemble_MPI_vector_write_cuda(NPROCTOT_VAL, &
+          call assemble_MPI_vector_write_cuda(Mesh_pointer,NPROCTOT_VAL, &
                             b_buffer_recv_vector_cm, &
                             num_interfaces_crust_mantle,max_nibool_interfaces_cm, &
                             b_request_send_vector_cm,b_request_recv_vector_cm, &
                             IREGION_CRUST_MANTLE, &
                             3) ! <-- 3 == adjoint b_accel
           ! inner core
-          call assemble_MPI_vector_write_cuda(NPROCTOT_VAL,&
+          call assemble_MPI_vector_write_cuda(Mesh_pointer,NPROCTOT_VAL,&
                             b_buffer_recv_vector_inner_core, &
                             num_interfaces_inner_core,max_nibool_interfaces_ic, &
                             b_request_send_vector_ic,b_request_recv_vector_ic, &

Deleted: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,713 +0,0 @@
-!=====================================================================
-!
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
-!          --------------------------------------------------
-!
-!          Main authors: Dimitri Komatitsch and Jeroen Tromp
-!                        Princeton University, USA
-!             and CNRS / INRIA / University of Pau, France
-! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
-!
-! 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.
-!
-!=====================================================================
-
-  subroutine compute_forces_inner_core( NSPEC,NGLOB,NSPEC_ATT, &
-                                        deltat, &
-                                        displ_inner_core, &
-                                        veloc_inner_core, &
-                                        accel_inner_core, &
-                                        phase_is_inner, &
-                                        R_xx,R_yy,R_xy,R_xz,R_yz, &
-                                        epsilondev_xx,epsilondev_yy,epsilondev_xy, &
-                                        epsilondev_xz,epsilondev_yz, &
-                                        epsilon_trace_over_3,&
-                                        alphaval,betaval,gammaval,factor_common, &
-                                        vx,vy,vz,vnspec)
-
-  use constants_solver
-
-  use specfem_par,only: &
-    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-    minus_gravity_table,density_table,minus_deriv_gravity_table
-
-  use specfem_par_innercore,only: &
-    xstore => xstore_inner_core,ystore => ystore_inner_core,zstore => zstore_inner_core, &
-    xix => xix_inner_core,xiy => xiy_inner_core,xiz => xiz_inner_core, &
-    etax => etax_inner_core,etay => etay_inner_core,etaz => etaz_inner_core, &
-    gammax => gammax_inner_core,gammay => gammay_inner_core,gammaz => gammaz_inner_core, &
-    kappavstore => kappavstore_inner_core, &
-    muvstore => muvstore_inner_core, &
-    c11store => c11store_inner_core,c12store => c12store_inner_core,c13store => c13store_inner_core, &
-    c33store => c33store_inner_core,c44store => c44store_inner_core, &
-    ibool => ibool_inner_core,idoubling => idoubling_inner_core, &
-    one_minus_sum_beta => one_minus_sum_beta_inner_core, &
-    phase_ispec_inner => phase_ispec_inner_inner_core, &
-    nspec_outer => nspec_outer_inner_core, &
-    nspec_inner => nspec_inner_inner_core
-
-  implicit none
-
-  integer :: NSPEC,NGLOB,NSPEC_ATT
-
-  ! time step
-  real(kind=CUSTOM_REAL) deltat
-
-  ! displacement, velocity and acceleration
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: displ_inner_core
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: veloc_inner_core
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: accel_inner_core
-
-  ! for attenuation
-  ! memory variables R_ij are stored at the local rather than global level
-  ! to allow for optimization of cache access by compiler
-  ! variable lengths for factor_common and one_minus_sum_beta
-
-  ! variable sized array variables
-  integer vx, vy, vz, vnspec
-
-  real(kind=CUSTOM_REAL), dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
-  real(kind=CUSTOM_REAL), dimension(N_SLS) :: alphaval,betaval,gammaval
-
-  real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_ATT) :: R_xx,R_yy,R_xy,R_xz,R_yz
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
-    epsilondev_xx,epsilondev_yy,epsilondev_xy,epsilondev_xz,epsilondev_yz
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: epsilon_trace_over_3
-
-  ! inner/outer element run flag
-  logical :: phase_is_inner
-
-  ! local parameters
-
-  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: factor_common_use
-  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
-  integer i_SLS
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
-    tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3
-
-  integer ispec,iglob,ispec_strain
-  integer i,j,k,l
-
-  real(kind=CUSTOM_REAL) xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl
-  real(kind=CUSTOM_REAL) duxdxl,duxdyl,duxdzl,duydxl,duydyl,duydzl,duzdxl,duzdyl,duzdzl
-
-  real(kind=CUSTOM_REAL) duxdxl_plus_duydyl,duxdxl_plus_duzdzl,duydyl_plus_duzdzl
-  real(kind=CUSTOM_REAL) duxdyl_plus_duydxl,duzdxl_plus_duxdzl,duzdyl_plus_duydzl
-
-  real(kind=CUSTOM_REAL) sigma_xx,sigma_yy,sigma_zz,sigma_xy,sigma_xz,sigma_yz
-
-  real(kind=CUSTOM_REAL) hp1,hp2,hp3
-  real(kind=CUSTOM_REAL) fac1,fac2,fac3
-  real(kind=CUSTOM_REAL) lambdal,mul,lambdalplus2mul
-  real(kind=CUSTOM_REAL) kappal
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: sum_terms
-
-  real(kind=CUSTOM_REAL) minus_sum_beta
-  real(kind=CUSTOM_REAL) c11l,c33l,c12l,c13l,c44l
-
-  real(kind=CUSTOM_REAL) tempx1l,tempx2l,tempx3l
-  real(kind=CUSTOM_REAL) tempy1l,tempy2l,tempy3l
-  real(kind=CUSTOM_REAL) tempz1l,tempz2l,tempz3l
-
-  real(kind=CUSTOM_REAL) tempx1l_att,tempx2l_att,tempx3l_att
-  real(kind=CUSTOM_REAL) tempy1l_att,tempy2l_att,tempy3l_att
-  real(kind=CUSTOM_REAL) tempz1l_att,tempz2l_att,tempz3l_att
-
-  real(kind=CUSTOM_REAL) duxdxl_att,duxdyl_att,duxdzl_att,duydxl_att
-  real(kind=CUSTOM_REAL) duydyl_att,duydzl_att,duzdxl_att,duzdyl_att,duzdzl_att;
-  real(kind=CUSTOM_REAL) duxdyl_plus_duydxl_att,duzdxl_plus_duxdzl_att,duzdyl_plus_duydzl_att;
-
-  ! for gravity
-  double precision radius,rho,minus_g,minus_dg
-  double precision minus_g_over_radius,minus_dg_plus_g_over_radius
-  double precision cos_theta,sin_theta,cos_phi,sin_phi
-  double precision cos_theta_sq,sin_theta_sq,cos_phi_sq,sin_phi_sq
-  double precision theta,phi,factor,gxl,gyl,gzl,sx_l,sy_l,sz_l
-  double precision Hxxl,Hyyl,Hzzl,Hxyl,Hxzl,Hyzl
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: rho_s_H
-  real(kind=CUSTOM_REAL) sigma_yx,sigma_zx,sigma_zy
-  integer :: int_radius
-
-!  integer :: computed_elements
-  integer :: num_elements,ispec_p
-  integer :: iphase
-
-! ****************************************************
-!   big loop over all spectral elements in the solid
-! ****************************************************
-
-!  computed_elements = 0
-  if( .not. phase_is_inner ) then
-    iphase = 1
-    num_elements = nspec_outer
-  else
-    iphase = 2
-    num_elements = nspec_inner
-  endif
-
-  do ispec_p = 1,num_elements
-
-    ispec = phase_ispec_inner(ispec_p,iphase)
-
-    ! only compute element which belong to current phase (inner or outer elements)
-
-    ! exclude fictitious elements in central cube
-    if(idoubling(ispec) /= IFLAG_IN_FICTITIOUS_CUBE) then
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempx2l = 0._CUSTOM_REAL
-          tempx3l = 0._CUSTOM_REAL
-
-          tempy1l = 0._CUSTOM_REAL
-          tempy2l = 0._CUSTOM_REAL
-          tempy3l = 0._CUSTOM_REAL
-
-          tempz1l = 0._CUSTOM_REAL
-          tempz2l = 0._CUSTOM_REAL
-          tempz3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            hp1 = hprime_xx(i,l)
-            iglob = ibool(l,j,k,ispec)
-            tempx1l = tempx1l + displ_inner_core(1,iglob)*hp1
-            tempy1l = tempy1l + displ_inner_core(2,iglob)*hp1
-            tempz1l = tempz1l + displ_inner_core(3,iglob)*hp1
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-            hp2 = hprime_yy(j,l)
-            iglob = ibool(i,l,k,ispec)
-            tempx2l = tempx2l + displ_inner_core(1,iglob)*hp2
-            tempy2l = tempy2l + displ_inner_core(2,iglob)*hp2
-            tempz2l = tempz2l + displ_inner_core(3,iglob)*hp2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-            hp3 = hprime_zz(k,l)
-            iglob = ibool(i,j,l,ispec)
-            tempx3l = tempx3l + displ_inner_core(1,iglob)*hp3
-            tempy3l = tempy3l + displ_inner_core(2,iglob)*hp3
-            tempz3l = tempz3l + displ_inner_core(3,iglob)*hp3
-          enddo
-
-          if( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
-             ! temporary variables used for fixing attenuation in a consistent way
-
-             tempx1l_att = tempx1l
-             tempx2l_att = tempx2l
-             tempx3l_att = tempx3l
-
-             tempy1l_att = tempy1l
-             tempy2l_att = tempy2l
-             tempy3l_att = tempy3l
-
-             tempz1l_att = tempz1l
-             tempz2l_att = tempz2l
-             tempz3l_att = tempz3l
-
-             if(ATTENUATION_NEW_VAL) then
-                ! takes new routines
-                ! use first order Taylor expansion of displacement for local storage of stresses
-                ! at this current time step, to fix attenuation in a consistent way
-                do l=1,NGLLX
-                   hp1 = hprime_xx(i,l)
-                   iglob = ibool(l,j,k,ispec)
-                   tempx1l_att = tempx1l_att + deltat*veloc_inner_core(1,iglob)*hp1
-                   tempy1l_att = tempy1l_att + deltat*veloc_inner_core(2,iglob)*hp1
-                   tempz1l_att = tempz1l_att + deltat*veloc_inner_core(3,iglob)*hp1
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-                   hp2 = hprime_yy(j,l)
-                   iglob = ibool(i,l,k,ispec)
-                   tempx2l_att = tempx2l_att + deltat*veloc_inner_core(1,iglob)*hp2
-                   tempy2l_att = tempy2l_att + deltat*veloc_inner_core(2,iglob)*hp2
-                   tempz2l_att = tempz2l_att + deltat*veloc_inner_core(3,iglob)*hp2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-                   hp3 = hprime_zz(k,l)
-                   iglob = ibool(i,j,l,ispec)
-                   tempx3l_att = tempx3l_att + deltat*veloc_inner_core(1,iglob)*hp3
-                   tempy3l_att = tempy3l_att + deltat*veloc_inner_core(2,iglob)*hp3
-                   tempz3l_att = tempz3l_att + deltat*veloc_inner_core(3,iglob)*hp3
-                enddo
-             endif
-          endif
-
-!         get derivatives of ux, uy and uz with respect to x, y and z
-
-          xixl = xix(i,j,k,ispec)
-          xiyl = xiy(i,j,k,ispec)
-          xizl = xiz(i,j,k,ispec)
-          etaxl = etax(i,j,k,ispec)
-          etayl = etay(i,j,k,ispec)
-          etazl = etaz(i,j,k,ispec)
-          gammaxl = gammax(i,j,k,ispec)
-          gammayl = gammay(i,j,k,ispec)
-          gammazl = gammaz(i,j,k,ispec)
-
-! compute the jacobian
-          jacobianl = 1._CUSTOM_REAL / (xixl*(etayl*gammazl-etazl*gammayl) &
-                        - xiyl*(etaxl*gammazl-etazl*gammaxl) &
-                        + xizl*(etaxl*gammayl-etayl*gammaxl))
-
-          duxdxl = xixl*tempx1l + etaxl*tempx2l + gammaxl*tempx3l
-          duxdyl = xiyl*tempx1l + etayl*tempx2l + gammayl*tempx3l
-          duxdzl = xizl*tempx1l + etazl*tempx2l + gammazl*tempx3l
-
-          duydxl = xixl*tempy1l + etaxl*tempy2l + gammaxl*tempy3l
-          duydyl = xiyl*tempy1l + etayl*tempy2l + gammayl*tempy3l
-          duydzl = xizl*tempy1l + etazl*tempy2l + gammazl*tempy3l
-
-          duzdxl = xixl*tempz1l + etaxl*tempz2l + gammaxl*tempz3l
-          duzdyl = xiyl*tempz1l + etayl*tempz2l + gammayl*tempz3l
-          duzdzl = xizl*tempz1l + etazl*tempz2l + gammazl*tempz3l
-
-! precompute some sums to save CPU time
-          duxdxl_plus_duydyl = duxdxl + duydyl
-          duxdxl_plus_duzdzl = duxdxl + duzdzl
-          duydyl_plus_duzdzl = duydyl + duzdzl
-          duxdyl_plus_duydxl = duxdyl + duydxl
-          duzdxl_plus_duxdzl = duzdxl + duxdzl
-          duzdyl_plus_duydzl = duzdyl + duydzl
-
-          if( ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL ) then
-             ! temporary variables used for fixing attenuation in a consistent way
-             duxdxl_att = xixl*tempx1l_att + etaxl*tempx2l_att + gammaxl*tempx3l_att
-             duxdyl_att = xiyl*tempx1l_att + etayl*tempx2l_att + gammayl*tempx3l_att
-             duxdzl_att = xizl*tempx1l_att + etazl*tempx2l_att + gammazl*tempx3l_att
-
-             duydxl_att = xixl*tempy1l_att + etaxl*tempy2l_att + gammaxl*tempy3l_att
-             duydyl_att = xiyl*tempy1l_att + etayl*tempy2l_att + gammayl*tempy3l_att
-             duydzl_att = xizl*tempy1l_att + etazl*tempy2l_att + gammazl*tempy3l_att
-
-             duzdxl_att = xixl*tempz1l_att + etaxl*tempz2l_att + gammaxl*tempz3l_att
-             duzdyl_att = xiyl*tempz1l_att + etayl*tempz2l_att + gammayl*tempz3l_att
-             duzdzl_att = xizl*tempz1l_att + etazl*tempz2l_att + gammazl*tempz3l_att
-
-             ! precompute some sums to save CPU time
-             duxdyl_plus_duydxl_att = duxdyl_att + duydxl_att
-             duzdxl_plus_duxdzl_att = duzdxl_att + duxdzl_att
-             duzdyl_plus_duydzl_att = duzdyl_att + duydzl_att
-
-             ! compute deviatoric strain
-             if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
-                ispec_strain = 1
-             else
-                ispec_strain = ispec
-             endif
-             epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl_att + duydyl_att + duzdzl_att)
-             epsilondev_loc(1,i,j,k) = duxdxl_att - epsilon_trace_over_3(i,j,k,ispec_strain)
-             epsilondev_loc(2,i,j,k) = duydyl_att - epsilon_trace_over_3(i,j,k,ispec_strain)
-             epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl_att
-             epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl_att
-             epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl_att
-          else
-             ! compute deviatoric strain
-             if (COMPUTE_AND_STORE_STRAIN_VAL) then
-                if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
-                   ispec_strain = 1
-                else
-                   ispec_strain = ispec
-                endif
-                epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl + duydyl + duzdzl)
-                epsilondev_loc(1,i,j,k) = duxdxl - epsilon_trace_over_3(i,j,k,ispec_strain)
-                epsilondev_loc(2,i,j,k) = duydyl - epsilon_trace_over_3(i,j,k,ispec_strain)
-                epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
-                epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
-                epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
-             endif
-          endif
-
-          ! precompute terms for attenuation if needed
-          if( ATTENUATION_VAL ) then
-            if( USE_3D_ATTENUATION_ARRAYS ) then
-              minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
-            else
-              minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
-            endif
-          endif
-
-          if(ANISOTROPIC_INNER_CORE_VAL) then
-
-! elastic tensor for hexagonal symmetry in reduced notation:
-!
-!      c11 c12 c13  0   0        0
-!      c12 c11 c13  0   0        0
-!      c13 c13 c33  0   0        0
-!       0   0   0  c44  0        0
-!       0   0   0   0  c44       0
-!       0   0   0   0   0  (c11-c12)/2
-!
-!       in terms of the A, C, L, N and F of Love (1927):
-!
-!       c11 = A
-!       c12 = A-2N
-!       c13 = F
-!       c33 = C
-!       c44 = L
-
-            c11l = c11store(i,j,k,ispec)
-            c12l = c12store(i,j,k,ispec)
-            c13l = c13store(i,j,k,ispec)
-            c33l = c33store(i,j,k,ispec)
-            c44l = c44store(i,j,k,ispec)
-
-! use unrelaxed parameters if attenuation
-            if(ATTENUATION_VAL) then
-              mul = muvstore(i,j,k,ispec)
-              c11l = c11l + FOUR_THIRDS * minus_sum_beta * mul
-              c12l = c12l - TWO_THIRDS * minus_sum_beta * mul
-              c13l = c13l - TWO_THIRDS * minus_sum_beta * mul
-              c33l = c33l + FOUR_THIRDS * minus_sum_beta * mul
-              c44l = c44l + minus_sum_beta * mul
-            endif
-
-            sigma_xx = c11l*duxdxl + c12l*duydyl + c13l*duzdzl
-            sigma_yy = c12l*duxdxl + c11l*duydyl + c13l*duzdzl
-            sigma_zz = c13l*duxdxl + c13l*duydyl + c33l*duzdzl
-            sigma_xy = 0.5*(c11l-c12l)*duxdyl_plus_duydxl
-            sigma_xz = c44l*duzdxl_plus_duxdzl
-            sigma_yz = c44l*duzdyl_plus_duydzl
-          else
-
-! inner core with no anisotropy, use kappav and muv for instance
-! layer with no anisotropy, use kappav and muv for instance
-            kappal = kappavstore(i,j,k,ispec)
-            mul = muvstore(i,j,k,ispec)
-
-            ! use unrelaxed parameters if attenuation
-            if( ATTENUATION_VAL ) then
-              if( USE_3D_ATTENUATION_ARRAYS ) then
-                mul = mul * one_minus_sum_beta(i,j,k,ispec)
-              else
-                mul = mul * one_minus_sum_beta(1,1,1,ispec)
-              endif
-            endif
-
-            lambdalplus2mul = kappal + FOUR_THIRDS * mul
-            lambdal = lambdalplus2mul - 2.*mul
-
-! compute stress sigma
-
-            sigma_xx = lambdalplus2mul*duxdxl + lambdal*duydyl_plus_duzdzl
-            sigma_yy = lambdalplus2mul*duydyl + lambdal*duxdxl_plus_duzdzl
-            sigma_zz = lambdalplus2mul*duzdzl + lambdal*duxdxl_plus_duydyl
-
-            sigma_xy = mul*duxdyl_plus_duydxl
-            sigma_xz = mul*duzdxl_plus_duxdzl
-            sigma_yz = mul*duzdyl_plus_duydzl
-
-          endif
-
-! subtract memory variables if attenuation
-          if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. ) ) then
-            do i_SLS = 1,N_SLS
-              R_xx_val = R_xx(i_SLS,i,j,k,ispec)
-              R_yy_val = R_yy(i_SLS,i,j,k,ispec)
-              sigma_xx = sigma_xx - R_xx_val
-              sigma_yy = sigma_yy - R_yy_val
-              sigma_zz = sigma_zz + R_xx_val + R_yy_val
-              sigma_xy = sigma_xy - R_xy(i_SLS,i,j,k,ispec)
-              sigma_xz = sigma_xz - R_xz(i_SLS,i,j,k,ispec)
-              sigma_yz = sigma_yz - R_yz(i_SLS,i,j,k,ispec)
-            enddo
-          endif
-
-! define symmetric components of sigma for gravity
-          sigma_yx = sigma_xy
-          sigma_zx = sigma_xz
-          sigma_zy = sigma_yz
-
-! compute non-symmetric terms for gravity
-          if(GRAVITY_VAL) then
-
-! use mesh coordinates to get theta and phi
-! x y and z contain r theta and phi
-
-            iglob = ibool(i,j,k,ispec)
-            radius = dble(xstore(iglob))
-            theta = dble(ystore(iglob))
-            phi = dble(zstore(iglob))
-
-! make sure radius is never zero even for points at center of cube
-! because we later divide by radius
-            if(radius < 100.d0 / R_EARTH) radius = 100.d0 / R_EARTH
-
-            cos_theta = dcos(theta)
-            sin_theta = dsin(theta)
-            cos_phi = dcos(phi)
-            sin_phi = dsin(phi)
-
-! get g, rho and dg/dr=dg
-! spherical components of the gravitational acceleration
-! for efficiency replace with lookup table every 100 m in radial direction
-! make sure we never use zero for point exactly at the center of the Earth
-            int_radius = max(1,nint(radius * R_EARTH_KM * 10.d0))
-            minus_g = minus_gravity_table(int_radius)
-            minus_dg = minus_deriv_gravity_table(int_radius)
-            rho = density_table(int_radius)
-
-! Cartesian components of the gravitational acceleration
-            gxl = minus_g*sin_theta*cos_phi
-            gyl = minus_g*sin_theta*sin_phi
-            gzl = minus_g*cos_theta
-
-! Cartesian components of gradient of gravitational acceleration
-! obtained from spherical components
-
-            minus_g_over_radius = minus_g / radius
-            minus_dg_plus_g_over_radius = minus_dg - minus_g_over_radius
-
-            cos_theta_sq = cos_theta**2
-            sin_theta_sq = sin_theta**2
-            cos_phi_sq = cos_phi**2
-            sin_phi_sq = sin_phi**2
-
-            Hxxl = minus_g_over_radius*(cos_phi_sq*cos_theta_sq + sin_phi_sq) + cos_phi_sq*minus_dg*sin_theta_sq
-            Hyyl = minus_g_over_radius*(cos_phi_sq + cos_theta_sq*sin_phi_sq) + minus_dg*sin_phi_sq*sin_theta_sq
-            Hzzl = cos_theta_sq*minus_dg + minus_g_over_radius*sin_theta_sq
-            Hxyl = cos_phi*minus_dg_plus_g_over_radius*sin_phi*sin_theta_sq
-            Hxzl = cos_phi*cos_theta*minus_dg_plus_g_over_radius*sin_theta
-            Hyzl = cos_theta*minus_dg_plus_g_over_radius*sin_phi*sin_theta
-
-            iglob = ibool(i,j,k,ispec)
-
-! distinguish between single and double precision for reals
-            if(CUSTOM_REAL == SIZE_REAL) then
-
-! get displacement and multiply by density to compute G tensor
-              sx_l = rho * dble(displ_inner_core(1,iglob))
-              sy_l = rho * dble(displ_inner_core(2,iglob))
-              sz_l = rho * dble(displ_inner_core(3,iglob))
-
-! compute G tensor from s . g and add to sigma (not symmetric)
-              sigma_xx = sigma_xx + sngl(sy_l*gyl + sz_l*gzl)
-              sigma_yy = sigma_yy + sngl(sx_l*gxl + sz_l*gzl)
-              sigma_zz = sigma_zz + sngl(sx_l*gxl + sy_l*gyl)
-
-              sigma_xy = sigma_xy - sngl(sx_l * gyl)
-              sigma_yx = sigma_yx - sngl(sy_l * gxl)
-
-              sigma_xz = sigma_xz - sngl(sx_l * gzl)
-              sigma_zx = sigma_zx - sngl(sz_l * gxl)
-
-              sigma_yz = sigma_yz - sngl(sy_l * gzl)
-              sigma_zy = sigma_zy - sngl(sz_l * gyl)
-
-! precompute vector
-              factor = dble(jacobianl) * wgll_cube(i,j,k)
-              rho_s_H(1,i,j,k) = sngl(factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl))
-              rho_s_H(2,i,j,k) = sngl(factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl))
-              rho_s_H(3,i,j,k) = sngl(factor * (sx_l * Hxzl + sy_l * Hyzl + sz_l * Hzzl))
-
-            else
-
-! get displacement and multiply by density to compute G tensor
-              sx_l = rho * displ_inner_core(1,iglob)
-              sy_l = rho * displ_inner_core(2,iglob)
-              sz_l = rho * displ_inner_core(3,iglob)
-
-! compute G tensor from s . g and add to sigma (not symmetric)
-              sigma_xx = sigma_xx + sy_l*gyl + sz_l*gzl
-              sigma_yy = sigma_yy + sx_l*gxl + sz_l*gzl
-              sigma_zz = sigma_zz + sx_l*gxl + sy_l*gyl
-
-              sigma_xy = sigma_xy - sx_l * gyl
-              sigma_yx = sigma_yx - sy_l * gxl
-
-              sigma_xz = sigma_xz - sx_l * gzl
-              sigma_zx = sigma_zx - sz_l * gxl
-
-              sigma_yz = sigma_yz - sy_l * gzl
-              sigma_zy = sigma_zy - sz_l * gyl
-
-! precompute vector
-              factor = jacobianl * wgll_cube(i,j,k)
-              rho_s_H(1,i,j,k) = factor * (sx_l * Hxxl + sy_l * Hxyl + sz_l * Hxzl)
-              rho_s_H(2,i,j,k) = factor * (sx_l * Hxyl + sy_l * Hyyl + sz_l * Hyzl)
-              rho_s_H(3,i,j,k) = factor * (sx_l * Hxzl + sy_l * Hyzl + sz_l * Hzzl)
-
-            endif
-
-          endif  ! end of section with gravity terms
-
-! form dot product with test vector, non-symmetric form
-
-          tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl)
-          tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl)
-          tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl)
-
-          tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl)
-          tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl)
-          tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl)
-
-          tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl)
-          tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl)
-          tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl)
-
-        enddo
-      enddo
-    enddo
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempy1l = 0._CUSTOM_REAL
-          tempz1l = 0._CUSTOM_REAL
-
-          tempx2l = 0._CUSTOM_REAL
-          tempy2l = 0._CUSTOM_REAL
-          tempz2l = 0._CUSTOM_REAL
-
-          tempx3l = 0._CUSTOM_REAL
-          tempy3l = 0._CUSTOM_REAL
-          tempz3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            fac1 = hprimewgll_xx(l,i)
-            tempx1l = tempx1l + tempx1(l,j,k)*fac1
-            tempy1l = tempy1l + tempy1(l,j,k)*fac1
-            tempz1l = tempz1l + tempz1(l,j,k)*fac1
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLY
-            fac2 = hprimewgll_yy(l,j)
-            tempx2l = tempx2l + tempx2(i,l,k)*fac2
-            tempy2l = tempy2l + tempy2(i,l,k)*fac2
-            tempz2l = tempz2l + tempz2(i,l,k)*fac2
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-
-!!! can merge these loops because NGLLX = NGLLY = NGLLZ          do l=1,NGLLZ
-            fac3 = hprimewgll_zz(l,k)
-            tempx3l = tempx3l + tempx3(i,j,l)*fac3
-            tempy3l = tempy3l + tempy3(i,j,l)*fac3
-            tempz3l = tempz3l + tempz3(i,j,l)*fac3
-          enddo
-
-          fac1 = wgllwgll_yz(j,k)
-          fac2 = wgllwgll_xz(i,k)
-          fac3 = wgllwgll_xy(i,j)
-
-          sum_terms(1,i,j,k) = - (fac1*tempx1l + fac2*tempx2l + fac3*tempx3l)
-          sum_terms(2,i,j,k) = - (fac1*tempy1l + fac2*tempy2l + fac3*tempy3l)
-          sum_terms(3,i,j,k) = - (fac1*tempz1l + fac2*tempz2l + fac3*tempz3l)
-
-          if(GRAVITY_VAL) sum_terms(:,i,j,k) = sum_terms(:,i,j,k) + rho_s_H(:,i,j,k)
-
-        enddo
-      enddo
-    enddo
-
-! sum contributions from each element to the global mesh and add gravity terms
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-          iglob = ibool(i,j,k,ispec)
-          accel_inner_core(:,iglob) = accel_inner_core(:,iglob) + sum_terms(:,i,j,k)
-        enddo
-      enddo
-    enddo
-
-! use Runge-Kutta scheme to march memory variables in time
-! convention for attenuation
-! term in xx = 1
-! term in yy = 2
-! term in xy = 3
-! term in xz = 4
-! term in yz = 5
-! term in zz not computed since zero trace
-! This is because we only implement Q_\mu attenuation and not Q_\kappa.
-! Note that this does *NOT* imply that there is no attenuation for P waves
-! because for Q_\kappa = infinity one gets (see for instance Dahlen and Tromp (1998)
-! equation (9.59) page 350): Q_\alpha = Q_\mu * 3 * (V_p/V_s)^2 / 4
-! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
-! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
-
-    if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. )) then
-
-      do i_SLS = 1,N_SLS
-
-        ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
-        if (USE_3D_ATTENUATION_ARRAYS) then
-          factor_common_use(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * muvstore(:,:,:,ispec)
-        else
-          factor_common_use(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * muvstore(:,:,:,ispec)
-        endif
-
-!        do i_memory = 1,5
-!          R_memory(i_memory,i_SLS,:,:,:,ispec) = &
-!                  alphaval(i_SLS) * &
-!                  R_memory(i_memory,i_SLS,:,:,:,ispec) + muvstore(:,:,:,ispec) * &
-!                  factor_common_use * &
-!                  (betaval(i_SLS) * &
-!                  epsilondev(i_memory,:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
-!        enddo
-
-        R_xx(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xx(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xx(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(1,:,:,:))
-
-        R_yy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yy(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_yy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(2,:,:,:))
-
-        R_xy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xy(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(3,:,:,:))
-
-        R_xz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xz(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_xz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(4,:,:,:))
-
-        R_yz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yz(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
-              (betaval(i_SLS) * epsilondev_yz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(5,:,:,:))
-
-      enddo
-
-    endif
-
-    if (COMPUTE_AND_STORE_STRAIN_VAL) then
-! save deviatoric strain for Runge-Kutta scheme
-      !epsilondev(:,:,:,:,ispec) = epsilondev_loc(:,:,:,:)
-      do k=1,NGLLZ
-        do j=1,NGLLY
-          do i=1,NGLLX
-            epsilondev_xx(i,j,k,ispec) = epsilondev_loc(1,i,j,k)
-            epsilondev_yy(i,j,k,ispec) = epsilondev_loc(2,i,j,k)
-            epsilondev_xy(i,j,k,ispec) = epsilondev_loc(3,i,j,k)
-            epsilondev_xz(i,j,k,ispec) = epsilondev_loc(4,i,j,k)
-            epsilondev_yz(i,j,k,ispec) = epsilondev_loc(5,i,j,k)
-          enddo
-        enddo
-      enddo
-
-    endif
-
-  endif   ! end test to exclude fictitious elements in central cube
-
-  enddo ! spectral element loop
-
-  end subroutine compute_forces_inner_core
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_Dev.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_Dev.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_Dev.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -44,7 +44,8 @@
 
   use specfem_par,only: &
     hprime_xx,hprime_xxT,hprimewgll_xx,hprimewgll_xxT,wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-    minus_gravity_table,density_table,minus_deriv_gravity_table
+    minus_gravity_table,density_table,minus_deriv_gravity_table, &
+    COMPUTE_AND_STORE_STRAIN
 
   use specfem_par_innercore,only: &
     xstore => xstore_inner_core,ystore => ystore_inner_core,zstore => zstore_inner_core, &
@@ -115,19 +116,7 @@
   equivalence(newtempy1,E2_m1_m2_5points)
   equivalence(newtempz1,E3_m1_m2_5points)
 
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
-    tempx1_att,tempx2_att,tempx3_att,tempy1_att,tempy2_att,tempy3_att,tempz1_att,tempz2_att,tempz3_att
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: dummyx_loc_att,dummyy_loc_att,dummyz_loc_att
-  real(kind=CUSTOM_REAL), dimension(NGLLX,m2) :: B1_m1_m2_5points_att,B2_m1_m2_5points_att,B3_m1_m2_5points_att
-  real(kind=CUSTOM_REAL), dimension(m1,m2) :: C1_m1_m2_5points_att,C2_m1_m2_5points_att,C3_m1_m2_5points_att
 
-  equivalence(dummyx_loc_att,B1_m1_m2_5points_att)
-  equivalence(dummyy_loc_att,B2_m1_m2_5points_att)
-  equivalence(dummyz_loc_att,B3_m1_m2_5points_att)
-  equivalence(tempx1_att,C1_m1_m2_5points_att)
-  equivalence(tempy1_att,C2_m1_m2_5points_att)
-  equivalence(tempz1_att,C3_m1_m2_5points_att)
-
   real(kind=CUSTOM_REAL), dimension(m2,NGLLX) :: &
     A1_mxm_m2_m1_5points,A2_mxm_m2_m1_5points,A3_mxm_m2_m1_5points
   real(kind=CUSTOM_REAL), dimension(m2,m1) :: &
@@ -145,18 +134,7 @@
   equivalence(newtempy3,E2_mxm_m2_m1_5points)
   equivalence(newtempz3,E3_mxm_m2_m1_5points)
 
-  real(kind=CUSTOM_REAL), dimension(m2,NGLLX) :: &
-    A1_mxm_m2_m1_5points_att,A2_mxm_m2_m1_5points_att,A3_mxm_m2_m1_5points_att
-  real(kind=CUSTOM_REAL), dimension(m2,m1) :: &
-    C1_mxm_m2_m1_5points_att,C2_mxm_m2_m1_5points_att,C3_mxm_m2_m1_5points_att
 
-  equivalence(dummyx_loc_att,A1_mxm_m2_m1_5points_att)
-  equivalence(dummyy_loc_att,A2_mxm_m2_m1_5points_att)
-  equivalence(dummyz_loc_att,A3_mxm_m2_m1_5points_att)
-  equivalence(tempx3_att,C1_mxm_m2_m1_5points_att)
-  equivalence(tempy3_att,C2_mxm_m2_m1_5points_att)
-  equivalence(tempz3_att,C3_mxm_m2_m1_5points_att)
-
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: sum_terms
   real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
 
@@ -166,9 +144,6 @@
   real(kind=CUSTOM_REAL) duxdxl_plus_duydyl,duxdxl_plus_duzdzl,duydyl_plus_duzdzl
   real(kind=CUSTOM_REAL) duxdyl_plus_duydxl,duzdxl_plus_duxdzl,duzdyl_plus_duydzl
 
-  real(kind=CUSTOM_REAL) duxdxl_att,duxdyl_att,duxdzl_att,duydxl_att,duydyl_att,duydzl_att,duzdxl_att,duzdyl_att,duzdzl_att
-  real(kind=CUSTOM_REAL) duxdyl_plus_duydxl_att,duzdxl_plus_duxdzl_att,duzdyl_plus_duydzl_att
-
   real(kind=CUSTOM_REAL) sigma_xx,sigma_yy,sigma_zz,sigma_xy,sigma_xz,sigma_yz
 
   real(kind=CUSTOM_REAL) fac1,fac2,fac3,templ
@@ -234,36 +209,6 @@
         enddo
       enddo
 
-      if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-         if(ATTENUATION_NEW_VAL) then
-            ! takes new routines
-            ! use first order Taylor expansion of displacement for local storage of stresses
-            ! at this current time step, to fix attenuation in a consistent way
-
-            do k=1,NGLLZ
-               do j=1,NGLLY
-                  do i=1,NGLLX
-                     iglob = ibool(i,j,k,ispec)
-                     dummyx_loc_att(i,j,k) = deltat*veloc_inner_core(1,iglob)
-                     dummyy_loc_att(i,j,k) = deltat*veloc_inner_core(2,iglob)
-                     dummyz_loc_att(i,j,k) = deltat*veloc_inner_core(3,iglob)
-                  enddo
-               enddo
-            enddo
-         else
-            ! takes old routines
-            do k=1,NGLLZ
-               do j=1,NGLLY
-                  do i=1,NGLLX
-                     dummyx_loc_att(i,j,k) = 0._CUSTOM_REAL
-                     dummyy_loc_att(i,j,k) = 0._CUSTOM_REAL
-                     dummyz_loc_att(i,j,k) = 0._CUSTOM_REAL
-                  enddo
-               enddo
-            enddo
-         endif
-      endif
-
       do j=1,m2
          do i=1,m1
             C1_m1_m2_5points(i,j) = hprime_xx(i,1)*B1_m1_m2_5points(1,j) + &
@@ -286,38 +231,6 @@
          enddo
       enddo
 
-      if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-         ! temporary variables used for fixing attenuation in a consistent way
-         do j=1,m2
-            do i=1,m1
-               C1_m1_m2_5points_att(i,j) = C1_m1_m2_5points(i,j) + &
-                    hprime_xx(i,1)*B1_m1_m2_5points_att(1,j) + &
-                    hprime_xx(i,2)*B1_m1_m2_5points_att(2,j) + &
-                    hprime_xx(i,3)*B1_m1_m2_5points_att(3,j) + &
-                    hprime_xx(i,4)*B1_m1_m2_5points_att(4,j) + &
-                    hprime_xx(i,5)*B1_m1_m2_5points_att(5,j)
-
-               C2_m1_m2_5points_att(i,j) = C2_m1_m2_5points(i,j) + &
-                    hprime_xx(i,1)*B2_m1_m2_5points_att(1,j) + &
-                    hprime_xx(i,2)*B2_m1_m2_5points_att(2,j) + &
-                    hprime_xx(i,3)*B2_m1_m2_5points_att(3,j) + &
-                    hprime_xx(i,4)*B2_m1_m2_5points_att(4,j) + &
-                    hprime_xx(i,5)*B2_m1_m2_5points_att(5,j)
-
-               C3_m1_m2_5points_att(i,j) = C3_m1_m2_5points(i,j) + &
-                    hprime_xx(i,1)*B3_m1_m2_5points_att(1,j) + &
-                    hprime_xx(i,2)*B3_m1_m2_5points_att(2,j) + &
-                    hprime_xx(i,3)*B3_m1_m2_5points_att(3,j) + &
-                    hprime_xx(i,4)*B3_m1_m2_5points_att(4,j) + &
-                    hprime_xx(i,5)*B3_m1_m2_5points_att(5,j)
-            enddo
-         enddo
-      else
-         tempx1_att(:,:,:) = 0._CUSTOM_REAL
-         tempy1_att(:,:,:) = 0._CUSTOM_REAL
-         tempz1_att(:,:,:) = 0._CUSTOM_REAL
-      endif
-
       do j=1,m1
          do i=1,m1
             ! for efficiency it is better to leave this loop on k inside, it leads to slightly faster code
@@ -343,41 +256,6 @@
          enddo
       enddo
 
-      if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-         ! temporary variables used for fixing attenuation in a consistent way
-         do j=1,m1
-            do i=1,m1
-               ! for efficiency it is better to leave this loop on k inside, it leads to slightly faster code
-               do k = 1,NGLLX
-                  tempx2_att(i,j,k) = tempx2(i,j,k) + &
-                       dummyx_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                       dummyx_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                       dummyx_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                       dummyx_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                       dummyx_loc_att(i,5,k)*hprime_xxT(5,j)
-
-                  tempy2_att(i,j,k) = tempy2(i,j,k) + &
-                       dummyy_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                       dummyy_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                       dummyy_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                       dummyy_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                       dummyy_loc_att(i,5,k)*hprime_xxT(5,j)
-
-                  tempz2_att(i,j,k) = tempz2(i,j,k) + &
-                       dummyz_loc_att(i,1,k)*hprime_xxT(1,j) + &
-                       dummyz_loc_att(i,2,k)*hprime_xxT(2,j) + &
-                       dummyz_loc_att(i,3,k)*hprime_xxT(3,j) + &
-                       dummyz_loc_att(i,4,k)*hprime_xxT(4,j) + &
-                       dummyz_loc_att(i,5,k)*hprime_xxT(5,j)
-               enddo
-            enddo
-         enddo
-      else
-         tempx2_att(:,:,:) = 0._CUSTOM_REAL
-         tempy2_att(:,:,:) = 0._CUSTOM_REAL
-         tempz2_att(:,:,:) = 0._CUSTOM_REAL
-      endif
-
       do j=1,m1
          do i=1,m2
             C1_mxm_m2_m1_5points(i,j) = A1_mxm_m2_m1_5points(i,1)*hprime_xxT(1,j) + &
@@ -400,38 +278,6 @@
          enddo
       enddo
 
-      if(ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-         ! temporary variables used for fixing attenuation in a consistent way
-         do j=1,m1
-            do i=1,m2
-               C1_mxm_m2_m1_5points_att(i,j) = C1_mxm_m2_m1_5points(i,j) + &
-                    A1_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                    A1_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                    A1_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                    A1_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                    A1_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-
-               C2_mxm_m2_m1_5points_att(i,j) = C2_mxm_m2_m1_5points(i,j) + &
-                    A2_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                    A2_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                    A2_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                    A2_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                    A2_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-
-               C3_mxm_m2_m1_5points_att(i,j) = C3_mxm_m2_m1_5points(i,j) + &
-                    A3_mxm_m2_m1_5points_att(i,1)*hprime_xxT(1,j) + &
-                    A3_mxm_m2_m1_5points_att(i,2)*hprime_xxT(2,j) + &
-                    A3_mxm_m2_m1_5points_att(i,3)*hprime_xxT(3,j) + &
-                    A3_mxm_m2_m1_5points_att(i,4)*hprime_xxT(4,j) + &
-                    A3_mxm_m2_m1_5points_att(i,5)*hprime_xxT(5,j)
-            enddo
-         enddo
-      else
-         tempx3_att(:,:,:) = 0._CUSTOM_REAL
-         tempy3_att(:,:,:) = 0._CUSTOM_REAL
-         tempz3_att(:,:,:) = 0._CUSTOM_REAL
-      endif
-
       do k=1,NGLLZ
         do j=1,NGLLY
           do i=1,NGLLX
@@ -472,64 +318,28 @@
             duzdxl_plus_duxdzl = duzdxl + duxdzl
             duzdyl_plus_duydzl = duzdyl + duydzl
 
-            if (ATTENUATION_VAL .and. COMPUTE_AND_STORE_STRAIN_VAL) then
-               ! temporary variables used for fixing attenuation in a consistent way
-               duxdxl_att = xixl*tempx1_att(i,j,k) + etaxl*tempx2_att(i,j,k) + gammaxl*tempx3_att(i,j,k)
-               duxdyl_att = xiyl*tempx1_att(i,j,k) + etayl*tempx2_att(i,j,k) + gammayl*tempx3_att(i,j,k)
-               duxdzl_att = xizl*tempx1_att(i,j,k) + etazl*tempx2_att(i,j,k) + gammazl*tempx3_att(i,j,k)
-
-               duydxl_att = xixl*tempy1_att(i,j,k) + etaxl*tempy2_att(i,j,k) + gammaxl*tempy3_att(i,j,k)
-               duydyl_att = xiyl*tempy1_att(i,j,k) + etayl*tempy2_att(i,j,k) + gammayl*tempy3_att(i,j,k)
-               duydzl_att = xizl*tempy1_att(i,j,k) + etazl*tempy2_att(i,j,k) + gammazl*tempy3_att(i,j,k)
-
-               duzdxl_att = xixl*tempz1_att(i,j,k) + etaxl*tempz2_att(i,j,k) + gammaxl*tempz3_att(i,j,k)
-               duzdyl_att = xiyl*tempz1_att(i,j,k) + etayl*tempz2_att(i,j,k) + gammayl*tempz3_att(i,j,k)
-               duzdzl_att = xizl*tempz1_att(i,j,k) + etazl*tempz2_att(i,j,k) + gammazl*tempz3_att(i,j,k)
-
-               ! precompute some sums to save CPU time
-               duxdyl_plus_duydxl_att = duxdyl_att + duydxl_att
-               duzdxl_plus_duxdzl_att = duzdxl_att + duxdzl_att
-               duzdyl_plus_duydzl_att = duzdyl_att + duydzl_att
-
-               ! compute deviatoric strain
-               if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
-                  ispec_strain = 1
-               else
-                  ispec_strain = ispec
-               endif
-               templ = ONE_THIRD * (duxdxl_att + duydyl_att + duzdzl_att)
-               epsilon_trace_over_3(i,j,k,ispec_strain) = templ
-               epsilondev_loc(1,i,j,k) = duxdxl_att - templ
-               epsilondev_loc(2,i,j,k) = duydyl_att - templ
-               epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl_att
-               epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl_att
-               epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl_att
-            else
-               ! compute deviatoric strain
-               if (COMPUTE_AND_STORE_STRAIN_VAL) then
-                  if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
-                     ispec_strain = 1
-                  else
-                     ispec_strain = ispec
-                  endif
-                  templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
-                  epsilon_trace_over_3(i,j,k,ispec_strain) = templ
-                  epsilondev_loc(1,i,j,k) = duxdxl - templ
-                  epsilondev_loc(2,i,j,k) = duydyl - templ
-                  epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
-                  epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
-                  epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
-               endif
-            endif
-
-            if(ATTENUATION_VAL ) then
-              if( USE_3D_ATTENUATION_ARRAYS ) then
-                minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
+            ! compute deviatoric strain
+            if (COMPUTE_AND_STORE_STRAIN) then
+              if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
+                ispec_strain = 1
               else
-                minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
+                ispec_strain = ispec
               endif
+              templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
+              epsilon_trace_over_3(i,j,k,ispec_strain) = templ
+              epsilondev_loc(1,i,j,k) = duxdxl - templ
+              epsilondev_loc(2,i,j,k) = duydyl - templ
+              epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
+              epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
+              epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
             endif
 
+            if(ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
+              minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
+            else if( ATTENUATION_VAL ) then
+              minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
+            endif
+
             if(ANISOTROPIC_INNER_CORE_VAL) then
               ! elastic tensor for hexagonal symmetry in reduced notation:
               !
@@ -577,12 +387,10 @@
               mul = muvstore(i,j,k,ispec)
 
               ! use unrelaxed parameters if attenuation
-              if(ATTENUATION_VAL) then
-                if( USE_3D_ATTENUATION_ARRAYS ) then
-                  mul = mul * one_minus_sum_beta(i,j,k,ispec)
-                else
-                  mul = mul * one_minus_sum_beta(1,1,1,ispec)
-                endif
+              if(ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
+                mul = mul * one_minus_sum_beta(i,j,k,ispec)
+              else if( ATTENUATION_VAL ) then
+                mul = mul * one_minus_sum_beta(1,1,1,ispec)
               endif
 
               lambdalplus2mul = kappal + FOUR_THIRDS * mul
@@ -600,7 +408,7 @@
             endif
 
             ! subtract memory variables if attenuation
-            if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+            if( ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
               ! note: Fortran passes pointers to array location, thus R_memory(1,1,...) is fine
               call compute_element_att_stress(R_xx(1,i,j,k,ispec), &
                                               R_yy(1,i,j,k,ispec), &
@@ -854,7 +662,7 @@
       ! equation (9.59) page 350): Q_\alpha = Q_\mu * 3 * (V_p/V_s)^2 / 4
       ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
       ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
-      if(ATTENUATION_VAL .and. ( PARTIAL_PHYS_DISPERSION_ONLY .eqv. .false. ) ) then
+      if( ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
         ! updates R_memory
         call compute_element_att_memory_ic(ispec,R_xx,R_yy,R_xy,R_xz,R_yz, &
@@ -868,7 +676,7 @@
       endif
 
       ! save deviatoric strain for Runge-Kutta scheme
-      if(COMPUTE_AND_STORE_STRAIN_VAL) then
+      if(COMPUTE_AND_STORE_STRAIN) then
         epsilondev_xx(:,:,:,ispec) = epsilondev_loc(1,:,:,:)
         epsilondev_yy(:,:,:,ispec) = epsilondev_loc(2,:,:,:)
         epsilondev_xy(:,:,:,ispec) = epsilondev_loc(3,:,:,:)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_noDev.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_noDev.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_inner_core_noDev.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,92 +25,84 @@
 !
 !=====================================================================
 
-  subroutine compute_forces_inner_core(minus_gravity_table,density_table,minus_deriv_gravity_table, &
-          displ_inner_core,accel_inner_core,xstore,ystore,zstore, &
-          xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
-            is_on_a_slice_edge_inner_core,icall, &
-            accel_crust_mantle,ibool_inner_core,idoubling_inner_core, &
-            myrank,iproc_xi,iproc_eta,ichunk,addressing, &
-            iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle,iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle, &
-            npoin2D_faces_crust_mantle,npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-            iboolfaces_crust_mantle,iboolcorner_crust_mantle, &
-            iboolleft_xi_inner_core,iboolright_xi_inner_core,iboolleft_eta_inner_core,iboolright_eta_inner_core, &
-            npoin2D_faces_inner_core,npoin2D_xi_inner_core,npoin2D_eta_inner_core, &
-            iboolfaces_inner_core,iboolcorner_inner_core, &
-            iprocfrom_faces,iprocto_faces, &
-            iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-            buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-            buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector,iphase, &
-            nb_msgs_theor_in_cube,sender_from_slices_to_cube, &
-            npoin2D_cube_from_slices,buffer_all_cube_from_slices,buffer_slices,ibool_central_cube, &
-            receiver_cube_from_slices,ibelm_bottom_inner_core,NSPEC2D_BOTTOM_INNER_CORE,INCLUDE_CENTRAL_CUBE,iphase_CC, &
-          hprime_xx,hprime_yy,hprime_zz, &
-          hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-          wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-          kappavstore,muvstore,ibool,idoubling, &
-          c11store,c33store,c12store,c13store,c44store,R_memory,one_minus_sum_beta,deltat,veloc_inner_core, &
-          alphaval,betaval,gammaval,factor_common, &
-          vx,vy,vz,vnspec,PARTIAL_PHYS_DISPERSION_ONLY,&
-          istage,R_memory_lddrk,tau_sigma_CUSTOM_REAL)
+  subroutine compute_forces_inner_core( NSPEC,NGLOB,NSPEC_ATT, &
+                                        deltat, &
+                                        displ_inner_core, &
+                                        veloc_inner_core, &
+                                        accel_inner_core, &
+                                        phase_is_inner, &
+                                        R_xx,R_yy,R_xy,R_xz,R_yz, &
+                                        epsilondev_xx,epsilondev_yy,epsilondev_xy, &
+                                        epsilondev_xz,epsilondev_yz, &
+                                        epsilon_trace_over_3,&
+                                        alphaval,betaval,gammaval,factor_common, &
+                                        vx,vy,vz,vnspec)
 
-  implicit none
+  use constants_solver
 
-  include "constants.h"
+  use specfem_par,only: &
+    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
+    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
+    minus_gravity_table,density_table,minus_deriv_gravity_table, &
+    COMPUTE_AND_STORE_STRAIN
 
-! include values created by the mesher
-! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
+  use specfem_par_innercore,only: &
+    xstore => xstore_inner_core,ystore => ystore_inner_core,zstore => zstore_inner_core, &
+    xix => xix_inner_core,xiy => xiy_inner_core,xiz => xiz_inner_core, &
+    etax => etax_inner_core,etay => etay_inner_core,etaz => etaz_inner_core, &
+    gammax => gammax_inner_core,gammay => gammay_inner_core,gammaz => gammaz_inner_core, &
+    kappavstore => kappavstore_inner_core, &
+    muvstore => muvstore_inner_core, &
+    c11store => c11store_inner_core,c12store => c12store_inner_core,c13store => c13store_inner_core, &
+    c33store => c33store_inner_core,c44store => c44store_inner_core, &
+    ibool => ibool_inner_core,idoubling => idoubling_inner_core, &
+    one_minus_sum_beta => one_minus_sum_beta_inner_core, &
+    phase_ispec_inner => phase_ispec_inner_inner_core, &
+    nspec_outer => nspec_outer_inner_core, &
+    nspec_inner => nspec_inner_inner_core
 
+  implicit none
+
+  integer :: NSPEC,NGLOB,NSPEC_ATT
+
+  ! time step
   real(kind=CUSTOM_REAL) deltat
 
-! displacement and acceleration
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_INNER_CORE) :: displ_inner_core,accel_inner_core,veloc_inner_core
+  ! displacement, velocity and acceleration
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: displ_inner_core
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: veloc_inner_core
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB) :: accel_inner_core
 
-! for attenuation
-! memory variables R_ij are stored at the local rather than global level
-! to allow for optimization of cache access by compiler
-  integer i_SLS,i_memory
-  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
+  ! for attenuation
+  ! memory variables R_ij are stored at the local rather than global level
+  ! to allow for optimization of cache access by compiler
+  ! variable lengths for factor_common and one_minus_sum_beta
 
-! variable lengths for factor_common and one_minus_sum_beta
+  ! variable sized array variables
   integer vx, vy, vz, vnspec
 
-  real(kind=CUSTOM_REAL), dimension(vx, vy, vz, vnspec) :: one_minus_sum_beta
-
-  real(kind=CUSTOM_REAL), dimension(N_SLS, vx, vy, vz, vnspec) :: factor_common
+  real(kind=CUSTOM_REAL), dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
   real(kind=CUSTOM_REAL), dimension(N_SLS) :: alphaval,betaval,gammaval
-  real(kind=CUSTOM_REAL), dimension(NGLLX, NGLLY, NGLLZ) :: factor_common_use
 
-  real(kind=CUSTOM_REAL), dimension(5,N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE_ATTENUATION) :: R_memory
-  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc,epsilondev_loc_nplus1
-  logical :: PARTIAL_PHYS_DISPERSION_ONLY
+  real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_ATT) :: R_xx,R_yy,R_xy,R_xz,R_yz
 
-! array with the local to global mapping per slice
-  integer, dimension(NSPEC_INNER_CORE) :: idoubling
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
+    epsilondev_xx,epsilondev_yy,epsilondev_xy,epsilondev_xz,epsilondev_yz
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: epsilon_trace_over_3
 
-! arrays with mesh parameters per slice
-  integer, dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: ibool
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: xix,xiy,xiz, &
-                      etax,etay,etaz,gammax,gammay,gammaz
+  ! inner/outer element run flag
+  logical :: phase_is_inner
 
-! array with derivatives of Lagrange polynomials and precalculated products
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx,hprimewgll_xx
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLY) :: hprime_yy,hprimewgll_yy
-  real(kind=CUSTOM_REAL), dimension(NGLLZ,NGLLZ) :: hprime_zz,hprimewgll_zz
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY) :: wgllwgll_xy
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ) :: wgllwgll_xz
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLZ) :: wgllwgll_yz
+  ! local parameters
 
+  real(kind=CUSTOM_REAL), dimension(5,NGLLX,NGLLY,NGLLZ) :: epsilondev_loc
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: factor_common_use
+  real(kind=CUSTOM_REAL) R_xx_val,R_yy_val
+  integer i_SLS
+
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: &
     tempx1,tempx2,tempx3,tempy1,tempy2,tempy3,tempz1,tempz2,tempz3
 
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: kappavstore,muvstore
-
-!  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: &
-!    c11store,c33store,c12store,c13store,c44store
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPECMAX_ANISO_IC) :: &
-    c11store,c33store,c12store,c13store,c44store
-
   integer ispec,iglob,ispec_strain
   integer i,j,k,l
 
@@ -135,132 +127,43 @@
   real(kind=CUSTOM_REAL) tempy1l,tempy2l,tempy3l
   real(kind=CUSTOM_REAL) tempz1l,tempz2l,tempz3l
 
-! for gravity
-  integer int_radius
-  real(kind=CUSTOM_REAL) sigma_yx,sigma_zx,sigma_zy
+  ! for gravity
   double precision radius,rho,minus_g,minus_dg
   double precision minus_g_over_radius,minus_dg_plus_g_over_radius
   double precision cos_theta,sin_theta,cos_phi,sin_phi
   double precision cos_theta_sq,sin_theta_sq,cos_phi_sq,sin_phi_sq
   double precision theta,phi,factor,gxl,gyl,gzl,sx_l,sy_l,sz_l
   double precision Hxxl,Hyyl,Hzzl,Hxyl,Hxzl,Hyzl
-  double precision, dimension(NRAD_GRAVITY) :: minus_gravity_table,density_table,minus_deriv_gravity_table
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLLX,NGLLY,NGLLZ) :: rho_s_H
-  double precision, dimension(NGLLX,NGLLY,NGLLZ) :: wgll_cube
-  real(kind=CUSTOM_REAL), dimension(NGLOB_INNER_CORE) :: xstore,ystore,zstore
+  real(kind=CUSTOM_REAL) sigma_yx,sigma_zx,sigma_zy
+  integer :: int_radius
 
-! this for non blocking MPI
-  integer :: iphase,icall
+!  integer :: computed_elements
+  integer :: num_elements,ispec_p
+  integer :: iphase
 
-  integer :: computed_elements
-
-  logical, dimension(NSPEC_INNER_CORE) :: is_on_a_slice_edge_inner_core
-
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: accel_crust_mantle
-
-  integer, dimension(NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE) :: ibool_inner_core
-
-  integer, dimension(NSPEC_INNER_CORE) :: idoubling_inner_core
-
-  integer :: ichunk,iproc_xi,iproc_eta,myrank
-
-  integer, dimension(NCHUNKS_VAL,0:NPROC_XI_VAL-1,0:NPROC_ETA_VAL-1) :: addressing
-
-  integer, dimension(NGLOB2DMAX_XMIN_XMAX_CM) :: iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle
-  integer, dimension(NGLOB2DMAX_YMIN_YMAX_CM) :: iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle
-
-  integer, dimension(NGLOB2DMAX_XMIN_XMAX_IC) :: iboolleft_xi_inner_core,iboolright_xi_inner_core
-  integer, dimension(NGLOB2DMAX_YMIN_YMAX_IC) :: iboolleft_eta_inner_core,iboolright_eta_inner_core
-
-  integer npoin2D_faces_crust_mantle(NUMFACES_SHARED)
-  integer npoin2D_faces_inner_core(NUMFACES_SHARED)
-
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR) :: npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-       npoin2D_xi_inner_core,npoin2D_eta_inner_core
-
-! communication pattern for faces between chunks
-  integer, dimension(NUMMSGS_FACES_VAL) :: iprocfrom_faces,iprocto_faces
-
-! communication pattern for corners between chunks
-  integer, dimension(NCORNERSCHUNKS_VAL) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
-
-  integer, dimension(NGLOB1D_RADIAL_CM,NUMCORNERS_SHARED) :: iboolcorner_crust_mantle
-  integer, dimension(NGLOB1D_RADIAL_IC,NUMCORNERS_SHARED) :: iboolcorner_inner_core
-
-  integer, dimension(NGLOB2DMAX_XY_CM_VAL,NUMFACES_SHARED) :: iboolfaces_crust_mantle
-  integer, dimension(NGLOB2DMAX_XY_IC_VAL,NUMFACES_SHARED) :: iboolfaces_inner_core
-
-  integer :: npoin2D_max_all_CM_IC
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin2D_max_all_CM_IC) :: buffer_send_faces,buffer_received_faces
-
-! size of buffers is the sum of two sizes because we handle two regions in the same MPI call
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB1D_RADIAL_CM + NGLOB1D_RADIAL_IC) :: &
-     buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector
-
-! for matching with central cube in inner core
-  integer nb_msgs_theor_in_cube, npoin2D_cube_from_slices,iphase_CC
-  integer, dimension(nb_msgs_theor_in_cube) :: sender_from_slices_to_cube
-  double precision, dimension(npoin2D_cube_from_slices,NDIM) :: buffer_slices
-  double precision, dimension(npoin2D_cube_from_slices,NDIM,nb_msgs_theor_in_cube) :: buffer_all_cube_from_slices
-  integer, dimension(nb_msgs_theor_in_cube,npoin2D_cube_from_slices):: ibool_central_cube
-  integer receiver_cube_from_slices
-  logical :: INCLUDE_CENTRAL_CUBE
-
-! local to global mapping
-  integer NSPEC2D_BOTTOM_INNER_CORE
-  integer, dimension(NSPEC2D_BOTTOM_INNER_CORE) :: ibelm_bottom_inner_core
-  real(kind=CUSTOM_REAL) templ
-
-! for LDDRK
-  integer :: istage
-  real(kind=CUSTOM_REAL), dimension(5,N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE_ATTENUATION) :: R_memory_lddrk
-  real(kind=CUSTOM_REAL),dimension(N_SLS) :: tau_sigma_CUSTOM_REAL
-
 ! ****************************************************
 !   big loop over all spectral elements in the solid
 ! ****************************************************
 
-  computed_elements = 0
+!  computed_elements = 0
+  if( .not. phase_is_inner ) then
+    iphase = 1
+    num_elements = nspec_outer
+  else
+    iphase = 2
+    num_elements = nspec_inner
+  endif
 
-  do ispec = 1,NSPEC_INNER_CORE
+  do ispec_p = 1,num_elements
 
-! hide communications by computing the edges first
-    if((icall == 2 .and. is_on_a_slice_edge_inner_core(ispec)) .or. &
-       (icall == 1 .and. .not. is_on_a_slice_edge_inner_core(ispec))) cycle
+    ispec = phase_ispec_inner(ispec_p,iphase)
 
-! exclude fictitious elements in central cube
+    ! only compute element which belong to current phase (inner or outer elements)
+
+    ! exclude fictitious elements in central cube
     if(idoubling(ispec) /= IFLAG_IN_FICTITIOUS_CUBE) then
 
-! process the non-blocking communications every ELEMENTS_NONBLOCKING elements
-    computed_elements = computed_elements + 1
-    if (icall == 2 .and. mod(computed_elements,ELEMENTS_NONBLOCKING_CM_IC) == 0) then
-
-      if(iphase <= 7) call assemble_MPI_vector(myrank,accel_crust_mantle,accel_inner_core, &
-            iproc_xi,iproc_eta,ichunk,addressing, &
-            iboolleft_xi_crust_mantle,iboolright_xi_crust_mantle,iboolleft_eta_crust_mantle,iboolright_eta_crust_mantle, &
-            npoin2D_faces_crust_mantle,npoin2D_xi_crust_mantle,npoin2D_eta_crust_mantle, &
-            iboolfaces_crust_mantle,iboolcorner_crust_mantle, &
-            iboolleft_xi_inner_core,iboolright_xi_inner_core,iboolleft_eta_inner_core,iboolright_eta_inner_core, &
-            npoin2D_faces_inner_core,npoin2D_xi_inner_core,npoin2D_eta_inner_core, &
-            iboolfaces_inner_core,iboolcorner_inner_core, &
-            iprocfrom_faces,iprocto_faces, &
-            iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-            buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-            buffer_send_chunkcorn_vector,buffer_recv_chunkcorn_vector, &
-            NUMMSGS_FACES_VAL,NCORNERSCHUNKS_VAL, &
-            NPROC_XI_VAL,NPROC_ETA_VAL,NGLOB1D_RADIAL_CM, &
-            NGLOB1D_RADIAL_IC,NCHUNKS_VAL,iphase)
-
-      if(INCLUDE_CENTRAL_CUBE) then
-          if(iphase > 7 .and. iphase_CC <= 4) &
-            call assemble_MPI_central_cube(ichunk,nb_msgs_theor_in_cube,sender_from_slices_to_cube, &
-                   npoin2D_cube_from_slices,buffer_all_cube_from_slices,buffer_slices,ibool_central_cube, &
-                   receiver_cube_from_slices,ibool_inner_core,idoubling_inner_core, &
-                   ibelm_bottom_inner_core,NSPEC2D_BOTTOM_IC,accel_inner_core,NDIM,iphase_CC)
-      endif
-
-    endif
-
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
@@ -338,28 +241,26 @@
           duzdxl_plus_duxdzl = duzdxl + duxdzl
           duzdyl_plus_duydzl = duzdyl + duydzl
 
-! compute deviatoric strain
-          if (COMPUTE_AND_STORE_STRAIN_VAL) then
+          ! compute deviatoric strain
+          if (COMPUTE_AND_STORE_STRAIN) then
             if(NSPEC_INNER_CORE_STRAIN_ONLY == 1) then
-              ispec_strain = 1
+               ispec_strain = 1
             else
-              ispec_strain = ispec
+               ispec_strain = ispec
             endif
-!ZN beware, here the expression differs from the strain used in memory variable equation (6) in D. Komatitsch and J. Tromp 1999,
-!ZN here Brian Savage uses the engineering strain which are epsilon = 1/2*(grad U + (grad U)^T),
-!ZN where U is the displacement vector and grad the gradient operator, i.e. there is a 1/2 factor difference between the two.
-!ZN Both expressions are fine, but we need to keep in mind that if we put the 1/2 factor here there we need to remove it
-!ZN from the expression in which we use the strain later in the code.
-            templ = ONE_THIRD * (duxdxl + duydyl + duzdzl)
-            epsilondev_loc(1,i,j,k) = duxdxl - templ
-            epsilondev_loc(2,i,j,k) = duydyl - templ
+            epsilon_trace_over_3(i,j,k,ispec_strain) = ONE_THIRD * (duxdxl + duydyl + duzdzl)
+            epsilondev_loc(1,i,j,k) = duxdxl - epsilon_trace_over_3(i,j,k,ispec_strain)
+            epsilondev_loc(2,i,j,k) = duydyl - epsilon_trace_over_3(i,j,k,ispec_strain)
             epsilondev_loc(3,i,j,k) = 0.5 * duxdyl_plus_duydxl
             epsilondev_loc(4,i,j,k) = 0.5 * duzdxl_plus_duxdzl
             epsilondev_loc(5,i,j,k) = 0.5 * duzdyl_plus_duydzl
           endif
 
-          if(ATTENUATION_VAL) then
-            minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0
+          ! precompute terms for attenuation if needed
+          if( ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
+            minus_sum_beta =  one_minus_sum_beta(i,j,k,ispec) - 1.0_CUSTOM_REAL
+          else if( ATTENUATION_VAL ) then
+            minus_sum_beta =  one_minus_sum_beta(1,1,1,ispec) - 1.0_CUSTOM_REAL
           endif
 
           if(ANISOTROPIC_INNER_CORE_VAL) then
@@ -411,8 +312,10 @@
             mul = muvstore(i,j,k,ispec)
 
             ! use unrelaxed parameters if attenuation
-            if(ATTENUATION_VAL) then
+            if( ATTENUATION_VAL .and. (ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL)) then
               mul = mul * one_minus_sum_beta(i,j,k,ispec)
+            else if( ATTENUATION_VAL ) then
+              mul = mul * one_minus_sum_beta(1,1,1,ispec)
             endif
 
             lambdalplus2mul = kappal + FOUR_THIRDS * mul
@@ -431,16 +334,16 @@
           endif
 
 ! subtract memory variables if attenuation
-          if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+          if( ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
             do i_SLS = 1,N_SLS
-              R_xx_val = R_memory(1,i_SLS,i,j,k,ispec)
-              R_yy_val = R_memory(2,i_SLS,i,j,k,ispec)
+              R_xx_val = R_xx(i_SLS,i,j,k,ispec)
+              R_yy_val = R_yy(i_SLS,i,j,k,ispec)
               sigma_xx = sigma_xx - R_xx_val
               sigma_yy = sigma_yy - R_yy_val
               sigma_zz = sigma_zz + R_xx_val + R_yy_val
-              sigma_xy = sigma_xy - R_memory(3,i_SLS,i,j,k,ispec)
-              sigma_xz = sigma_xz - R_memory(4,i_SLS,i,j,k,ispec)
-              sigma_yz = sigma_yz - R_memory(5,i_SLS,i,j,k,ispec)
+              sigma_xy = sigma_xy - R_xy(i_SLS,i,j,k,ispec)
+              sigma_xz = sigma_xz - R_xz(i_SLS,i,j,k,ispec)
+              sigma_yz = sigma_yz - R_yz(i_SLS,i,j,k,ispec)
             enddo
           endif
 
@@ -563,18 +466,19 @@
           endif  ! end of section with gravity terms
 
 ! form dot product with test vector, non-symmetric form
-        tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl) ! this goes to accel_x
-        tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl) ! this goes to accel_y
-        tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl) ! this goes to accel_z
 
-        tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl) ! this goes to accel_x
-        tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl) ! this goes to accel_y
-        tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl) ! this goes to accel_z
+          tempx1(i,j,k) = jacobianl * (sigma_xx*xixl + sigma_yx*xiyl + sigma_zx*xizl)
+          tempy1(i,j,k) = jacobianl * (sigma_xy*xixl + sigma_yy*xiyl + sigma_zy*xizl)
+          tempz1(i,j,k) = jacobianl * (sigma_xz*xixl + sigma_yz*xiyl + sigma_zz*xizl)
 
-        tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl) ! this goes to accel_x
-        tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl) ! this goes to accel_y
-        tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl) ! this goes to accel_z
+          tempx2(i,j,k) = jacobianl * (sigma_xx*etaxl + sigma_yx*etayl + sigma_zx*etazl)
+          tempy2(i,j,k) = jacobianl * (sigma_xy*etaxl + sigma_yy*etayl + sigma_zy*etazl)
+          tempz2(i,j,k) = jacobianl * (sigma_xz*etaxl + sigma_yz*etayl + sigma_zz*etazl)
 
+          tempx3(i,j,k) = jacobianl * (sigma_xx*gammaxl + sigma_yx*gammayl + sigma_zx*gammazl)
+          tempy3(i,j,k) = jacobianl * (sigma_xy*gammaxl + sigma_yy*gammayl + sigma_zy*gammazl)
+          tempz3(i,j,k) = jacobianl * (sigma_xz*gammaxl + sigma_yz*gammayl + sigma_zz*gammazl)
+
         enddo
       enddo
     enddo
@@ -655,45 +559,62 @@
 ! therefore Q_\alpha is not zero; for instance for V_p / V_s = sqrt(3)
 ! we get Q_\alpha = (9 / 4) * Q_\mu = 2.25 * Q_\mu
 
-    if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+    if( ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL ) then
 
-       call compute_element_strain_att_noDev(ispec,NGLOB_INNER_CORE,NSPEC_INNER_CORE,displ_inner_core,&
-                                             veloc_inner_core,deltat,hprime_xx,hprime_yy,hprime_zz,ibool,&
-                                             xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz,epsilondev_loc_nplus1)
-
       do i_SLS = 1,N_SLS
-        factor_common_use = factor_common(i_SLS,:,:,:,ispec)
+
+        ! reformatted R_memory to handle large factor_common and reduced [alpha,beta,gamma]val
+        if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
+          factor_common_use(:,:,:) = factor_common(i_SLS,:,:,:,ispec) * muvstore(:,:,:,ispec)
+        else
+          factor_common_use(:,:,:) = factor_common(i_SLS,1,1,1,ispec) * muvstore(:,:,:,ispec)
+        endif
+
 !        do i_memory = 1,5
 !          R_memory(i_memory,i_SLS,:,:,:,ispec) = &
 !                  alphaval(i_SLS) * &
 !                  R_memory(i_memory,i_SLS,:,:,:,ispec) + muvstore(:,:,:,ispec) * &
 !                  factor_common_use * &
 !                  (betaval(i_SLS) * &
-!                  epsilondev_loc_nplus1(i_memory,:,:,:) + gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
+!                  epsilondev(i_memory,:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
 !        enddo
-        if(USE_LDDRK)then
-          do i_memory = 1,5
-            R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec) = ALPHA_LDDRK(istage) * R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec) + &
-                     deltat * (muvstore(:,:,:,ispec)*factor_common_use*epsilondev_loc(i_memory,:,:,:) - &
-                               R_memory(i_memory,i_SLS,:,:,:,ispec)*(1._CUSTOM_REAL/tau_sigma_CUSTOM_REAL(i_SLS)))
-            R_memory(i_memory,i_SLS,:,:,:,ispec) = R_memory(i_memory,i_SLS,:,:,:,ispec) + &
-                                               BETA_LDDRK(istage) * R_memory_lddrk(i_memory,i_SLS,:,:,:,ispec)
-          enddo
-        else
-          do i_memory = 1,5
-            R_memory(i_memory,i_SLS,:,:,:,ispec) = &
-                   alphaval(i_SLS) * &
-                   R_memory(i_memory,i_SLS,:,:,:,ispec) + muvstore(:,:,:,ispec) * &
-                   factor_common_use * &
-                   (betaval(i_SLS) * &
-                   epsilondev_loc_nplus1(i_memory,:,:,:) + gammaval(i_SLS) * epsilondev_loc(i_memory,:,:,:))
-          enddo
-        endif
 
+        R_xx(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xx(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xx(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(1,:,:,:))
+
+        R_yy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yy(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_yy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(2,:,:,:))
+
+        R_xy(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xy(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xy(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(3,:,:,:))
+
+        R_xz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_xz(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_xz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(4,:,:,:))
+
+        R_yz(i_SLS,:,:,:,ispec) = alphaval(i_SLS) * R_yz(i_SLS,:,:,:,ispec) + factor_common_use(:,:,:) * &
+              (betaval(i_SLS) * epsilondev_yz(:,:,:,ispec) + gammaval(i_SLS) * epsilondev_loc(5,:,:,:))
+
       enddo
 
     endif
 
+    if (COMPUTE_AND_STORE_STRAIN) then
+! save deviatoric strain for Runge-Kutta scheme
+      !epsilondev(:,:,:,:,ispec) = epsilondev_loc(:,:,:,:)
+      do k=1,NGLLZ
+        do j=1,NGLLY
+          do i=1,NGLLX
+            epsilondev_xx(i,j,k,ispec) = epsilondev_loc(1,i,j,k)
+            epsilondev_yy(i,j,k,ispec) = epsilondev_loc(2,i,j,k)
+            epsilondev_xy(i,j,k,ispec) = epsilondev_loc(3,i,j,k)
+            epsilondev_xz(i,j,k,ispec) = epsilondev_loc(4,i,j,k)
+            epsilondev_yz(i,j,k,ispec) = epsilondev_loc(5,i,j,k)
+          enddo
+        enddo
+      enddo
+
+    endif
+
   endif   ! end test to exclude fictitious elements in central cube
 
   enddo ! spectral element loop

Deleted: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,339 +0,0 @@
-!=====================================================================
-!
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
-!          --------------------------------------------------
-!
-!          Main authors: Dimitri Komatitsch and Jeroen Tromp
-!                        Princeton University, USA
-!             and CNRS / INRIA / University of Pau, France
-! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
-!
-! 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.
-!
-!=====================================================================
-
-  subroutine compute_forces_outer_core(time,deltat,two_omega_earth, &
-                                      NSPEC,NGLOB, &
-                                      A_array_rotation,B_array_rotation, &
-                                      displfluid,accelfluid, &
-                                      div_displfluid,phase_is_inner)
-
-  use constants_solver
-
-  use specfem_par,only: &
-    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-    minus_rho_g_over_kappa_fluid,d_ln_density_dr_table, &
-    MOVIE_VOLUME
-
-  use specfem_par_outercore,only: &
-    xstore => xstore_outer_core,ystore => ystore_outer_core,zstore => zstore_outer_core, &
-    xix => xix_outer_core,xiy => xiy_outer_core,xiz => xiz_outer_core, &
-    etax => etax_outer_core,etay => etay_outer_core,etaz => etaz_outer_core, &
-    gammax => gammax_outer_core,gammay => gammay_outer_core,gammaz => gammaz_outer_core, &
-    ibool => ibool_outer_core, &
-    phase_ispec_inner => phase_ispec_inner_outer_core, &
-    nspec_outer => nspec_outer_outer_core, &
-    nspec_inner => nspec_inner_outer_core
-
-  implicit none
-
-  integer :: NSPEC,NGLOB
-
-  ! for the Euler scheme for rotation
-  real(kind=CUSTOM_REAL) time,deltat,two_omega_earth
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
-    A_array_rotation,B_array_rotation
-
-  ! displacement and acceleration
-  real(kind=CUSTOM_REAL), dimension(NGLOB) :: displfluid,accelfluid
-
-  ! divergence of displacement
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_OUTER_CORE_ADJOINT) :: div_displfluid
-
-  ! inner/outer element run flag
-  logical :: phase_is_inner
-
-  ! local parameters
-
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: tempx1,tempx2,tempx3
-  ! for gravity
-  integer int_radius
-  double precision radius,theta,phi,gxl,gyl,gzl
-  double precision cos_theta,sin_theta,cos_phi,sin_phi
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: gravity_term
-  ! for the Euler scheme for rotation
-  real(kind=CUSTOM_REAL) two_omega_deltat,cos_two_omega_t,sin_two_omega_t,A_rotation,B_rotation, &
-       ux_rotation,uy_rotation,dpotentialdx_with_rot,dpotentialdy_with_rot
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: source_euler_A,source_euler_B
-
-  integer ispec,iglob
-  integer i,j,k,l
-
-  real(kind=CUSTOM_REAL) xixl,xiyl,xizl,etaxl,etayl,etazl,gammaxl,gammayl,gammazl,jacobianl
-  real(kind=CUSTOM_REAL) dpotentialdxl,dpotentialdyl,dpotentialdzl
-  real(kind=CUSTOM_REAL) tempx1l,tempx2l,tempx3l,sum_terms
-
-  double precision grad_x_ln_rho,grad_y_ln_rho,grad_z_ln_rho
-
-!  integer :: computed_elements
-  integer :: num_elements,ispec_p
-  integer :: iphase
-
-! ****************************************************
-!   big loop over all spectral elements in the fluid
-! ****************************************************
-
-  if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. ( .not. phase_is_inner )) div_displfluid(:,:,:,:) = 0._CUSTOM_REAL
-
-!  computed_elements = 0
-  if( .not. phase_is_inner ) then
-    iphase = 1
-    num_elements = nspec_outer
-  else
-    iphase = 2
-    num_elements = nspec_inner
-  endif
-
-  do ispec_p = 1,num_elements
-
-    ispec = phase_ispec_inner(ispec_p,iphase)
-
-    ! only compute element which belong to current phase (inner or outer elements)
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempx2l = 0._CUSTOM_REAL
-          tempx3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            !!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-            tempx1l = tempx1l + displfluid(ibool(l,j,k,ispec)) * hprime_xx(i,l)
-            tempx2l = tempx2l + displfluid(ibool(i,l,k,ispec)) * hprime_yy(j,l)
-            tempx3l = tempx3l + displfluid(ibool(i,j,l,ispec)) * hprime_zz(k,l)
-          enddo
-
-          ! get derivatives of velocity potential with respect to x, y and z
-          xixl = xix(i,j,k,ispec)
-          xiyl = xiy(i,j,k,ispec)
-          xizl = xiz(i,j,k,ispec)
-          etaxl = etax(i,j,k,ispec)
-          etayl = etay(i,j,k,ispec)
-          etazl = etaz(i,j,k,ispec)
-          gammaxl = gammax(i,j,k,ispec)
-          gammayl = gammay(i,j,k,ispec)
-          gammazl = gammaz(i,j,k,ispec)
-
-          ! compute the jacobian
-          jacobianl = 1._CUSTOM_REAL / (xixl*(etayl*gammazl-etazl*gammayl) &
-                        - xiyl*(etaxl*gammazl-etazl*gammaxl) &
-                        + xizl*(etaxl*gammayl-etayl*gammaxl))
-
-          dpotentialdxl = xixl*tempx1l + etaxl*tempx2l + gammaxl*tempx3l
-          dpotentialdyl = xiyl*tempx1l + etayl*tempx2l + gammayl*tempx3l
-          dpotentialdzl = xizl*tempx1l + etazl*tempx2l + gammazl*tempx3l
-
-          ! compute contribution of rotation and add to gradient of potential
-          ! this term has no Z component
-          if(ROTATION_VAL) then
-
-            ! store the source for the Euler scheme for A_rotation and B_rotation
-            two_omega_deltat = deltat * two_omega_earth
-
-            cos_two_omega_t = cos(two_omega_earth*time)
-            sin_two_omega_t = sin(two_omega_earth*time)
-
-            ! time step deltat of Euler scheme is included in the source
-            source_euler_A(i,j,k) = two_omega_deltat &
-                  * (cos_two_omega_t * dpotentialdyl + sin_two_omega_t * dpotentialdxl)
-            source_euler_B(i,j,k) = two_omega_deltat &
-                  * (sin_two_omega_t * dpotentialdyl - cos_two_omega_t * dpotentialdxl)
-
-            A_rotation = A_array_rotation(i,j,k,ispec)
-            B_rotation = B_array_rotation(i,j,k,ispec)
-
-            ux_rotation =   A_rotation*cos_two_omega_t + B_rotation*sin_two_omega_t
-            uy_rotation = - A_rotation*sin_two_omega_t + B_rotation*cos_two_omega_t
-
-            dpotentialdx_with_rot = dpotentialdxl + ux_rotation
-            dpotentialdy_with_rot = dpotentialdyl + uy_rotation
-
-          else
-
-            dpotentialdx_with_rot = dpotentialdxl
-            dpotentialdy_with_rot = dpotentialdyl
-
-          endif  ! end of section with rotation
-
-          ! add (chi/rho)grad(rho) term in no gravity case
-          if(.not. GRAVITY_VAL) then
-            ! With regards to the non-gravitating case: we cannot set N^2 = 0 *and* let g = 0.
-            ! We can *either* assume N^2 = 0 but keep gravity g, *or* we can assume that gravity
-            ! is negligible to begin with, as in our GJI 2002a, in which case N does not arise.
-            ! We get:
-            !
-            ! \ddot\chi = \rho^{-1}\kappa\bdel\cdot(\bdel\chi+\chi\bdel\ln\rho)
-            !
-            ! Then the displacement is
-            !
-            ! \bu = \bdel\chi+\chi\bdel\ln\rho = \rho^{-1}\bdel(\rho\chi)
-            !
-            ! and the pressure is
-            !
-            ! p = -\rho\ddot{\chi}
-            !
-            ! Thus in our 2002b GJI paper eqn (21) is wrong, and equation (41)
-            ! in our AGU monograph is incorrect; these equations should be replaced by
-            !
-            ! \ddot\chi = \rho^{-1}\kappa\bdel\cdot(\bdel\chi+\chi\bdel\ln\rho)
-            !
-            ! Note that the fluid potential we use in GJI 2002a differs from the one used here:
-            !
-            ! \chi_GJI2002a = \rho\partial\t\chi
-            !
-            ! such that
-            !
-            ! \bv = \partial_t\bu=\rho^{-1}\bdel\chi_GJI2002a  (GJI 2002a eqn 20)
-            !
-            ! p = - \partial_t\chi_GJI2002a (GJI 2002a eqn 19)
-
-            ! use mesh coordinates to get theta and phi
-            ! x y z contain r theta phi
-            iglob = ibool(i,j,k,ispec)
-
-            radius = dble(xstore(iglob))
-            theta = dble(ystore(iglob))
-            phi = dble(zstore(iglob))
-
-            cos_theta = dcos(theta)
-            sin_theta = dsin(theta)
-            cos_phi = dcos(phi)
-            sin_phi = dsin(phi)
-
-            int_radius = nint(radius * R_EARTH_KM * 10.d0)
-
-            ! grad(rho)/rho in Cartesian components
-            grad_x_ln_rho = sin_theta * cos_phi * d_ln_density_dr_table(int_radius)
-            grad_y_ln_rho = sin_theta * sin_phi * d_ln_density_dr_table(int_radius)
-            grad_z_ln_rho = cos_theta * d_ln_density_dr_table(int_radius)
-
-            ! adding (chi/rho)grad(rho)
-            dpotentialdx_with_rot = dpotentialdx_with_rot + displfluid(iglob) * grad_x_ln_rho
-            dpotentialdy_with_rot = dpotentialdy_with_rot + displfluid(iglob) * grad_y_ln_rho
-            dpotentialdzl = dpotentialdzl + displfluid(iglob) * grad_z_ln_rho
-
-
-         else  ! if gravity is turned on
-
-            ! compute divergence of displacment
-            ! precompute and store gravity term
-
-            ! use mesh coordinates to get theta and phi
-            ! x y z contain r theta phi
-            iglob = ibool(i,j,k,ispec)
-
-            radius = dble(xstore(iglob))
-            theta = dble(ystore(iglob))
-            phi = dble(zstore(iglob))
-
-            cos_theta = dcos(theta)
-            sin_theta = dsin(theta)
-            cos_phi = dcos(phi)
-            sin_phi = dsin(phi)
-
-            ! get g, rho and dg/dr=dg
-            ! spherical components of the gravitational acceleration
-            ! for efficiency replace with lookup table every 100 m in radial direction
-            int_radius = nint(radius * R_EARTH_KM * 10.d0)
-
-            ! Cartesian components of the gravitational acceleration
-            ! integrate and multiply by rho / Kappa
-            gxl = sin_theta*cos_phi
-            gyl = sin_theta*sin_phi
-            gzl = cos_theta
-
-            ! distinguish between single and double precision for reals
-            if(CUSTOM_REAL == SIZE_REAL) then
-              gravity_term(i,j,k) = &
-                sngl(minus_rho_g_over_kappa_fluid(int_radius) * &
-                dble(jacobianl) * wgll_cube(i,j,k) * &
-               (dble(dpotentialdx_with_rot) * gxl + &
-                dble(dpotentialdy_with_rot) * gyl + dble(dpotentialdzl) * gzl))
-            else
-              gravity_term(i,j,k) = minus_rho_g_over_kappa_fluid(int_radius) * &
-                 jacobianl * wgll_cube(i,j,k) * (dpotentialdx_with_rot * gxl + &
-                 dpotentialdy_with_rot * gyl + dpotentialdzl * gzl)
-            endif
-
-            ! divergence of displacement field with gravity on
-            ! note: these calculations are only considered for SIMULATION_TYPE == 1 .and. SAVE_FORWARD
-            !          and one has set MOVIE_VOLUME_TYPE == 4 when MOVIE_VOLUME is .true.;
-            !         in case of SIMULATION_TYPE == 3, it gets overwritten by compute_kernels_outer_core()
-            if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. MOVIE_VOLUME ) then
-              div_displfluid(i,j,k,ispec) =  &
-                 minus_rho_g_over_kappa_fluid(int_radius) * (dpotentialdx_with_rot * gxl + &
-                 dpotentialdy_with_rot * gyl + dpotentialdzl * gzl)
-            endif
-
-          endif
-
-          tempx1(i,j,k) = jacobianl*(xixl*dpotentialdx_with_rot + xiyl*dpotentialdy_with_rot + xizl*dpotentialdzl)
-          tempx2(i,j,k) = jacobianl*(etaxl*dpotentialdx_with_rot + etayl*dpotentialdy_with_rot + etazl*dpotentialdzl)
-          tempx3(i,j,k) = jacobianl*(gammaxl*dpotentialdx_with_rot + gammayl*dpotentialdy_with_rot + gammazl*dpotentialdzl)
-
-        enddo
-      enddo
-    enddo
-
-    do k=1,NGLLZ
-      do j=1,NGLLY
-        do i=1,NGLLX
-
-          tempx1l = 0._CUSTOM_REAL
-          tempx2l = 0._CUSTOM_REAL
-          tempx3l = 0._CUSTOM_REAL
-
-          do l=1,NGLLX
-            !!! can merge these loops because NGLLX = NGLLY = NGLLZ          enddo
-            tempx1l = tempx1l + tempx1(l,j,k) * hprimewgll_xx(l,i)
-            tempx2l = tempx2l + tempx2(i,l,k) * hprimewgll_yy(l,j)
-            tempx3l = tempx3l + tempx3(i,j,l) * hprimewgll_zz(l,k)
-          enddo
-
-          ! sum contributions from each element to the global mesh and add gravity term
-          sum_terms = - (wgllwgll_yz(j,k)*tempx1l + wgllwgll_xz(i,k)*tempx2l + wgllwgll_xy(i,j)*tempx3l)
-          if(GRAVITY_VAL) sum_terms = sum_terms + gravity_term(i,j,k)
-
-          accelfluid(ibool(i,j,k,ispec)) = accelfluid(ibool(i,j,k,ispec)) + sum_terms
-
-        enddo
-      enddo
-    enddo
-
-    ! update rotation term with Euler scheme
-    if(ROTATION_VAL) then
-      ! use the source saved above
-      A_array_rotation(:,:,:,ispec) = A_array_rotation(:,:,:,ispec) + source_euler_A(:,:,:)
-      B_array_rotation(:,:,:,ispec) = B_array_rotation(:,:,:,ispec) + source_euler_B(:,:,:)
-    endif
-
-  enddo   ! spectral element loop
-
-  end subroutine compute_forces_outer_core
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_Dev.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_Dev.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_Dev.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_noDev.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_noDev.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_forces_outer_core_noDev.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -26,73 +26,56 @@
 !=====================================================================
 
   subroutine compute_forces_outer_core(time,deltat,two_omega_earth, &
-                          A_array_rotation,B_array_rotation, &
-                          d_ln_density_dr_table, &
-                          minus_rho_g_over_kappa_fluid,displfluid,accelfluid, &
-                          div_displfluid, &
-                          xstore,ystore,zstore, &
-                          xix,xiy,xiz,etax,etay,etaz,gammax,gammay,gammaz, &
-          is_on_a_slice_edge_outer_core, &
-          myrank,iproc_xi,iproc_eta,ichunk,addressing, &
-          iboolleft_xi_outer_core,iboolright_xi_outer_core,iboolleft_eta_outer_core,iboolright_eta_outer_core, &
-          npoin2D_faces_outer_core,npoin2D_xi_outer_core,npoin2D_eta_outer_core, &
-          iboolfaces_outer_core,iboolcorner_outer_core, &
-          iprocfrom_faces,iprocto_faces, &
-          iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-          buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-          buffer_send_chunkcorn_scalar,buffer_recv_chunkcorn_scalar,iphase,icall, &
-                          hprime_xx,hprime_yy,hprime_zz, &
-                          hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
-                          wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
-                          ibool,MOVIE_VOLUME,&
-                          istage,A_array_rotation_lddrk,B_array_rotation_lddrk)
+                                      NSPEC,NGLOB, &
+                                      A_array_rotation,B_array_rotation, &
+                                      displfluid,accelfluid, &
+                                      div_displfluid,phase_is_inner)
 
+  use constants_solver
+
+  use specfem_par,only: &
+    hprime_xx,hprime_yy,hprime_zz,hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
+    wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube, &
+    minus_rho_g_over_kappa_fluid,d_ln_density_dr_table, &
+    MOVIE_VOLUME
+
+  use specfem_par_outercore,only: &
+    xstore => xstore_outer_core,ystore => ystore_outer_core,zstore => zstore_outer_core, &
+    xix => xix_outer_core,xiy => xiy_outer_core,xiz => xiz_outer_core, &
+    etax => etax_outer_core,etay => etay_outer_core,etaz => etaz_outer_core, &
+    gammax => gammax_outer_core,gammay => gammay_outer_core,gammaz => gammaz_outer_core, &
+    ibool => ibool_outer_core, &
+    phase_ispec_inner => phase_ispec_inner_outer_core, &
+    nspec_outer => nspec_outer_outer_core, &
+    nspec_inner => nspec_inner_outer_core
+
   implicit none
 
-  include "constants.h"
+  integer :: NSPEC,NGLOB
 
-! include values created by the mesher
-! done for performance only using static allocation to allow for loop unrolling
-  include "OUTPUT_FILES/values_from_mesher.h"
+  ! for the Euler scheme for rotation
+  real(kind=CUSTOM_REAL) time,deltat,two_omega_earth
+  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC) :: &
+    A_array_rotation,B_array_rotation
 
-! displacement and acceleration
-  real(kind=CUSTOM_REAL), dimension(NGLOB_OUTER_CORE) :: displfluid,accelfluid
+  ! displacement and acceleration
+  real(kind=CUSTOM_REAL), dimension(NGLOB) :: displfluid,accelfluid
 
-! divergence of displacement
+  ! divergence of displacement
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_OUTER_CORE_ADJOINT) :: div_displfluid
 
-! arrays with mesh parameters per slice
-  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec_outer_core) :: ibool
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,nspec_outer_core) :: xix,xiy,xiz, &
-                      etax,etay,etaz,gammax,gammay,gammaz
+  ! inner/outer element run flag
+  logical :: phase_is_inner
 
-! array with derivatives of Lagrange polynomials and precalculated products
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLX) :: hprime_xx,hprimewgll_xx
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLY) :: hprime_yy,hprimewgll_yy
-  real(kind=CUSTOM_REAL), dimension(NGLLZ,NGLLZ) :: hprime_zz,hprimewgll_zz
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY) :: wgllwgll_xy
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLZ) :: wgllwgll_xz
-  real(kind=CUSTOM_REAL), dimension(NGLLY,NGLLZ) :: wgllwgll_yz
-  double precision, dimension(NGLLX,NGLLY,NGLLZ) :: wgll_cube
+  ! local parameters
 
-  logical :: MOVIE_VOLUME
-
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: tempx1,tempx2,tempx3
-
-! for gravity
+  ! for gravity
   integer int_radius
   double precision radius,theta,phi,gxl,gyl,gzl
   double precision cos_theta,sin_theta,cos_phi,sin_phi
-  double precision, dimension(NRAD_GRAVITY) :: minus_rho_g_over_kappa_fluid
-  double precision, dimension(NRAD_GRAVITY) :: d_ln_density_dr_table
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: gravity_term
-  real(kind=CUSTOM_REAL), dimension(nglob_outer_core) :: xstore,ystore,zstore
-
-! for the Euler scheme for rotation
-  real(kind=CUSTOM_REAL) time,deltat,two_omega_earth
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_OUTER_CORE_ROTATION) :: &
-    A_array_rotation,B_array_rotation
-
+  ! for the Euler scheme for rotation
   real(kind=CUSTOM_REAL) two_omega_deltat,cos_two_omega_t,sin_two_omega_t,A_rotation,B_rotation, &
        ux_rotation,uy_rotation,dpotentialdx_with_rot,dpotentialdy_with_rot
   real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ) :: source_euler_A,source_euler_B
@@ -106,81 +89,31 @@
 
   double precision grad_x_ln_rho,grad_y_ln_rho,grad_z_ln_rho
 
-! this for non blocking MPI
-  integer :: ichunk,iproc_xi,iproc_eta,myrank
+!  integer :: computed_elements
+  integer :: num_elements,ispec_p
+  integer :: iphase
 
-  integer, dimension(NCHUNKS_VAL,0:NPROC_XI_VAL-1,0:NPROC_ETA_VAL-1) :: addressing
-
-  integer, dimension(NGLOB2DMAX_XMIN_XMAX_OC) :: iboolleft_xi_outer_core,iboolright_xi_outer_core
-  integer, dimension(NGLOB2DMAX_YMIN_YMAX_OC) :: iboolleft_eta_outer_core,iboolright_eta_outer_core
-
-  integer npoin2D_faces_outer_core(NUMFACES_SHARED)
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR) :: npoin2D_xi_outer_core,npoin2D_eta_outer_core
-
-! communication pattern for faces between chunks
-  integer, dimension(NUMMSGS_FACES_VAL) :: iprocfrom_faces,iprocto_faces
-
-! communication pattern for corners between chunks
-  integer, dimension(NCORNERSCHUNKS_VAL) :: iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners
-
-! indirect addressing for each message for faces and corners of the chunks
-! a given slice can belong to at most one corner and at most two faces
-  integer, dimension(NGLOB2DMAX_XY_OC_VAL,NUMFACES_SHARED) :: iboolfaces_outer_core
-
-! buffers for send and receive between faces of the slices and the chunks
-! we use the same buffers to assemble scalars and vectors because vectors are
-! always three times bigger and therefore scalars can use the first part
-! of the vector buffer in memory even if it has an additional index here
-  integer :: npoin2D_max_all_CM_IC
-  real(kind=CUSTOM_REAL), dimension(NDIM,npoin2D_max_all_CM_IC,NUMFACES_SHARED) :: buffer_send_faces,buffer_received_faces
-
-  integer, dimension(NGLOB1D_RADIAL_OC,NUMCORNERS_SHARED) :: iboolcorner_outer_core
-
-  real(kind=CUSTOM_REAL), dimension(NGLOB1D_RADIAL_OC) :: buffer_send_chunkcorn_scalar,buffer_recv_chunkcorn_scalar
-
-  logical, dimension(NSPEC_OUTER_CORE) :: is_on_a_slice_edge_outer_core
-
-  integer :: iphase,icall
-
-  integer :: computed_elements
-
-! for LDDRK
-  integer :: istage
-  real(kind=CUSTOM_REAL), dimension(NGLLX,NGLLY,NGLLZ,NSPEC_OUTER_CORE_ROTATION) :: &
-            A_array_rotation_lddrk,B_array_rotation_lddrk
-
 ! ****************************************************
 !   big loop over all spectral elements in the fluid
 ! ****************************************************
-  if(istage == 1) then
-    if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. SIMULATION_TYPE == 1 .and. icall == 1) div_displfluid(:,:,:,:) = 0._CUSTOM_REAL
-  endif
 
-  computed_elements = 0
+  if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. ( .not. phase_is_inner )) div_displfluid(:,:,:,:) = 0._CUSTOM_REAL
 
-  do ispec = 1,NSPEC_OUTER_CORE
+!  computed_elements = 0
+  if( .not. phase_is_inner ) then
+    iphase = 1
+    num_elements = nspec_outer
+  else
+    iphase = 2
+    num_elements = nspec_inner
+  endif
 
-! hide communications by computing the edges first
-    if((icall == 2 .and. is_on_a_slice_edge_outer_core(ispec)) .or. &
-       (icall == 1 .and. .not. is_on_a_slice_edge_outer_core(ispec))) cycle
+  do ispec_p = 1,num_elements
 
-! process the non-blocking communications every ELEMENTS_NONBLOCKING elements
-    computed_elements = computed_elements + 1
-    if (icall == 2 .and. mod(computed_elements,ELEMENTS_NONBLOCKING_OC) == 0 .and. iphase <= 7) &
-      call assemble_MPI_scalar(myrank,accelfluid,NGLOB_OUTER_CORE, &
-            iproc_xi,iproc_eta,ichunk,addressing, &
-            iboolleft_xi_outer_core,iboolright_xi_outer_core,iboolleft_eta_outer_core,iboolright_eta_outer_core, &
-            npoin2D_faces_outer_core,npoin2D_xi_outer_core,npoin2D_eta_outer_core, &
-            iboolfaces_outer_core,iboolcorner_outer_core, &
-            iprocfrom_faces,iprocto_faces, &
-            iproc_master_corners,iproc_worker1_corners,iproc_worker2_corners, &
-            buffer_send_faces,buffer_received_faces,npoin2D_max_all_CM_IC, &
-            buffer_send_chunkcorn_scalar,buffer_recv_chunkcorn_scalar, &
-            NUMMSGS_FACES_VAL,NCORNERSCHUNKS_VAL, &
-            NPROC_XI_VAL,NPROC_ETA_VAL,NGLOB1D_RADIAL_OC, &
-            NGLOB2DMAX_XMIN_XMAX_OC,NGLOB2DMAX_YMIN_YMAX_OC, &
-            NGLOB2DMAX_XY_OC_VAL,NCHUNKS_VAL,iphase)
+    ispec = phase_ispec_inner(ispec_p,iphase)
 
+    ! only compute element which belong to current phase (inner or outer elements)
+
     do k=1,NGLLZ
       do j=1,NGLLY
         do i=1,NGLLX
@@ -227,8 +160,10 @@
             sin_two_omega_t = sin(two_omega_earth*time)
 
             ! time step deltat of Euler scheme is included in the source
-            source_euler_A(i,j,k) = two_omega_deltat * (cos_two_omega_t * dpotentialdyl + sin_two_omega_t * dpotentialdxl)
-            source_euler_B(i,j,k) = two_omega_deltat * (sin_two_omega_t * dpotentialdyl - cos_two_omega_t * dpotentialdxl)
+            source_euler_A(i,j,k) = two_omega_deltat &
+                  * (cos_two_omega_t * dpotentialdyl + sin_two_omega_t * dpotentialdxl)
+            source_euler_B(i,j,k) = two_omega_deltat &
+                  * (sin_two_omega_t * dpotentialdyl - cos_two_omega_t * dpotentialdxl)
 
             A_rotation = A_array_rotation(i,j,k,ispec)
             B_rotation = B_array_rotation(i,j,k,ispec)
@@ -346,16 +281,14 @@
                  dpotentialdy_with_rot * gyl + dpotentialdzl * gzl)
             endif
 
-            if(istage == 1) then
-              ! divergence of displacement field with gravity on
-              ! note: these calculations are only considered for SIMULATION_TYPE == 1 .and. SAVE_FORWARD
-              !          and one has set MOVIE_VOLUME_TYPE == 4 when MOVIE_VOLUME is .true.;
-              !         in case of SIMULATION_TYPE == 3, it gets overwritten by compute_kernels_outer_core()
-              if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. SIMULATION_TYPE == 1 .and. MOVIE_VOLUME) then
-                div_displfluid(i,j,k,ispec) =  &
-                   minus_rho_g_over_kappa_fluid(int_radius) * (dpotentialdx_with_rot * gxl + &
-                   dpotentialdy_with_rot * gyl + dpotentialdzl * gzl)
-              endif
+            ! divergence of displacement field with gravity on
+            ! note: these calculations are only considered for SIMULATION_TYPE == 1 .and. SAVE_FORWARD
+            !          and one has set MOVIE_VOLUME_TYPE == 4 when MOVIE_VOLUME is .true.;
+            !         in case of SIMULATION_TYPE == 3, it gets overwritten by compute_kernels_outer_core()
+            if (NSPEC_OUTER_CORE_ADJOINT /= 1 .and. MOVIE_VOLUME ) then
+              div_displfluid(i,j,k,ispec) =  &
+                 minus_rho_g_over_kappa_fluid(int_radius) * (dpotentialdx_with_rot * gxl + &
+                 dpotentialdy_with_rot * gyl + dpotentialdzl * gzl)
             endif
 
           endif
@@ -395,18 +328,9 @@
 
     ! update rotation term with Euler scheme
     if(ROTATION_VAL) then
-      if(USE_LDDRK)then
-        ! use the source saved above
-        A_array_rotation_lddrk(:,:,:,ispec) = ALPHA_LDDRK(istage) * A_array_rotation_lddrk(:,:,:,ispec) + source_euler_A(:,:,:)
-        A_array_rotation(:,:,:,ispec) = A_array_rotation(:,:,:,ispec) + BETA_LDDRK(istage) * A_array_rotation_lddrk(:,:,:,ispec)
-
-        B_array_rotation_lddrk(:,:,:,ispec) = ALPHA_LDDRK(istage) * B_array_rotation_lddrk(:,:,:,ispec) + source_euler_B(:,:,:)
-        B_array_rotation(:,:,:,ispec) = B_array_rotation(:,:,:,ispec) + BETA_LDDRK(istage) * B_array_rotation_lddrk(:,:,:,ispec)
-      else
-        ! use the source saved above
-        A_array_rotation(:,:,:,ispec) = A_array_rotation(:,:,:,ispec) + source_euler_A(:,:,:)
-        B_array_rotation(:,:,:,ispec) = B_array_rotation(:,:,:,ispec) + source_euler_B(:,:,:)
-      endif
+      ! use the source saved above
+      A_array_rotation(:,:,:,ispec) = A_array_rotation(:,:,:,ispec) + source_euler_A(:,:,:)
+      B_array_rotation(:,:,:,ispec) = B_array_rotation(:,:,:,ispec) + source_euler_B(:,:,:)
     endif
 
   enddo   ! spectral element loop

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_kernels.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_kernels.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_kernels.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -61,8 +61,7 @@
   subroutine compute_kernels_crust_mantle()
 
   use constants_solver
-  use specfem_par,only: deltat
-  use specfem_par,only: GPU_MODE,Mesh_pointer
+  use specfem_par,only: deltat,GPU_MODE,Mesh_pointer,ANISOTROPIC_KL
   use specfem_par_crustmantle
   implicit none
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_seismograms.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_seismograms.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_seismograms.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -32,9 +32,9 @@
                                 seismo_current,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
                                 seismograms)
 
+  use constants_solver
+
   implicit none
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
 
   integer nrec_local,nrec
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_crust_mantle.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_crust_mantle.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_crust_mantle.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_outer_core.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_outer_core.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/compute_stacey_outer_core.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/convert_time.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/convert_time.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/convert_time.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/create_central_cube_buffers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/create_central_cube_buffers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/create_central_cube_buffers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -40,12 +40,10 @@
        receiver_cube_from_slices,sender_from_slices_to_cube,ibool_central_cube, &
        buffer_slices,buffer_slices2,buffer_all_cube_from_slices)
 
-  use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-
   integer, intent(in) :: myrank,iproc_xi,iproc_eta,ichunk, &
        NPROC_XI,NPROC_ETA,NCHUNKS,NSPEC_INNER_CORE,NGLOB_INNER_CORE, &
        NSPEC2DMAX_XMIN_XMAX_INNER_CORE,NSPEC2DMAX_YMIN_YMAX_INNER_CORE,NSPEC2D_BOTTOM_INNER_CORE
@@ -85,9 +83,6 @@
   double precision x_target,y_target,z_target
   double precision x_current,y_current,z_current
 
-! MPI status of messages to be received
-  integer msg_status(MPI_STATUS_SIZE)
-
 !--- processor to send information to in cube from slices
 
 ! four vertical sides first
@@ -231,9 +226,7 @@
 
 ! receive buffers from slices
     sender = sender_from_slices_to_cube(imsg)
-    call MPI_RECV(buffer_slices, &
-              NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-              itag,MPI_COMM_WORLD,msg_status,ier)
+    call recv_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,sender,itag)
 
 ! copy buffer in 2D array for each slice
     buffer_all_cube_from_slices(imsg,:,:) = buffer_slices(:,:)
@@ -265,8 +258,7 @@
 
 ! send buffer to central cube
     receiver = receiver_cube_from_slices
-    call MPI_SEND(buffer_slices,NDIM*npoin2D_cube_from_slices, &
-              MPI_DOUBLE_PRECISION,receiver,itag,MPI_COMM_WORLD,ier)
+    call send_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,receiver,itag)
 
  endif  ! end sending info to central cube
 
@@ -292,9 +284,8 @@
 
     sender = sender_from_slices_to_cube(nb_msgs_theor_in_cube)
 
-    call MPI_SENDRECV(buffer_slices,NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,receiver_cube_from_slices, &
-        itag,buffer_slices2,NDIM*npoin2D_cube_from_slices,MPI_DOUBLE_PRECISION,sender, &
-        itag,MPI_COMM_WORLD,msg_status,ier)
+    call sendrecv_dp(buffer_slices,NDIM*npoin2D_cube_from_slices,receiver_cube_from_slices,itag, &
+                    buffer_slices2,NDIM*npoin2D_cube_from_slices,sender,itag)
 
     buffer_all_cube_from_slices(nb_msgs_theor_in_cube,:,:) = buffer_slices2(:,:)
 
@@ -479,10 +470,10 @@
 !--- compute number of messages to expect in cube as well as their size
 !--- take into account vertical sides and bottom side
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer, intent(in) :: iproc_xi,iproc_eta,ichunk,NPROC_XI,NPROC_ETA,NSPEC2D_BOTTOM_INNER_CORE
 
   integer, intent(out) :: nb_msgs_theor_in_cube,npoin2D_cube_from_slices

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/define_derivation_matrices.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/define_derivation_matrices.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/define_derivation_matrices.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,10 @@
          hprimewgll_xx,hprimewgll_yy,hprimewgll_zz, &
          wgllwgll_xy,wgllwgll_xz,wgllwgll_yz,wgll_cube)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
 ! Gauss-Lobatto-Legendre points of integration and weights
   double precision, dimension(NGLLX) :: xigll,wxgll
   double precision, dimension(NGLLY) :: yigll,wygll

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/finalize_simulation.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/finalize_simulation.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/finalize_simulation.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/fix_non_blocking_flags.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/fix_non_blocking_flags.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/fix_non_blocking_flags.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_attenuation.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_attenuation.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_attenuation.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -25,17 +25,16 @@
 !
 !=====================================================================
 
-  subroutine get_attenuation_model_3D_or_1D(myrank, prname, &
-                                           one_minus_sum_beta, &
-                                           factor_common, &
-                                           scale_factor, tau_s, vx, vy, vz, vnspec)
+  subroutine get_attenuation_model_3D(myrank, prname, &
+                                      one_minus_sum_beta, &
+                                      factor_common, &
+                                      scale_factor, tau_s, vnspec)
 
+  use constants_solver
   use specfem_par,only: ATTENUATION_VAL, ADIOS_FOR_ARRAYS_SOLVER
 
   implicit none
 
-  include 'constants.h'
-
   integer :: myrank
 
   integer :: vx,vy,vz,vnspec
@@ -52,8 +51,8 @@
 !! DK DK to Daniel, Jul 2013
 !! DK DK to Daniel, Jul 2013
 !! DK DK to Daniel, Jul 2013
-  double precision, dimension(vx,vy,vz,vnspec)       :: one_minus_sum_beta, scale_factor
-  double precision, dimension(N_SLS,vx,vy,vz,vnspec) :: factor_common
+  real(kind=CUSTOM_REAL_ATT), dimension(ATT1_VAL,ATT2_VAL,ATT3_VAL,vnspec)       :: one_minus_sum_beta, scale_factor
+  real(kind=CUSTOM_REAL_ATT), dimension(N_SLS,ATT1_VAL,ATT2_VAL,ATT3_VAL,vnspec) :: factor_common
 
   double precision, dimension(N_SLS)                 :: tau_s
 
@@ -90,56 +89,38 @@
   T_c_source               = 1000.0d0 / T_c_source
   T_c_source               = T_c_source / scale_t
 
-  if( USE_3D_ATTENUATION_ARRAYS ) then
-    do ispec = 1, vnspec
-      do k = 1, NGLLZ
-        do j = 1, NGLLY
-          do i = 1, NGLLX
-            tau_e(:) = factor_common(:,i,j,k,ispec)
-            Q_mu     = scale_factor(i,j,k,ispec)
+  do ispec = 1, vnspec
+    do k = 1, ATT3_VAL
+      do j = 1, ATT2_VAL
+        do i = 1, ATT1_VAL
+          tau_e(:) = factor_common(:,i,j,k,ispec)
+          Q_mu     = scale_factor(i,j,k,ispec)
 
-            ! Determine the factor_common and one_minus_sum_beta from tau_s and tau_e
-            call get_attenuation_property_values(tau_s, tau_e, fc, omsb)
+          ! Determine the factor_common and one_minus_sum_beta from tau_s and tau_e
+          call get_attenuation_property_values(tau_s, tau_e, fc, omsb)
 
-            factor_common(:,i,j,k,ispec)    = fc(:)
-            one_minus_sum_beta(i,j,k,ispec) = omsb
+          factor_common(:,i,j,k,ispec)    = fc(:)
+          one_minus_sum_beta(i,j,k,ispec) = omsb
 
-            ! Determine the "scale_factor" from tau_s, tau_e, central source frequency, and Q
-            call get_attenuation_scale_factor(myrank, T_c_source, tau_e, tau_s, Q_mu, sf)
-            scale_factor(i,j,k,ispec) = sf
-          enddo
+          ! Determine the "scale_factor" from tau_s, tau_e, central source frequency, and Q
+          call get_attenuation_scale_factor(myrank, T_c_source, tau_e, tau_s, Q_mu, sf)
+          scale_factor(i,j,k,ispec) = sf
         enddo
       enddo
     enddo
-  else
-    ! uses 1-D arrays for attenuation
-    do ispec = 1, vnspec
-      tau_e(:) = factor_common(:,1,1,1,ispec)
-      Q_mu     = scale_factor(1,1,1,ispec)
+  enddo
 
-      ! Determine the factor_common and one_minus_sum_beta from tau_s and tau_e
-      call get_attenuation_property_values(tau_s, tau_e, fc, omsb)
+  end subroutine get_attenuation_model_3D
 
-      factor_common(:,1,1,1,ispec)   = fc(:)
-      one_minus_sum_beta(1,1,1,ispec) = omsb
-
-      ! Determine the "scale_factor" from tau_s, tau_e, central source frequency, and Q
-      call get_attenuation_scale_factor(myrank, T_c_source, tau_e, tau_s, Q_mu, sf)
-      scale_factor(1,1,1,ispec) = sf
-    enddo
-  endif
-
-  end subroutine get_attenuation_model_3D_or_1D
-
 !
 !-------------------------------------------------------------------------------------------------
 !
   subroutine get_attenuation_property_values(tau_s, tau_e, factor_common, one_minus_sum_beta)
 
+  use constants
+
   implicit none
 
-  include 'constants.h'
-
   double precision, dimension(N_SLS),intent(in) :: tau_s, tau_e
   double precision, dimension(N_SLS),intent(out) :: factor_common
   double precision,intent(out) ::  one_minus_sum_beta
@@ -172,10 +153,10 @@
 
   subroutine get_attenuation_scale_factor(myrank, T_c_source, tau_mu, tau_sigma, Q_mu, scale_factor)
 
+  use constants
+
   implicit none
 
-  include 'constants.h'
-
   integer myrank
   double precision scale_factor, Q_mu, T_c_source
   double precision, dimension(N_SLS) :: tau_mu, tau_sigma
@@ -238,10 +219,10 @@
 
   subroutine get_attenuation_memory_values(tau_s,deltat, alphaval,betaval,gammaval)
 
+  use constants
+
   implicit none
 
-  include 'constants.h'
-
   double precision, dimension(N_SLS), intent(in) :: tau_s
   double precision, dimension(N_SLS), intent(out) :: alphaval, betaval,gammaval
   real(kind=CUSTOM_REAL), intent(in) :: deltat

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_backazimuth.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_backazimuth.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_backazimuth.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_cmt.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_cmt.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_cmt.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_event_info.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_event_info.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/get_event_info.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -38,12 +38,10 @@
                                     elat,elon,depth,mb,cmt_lat, &
                                     cmt_lon,cmt_depth,cmt_hdur,NSOURCES)
 
-  use mpi
+  use constants
 
   implicit none
 
-  include "constants.h"
-
 !--- input or output arguments of the subroutine below
 
   integer, intent(in) :: myrank
@@ -57,9 +55,6 @@
 
   character(len=20), intent(out) :: event_name
 
-  ! local parameters
-  integer :: ier
-
   ! get event information for SAC header on the master
   if(myrank == 0) then
 
@@ -81,28 +76,28 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(yr,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(jda,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ho,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(mi,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(yr,1)
+  call bcast_all_i(jda,1)
+  call bcast_all_i(ho,1)
+  call bcast_all_i(mi,1)
 
-  call MPI_BCAST(sec,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(sec,1)
 
-  call MPI_BCAST(tshift_cmt,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(t_shift,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(tshift_cmt,1)
+  call bcast_all_dp(t_shift,1)
 
   ! event location given on first, PDE line
-  call MPI_BCAST(elat,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(elon,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(depth,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(elat,1)
+  call bcast_all_dp(elon,1)
+  call bcast_all_dp(depth,1)
 
   ! cmt location given in CMT file
-  call MPI_BCAST(cmt_lat,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(cmt_lon,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(cmt_depth,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(cmt_hdur,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(cmt_lat,1)
+  call bcast_all_dp(cmt_lon,1)
+  call bcast_all_dp(cmt_depth,1)
+  call bcast_all_dp(cmt_hdur,1)
 
-  call MPI_BCAST(event_name,20,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(event_name,20)
 
   end subroutine get_event_info_parallel
 
@@ -120,10 +115,10 @@
                             elat_pde,elon_pde,depth_pde,mb,&
                             cmt_lat,cmt_lon,cmt_depth,cmt_hdur,NSOURCES)
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
 !--- arguments of the subroutine below
 
   integer, intent(in) :: NSOURCES

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/initialize_simulation.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/initialize_simulation.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/initialize_simulation.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -33,32 +33,31 @@
   implicit none
 
   ! local parameters
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC_computed,NGLOB_computed, &
-    NSPEC2D_XI,NSPEC2D_ETA,NSPEC1D_RADIAL,NGLOB1D_RADIAL
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-    NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC_computed,NGLOB_computed, &
+!    NSPEC2D_XI,NSPEC2D_ETA,NSPEC1D_RADIAL,NGLOB1D_RADIAL
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!    NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX
 
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
-  integer :: ratio_divide_central_cube
+!  integer :: ratio_divide_central_cube
   integer :: sizeprocs
   integer :: ios
-  integer :: NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,NCHUNKS,NPROC_XI,NPROC_ETA
+!  integer :: NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,NCHUNKS,NPROC_XI,NPROC_ETA
 
-  double precision :: RMOHO_FICTITIOUS_IN_MESHER,R120,R_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES,&
-    CENTER_LATITUDE_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-    GAMMA_ROTATION_AZIMUTH
+!  double precision :: RMOHO_FICTITIOUS_IN_MESHER,R120,R_CENTRAL_CUBE,CENTER_LONGITUDE_IN_DEGREES,&
+!    CENTER_LATITUDE_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+!    GAMMA_ROTATION_AZIMUTH
 
-  integer :: REFERENCE_1D_MODEL,THREE_D_MODEL
+!  integer :: REFERENCE_1D_MODEL,THREE_D_MODEL
 
-  logical :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE,OCEANS, &
-    ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ROTATION,ELLIPTICITY, &
-    GRAVITY,CASE_3D,ISOTROPIC_3D_MANTLE, &
-    HETEROGEN_3D_MANTLE,CRUSTAL,INFLATE_CENTRAL_CUBE
+!  logical :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE,OCEANS, &
+!    ATTENUATION,ATTENUATION_3D,ROTATION,ELLIPTICITY, &
+!    GRAVITY,CASE_3D,ISOTROPIC_3D_MANTLE, &
+!    HETEROGEN_3D_MANTLE,CRUSTAL,INFLATE_CENTRAL_CUBE
   character(len=150) :: dummystring
-  integer, external :: err_occurred
 
   ! sizeprocs returns number of processes started (should be equal to NPROCTOT).
   ! myrank is the rank of each process, between 0 and sizeprocs-1.
@@ -70,94 +69,95 @@
   if (myrank == 0) then
 
     ! read the parameter file and compute additional parameters
-    call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST, &
-         MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-         ATTENUATION,ATTENUATION_NEW,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
-         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-         SIMULATION_TYPE,SAVE_FORWARD, &
-         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-         NSPEC_computed,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
-         NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB_computed, &
-         ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-         this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
-         HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
-         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
+    call read_compute_parameters()
+!         MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!         NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!         NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!         NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!         NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!         NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!         NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!         ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!         CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!         RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!         R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!         MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST, &
+!         MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!         TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!         ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!         ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!         MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!         PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!         ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!         INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE, &
+!         LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!         SIMULATION_TYPE,SAVE_FORWARD, &
+!         NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!         NSPEC_computed,NSPEC2D_XI,NSPEC2D_ETA,NSPEC2DMAX_XMIN_XMAX, &
+!         NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!         NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB_computed, &
+!         ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!         this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!         OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!         ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube, &
+!         HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!         DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!         WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE, &
+!         USE_BINARY_FOR_LARGE_FILE,.false.,NOISE_TOMOGRAPHY)
 
-    if(err_occurred() /= 0) then
-      call exit_MPI(myrank,'an error occurred while reading the parameter file')
-    endif
+!    ! GPU_MODE: parameter is optional, may not be in the Par_file
+!    call read_gpu_mode(GPU_MODE)
 
-    ! GPU_MODE: parameter is optional, may not be in the Par_file
-    call read_gpu_mode(GPU_MODE)
     ! ADIOS_ENABLED: parameter is optional, may not be in the Par_file
-    call read_adios_parameters(ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, &
-        ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
-        ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
+!    call read_adios_parameters(ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, &
+!                               ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
+!                               ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
+
   endif
 
   ! distributes parameters from master to all processes
-  ! note: uses NSPEC_computed,NGLOB_computed as arguments
-  call broadcast_computed_parameters(myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
-                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-                RMOHO_FICTITIOUS_IN_MESHER, &
-                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
-                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
-                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
-                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-                NSPEC_computed,NSPEC2D_XI,NSPEC2D_ETA, &
-                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB_computed, &
-                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
-                this_region_has_a_doubling,rmins,rmaxs, &
-                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
-                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
-                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
-                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
-                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
-                ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+  call broadcast_computed_parameters()
+!                myrank,MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!                NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!                NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!                NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!                NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!                NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!                NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!                MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP, &
+!                DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!                CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!                RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!                R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!                MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!                RMOHO_FICTITIOUS_IN_MESHER, &
+!                MOVIE_SURFACE,MOVIE_VOLUME,RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!                SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!                SAVE_ALL_SEISMOS_IN_ONE_FILE,MOVIE_COARSE,OUTPUT_SEISMOS_ASCII_TEXT, &
+!                OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!                ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,USE_BINARY_FOR_LARGE_FILE, &
+!                LOCAL_PATH,LOCAL_TMP_PATH,MODEL, &
+!                NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!                NSPEC_computed,NSPEC2D_XI,NSPEC2D_ETA, &
+!                NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!                NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB_computed, &
+!                ratio_sampling_array, ner, doubling_index,r_bottom,r_top, &
+!                this_region_has_a_doubling,rmins,rmaxs, &
+!                ratio_divide_central_cube,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA, &
+!                DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA, &
+!                REFERENCE_1D_MODEL,THREE_D_MODEL,ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, &
+!                HONOR_1D_SPHERICAL_MOHO,CRUSTAL,ONE_CRUST,CASE_3D,TRANSVERSE_ISOTROPY, &
+!                ISOTROPIC_3D_MANTLE,ANISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE, &
+!                ATTENUATION,ATTENUATION_3D,ANISOTROPIC_INNER_CORE,NOISE_TOMOGRAPHY)
+!
+  ! broadcasts optional GPU_MODE
+!  call broadcast_gpu_parameters(myrank,GPU_MODE)
 
-  ! broadcasts optional GPU_MODE
-  call broadcast_gpu_parameters(myrank,GPU_MODE)
   ! broadcasts optional ADIOS_ENABLED
-  call broadcast_adios_parameters(myrank,ADIOS_ENABLED, &
-      ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
-      ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
+!  call broadcast_adios_parameters(myrank,ADIOS_ENABLED, &
+!                                  ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, ADIOS_FOR_ARRAYS_SOLVER, &
+!                                  ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX)
+
   ! get the base pathname for output files
   call get_value_string(OUTPUT_FILES, 'OUTPUT_FILES', 'OUTPUT_FILES')
 
@@ -286,13 +286,24 @@
 
   endif
 
+  ! define strain storage
+  ! this cannot be made a constant stored in values_from_mesher.h because it depends on SIMULATION_TYPE
+  if (ATTENUATION_VAL .or. SIMULATION_TYPE /= 1 .or. SAVE_FORWARD &
+    .or. (MOVIE_VOLUME .and. SIMULATION_TYPE /= 3)) then
+    COMPUTE_AND_STORE_STRAIN = .true.
+  else
+    COMPUTE_AND_STORE_STRAIN = .false.
+  endif
+
   ! checks flags
-  call initialize_simulation_check(sizeprocs,NPROCTOT,NSPEC_COMPUTED, &
-                                  ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,NCHUNKS,GRAVITY,ROTATION, &
-                                  ELLIPTICITY,OCEANS,NPROC_XI,NPROC_ETA, &
-                                  TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-                                  ANISOTROPIC_INNER_CORE)
+  call initialize_simulation_check(sizeprocs)
+!                                 ,NPROCTOT,NSPEC, &
+!                                  ATTENUATION,ATTENUATION_3D,NCHUNKS,GRAVITY,ROTATION, &
+!                                  ELLIPTICITY,OCEANS,NPROC_XI,NPROC_ETA, &
+!                                  TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!                                  ANISOTROPIC_INNER_CORE)
 
+
   ! counts receiver stations
   if (SIMULATION_TYPE == 1) then
     rec_filename = 'DATA/STATIONS'
@@ -343,37 +354,38 @@
 !-------------------------------------------------------------------------------------------------
 !
 
-  subroutine initialize_simulation_check(sizeprocs,NPROCTOT,NSPEC_COMPUTED, &
-                                        ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,NCHUNKS,GRAVITY,ROTATION, &
-                                        ELLIPTICITY,OCEANS,NPROC_XI,NPROC_ETA, &
-                                        TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-                                        ANISOTROPIC_INNER_CORE)
+  subroutine initialize_simulation_check(sizeprocs)
+!                                      ,NPROCTOT,NSPEC, &
+!                                        ATTENUATION,ATTENUATION_3D,NCHUNKS,GRAVITY,ROTATION, &
+!                                        ELLIPTICITY,OCEANS,NPROC_XI,NPROC_ETA, &
+!                                        TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!                                        ANISOTROPIC_INNER_CORE)
 
   use specfem_par
   implicit none
 
   integer :: sizeprocs
-  integer :: NPROCTOT,NCHUNKS,NPROC_XI,NPROC_ETA
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC_computed
+!  integer :: NPROCTOT,NCHUNKS,NPROC_XI,NPROC_ETA
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC
 
-  logical :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE,OCEANS, &
-    ATTENUATION,ATTENUATION_NEW,ATTENUATION_3D,ROTATION,ELLIPTICITY,GRAVITY
+!  logical :: TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE,OCEANS, &
+!    ATTENUATION,ATTENUATION_3D,ROTATION,ELLIPTICITY,GRAVITY
 
 
   ! check that the code is running with the requested nb of processes
   if(sizeprocs /= NPROCTOT) call exit_MPI(myrank,'wrong number of MPI processes(initialization specfem)')
 
   ! check that the code has been compiled with the right values
-  if (NSPEC_computed(IREGION_CRUST_MANTLE) /= NSPEC_CRUST_MANTLE) then
-      write(IMAIN,*) 'NSPEC_CRUST_MANTLE:',NSPEC_computed(IREGION_CRUST_MANTLE),NSPEC_CRUST_MANTLE
+  if (NSPEC(IREGION_CRUST_MANTLE) /= NSPEC_CRUST_MANTLE) then
+      write(IMAIN,*) 'NSPEC_CRUST_MANTLE:',NSPEC(IREGION_CRUST_MANTLE),NSPEC_CRUST_MANTLE
       call exit_MPI(myrank,'error in compiled parameters, please recompile solver 1')
   endif
-  if (NSPEC_computed(IREGION_OUTER_CORE) /= NSPEC_OUTER_CORE) then
-      write(IMAIN,*) 'NSPEC_OUTER_CORE:',NSPEC_computed(IREGION_OUTER_CORE),NSPEC_OUTER_CORE
+  if (NSPEC(IREGION_OUTER_CORE) /= NSPEC_OUTER_CORE) then
+      write(IMAIN,*) 'NSPEC_OUTER_CORE:',NSPEC(IREGION_OUTER_CORE),NSPEC_OUTER_CORE
       call exit_MPI(myrank,'error in compiled parameters, please recompile solver 2')
   endif
-  if (NSPEC_computed(IREGION_INNER_CORE) /= NSPEC_INNER_CORE) then
-      write(IMAIN,*) 'NSPEC_INNER_CORE:',NSPEC_computed(IREGION_INNER_CORE),NSPEC_INNER_CORE
+  if (NSPEC(IREGION_INNER_CORE) /= NSPEC_INNER_CORE) then
+      write(IMAIN,*) 'NSPEC_INNER_CORE:',NSPEC(IREGION_INNER_CORE),NSPEC_INNER_CORE
       call exit_MPI(myrank,'error in compiled parameters, please recompile solver 3')
   endif
   if (ATTENUATION_3D .NEQV. ATTENUATION_3D_VAL) then
@@ -396,10 +408,6 @@
       write(IMAIN,*) 'ATTENUATION:',ATTENUATION,ATTENUATION_VAL
       call exit_MPI(myrank,'error in compiled parameters ATTENUATION, please recompile solver')
   endif
-  if (ATTENUATION_NEW .NEQV. ATTENUATION_NEW_VAL) then
-      write(IMAIN,*) 'ATTENUATION_NEW:',ATTENUATION_NEW,ATTENUATION_NEW_VAL
-      call exit_MPI(myrank,'error in compiled parameters ATTENUATION_NEW, please recompile solver')
-  endif
   if (ELLIPTICITY .NEQV. ELLIPTICITY_VAL) then
       write(IMAIN,*) 'ELLIPTICITY:',ELLIPTICITY,ELLIPTICITY_VAL
       call exit_MPI(myrank,'error in compiled parameters ELLIPTICITY, please recompile solver')
@@ -448,13 +456,26 @@
   if (SIMULATION_TYPE /= 1 .and. NSOURCES > 999999)  &
     call exit_MPI(myrank,'for adjoint simulations, NSOURCES <= 999999, if you need more change i6.6 in write_seismograms.f90')
 
+  ! attenuation
+  if(UNDO_ATTENUATION .and. PARTIAL_PHYS_DISPERSION_ONLY) &
+    call exit_MPI(myrank,'cannot have both UNDO_ATTENUATION and PARTIAL_PHYS_DISPERSION_ONLY, please check Par_file...')
+
   if((SIMULATION_TYPE == 1 .and. SAVE_FORWARD) .or. SIMULATION_TYPE == 3) then
     if ( ATTENUATION_VAL) then
       ! checks mimic flag:
       ! attenuation for adjoint simulations must have PARTIAL_PHYS_DISPERSION_ONLY set by xcreate_header_file
-      if(.not. PARTIAL_PHYS_DISPERSION_ONLY) &
-        call exit_MPI(myrank,'error in compiled attenuation parameters, please recompile solver 17b')
+      if(.not. UNDO_ATTENUATION )then
+        if(.not. PARTIAL_PHYS_DISPERSION_ONLY) then
+          call exit_MPI(myrank, &
+                    'ATTENUATION for adjoint runs or SAVE_FORWARD requires UNDO_ATTENUATION or PARTIAL_PHYS_DISPERSION_ONLY')
+        endif
+      endif
 
+      if (PARTIAL_PHYS_DISPERSION_ONLY .NEQV. PARTIAL_PHYS_DISPERSION_ONLY_VAL) then
+        write(IMAIN,*) 'PARTIAL_PHYS_DISPERSION_ONLY:',PARTIAL_PHYS_DISPERSION_ONLY,PARTIAL_PHYS_DISPERSION_ONLY_VAL
+        call exit_MPI(myrank,'error in compiled parameters, please recompile solver 17')
+      endif
+
       ! user output
       if( myrank == 0 ) then
         write(IMAIN,*) 'incorporates ATTENUATION for time-reversed simulation'
@@ -483,11 +504,11 @@
   ! checks strain storage
   if (ATTENUATION_VAL .or. SIMULATION_TYPE /= 1 .or. SAVE_FORWARD &
     .or. (MOVIE_VOLUME .and. SIMULATION_TYPE /= 3)) then
-    if( COMPUTE_AND_STORE_STRAIN_VAL .neqv. .true. ) &
-      call exit_MPI(myrank, 'error in compiled COMPUTE_AND_STORE_STRAIN_VAL parameter, please recompile solver 19')
+    if( COMPUTE_AND_STORE_STRAIN .neqv. .true. ) &
+      call exit_MPI(myrank, 'error in compiled COMPUTE_AND_STORE_STRAIN parameter, please recompile solver 19')
   else
-    if( COMPUTE_AND_STORE_STRAIN_VAL .neqv. .false. ) &
-      call exit_MPI(myrank, 'error in compiled COMPUTE_AND_STORE_STRAIN_VAL parameter, please recompile solver 20')
+    if( COMPUTE_AND_STORE_STRAIN .neqv. .false. ) &
+      call exit_MPI(myrank, 'error in compiled COMPUTE_AND_STORE_STRAIN parameter, please recompile solver 20')
   endif
 
   if (SIMULATION_TYPE == 3 .and. (ANISOTROPIC_3D_MANTLE_VAL .or. ANISOTROPIC_INNER_CORE_VAL)) &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/iterate_time.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/iterate_time.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/iterate_time.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -64,6 +64,12 @@
   ! get MPI starting time
   time_start = wtime()
 
+#ifdef FORCE_VECTORIZATION
+  if(ATTENUATION_VAL .and. .not. PARTIAL_PHYS_DISPERSION_ONLY_VAL .and. N_SLS /= 3) &
+      stop 'FORCE_VECTORIZATION can only be used with N_SLS == 3 when ATTENUATION .and. .not. PARTIAL_PHYS_DISPERSION_ONLY&
+              & because N_SLS is assumed to be equal to 3 when vectorizing compute_element_iso,tiso,aniso'
+#endif
+
   ! *********************************************************
   ! ************* MAIN LOOP OVER THE TIME STEPS *************
   ! *********************************************************

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_receivers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_receivers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_receivers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -34,8 +34,8 @@
                              yr,jda,ho,mi,sec, &
                              theta_source,phi_source,NCHUNKS,ELLIPTICITY)
 
-  use mpi
   use constants_solver
+
   use specfem_par,only: &
     myrank,DT,NSTEP, &
     xigll,yigll,zigll, &
@@ -47,8 +47,6 @@
 
   implicit none
 
-  include "precision.h"
-
   integer nspec,nglob
 
   integer ibool(NGLLX,NGLLY,NGLLZ,nspec)
@@ -138,6 +136,8 @@
   character(len=150) OUTPUT_FILES
   character(len=2) bic
 
+  integer, allocatable, dimension(:) :: station_duplet
+
   ! timing
   double precision, external :: wtime
 
@@ -220,8 +220,9 @@
 ! file, problems occur, as two (or more) seismograms are written (with mode
 ! "append") to a file with same name. The philosophy here is to accept multiple
 ! appearences and to just add a count to the station name in this case.
-    allocate(station_duplet(nrec))
-    station_duplet=0
+    allocate(station_duplet(nrec),stat=ier)
+    if( ier /= 0 ) call exit_MPI(myrank,'error allocating station_duplet array')
+    station_duplet(:) = 0
     do irec = 1,nrec
       do i=1,irec-1
         if ((station_name(irec)==station_name(i)) .and. &
@@ -237,6 +238,7 @@
         endif
       enddo
     enddo
+    deallocate(station_duplet)
 ! BS BS end
 
     ! if receivers can not be buried, sets depth to zero
@@ -245,13 +247,13 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(station_name,nrec*MAX_LENGTH_STATION_NAME,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(network_name,nrec*MAX_LENGTH_NETWORK_NAME,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(station_name,nrec*MAX_LENGTH_STATION_NAME)
+  call bcast_all_ch(network_name,nrec*MAX_LENGTH_NETWORK_NAME)
 
-  call MPI_BCAST(stlat,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stlon,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stele,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stbur,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(stlat,nrec)
+  call bcast_all_dp(stlon,nrec)
+  call bcast_all_dp(stele,nrec)
+  call bcast_all_dp(stbur,nrec)
 
   ! loop on all the stations to locate them in the mesh
   do irec=1,nrec
@@ -590,22 +592,15 @@
 
   ! for MPI version, gather information from all the nodes
   ispec_selected_rec_all(:,:) = -1
-  call MPI_GATHER(ispec_selected_rec,nrec,MPI_INTEGER,ispec_selected_rec_all,nrec,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call gather_all_i(ispec_selected_rec,nrec,ispec_selected_rec_all,nrec,NPROCTOT_VAL)
 
-  call MPI_GATHER(xi_receiver,nrec,MPI_DOUBLE_PRECISION,xi_receiver_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(eta_receiver,nrec,MPI_DOUBLE_PRECISION,eta_receiver_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(gamma_receiver,nrec,MPI_DOUBLE_PRECISION,gamma_receiver_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(final_distance,nrec,MPI_DOUBLE_PRECISION,final_distance_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(x_found,nrec,MPI_DOUBLE_PRECISION,x_found_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(y_found,nrec,MPI_DOUBLE_PRECISION,y_found_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(z_found,nrec,MPI_DOUBLE_PRECISION,z_found_all,nrec, &
-                  MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call gather_all_dp(xi_receiver,nrec,xi_receiver_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(eta_receiver,nrec,eta_receiver_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(gamma_receiver,nrec,gamma_receiver_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(final_distance,nrec,final_distance_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(x_found,nrec,x_found_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(y_found,nrec,y_found_all,nrec,NPROCTOT_VAL)
+  call gather_all_dp(z_found,nrec,z_found_all,nrec,NPROCTOT_VAL)
 
   ! this is executed by main process only
   if(myrank == 0) then
@@ -770,23 +765,24 @@
   deallocate(final_distance_all)
 
   ! main process broadcasts the results to all the slices
-  call MPI_BCAST(nrec,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(nrec,1)
 
-  call MPI_BCAST(islice_selected_rec,nrec,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ispec_selected_rec,nrec,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(xi_receiver,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eta_receiver,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(gamma_receiver,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(islice_selected_rec,nrec)
+  call bcast_all_i(ispec_selected_rec,nrec)
 
-  call MPI_BCAST(station_name,nrec*MAX_LENGTH_STATION_NAME,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(network_name,nrec*MAX_LENGTH_NETWORK_NAME,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(xi_receiver,nrec)
+  call bcast_all_dp(eta_receiver,nrec)
+  call bcast_all_dp(gamma_receiver,nrec)
 
-  call MPI_BCAST(stlat,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stlon,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stele,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(stbur,nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(nu,nrec*3*3,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_ch(station_name,nrec*MAX_LENGTH_STATION_NAME)
+  call bcast_all_ch(network_name,nrec*MAX_LENGTH_NETWORK_NAME)
 
+  call bcast_all_dp(stlat,nrec)
+  call bcast_all_dp(stlon,nrec)
+  call bcast_all_dp(stele,nrec)
+  call bcast_all_dp(stbur,nrec)
+  call bcast_all_dp(nu,nrec*3*3)
+
   ! elapsed time since beginning of mesh generation
   if( myrank == 0 ) then
     tCPU = wtime() - time_start

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_regular_points.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_regular_points.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_regular_points.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,8 +27,9 @@
 
 subroutine read_kl_regular_grid(myrank, GRID)
 
+  use constants
+
   implicit none
-  include 'constants.h'
 
   type kl_reg_grid_variables
     sequence
@@ -88,8 +89,9 @@
 subroutine find_regular_grid_slice_number(slice_number, GRID, &
                                           NCHUNKS, NPROC_XI, NPROC_ETA)
 
+  use constants
+
   implicit none
-  include 'constants.h'
 
   integer, intent(out) :: slice_number(*)
 
@@ -158,11 +160,10 @@
                              xigll,yigll,zigll,ispec_reg, &
                              hxir_reg,hetar_reg,hgammar_reg)
 
+  use constants_solver
+
   implicit none
 
-  include 'constants.h'
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   ! declarations of regular grid model
   integer, intent(in) :: npoints_slice
   integer, dimension(NM_KL_REG_PTS_VAL), intent(in) :: points_slice
@@ -362,8 +363,9 @@
 
 subroutine hex_nodes2(iaddx,iaddy,iaddz)
 
+  use constants
+
   implicit none
-  include 'constants.h'
 
   integer, dimension(NGNOD), intent(out) :: iaddx,iaddy,iaddz
   integer :: ia
@@ -449,8 +451,9 @@
   ! point under the k'th chunk coordinate
   ! transformation
 
+  use constants
+
   implicit none
-  include 'constants.h'
 
   integer, intent(in) :: k
   real, intent(in) :: xx, yy, zz

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_sources.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_sources.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/locate_sources.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -33,8 +33,8 @@
                             xstore,ystore,zstore, &
                             ELLIPTICITY,min_tshift_cmt_original)
 
-  use mpi
   use constants_solver
+
   use specfem_par,only: &
     NSOURCES,myrank, &
     tshift_cmt,theta_source,phi_source, &
@@ -43,14 +43,13 @@
     LOCAL_TMP_PATH,SIMULATION_TYPE,TOPOGRAPHY, &
     xigll,yigll,zigll, &
     xi_source,eta_source,gamma_source,nu_source, &
-    islice_selected_source,ispec_selected_source
+    islice_selected_source,ispec_selected_source, &
+    SAVE_SOURCE_MASK
 
   use specfem_par_movie,only: vtkdata_source_x,vtkdata_source_y,vtkdata_source_z
 
   implicit none
 
-  include "precision.h"
-
   integer nspec,nglob
   integer ibool(NGLLX,NGLLY,NGLLZ,nspec)
 
@@ -150,14 +149,14 @@
                               DT,NSOURCES,min_tshift_cmt_original)
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(tshift_cmt,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(hdur,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(lat,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(long,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(depth,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(tshift_cmt,NSOURCES)
+  call bcast_all_dp(hdur,NSOURCES)
+  call bcast_all_dp(lat,NSOURCES)
+  call bcast_all_dp(long,NSOURCES)
+  call bcast_all_dp(depth,NSOURCES)
 
-  call MPI_BCAST(moment_tensor,6*NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(min_tshift_cmt_original,1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(moment_tensor,6*NSOURCES)
+  call bcast_all_dp(min_tshift_cmt_original,1)
 
   ! define topology of the control element
   call hex_nodes(iaddx,iaddy,iaddr)
@@ -554,23 +553,25 @@
     ! now gather information from all the nodes
     ! use -1 as a flag to detect if gather fails for some reason
     ispec_selected_source_all(:,:) = -1
-    call MPI_GATHER(ispec_selected_source_subset,NSOURCES_SUBSET_current_size,MPI_INTEGER, &
-      ispec_selected_source_all,NSOURCES_SUBSET_current_size,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(xi_source_subset,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      xi_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(eta_source_subset,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      eta_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(gamma_source_subset,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      gamma_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(final_distance_source_subset,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      final_distance_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(x_found_source,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      x_found_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(y_found_source,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      y_found_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-    call MPI_GATHER(z_found_source,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION, &
-      z_found_source_all,NSOURCES_SUBSET_current_size,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
 
+    call gather_all_i(ispec_selected_source_subset,NSOURCES_SUBSET_current_size, &
+      ispec_selected_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+
+    call gather_all_dp(xi_source_subset,NSOURCES_SUBSET_current_size, &
+      xi_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(eta_source_subset,NSOURCES_SUBSET_current_size, &
+      eta_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(gamma_source_subset,NSOURCES_SUBSET_current_size, &
+      gamma_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(final_distance_source_subset,NSOURCES_SUBSET_current_size, &
+      final_distance_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(x_found_source,NSOURCES_SUBSET_current_size, &
+      x_found_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(y_found_source,NSOURCES_SUBSET_current_size, &
+      y_found_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+    call gather_all_dp(z_found_source,NSOURCES_SUBSET_current_size, &
+      z_found_source_all,NSOURCES_SUBSET_current_size,NPROCTOT_VAL)
+
     ! this is executed by main process only
     if(myrank == 0) then
 
@@ -730,12 +731,12 @@
   call sync_all()
 
   ! main process broadcasts the results to all the slices
-  call MPI_BCAST(islice_selected_source,NSOURCES,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ispec_selected_source,NSOURCES,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(islice_selected_source,NSOURCES)
+  call bcast_all_i(ispec_selected_source,NSOURCES)
 
-  call MPI_BCAST(xi_source,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(eta_source,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(gamma_source,NSOURCES,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+  call bcast_all_dp(xi_source,NSOURCES)
+  call bcast_all_dp(eta_source,NSOURCES)
+  call bcast_all_dp(gamma_source,NSOURCES)
 
   ! stores source mask
   if( SAVE_SOURCE_MASK .and. SIMULATION_TYPE == 3 ) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/multiply_arrays_source.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/multiply_arrays_source.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/multiply_arrays_source.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/netlib_specfun_erf.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/netlib_specfun_erf.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/netlib_specfun_erf.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/noise_tomography.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/noise_tomography.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/noise_tomography.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -34,8 +34,11 @@
   subroutine noise_distribution_direction(xcoord_in,ycoord_in,zcoord_in, &
                   normal_x_noise_out,normal_y_noise_out,normal_z_noise_out, &
                   mask_noise_out)
+
+  use constants
+
   implicit none
-  include "constants.h"
+
   ! input parameters
   real(kind=CUSTOM_REAL) :: xcoord_in,ycoord_in,zcoord_in
   ! output parameters
@@ -75,17 +78,14 @@
 
   subroutine read_parameters_noise()
 
-  use mpi
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_movie
 
   implicit none
 
-  include "precision.h"
-
   ! local parameters
-  integer :: ipoin, ispec2D, ispec, i, j, k, iglob, ios, ier
+  integer :: ipoin, ispec2D, ispec, i, j, k, iglob, ios
   real(kind=CUSTOM_REAL) :: normal_x_noise_out,normal_y_noise_out,normal_z_noise_out,mask_noise_out
   character(len=150) :: filename
   real(kind=CUSTOM_REAL), dimension(nmovie_points) :: &
@@ -170,12 +170,12 @@
 
   ! gather info on master proc
   ispec = nmovie_points
-  call MPI_GATHER(val_x,ispec,CUSTOM_MPI_TYPE,val_x_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(val_y,ispec,CUSTOM_MPI_TYPE,val_y_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(val_z,ispec,CUSTOM_MPI_TYPE,val_z_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(val_ux,ispec,CUSTOM_MPI_TYPE,val_ux_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(val_uy,ispec,CUSTOM_MPI_TYPE,val_uy_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(val_uz,ispec,CUSTOM_MPI_TYPE,val_uz_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
+  call gather_all_cr(val_x,ispec,val_x_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(val_y,ispec,val_y_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(val_z,ispec,val_z_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(val_ux,ispec,val_ux_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(val_uy,ispec,val_uy_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(val_uz,ispec,val_uz_all,ispec,NPROCTOT_VAL)
 
   ! save maks_noise data to disk in home directory
   ! this file can be viewed the same way as surface movie data (xcreate_movie_AVS_DX)
@@ -300,9 +300,11 @@
   subroutine compute_arrays_source_noise(myrank, &
                                          xi_noise,eta_noise,gamma_noise,nu_single,noise_sourcearray, &
                                          xigll,yigll,zigll,NSTEP)
+
+  use constants_solver
+
   implicit none
-  include 'constants.h'
-  include "OUTPUT_FILES/values_from_mesher.h"
+
   ! input parameters
   integer :: myrank, NSTEP
   double precision, dimension(NGLLX) :: xigll
@@ -494,15 +496,15 @@
 ! by this modification, the efficiency is greatly improved
 ! and now, it should be OK to run NOISE_TOMOGRAPHY on a cluster with global storage
 
-  subroutine noise_read_add_surface_movie(NGLOB,accel,it_index)
+  subroutine noise_read_add_surface_movie(NGLOB_AB,accel,it_index)
 
   use specfem_par
   use specfem_par_crustmantle
 
   implicit none
 
-  integer :: NGLOB
-  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB),intent(inout) :: accel
+  integer :: NGLOB_AB
+  real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_AB),intent(inout) :: accel
 
   integer,intent(in) :: it_index
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/prepare_timerun.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/prepare_timerun.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/prepare_timerun.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -722,16 +722,16 @@
   endif
 
   ! allocates temporary arrays
-  allocate(omsb_crust_mantle_dble(ATT1,ATT2,ATT3,ATT4), &
-          factor_scale_crust_mantle_dble(ATT1,ATT2,ATT3,ATT4),stat=ier)
+  allocate(omsb_crust_mantle_dble(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT4_VAL), &
+          factor_scale_crust_mantle_dble(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT4_VAL),stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'error allocating omsb crust_mantle arrays')
-  allocate(factor_common_crust_mantle_dble(N_SLS,ATT1,ATT2,ATT3,ATT4),stat=ier)
+  allocate(factor_common_crust_mantle_dble(N_SLS,ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT4_VAL),stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'error allocating factor_common crust_mantle array')
 
-  allocate(omsb_inner_core_dble(ATT1,ATT2,ATT3,ATT5), &
-          factor_scale_inner_core_dble(ATT1,ATT2,ATT3,ATT5),stat=ier)
+  allocate(omsb_inner_core_dble(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT5_VAL), &
+          factor_scale_inner_core_dble(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT5_VAL),stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'error allocating omsb inner_core arrays')
-  allocate(factor_common_inner_core_dble(N_SLS,ATT1,ATT2,ATT3,ATT5),stat=ier)
+  allocate(factor_common_inner_core_dble(N_SLS,ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT5_VAL),stat=ier)
   if( ier /= 0 ) call exit_MPI(myrank,'error allocating factor_common inner_core array')
 
   ! CRUST_MANTLE ATTENUATION
@@ -747,11 +747,11 @@
   else
     call create_name_database(prnamel, myrank, IREGION_CRUST_MANTLE, LOCAL_PATH)
   endif
-  call get_attenuation_model_3D_or_1D(myrank, prnamel, &
-                                     omsb_crust_mantle_dble, &
-                                     factor_common_crust_mantle_dble, &
-                                     factor_scale_crust_mantle_dble,tau_sigma_dble, &
-                                     ATT1,ATT2,ATT3,ATT4)
+  call get_attenuation_model_3D(myrank, prnamel, &
+                                omsb_crust_mantle_dble, &
+                                factor_common_crust_mantle_dble, &
+                                factor_scale_crust_mantle_dble,tau_sigma_dble, &
+                                NSPEC_CRUST_MANTLE)
 
   ! INNER_CORE ATTENUATION
   ! initializes
@@ -766,11 +766,11 @@
   else
     call create_name_database(prnamel, myrank, IREGION_INNER_CORE, LOCAL_PATH)
   endif
-  call get_attenuation_model_3D_or_1D(myrank, prnamel, &
-                                     omsb_inner_core_dble, &
-                                     factor_common_inner_core_dble, &
-                                     factor_scale_inner_core_dble,tau_sigma_dble, &
-                                     ATT1,ATT2,ATT3,ATT5)
+  call get_attenuation_model_3D(myrank, prnamel, &
+                                omsb_inner_core_dble, &
+                                factor_common_inner_core_dble, &
+                                factor_scale_inner_core_dble,tau_sigma_dble, &
+                                NSPEC_INNER_CORE)
 
   ! converts to custom real arrays
   if(CUSTOM_REAL == SIZE_REAL) then
@@ -816,7 +816,7 @@
       do j=1,NGLLY
         do i=1,NGLLX
 
-          if( USE_3D_ATTENUATION_ARRAYS ) then
+          if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
             scale_factor = factor_scale_crust_mantle(i,j,k,ispec)
           else
             scale_factor = factor_scale_crust_mantle(1,1,1,ispec)
@@ -870,7 +870,7 @@
       do j=1,NGLLY
         do i=1,NGLLX
 
-          if( USE_3D_ATTENUATION_ARRAYS ) then
+          if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
             scale_factor = factor_scale_inner_core(i,j,k,ispec)
           else
             scale_factor = factor_scale_inner_core(1,1,1,ispec)
@@ -1062,7 +1062,7 @@
 
   endif
 
-  if (COMPUTE_AND_STORE_STRAIN_VAL) then
+  if (COMPUTE_AND_STORE_STRAIN) then
     if(MOVIE_VOLUME .and. (MOVIE_VOLUME_TYPE == 2 .or. MOVIE_VOLUME_TYPE == 3)) then
       Iepsilondev_xx_crust_mantle(:,:,:,:) = 0._CUSTOM_REAL
       Iepsilondev_yy_crust_mantle(:,:,:,:) = 0._CUSTOM_REAL
@@ -1448,7 +1448,6 @@
   use specfem_par_innercore
   use specfem_par_outercore
   use specfem_par_movie
-  use mpi
 
   implicit none
 
@@ -1462,6 +1461,7 @@
     cr_d_ln_density_dr_table,cr_minus_rho_g_over_kappa_fluid, &
     cr_minus_gravity_table,cr_minus_deriv_gravity_table, &
     cr_density_table
+  logical :: USE_3D_ATTENUATION_ARRAYS
 
   ! user output
   if(myrank == 0 ) then
@@ -1469,6 +1469,12 @@
     write(IMAIN,*)
   endif
 
+  if( ATTENUATION_3D_VAL .or. ATTENUATION_1D_WITH_3D_STORAGE_VAL ) then
+    USE_3D_ATTENUATION_ARRAYS = .true.
+  else
+    USE_3D_ATTENUATION_ARRAYS = .false.
+  endif
+
   ! prepares general fields on GPU
   call prepare_constants_device(Mesh_pointer,myrank,NGLLX, &
                                   hprime_xx, &
@@ -1490,9 +1496,9 @@
                                   OCEANS_VAL, &
                                   GRAVITY_VAL, &
                                   ROTATION_VAL, &
-                                  ATTENUATION_VAL,ATTENUATION_NEW_VAL, &
+                                  ATTENUATION_VAL, &
                                   PARTIAL_PHYS_DISPERSION_ONLY,USE_3D_ATTENUATION_ARRAYS, &
-                                  COMPUTE_AND_STORE_STRAIN_VAL, &
+                                  COMPUTE_AND_STORE_STRAIN, &
                                   ANISOTROPIC_3D_MANTLE_VAL,ANISOTROPIC_INNER_CORE_VAL, &
                                   SAVE_BOUNDARY_MESH, &
                                   USE_MESH_COLORING_GPU, &
@@ -1588,7 +1594,7 @@
 
 
   ! prepares attenuation arrays
-  if( COMPUTE_AND_STORE_STRAIN_VAL ) then
+  if( COMPUTE_AND_STORE_STRAIN ) then
     if(myrank == 0 ) write(IMAIN,*) "  loading strain"
 
     call prepare_fields_strain_device(Mesh_pointer, &
@@ -1897,7 +1903,6 @@
   integer :: vol_nspec_all,ispec_start,ispec_end
   real(kind=CUSTOM_REAL),dimension(1):: dummy
   integer,dimension(1):: dummy_i
-  integer :: NPROC
 
   real(kind=CUSTOM_REAL) :: x,y,z
 
@@ -1916,7 +1921,7 @@
   call sync_all()
 
   ! to avoid compiler warnings
-  NPROC = NPROCTOT_VAL
+  !NPROC = NPROCTOT_VAL
 
   ! adds source
   if( myrank == 0 ) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_buffers_solver.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_buffers_solver.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_buffers_solver.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -36,8 +36,6 @@
      NUMMSGS_FACES,NCORNERSCHUNKS,NPROCTOT,NPROC_XI,NPROC_ETA, &
      LOCAL_PATH,NCHUNKS)
 
-  use mpi
-
   implicit none
 
   include "constants.h"
@@ -123,13 +121,13 @@
     endif
 
     ! broadcast the information read on the master to the nodes
-    call MPI_BCAST(imsg_type,NUMMSGS_FACES,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(iprocfrom_faces,NUMMSGS_FACES,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(iprocto_faces,NUMMSGS_FACES,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+    call bcast_all_i(imsg_type,NUMMSGS_FACES)
+    call bcast_all_i(iprocfrom_faces,NUMMSGS_FACES)
+    call bcast_all_i(iprocto_faces,NUMMSGS_FACES)
 
-    call MPI_BCAST(iproc_master_corners,NCORNERSCHUNKS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(iproc_worker1_corners,NCORNERSCHUNKS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-    call MPI_BCAST(iproc_worker2_corners,NCORNERSCHUNKS,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+    call bcast_all_i(iproc_master_corners,NCORNERSCHUNKS)
+    call bcast_all_i(iproc_worker1_corners,NCORNERSCHUNKS)
+    call bcast_all_i(iproc_worker2_corners,NCORNERSCHUNKS)
 
     ! synchronizes processes
     call sync_all()
@@ -157,8 +155,6 @@
      npoin2D_xi,npoin2D_eta, &
      NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,LOCAL_PATH)
 
-  use mpi
-
   implicit none
 
   include "constants.h"
@@ -311,8 +307,6 @@
      NGLOB2DMAX_XY,NGLOB1D_RADIAL, &
      NUMMSGS_FACES,NCORNERSCHUNKS,NPROC_XI,NPROC_ETA,LOCAL_PATH)
 
-  use mpi
-
   implicit none
 
   include "constants.h"

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_arrays_solver_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -437,7 +437,7 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
   ! checks dimensions
   if( lnspec /= nspec ) then
     print*,'error file dimension: nspec in file = ',lnspec, &

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_attenuation_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_attenuation_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_attenuation_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays_adios.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays_adios.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_forward_arrays_adios.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -231,7 +231,7 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
 
 end subroutine read_intermediate_forward_arrays_adios
 
@@ -437,6 +437,6 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
 
 end subroutine read_forward_arrays_adios

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -138,11 +138,11 @@
   !
   ! if absorbing_conditions are not set or if NCHUNKS=6, only one mass matrix is needed
   ! for the sake of performance, only "rmassz" array will be filled and "rmassx" & "rmassy" will be obsolete
-  if(NCHUNKS_VAL /= 6 .and. ABSORBING_CONDITIONS) then
-     NGLOB_XY_CM = NGLOB_CRUST_MANTLE
-  else
-     NGLOB_XY_CM = 1
-  endif
+!  if(NCHUNKS_VAL /= 6 .and. ABSORBING_CONDITIONS) then
+!     NGLOB_XY_CM = NGLOB_CRUST_MANTLE
+!  else
+!     NGLOB_XY_CM = 1
+!  endif
 
   ! allocates dummy array
   allocate(dummy_idoubling(NSPEC_CRUST_MANTLE),stat=ier)
@@ -439,7 +439,6 @@
 
 ! to couple mantle with outer core
 
-  use mpi
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_innercore
@@ -604,7 +603,6 @@
 
   subroutine read_mesh_databases_addressing()
 
-  use mpi
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_innercore
@@ -636,10 +634,10 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(addressing,NCHUNKS_VAL*NPROC_XI_VAL*NPROC_ETA_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(ichunk_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(iproc_xi_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
-  call MPI_BCAST(iproc_eta_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+  call bcast_all_i(addressing,NCHUNKS_VAL*NPROC_XI_VAL*NPROC_ETA_VAL)
+  call bcast_all_i(ichunk_slice,NPROCTOT_VAL)
+  call bcast_all_i(iproc_xi_slice,NPROCTOT_VAL)
+  call bcast_all_i(iproc_eta_slice,NPROCTOT_VAL)
 
   ! output a topology map of slices - fix 20x by nproc
   if (myrank == 0 ) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases_adios.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases_adios.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_mesh_databases_adios.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -673,10 +673,10 @@
   endif
 
   ! broadcast the information read on the master to the nodes
-  call MPI_BCAST(addressing,NCHUNKS_VAL*NPROC_XI_VAL*NPROC_ETA_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
-  call MPI_BCAST(ichunk_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
-  call MPI_BCAST(iproc_xi_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
-  call MPI_BCAST(iproc_eta_slice,NPROCTOT_VAL,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
+  call bcast_all_i(addressing,NCHUNKS_VAL*NPROC_XI_VAL*NPROC_ETA_VAL)
+  call bcast_all_i(ichunk_slice,NPROCTOT_VAL)
+  call bcast_all_i(iproc_xi_slice,NPROCTOT_VAL)
+  call bcast_all_i(iproc_eta_slice,NPROCTOT_VAL)
 
   ! output a topology map of slices - fix 20x by nproc
   if (myrank == 0 ) then
@@ -919,7 +919,7 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
 
 end subroutine read_mesh_databases_MPI_CM_adios
 
@@ -1102,7 +1102,7 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
 
 end subroutine read_mesh_databases_MPI_OC_adios
 
@@ -1287,7 +1287,7 @@
   call adios_read_finalize_method(ADIOS_READ_METHOD_BP, adios_err)
   call check_adios_err(myrank,adios_err)
 
-  call MPI_Barrier(comm, ierr)
+  call sync_all()
 
 end subroutine read_mesh_databases_MPI_IC_adios
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_topography_bathymetry.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_topography_bathymetry.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/read_topography_bathymetry.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,7 +27,6 @@
 
   subroutine read_topography_bathymetry()
 
-  use mpi
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_innercore
@@ -69,7 +68,7 @@
     endif
 
     ! broadcast the information read on the master to the nodes
-    call MPI_BCAST(ibathy_topo,NX_BATHY*NY_BATHY,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+    call bcast_all_i(ibathy_topo,NX_BATHY*NY_BATHY)
   endif
 
   ! user output

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/recompute_jacobian.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/recompute_jacobian.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/recompute_jacobian.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/rules.mk
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/rules.mk	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/rules.mk	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 #=====================================================================
 #
-#          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+#          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 #          --------------------------------------------------
 #
 #          Main authors: Dimitri Komatitsch and Jeroen Tromp
 #                        Princeton University, USA
 #             and University of Pau / CNRS / INRIA, France
 # (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-#                            April 2011
+#                            August 2013
 #
 # 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
@@ -32,304 +32,263 @@
 	$(EMPTY_MACRO)
 
 specfem3D_OBJECTS = \
-	$O/assemble_MPI_central_cube.o \
-	$O/assemble_MPI_scalar.o \
-	$O/assemble_MPI_vector.o \
-	$O/assemble_MPI_central_cube_block.o \
-	$O/assemble_MPI_scalar_block.o \
-	$O/assemble_MPI_vector_block.o \
-	$O/comp_source_spectrum.o \
-	$O/comp_source_time_function.o \
-	$O/compute_adj_source_frechet.o \
-	$O/compute_arrays_source.o \
-	$O/convert_time.o \
-	$O/create_central_cube_buffers.o \
-	$O/define_derivation_matrices.o \
-	$O/get_attenuation.o \
-	$O/get_backazimuth.o \
-	$O/get_cmt.o \
-	$O/get_event_info.o \
-	$O/locate_receivers.o \
-	$O/locate_regular_points.o \
-	$O/locate_sources.o \
-	$O/multiply_arrays_source.o \
-	$O/netlib_specfun_erf.o \
-	$O/read_arrays_buffers_solver.o \
-	$O/recompute_jacobian.o \
-	$O/save_regular_kernels.o \
-	$O/write_seismograms.o \
-	$O/write_output_ASCII.o \
-	$O/write_output_SAC.o \
+	$O/assemble_MPI_scalar.solver.o \
+	$O/assemble_MPI_vector.solver.o \
+	$O/comp_source_spectrum.solver.o \
+	$O/comp_source_time_function.solver.o \
+	$O/compute_adj_source_frechet.solver.o \
+	$O/compute_arrays_source.solver.o \
+	$O/convert_time.solver.o \
+	$O/define_derivation_matrices.solver.o \
+	$O/get_backazimuth.solver.o \
+	$O/get_cmt.solver.o \
+	$O/get_event_info.solver.o \
+	$O/multiply_arrays_source.solver.o \
+	$O/netlib_specfun_erf.solver.o \
+	$O/recompute_jacobian.solver.o \
+	$O/write_output_ASCII.solver.o \
+	$O/write_output_SAC.solver.o \
 	$(EMPTY_MACRO)
 
 # solver objects with statically allocated arrays; dependent upon
 # values_from_mesher.h
 specfem3D_OBJECTS += \
-	$O/check_simulation_stability.o \
-	$O/compute_add_sources.o \
-	$O/compute_boundary_kernel.o \
-	$O/compute_coupling.o \
-	$O/compute_element.o \
-	$O/compute_forces_crust_mantle_noDev.o \
-	$O/compute_forces_crust_mantle_Dev.o \
-	$O/compute_forces_inner_core_noDev.o \
-	$O/compute_forces_inner_core_Dev.o \
-	$O/compute_forces_outer_core_noDev.o \
-	$O/compute_forces_outer_core_Dev.o \
-	$O/compute_kernels.o \
-	$O/compute_seismograms.o \
-	$O/compute_stacey_crust_mantle.o \
-	$O/compute_stacey_outer_core.o \
-	$O/fix_non_blocking_flags.o \
-	$O/initialize_simulation.o \
-	$O/noise_tomography.o \
-	$O/prepare_timerun.o \
-	$O/read_arrays_solver.o \
-	$O/read_forward_arrays.o \
-	$O/read_mesh_databases.o \
-	$O/save_forward_arrays.o \
-	$O/save_kernels.o \
-	$O/setup_sources_receivers.o \
-	$O/specfem3D.o \
-	$O/write_movie_volume.o \
-	$O/write_movie_surface.o \
+	$O/specfem3D_par.solverstatic.o \
+	$O/check_simulation_stability.solverstatic.o \
+	$O/compute_add_sources.solverstatic.o \
+	$O/compute_boundary_kernel.solverstatic.o \
+	$O/compute_coupling.solverstatic.o \
+	$O/compute_element.solverstatic.o \
+	$O/compute_forces_acoustic.solverstatic.o \
+	$O/compute_forces_elastic.solverstatic.o \
+	$O/compute_forces_crust_mantle_noDev.solverstatic.o \
+	$O/compute_forces_crust_mantle_Dev.solverstatic.o \
+	$O/compute_forces_inner_core_noDev.solverstatic.o \
+	$O/compute_forces_inner_core_Dev.solverstatic.o \
+	$O/compute_forces_outer_core_noDev.solverstatic.o \
+	$O/compute_forces_outer_core_Dev.solverstatic.o \
+	$O/compute_kernels.solverstatic.o \
+	$O/compute_seismograms.solverstatic.o \
+	$O/compute_stacey_crust_mantle.solverstatic.o \
+	$O/compute_stacey_outer_core.solverstatic.o \
+	$O/finalize_simulation.solverstatic.o \
+	$O/get_attenuation.solverstatic.o \
+	$O/initialize_simulation.solverstatic.o \
+	$O/iterate_time.solverstatic.o \
+	$O/locate_receivers.solverstatic.o \
+	$O/locate_regular_points.solverstatic.o \
+	$O/locate_sources.solver.o \
+	$O/noise_tomography.solverstatic.o \
+	$O/prepare_timerun.solverstatic.o \
+	$O/read_arrays_solver.solverstatic.o \
+	$O/read_forward_arrays.solverstatic.o \
+	$O/read_mesh_databases.solverstatic.o \
+	$O/read_topography_bathymetry.solverstatic.o \
+	$O/save_forward_arrays.solverstatic.o \
+	$O/save_kernels.solverstatic.o \
+	$O/save_regular_kernels.solverstatic.o \
+	$O/setup_GLL_points.solverstatic.o \
+	$O/setup_sources_receivers.solverstatic.o \
+	$O/specfem3D.solverstatic.o \
+	$O/write_movie_output.solverstatic.o \
+	$O/write_movie_volume.solverstatic.o \
+	$O/write_movie_surface.solverstatic.o \
+	$O/write_seismograms.solver.o \
 	$(EMPTY_MACRO)
 
 # These files come from the shared directory
 specfem3D_SHARED_OBJECTS = \
-	$O/auto_ner.o \
-	$O/broadcast_computed_parameters.o \
-	$O/calendar.o \
-	$O/count_number_of_sources.o \
-	$O/create_name_database.o \
-	$O/euler_angles.o \
-	$O/exit_mpi.o \
-	$O/force_ftz.o \
-	$O/get_model_parameters.o \
-	$O/get_value_parameters.o \
-	$O/gll_library.o \
-	$O/hex_nodes.o \
-	$O/intgrl.o \
-	$O/lagrange_poly.o \
-	$O/make_ellipticity.o \
-	$O/make_gravity.o \
-	$O/model_prem.o \
-	$O/model_topo_bathy.o \
-	$O/param_reader.o \
-	$O/read_compute_parameters.o \
-	$O/read_parameter_file.o \
-	$O/read_value_parameters.o \
-	$O/reduce.o \
-	$O/rthetaphi_xyz.o \
-	$O/spline_routines.o \
-	$O/write_c_binary.o \
+	$O/shared_par.shared.o \
+	$O/auto_ner.shared.o \
+	$O/broadcast_computed_parameters.shared.o \
+	$O/calendar.shared.o \
+	$O/count_elements.shared.o \
+	$O/count_number_of_sources.shared.o \
+	$O/count_points.shared.o \
+	$O/create_name_database.shared.o \
+	$O/define_all_layers.shared.o \
+	$O/euler_angles.shared.o \
+	$O/exit_mpi.sharedmpi.o \
+	$O/force_ftz.cc.o \
+	$O/get_model_parameters.shared.o \
+	$O/get_timestep_and_layers.shared.o \
+	$O/get_value_parameters.shared.o \
+	$O/gll_library.shared.o \
+	$O/hex_nodes.shared.o \
+	$O/intgrl.shared.o \
+	$O/lagrange_poly.shared.o \
+	$O/make_ellipticity.shared.o \
+	$O/make_gravity.shared.o \
+	$O/model_prem.shared.o \
+	$O/model_topo_bathy.shared.o \
+	$O/param_reader.cc.o \
+	$O/read_compute_parameters.shared.o \
+	$O/read_parameter_file.shared.o \
+	$O/read_value_parameters.shared.o \
+	$O/reduce.shared.o \
+	$O/rthetaphi_xyz.shared.o \
+	$O/spline_routines.shared.o \
+	$O/write_c_binary.cc.o \
 	$(EMPTY_MACRO)
 
+###
+### CUDA
+###
 
-#######################################
+cuda_OBJECTS = \
+  $O/assemble_MPI_scalar_cuda.cuda.o \
+	$O/assemble_MPI_vector_cuda.cuda.o \
+  $O/check_fields_cuda.cuda.o \
+	$O/compute_add_sources_elastic_cuda.cuda.o \
+	$O/compute_coupling_cuda.cuda.o \
+	$O/compute_forces_crust_mantle_cuda.cuda.o \
+	$O/compute_forces_inner_core_cuda.cuda.o \
+	$O/compute_forces_outer_core_cuda.cuda.o \
+	$O/compute_kernels_cuda.cuda.o \
+	$O/compute_stacey_acoustic_cuda.cuda.o \
+	$O/compute_stacey_elastic_cuda.cuda.o \
+	$O/initialize_cuda.cuda.o \
+	$O/it_update_displacement_cuda.cuda.o \
+	$O/noise_tomography_cuda.cuda.o \
+	$O/prepare_mesh_constants_cuda.cuda.o \
+	$O/transfer_fields_cuda.cuda.o \
+	$O/write_seismograms_cuda.cuda.o \
+	$O/save_and_compare_cpu_vs_gpu.cudacc.o \
+	$(EMPTY_MACRO)
 
-####
-#### rules for executables
-####
+cuda_STUBS = \
+	$O/specfem3D_gpu_cuda_method_stubs.cudacc.o \
+	$(EMPTY_MACRO)
 
-${E}/xspecfem3D: $(specfem3D_OBJECTS) $(specfem3D_SHARED_OBJECTS)
-## use MPI here
-## DK DK add OpenMP compiler flag here if needed
-#	${MPIFCCOMPILE_CHECK} -qsmp=omp -o ${E}/xspecfem3D $(specfem3D_OBJECTS) $(specfem3D_SHARED_OBJECTS) $(MPILIBS)
-	${MPIFCCOMPILE_CHECK} -o ${E}/xspecfem3D $(specfem3D_OBJECTS) $(specfem3D_SHARED_OBJECTS) $(MPILIBS)
+cuda_DEVICE_OBJ = \
+	$O/cuda_device_obj.o \
+	$(EMPTY_MACRO)
 
-#######################################
+LIBSPECFEM_SOLVER = $O/libspecfem_solver.a
 
-## compilation directories
-S := ${S_TOP}/src/specfem3D
-$(specfem3D_OBJECTS): S = ${S_TOP}/src/specfem3D
+ifeq ($(CUDA),yes)
+XSPECFEM_OBJECTS = $(specfem3D_SHARED_OBJECTS) $(specfem3D_OBJECTS) $(cuda_OBJECTS)
+else
+XSPECFEM_OBJECTS = $(specfem3D_SHARED_OBJECTS) $(specfem3D_OBJECTS) $(cuda_STUBS)
+endif
 
-####
-#### rule for each .o file below
-####
-
 ###
-### specfem3D - optimized flags and dependence on values from mesher here
+### ADIOS
 ###
-$O/compute_add_sources.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_add_sources.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_add_sources.o ${FCFLAGS_f90} $S/compute_add_sources.f90
 
-$O/compute_boundary_kernel.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_boundary_kernel.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_boundary_kernel.o ${FCFLAGS_f90} $S/compute_boundary_kernel.f90
+adios_OBJECTS = \
+  $O/adios_helpers.shared.o \
+  $O/adios_manager.shared.o \
+	$(EMPTY_MACRO)
 
-$O/compute_coupling.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_coupling.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_coupling.o ${FCFLAGS_f90} $S/compute_coupling.f90
+adios_STUBS = \
+	$O/adios_method_stubs.shared.o \
+	$(EMPTY_MACRO)
 
-$O/compute_element.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_element.F90
-	${FCCOMPILE_CHECK} -c -o $O/compute_element.o ${FCFLAGS_f90} $S/compute_element.F90
+# conditional adios linking
+ifeq ($(ADIOS),yes)
+XSPECFEM_OBJECTS += $(adios_OBJECTS)
+else
+XSPECFEM_OBJECTS += $(adios_STUBS)
+endif
 
-$O/compute_forces_crust_mantle_noDev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_crust_mantle_noDev.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_crust_mantle_noDev.o ${FCFLAGS_f90} $S/compute_forces_crust_mantle_noDev.f90
-
-$O/compute_forces_crust_mantle_Dev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_crust_mantle_Dev.F90
-## DK DK add OpenMP compiler flag here if needed
-#	${FCCOMPILE_CHECK} -c -qsmp=omp -o $O/compute_forces_crust_mantle_Dev.o ${FCFLAGS_f90} $S/compute_forces_crust_mantle_Dev.F90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_crust_mantle_Dev.o ${FCFLAGS_f90} $S/compute_forces_crust_mantle_Dev.F90
-
-$O/compute_forces_outer_core_noDev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_outer_core_noDev.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_outer_core_noDev.o ${FCFLAGS_f90} $S/compute_forces_outer_core_noDev.f90
-
-$O/compute_forces_outer_core_Dev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_outer_core_Dev.F90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_outer_core_Dev.o ${FCFLAGS_f90} $S/compute_forces_outer_core_Dev.F90
-
-$O/compute_forces_inner_core_noDev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_inner_core_noDev.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_inner_core_noDev.o ${FCFLAGS_f90} $S/compute_forces_inner_core_noDev.f90
-
-$O/compute_forces_inner_core_Dev.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_forces_inner_core_Dev.F90
-	${FCCOMPILE_CHECK} -c -o $O/compute_forces_inner_core_Dev.o ${FCFLAGS_f90} $S/compute_forces_inner_core_Dev.F90
-
-$O/compute_kernels.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_kernels.F90
-	${FCCOMPILE_CHECK} -c -o $O/compute_kernels.o ${FCFLAGS_f90} $S/compute_kernels.F90
-
-$O/compute_seismograms.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_seismograms.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_seismograms.o ${FCFLAGS_f90} $S/compute_seismograms.f90
-
-$O/compute_stacey_crust_mantle.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_stacey_crust_mantle.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_stacey_crust_mantle.o ${FCFLAGS_f90} $S/compute_stacey_crust_mantle.f90
-
-$O/compute_stacey_outer_core.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/compute_stacey_outer_core.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_stacey_outer_core.o ${FCFLAGS_f90} $S/compute_stacey_outer_core.f90
-
-$O/read_arrays_solver.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/read_arrays_solver.f90
-	${FCCOMPILE_CHECK} -c -o $O/read_arrays_solver.o ${FCFLAGS_f90} $S/read_arrays_solver.f90
-
-$O/read_forward_arrays.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/read_forward_arrays.f90
-	${FCCOMPILE_CHECK} -c -o $O/read_forward_arrays.o ${FCFLAGS_f90} $S/read_forward_arrays.f90
-
-$O/save_forward_arrays.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/save_forward_arrays.f90
-	${FCCOMPILE_CHECK} -c -o $O/save_forward_arrays.o ${FCFLAGS_f90} $S/save_forward_arrays.f90
-
-$O/save_kernels.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/save_kernels.f90
-	${FCCOMPILE_CHECK} -c -o $O/save_kernels.o ${FCFLAGS_f90} $S/save_kernels.f90
-
-$O/save_regular_kernels.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/save_regular_kernels.f90
-	${FCCOMPILE_CHECK} -c -o $O/save_regular_kernels.o ${FCFLAGS_f90} $S/save_regular_kernels.f90
-
 ###
-### specfem3D - regular compilation options here
+### VTK
 ###
-$O/comp_source_time_function.o: $S/comp_source_time_function.f90
-	${FCCOMPILE_CHECK} -c -o $O/comp_source_time_function.o ${FCFLAGS_f90} $S/comp_source_time_function.f90
 
-$O/comp_source_spectrum.o: ${SETUP}/constants.h $S/comp_source_spectrum.f90
-	${FCCOMPILE_CHECK} -c -o $O/comp_source_spectrum.o ${FCFLAGS_f90} $S/comp_source_spectrum.f90
+vtk_OBJECTS = \
+  $O/visual_vtk.visualcc.o \
+	$(EMPTY_MACRO)
 
-$O/compute_adj_source_frechet.o: ${SETUP}/constants.h $S/compute_adj_source_frechet.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_adj_source_frechet.o ${FCFLAGS_f90} $S/compute_adj_source_frechet.f90
+vtk_STUBS = \
+	$O/visual_vtk_stubs.visualc.o \
+	$(EMPTY_MACRO)
 
-$O/compute_arrays_source.o: ${SETUP}/constants.h $S/compute_arrays_source.f90
-	${FCCOMPILE_CHECK} -c -o $O/compute_arrays_source.o ${FCFLAGS_f90} $S/compute_arrays_source.f90
+# conditional adios linking
+ifeq ($(VTK),yes)
+XSPECFEM_OBJECTS += $(vtk_OBJECTS)
+else
+XSPECFEM_OBJECTS += $(vtk_STUBS)
+endif
 
-$O/convert_time.o: $S/convert_time.f90
-	${FCCOMPILE_CHECK} -c -o $O/convert_time.o ${FCFLAGS_f90} $S/convert_time.f90
 
-$O/define_derivation_matrices.o: ${SETUP}/constants.h $S/define_derivation_matrices.f90
-	${FCCOMPILE_CHECK} -c -o $O/define_derivation_matrices.o ${FCFLAGS_f90} $S/define_derivation_matrices.f90
+#######################################
 
-$O/get_attenuation.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/get_attenuation.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_attenuation.o ${FCFLAGS_f90} $S/get_attenuation.f90
+####
+#### rules for executables
+####
 
-$O/get_backazimuth.o: ${SETUP}/constants.h $S/get_backazimuth.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_backazimuth.o ${FCFLAGS_f90} $S/get_backazimuth.f90
+ifeq ($(CUDA),yes)
+## cuda version
 
-$O/get_cmt.o: ${SETUP}/constants.h $S/get_cmt.f90
-	${FCCOMPILE_CHECK} -c -o $O/get_cmt.o ${FCFLAGS_f90} $S/get_cmt.f90
+ifeq ($(CUDA5),yes)
 
-$O/multiply_arrays_source.o: ${SETUP}/constants.h $S/multiply_arrays_source.f90
-	${FCCOMPILE_CHECK} -c -o $O/multiply_arrays_source.o ${FCFLAGS_f90} $S/multiply_arrays_source.f90
+## cuda 5 version
+${E}/xspecfem3D: $(XSPECFEM_OBJECTS)
+	@echo "building xspecfem3D with CUDA 5 support"
+	${NVCCLINK} -o $(cuda_DEVICE_OBJ) $(cuda_OBJECTS)
+  ${FCLINK} -o ${E}/xspecfem3D $(XSPECFEM_OBJECTS) $(cuda_DEVICE_OBJ) $(MPILIBS) $(CUDA_LINK)
+else
 
-$O/netlib_specfun_erf.o: $S/netlib_specfun_erf.f90
-	${FCCOMPILE_CHECK} -c -o $O/netlib_specfun_erf.o ${FCFLAGS_f90} $S/netlib_specfun_erf.f90
+## cuda 4 version
+${E}/xspecfem3D: $(XSPECFEM_OBJECTS)
+	@echo "building xspecfem3D with CUDA 4 support"
+	${FCLINK} -o ${E}/xspecfem3D $(XSPECFEM_OBJECTS) $(MPILIBS) $(CUDA_LINK)
+endif
 
-$O/recompute_jacobian.o: ${SETUP}/constants.h $S/recompute_jacobian.f90
-	${FCCOMPILE_CHECK} -c -o $O/recompute_jacobian.o ${FCFLAGS_f90} $S/recompute_jacobian.f90
+else
 
-##
-## specfem3D - use MPI here & dependent on values from mesher here
-##
-$O/assemble_MPI_central_cube.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/assemble_MPI_central_cube.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_central_cube.o ${FCFLAGS_f90} $S/assemble_MPI_central_cube.f90
+## non-cuda version
+${E}/xspecfem3D: $(XSPECFEM_OBJECTS)
+	@echo "building xspecfem3D without CUDA support"
+## use MPI here
+## DK DK add OpenMP compiler flag here if needed
+#	${MPIFCCOMPILE_CHECK} -qsmp=omp -o ${E}/xspecfem3D $(XSPECFEM_OBJECTS) $(MPILIBS)
+	${MPIFCCOMPILE_CHECK} -o ${E}/xspecfem3D $(XSPECFEM_OBJECTS) $(MPILIBS)
 
-$O/assemble_MPI_vector.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/assemble_MPI_vector.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_vector.o ${FCFLAGS_f90} $S/assemble_MPI_vector.f90
+endif
 
-$O/assemble_MPI_vector_block.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/assemble_MPI_vector_block.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_vector_block.o ${FCFLAGS_f90} $S/assemble_MPI_vector_block.f90
+#######################################
 
-$O/check_simulation_stability.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/check_simulation_stability.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/check_simulation_stability.o ${FCFLAGS_f90} $S/check_simulation_stability.f90
+## compilation directories
+S := ${S_TOP}/src/specfem3D
+$(specfem3D_OBJECTS): S = ${S_TOP}/src/specfem3D
 
-$O/initialize_simulation.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/initialize_simulation.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/initialize_simulation.o ${FCFLAGS_f90} $S/initialize_simulation.f90
+####
+#### rule for each .o file below
+####
 
-$O/noise_tomography.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/noise_tomography.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/noise_tomography.o ${FCFLAGS_f90} $S/noise_tomography.f90
+###
+### specfem3D - optimized flags and dependence on values from mesher here
+###
+$O/%.solverstatic.o: $S/%.f90 ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/prepare_timerun.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/prepare_timerun.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/prepare_timerun.o ${FCFLAGS_f90} $S/prepare_timerun.f90
+$O/%.solverstatic.o: $S/%.F90 ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/read_mesh_databases.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/read_mesh_databases.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/read_mesh_databases.o ${FCFLAGS_f90} $S/read_mesh_databases.f90
+$O/%.solverstatic_openmp.o: $S/%.f90 ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h
+## DK DK add OpenMP compiler flag here if needed
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -qsmp=omp -o $@ $<
 
-$O/setup_sources_receivers.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/setup_sources_receivers.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/setup_sources_receivers.o ${FCFLAGS_f90} $S/setup_sources_receivers.f90
+###
+### no dependence on values from mesher here
+###
 
-$O/specfem3D.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/specfem3D.F90
-	${MPIFCCOMPILE_CHECK} -c -o $O/specfem3D.o ${FCFLAGS_f90} $S/specfem3D.F90
+$O/%.solver.o: $S/%.f90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/write_movie_surface.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/write_movie_surface.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/write_movie_surface.o ${FCFLAGS_f90} $S/write_movie_surface.f90
+$O/%.solver.o: $S/%.F90 ${SETUP}/constants.h
+	${FCCOMPILE_CHECK} ${FCFLAGS_f90} -c -o $@ $<
 
-$O/write_movie_volume.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/write_movie_volume.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/write_movie_volume.o ${FCFLAGS_f90} $S/write_movie_volume.f90
 
-##
-## specfem3D - non-dependent on values from mesher here
-##
-$O/assemble_MPI_central_cube_block.o: ${SETUP}/constants.h $S/assemble_MPI_central_cube_block.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_central_cube_block.o ${FCFLAGS_f90} $S/assemble_MPI_central_cube_block.f90
-
-$O/assemble_MPI_scalar.o: ${SETUP}/constants.h $S/assemble_MPI_scalar.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_scalar.o ${FCFLAGS_f90} $S/assemble_MPI_scalar.f90
-
-$O/assemble_MPI_scalar_block.o: ${SETUP}/constants.h $S/assemble_MPI_scalar_block.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/assemble_MPI_scalar_block.o ${FCFLAGS_f90} $S/assemble_MPI_scalar_block.f90
-
-$O/fix_non_blocking_flags.o: ${SETUP}/constants.h $S/fix_non_blocking_flags.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/fix_non_blocking_flags.o ${FCFLAGS_f90} $S/fix_non_blocking_flags.f90
-
 ###
-### specfem3D - regular MPI compilation options here
+### VTK compilation
 ###
-$O/create_central_cube_buffers.o: ${SETUP}/constants.h $S/create_central_cube_buffers.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/create_central_cube_buffers.o ${FCFLAGS_f90} $S/create_central_cube_buffers.f90
 
-$O/get_event_info.o: ${SETUP}/constants.h $S/get_event_info.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/get_event_info.o ${FCFLAGS_f90} $S/get_event_info.f90
+$O/%.visualcc.o: $S/%.cpp ${SETUP}/config.h
+	${CC} -c $(CPPFLAGS) $(MPI_INC) -o $@ $<
 
-$O/locate_receivers.o: ${SETUP}/constants.h $S/locate_receivers.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/locate_receivers.o ${FCFLAGS_f90} $S/locate_receivers.f90
+$O/%.visualc.o: $S/%.c ${SETUP}/config.h
+	${CC} -c $(CPPFLAGS) $(MPI_INC) -o $@ $<
 
-$O/locate_regular_points.o: ${SETUP}/constants.h ${OUTPUT}/values_from_mesher.h $S/locate_regular_points.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/locate_regular_points.o ${FCFLAGS_f90} $S/locate_regular_points.f90
-
-$O/locate_sources.o: ${SETUP}/constants.h $S/locate_sources.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/locate_sources.o ${FCFLAGS_f90} $S/locate_sources.f90
-
-$O/read_arrays_buffers_solver.o: ${SETUP}/constants.h $S/read_arrays_buffers_solver.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/read_arrays_buffers_solver.o ${FCFLAGS_f90} $S/read_arrays_buffers_solver.f90
-
-$O/write_seismograms.o: ${SETUP}/constants.h $S/write_seismograms.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/write_seismograms.o ${FCFLAGS_f90} $S/write_seismograms.f90
-
-$O/write_output_ASCII.o: ${SETUP}/constants.h $S/write_output_ASCII.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/write_output_ASCII.o ${FCFLAGS_f90} $S/write_output_ASCII.f90
-
-$O/write_output_SAC.o: ${SETUP}/constants.h $S/write_output_SAC.f90
-	${MPIFCCOMPILE_CHECK} -c -o $O/write_output_SAC.o ${FCFLAGS_f90} $S/write_output_SAC.f90
-

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays_adios.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays_adios.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_forward_arrays_adios.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_kernels.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_kernels.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_kernels.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -443,7 +443,7 @@
 
   ! local parameters
   real(kind=CUSTOM_REAL):: scale_kl
-  real(kind=CUSTOM_REAL) :: rhol,kappal,rho_kl,alpha_kl,beta_kl
+  real(kind=CUSTOM_REAL) :: rhol,kappal,rho_kl,alpha_kl
   integer :: ispec,i,j,k
 
   scale_kl = scale_t/scale_displ * 1.d9

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_regular_kernels.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_regular_kernels.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/save_regular_kernels.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -37,11 +37,11 @@
                   eta_anisostore_crust_mantle,ispec_is_tiso_crust_mantle, &
                   LOCAL_PATH)
 
+  use constants_solver
+  use specfem_par,only: ANISOTROPIC_KL,SAVE_TRANSVERSE_KL_ONLY
+
   implicit none
 
-  include "constants.h"
-  include "OUTPUT_FILES/values_from_mesher.h"
-
   integer myrank
 
   integer, intent(in) :: npoints_slice

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_GLL_points.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_GLL_points.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_GLL_points.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_sources_receivers.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_sources_receivers.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/setup_sources_receivers.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D_par.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D_par.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/specfem3D_par.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -44,6 +44,7 @@
 ! main parameter module for specfem simulations
 
   use constants_solver
+  use shared_parameters
 
   implicit none
 
@@ -202,29 +203,34 @@
   !-----------------------------------------------------------------
 
   ! parameters read from parameter file
-  double precision DT,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-          ANGULAR_WIDTH_XI_IN_DEGREES
+!  double precision DT,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!          ANGULAR_WIDTH_XI_IN_DEGREES
 
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NTSTEP_BETWEEN_OUTPUT_SEISMOS,&
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NTSTEP_BETWEEN_OUTPUT_SEISMOS,&
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,SIMULATION_TYPE, &
+!          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  logical ONE_CRUST,TOPOGRAPHY,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  integer NT_DUMP_ATTENUATION
 
-  character(len=150) :: OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  logical ONE_CRUST,TOPOGRAPHY,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+
+  logical :: COMPUTE_AND_STORE_STRAIN
+
+!  character(len=150) :: OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+
   ! process/partition name
   character(len=150) :: prname
 
@@ -234,14 +240,14 @@
   !-----------------------------------------------------------------
 
   ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2D_BOTTOM,NSPEC2D_TOP
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC2D_BOTTOM,NSPEC2D_TOP
 
   ! computed in read_compute_parameters
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
   !-----------------------------------------------------------------
   ! MPI partitions
@@ -301,14 +307,14 @@
 
   ! CUDA mesh pointer<->integer wrapper
   integer(kind=8) :: Mesh_pointer
-  logical :: GPU_MODE
+!  logical :: GPU_MODE
 
   !-----------------------------------------------------------------
   ! ADIOS
   !-----------------------------------------------------------------
 
-  logical :: ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, &
-      ADIOS_FOR_ARRAYS_SOLVER, ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX
+!  logical :: ADIOS_ENABLED, ADIOS_FOR_FORWARD_ARRAYS, ADIOS_FOR_MPI_ARRAYS, &
+!      ADIOS_FOR_ARRAYS_SOLVER, ADIOS_FOR_SOLVER_MESHFILES, ADIOS_FOR_AVS_DX
 
   !-----------------------------------------------------------------
   ! time scheme
@@ -378,7 +384,7 @@
   real(kind=CUSTOM_REAL), dimension(:), allocatable :: rmassx_crust_mantle
   real(kind=CUSTOM_REAL), dimension(:), allocatable :: rmassy_crust_mantle
   real(kind=CUSTOM_REAL), dimension(:), allocatable :: rmassz_crust_mantle
-  integer :: NGLOB_XY_CM
+!  integer :: NGLOB_XY_CM
 
   ! displacement, velocity, acceleration
   real(kind=CUSTOM_REAL), dimension(NDIM,NGLOB_CRUST_MANTLE) :: &
@@ -389,9 +395,9 @@
     b_displ_crust_mantle,b_veloc_crust_mantle,b_accel_crust_mantle
 
   ! memory variables and standard linear solids for attenuation
-  real(kind=CUSTOM_REAL), dimension(ATT1,ATT2,ATT3,ATT4) :: &
+  real(kind=CUSTOM_REAL), dimension(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT4_VAL) :: &
     one_minus_sum_beta_crust_mantle, factor_scale_crust_mantle
-  real(kind=CUSTOM_REAL), dimension(N_SLS,ATT1,ATT2,ATT3,ATT4) :: &
+  real(kind=CUSTOM_REAL), dimension(N_SLS,ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT4_VAL) :: &
     factor_common_crust_mantle
   real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_CRUST_MANTLE_ATTENUATION) :: &
     R_xx_crust_mantle,R_yy_crust_mantle,R_xy_crust_mantle,R_xz_crust_mantle,R_yz_crust_mantle
@@ -537,9 +543,9 @@
     b_displ_inner_core,b_veloc_inner_core,b_accel_inner_core
 
   ! memory variables and standard linear solids for attenuation
-  real(kind=CUSTOM_REAL), dimension(ATT1,ATT2,ATT3,ATT5) :: &
+  real(kind=CUSTOM_REAL), dimension(ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT5_VAL) :: &
     one_minus_sum_beta_inner_core, factor_scale_inner_core
-  real(kind=CUSTOM_REAL), dimension(N_SLS,ATT1,ATT2,ATT3,ATT5) :: &
+  real(kind=CUSTOM_REAL), dimension(N_SLS,ATT1_VAL,ATT2_VAL,ATT3_VAL,ATT5_VAL) :: &
     factor_common_inner_core
   real(kind=CUSTOM_REAL), dimension(N_SLS,NGLLX,NGLLY,NGLLZ,NSPEC_INNER_CORE_ATTENUATION) :: &
     R_xx_inner_core,R_yy_inner_core,R_xy_inner_core,R_xz_inner_core,R_yz_inner_core

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk.cpp
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk.cpp	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk.cpp	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
 /*
  !=====================================================================
  !
- !          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+ !          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
  !          --------------------------------------------------
  !
  !          Main authors: Dimitri Komatitsch and Jeroen Tromp
  !                        Princeton University, USA
  !             and University of Pau / CNRS / INRIA, France
  ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
- !                            April 2011
+ !                            August 2013
  !
  ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk_stubs.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk_stubs.c	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/visual_vtk_stubs.c	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,14 +1,14 @@
 /*
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_output.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_output.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_output.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_surface.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_surface.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_surface.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -27,15 +27,12 @@
 
   subroutine write_movie_surface()
 
-  use mpi
   use specfem_par
   use specfem_par_crustmantle
   use specfem_par_movie
 
   implicit none
 
-  include "precision.h"
-
   ! local parameters
   character(len=150) :: outputname
   integer :: ipoin,ispec2D,ispec,i,j,k,ier,iglob
@@ -80,12 +77,12 @@
 
   ! gather info on master proc
   ispec = nmovie_points
-  call MPI_GATHER(store_val_x,ispec,CUSTOM_MPI_TYPE,store_val_x_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(store_val_y,ispec,CUSTOM_MPI_TYPE,store_val_y_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(store_val_z,ispec,CUSTOM_MPI_TYPE,store_val_z_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(store_val_ux,ispec,CUSTOM_MPI_TYPE,store_val_ux_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(store_val_uy,ispec,CUSTOM_MPI_TYPE,store_val_uy_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
-  call MPI_GATHER(store_val_uz,ispec,CUSTOM_MPI_TYPE,store_val_uz_all,ispec,CUSTOM_MPI_TYPE,0,MPI_COMM_WORLD,ier)
+  call gather_all_cr(store_val_x,ispec,store_val_x_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(store_val_y,ispec,store_val_y_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(store_val_z,ispec,store_val_z_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(store_val_ux,ispec,store_val_ux_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(store_val_uy,ispec,store_val_uy_all,ispec,NPROCTOT_VAL)
+  call gather_all_cr(store_val_uz,ispec,store_val_uz_all,ispec,NPROCTOT_VAL)
 
   ! save movie data to disk in home directory
   if(myrank == 0) then

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_volume.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_volume.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_movie_volume.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_ASCII.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_ASCII.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_ASCII.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -37,10 +37,10 @@
 ! here would result in a loss of accuracy when one later convolves
 ! the results with the source time function
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer :: seismo_offset, seismo_current, NTSTEP_BETWEEN_OUTPUT_SEISMOS
 
   real(kind=CUSTOM_REAL), dimension(5,NTSTEP_BETWEEN_OUTPUT_SEISMOS) :: seismogram_tmp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_SAC.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_SAC.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_output_SAC.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -38,10 +38,10 @@
 ! SAC headers have new format
 ! by Ebru
 
+  use constants
+
   implicit none
 
-  include "constants.h"
-
   integer nrec,it_end
 
   integer :: seismo_offset, seismo_current, NTSTEP_BETWEEN_OUTPUT_SEISMOS

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_seismograms.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_seismograms.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_seismograms.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -123,7 +123,6 @@
 ! write seismograms to files
   subroutine write_seismograms_to_file()
 
-  use mpi
   use constants_solver
   use specfem_par,only: &
           NPROCTOT_VAL,myrank,nrec,nrec_local, &
@@ -138,8 +137,6 @@
 
   implicit none
 
-  include "precision.h"
-
   ! local parameters
   double precision :: write_time_begin,write_time
   real(kind=CUSTOM_REAL), dimension(:,:), allocatable :: one_seismogram
@@ -148,7 +145,6 @@
   integer :: nrec_local_received
   integer :: total_seismos,total_seismos_local
   integer,dimension(:),allocatable:: islice_num_rec_local
-  integer :: msg_status(MPI_STATUS_SIZE)
   character(len=256) :: sisname
   ! timing
   double precision, external :: wtime
@@ -272,7 +268,7 @@
        ! receive except from proc 0, which is me and therefore I already have this value
        sender = iproc
        if(iproc /= 0) then
-         call MPI_RECV(nrec_local_received,1,MPI_INTEGER,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+         call recv_singlei(nrec_local_received,sender,itag)
          if(nrec_local_received < 0) call exit_MPI(myrank,'error while receiving local number of receivers')
        else
          nrec_local_received = nrec_local
@@ -285,9 +281,9 @@
              irec = number_receiver_global(irec_local)
              one_seismogram(:,:) = seismograms(:,irec_local,:)
            else
-             call MPI_RECV(irec,1,MPI_INTEGER,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+             call recv_singlei(irec,sender,itag)
              if(irec < 1 .or. irec > nrec) call exit_MPI(myrank,'error while receiving global receiver number')
-             call MPI_RECV(one_seismogram,NDIM*seismo_current,CUSTOM_MPI_TYPE,sender,itag,MPI_COMM_WORLD,msg_status,ier)
+             call recv_cr(one_seismogram,NDIM*seismo_current,sender,itag)
            endif
 
            total_seismos = total_seismos + 1
@@ -310,14 +306,15 @@
 
     else  ! on the nodes, send the seismograms to the master
       receiver = 0
-      call MPI_SEND(nrec_local,1,MPI_INTEGER,receiver,itag,MPI_COMM_WORLD,ier)
+      call send_singlei(nrec_local,receiver,itag)
       if (nrec_local > 0) then
         do irec_local = 1,nrec_local
           ! get global number of that receiver
           irec = number_receiver_global(irec_local)
-          call MPI_SEND(irec,1,MPI_INTEGER,receiver,itag,MPI_COMM_WORLD,ier)
+          call send_singlei(irec,receiver,itag)
+
           one_seismogram(:,:) = seismograms(:,irec_local,:)
-          call MPI_SEND(one_seismogram,NDIM*seismo_current,CUSTOM_MPI_TYPE,receiver,itag,MPI_COMM_WORLD,ier)
+          call send_cr(one_seismogram,NDIM*seismo_current,receiver,itag)
         enddo
       endif
     endif

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_specfem_adios_header.F90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_specfem_adios_header.F90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/src/specfem3D/write_specfem_adios_header.F90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and CNRS / INRIA / University of Pau, France
 ! (c) Princeton University and CNRS / INRIA / University of Pau
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -46,6 +46,8 @@
   use adios_write_mod
   use specfem_par, only : myrank, NSOURCES
 
+  use shared_input_parameters
+
   implicit none
   include "constants.h"
 
@@ -53,25 +55,25 @@
   ! local parameters
   !-------------------------------------------------------------------
   ! parameters read from parameter file (cf. DATA/Par_file)
-  integer  :: NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,        &
-      NTSTEP_BETWEEN_FRAMES, NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,        &
-      NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, MOVIE_VOLUME_TYPE,           &
-      MOVIE_START,MOVIE_STOP, NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA,               &
-      NOISE_TOMOGRAPHY
+!  integer  :: NTSTEP_BETWEEN_OUTPUT_SEISMOS,NTSTEP_BETWEEN_READ_ADJSRC,        &
+!      NTSTEP_BETWEEN_FRAMES, NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,        &
+!      NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, MOVIE_VOLUME_TYPE,           &
+!      MOVIE_START,MOVIE_STOP, NEX_XI,NEX_ETA,NPROC_XI,NPROC_ETA,               &
+!      NOISE_TOMOGRAPHY
 
-  double precision :: ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
-      CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,                  &
-      GAMMA_ROTATION_AZIMUTH, HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,         &
-      MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,           &
-      RECORD_LENGTH_IN_MINUTES
+!  double precision :: ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,&
+!      CENTER_LONGITUDE_IN_DEGREES,CENTER_LATITUDE_IN_DEGREES,                  &
+!      GAMMA_ROTATION_AZIMUTH, HDUR_MOVIE,MOVIE_TOP_KM,MOVIE_BOTTOM_KM,         &
+!      MOVIE_EAST_DEG,MOVIE_WEST_DEG,MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG,           &
+!      RECORD_LENGTH_IN_MINUTES
 
-  logical :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, MOVIE_SURFACE,    &
-      MOVIE_VOLUME,MOVIE_COARSE, RECEIVERS_CAN_BE_BURIED,                      &
-      PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW, &
-      ABSORBING_CONDITIONS,SAVE_FORWARD, OUTPUT_SEISMOS_ASCII_TEXT,            &
-      OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,                   &
-      ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,                       &
-      SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS, MOVIE_SURFACE,    &
+!      MOVIE_VOLUME,MOVIE_COARSE, RECEIVERS_CAN_BE_BURIED,                      &
+!      PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,ATTENUATION, &
+!      ABSORBING_CONDITIONS,SAVE_FORWARD, OUTPUT_SEISMOS_ASCII_TEXT,            &
+!      OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,                   &
+!      ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,                       &
+!      SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
   ! values from CMTSOLUTION -------------------------------
   ! integer          :: NSOURCES -> in specfem_par module
@@ -88,7 +90,7 @@
   character(len=:),   allocatable :: station_name, network_name
   double precision, allocatable, dimension(:) :: stlat, stlon, stele, stbur
 
-  character(len=150) :: OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
+!  character(len=150) :: OUTPUT_FILES,LOCAL_PATH,LOCAL_TMP_PATH,MODEL
 
   ! Adios variables
   integer                 :: adios_err
@@ -115,24 +117,25 @@
 
     !--*** Values read from DATA/Par_file ***
     ! extract all unmodified values from the Par_file
-    call read_parameter_file(OUTPUT_FILES,                                     &
-        LOCAL_PATH, LOCAL_TMP_PATH, MODEL,                                     &
-        NTSTEP_BETWEEN_OUTPUT_SEISMOS, NTSTEP_BETWEEN_READ_ADJSRC,             &
-        NTSTEP_BETWEEN_FRAMES, NTSTEP_BETWEEN_OUTPUT_INFO, NUMBER_OF_RUNS,     &
-        NUMBER_OF_THIS_RUN, NCHUNKS, SIMULATION_TYPE, MOVIE_VOLUME_TYPE,       &
-        MOVIE_START, MOVIE_STOP, NEX_XI, NEX_ETA, NPROC_XI, NPROC_ETA,         &
-        ANGULAR_WIDTH_XI_IN_DEGREES, ANGULAR_WIDTH_ETA_IN_DEGREES,             &
-        CENTER_LONGITUDE_IN_DEGREES, CENTER_LATITUDE_IN_DEGREES,               &
-        GAMMA_ROTATION_AZIMUTH, HDUR_MOVIE, MOVIE_TOP_KM, MOVIE_BOTTOM_KM,     &
-        RECORD_LENGTH_IN_MINUTES, MOVIE_EAST_DEG, MOVIE_WEST_DEG,              &
-        MOVIE_NORTH_DEG, MOVIE_SOUTH_DEG, ELLIPTICITY, GRAVITY, ROTATION,      &
-        TOPOGRAPHY, OCEANS, MOVIE_SURFACE, MOVIE_VOLUME, MOVIE_COARSE,         &
-        RECEIVERS_CAN_BE_BURIED, PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,  &
-        ATTENUATION, ATTENUATION_NEW, ABSORBING_CONDITIONS, SAVE_FORWARD,      &
-        OUTPUT_SEISMOS_ASCII_TEXT, OUTPUT_SEISMOS_SAC_ALPHANUM,                &
-        OUTPUT_SEISMOS_SAC_BINARY, ROTATE_SEISMOGRAMS_RT,                      &
-        WRITE_SEISMOGRAMS_BY_MASTER, SAVE_ALL_SEISMOS_IN_ONE_FILE,             &
-        USE_BINARY_FOR_LARGE_FILE, NOISE_TOMOGRAPHY)
+    call read_parameter_file()
+!        OUTPUT_FILES,                                     &
+!        LOCAL_PATH, LOCAL_TMP_PATH, MODEL,                                     &
+!        NTSTEP_BETWEEN_OUTPUT_SEISMOS, NTSTEP_BETWEEN_READ_ADJSRC,             &
+!        NTSTEP_BETWEEN_FRAMES, NTSTEP_BETWEEN_OUTPUT_INFO, NUMBER_OF_RUNS,     &
+!        NUMBER_OF_THIS_RUN, NCHUNKS, SIMULATION_TYPE, MOVIE_VOLUME_TYPE,       &
+!        MOVIE_START, MOVIE_STOP, NEX_XI, NEX_ETA, NPROC_XI, NPROC_ETA,         &
+!        ANGULAR_WIDTH_XI_IN_DEGREES, ANGULAR_WIDTH_ETA_IN_DEGREES,             &
+!        CENTER_LONGITUDE_IN_DEGREES, CENTER_LATITUDE_IN_DEGREES,               &
+!        GAMMA_ROTATION_AZIMUTH, HDUR_MOVIE, MOVIE_TOP_KM, MOVIE_BOTTOM_KM,     &
+!        RECORD_LENGTH_IN_MINUTES, MOVIE_EAST_DEG, MOVIE_WEST_DEG,              &
+!        MOVIE_NORTH_DEG, MOVIE_SOUTH_DEG, ELLIPTICITY, GRAVITY, ROTATION,      &
+!        TOPOGRAPHY, OCEANS, MOVIE_SURFACE, MOVIE_VOLUME, MOVIE_COARSE,         &
+!        RECEIVERS_CAN_BE_BURIED, PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,  &
+!        ATTENUATION, ABSORBING_CONDITIONS, SAVE_FORWARD,      &
+!        OUTPUT_SEISMOS_ASCII_TEXT, OUTPUT_SEISMOS_SAC_ALPHANUM,                &
+!        OUTPUT_SEISMOS_SAC_BINARY, ROTATE_SEISMOGRAMS_RT,                      &
+!        WRITE_SEISMOGRAMS_BY_MASTER, SAVE_ALL_SEISMOS_IN_ONE_FILE,             &
+!        USE_BINARY_FOR_LARGE_FILE, NOISE_TOMOGRAPHY)
 
     model_length = len(MODEL)
     ! define adios variables for the Par_file
@@ -175,7 +178,7 @@
         NEX_ETA, NPROC_XI, NPROC_ETA, NOISE_TOMOGRAPHY, ELLIPTICITY, GRAVITY,  &
         ROTATION, TOPOGRAPHY, OCEANS, MOVIE_SURFACE, MOVIE_VOLUME,MOVIE_COARSE,&
         RECEIVERS_CAN_BE_BURIED, PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,  &
-        ATTENUATION, ATTENUATION_NEW, ABSORBING_CONDITIONS, SAVE_FORWARD,      &
+        ATTENUATION, ABSORBING_CONDITIONS, SAVE_FORWARD,      &
         OUTPUT_SEISMOS_ASCII_TEXT, OUTPUT_SEISMOS_SAC_ALPHANUM,                &
         OUTPUT_SEISMOS_SAC_BINARY, ROTATE_SEISMOGRAMS_RT,                      &
         WRITE_SEISMOGRAMS_BY_MASTER, SAVE_ALL_SEISMOS_IN_ONE_FILE,             &
@@ -304,7 +307,6 @@
   call define_adios_byte_scalar (adios_group, "PRINT_SOURCE_TIME_FUNCTION", "/specfem3D_globe_parameter_file", group_size_inc)
   call define_adios_byte_scalar (adios_group, "SAVE_MESH_FILES", "/specfem3D_globe_parameter_file", group_size_inc)
   call define_adios_byte_scalar (adios_group, "ATTENUATION", "/specfem3D_globe_parameter_file", group_size_inc)
-  call define_adios_byte_scalar (adios_group, "ATTENUATION_NEW", "/specfem3D_globe_parameter_file", group_size_inc)
   call define_adios_byte_scalar (adios_group, "ABSORBING_CONDITIONS", "/specfem3D_globe_parameter_file", group_size_inc)
   call define_adios_byte_scalar (adios_group, "SAVE_FORWARD", "/specfem3D_globe_parameter_file", group_size_inc)
   call define_adios_byte_scalar (adios_group, "OUTPUT_SEISMOS_ASCII_TEXT", "/specfem3D_globe_parameter_file", group_size_inc)
@@ -598,7 +600,7 @@
     NEX_ETA, NPROC_XI, NPROC_ETA, NOISE_TOMOGRAPHY, ELLIPTICITY, GRAVITY,      &
     ROTATION, TOPOGRAPHY, OCEANS, MOVIE_SURFACE, MOVIE_VOLUME, MOVIE_COARSE,   &
     RECEIVERS_CAN_BE_BURIED, PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,      &
-    ATTENUATION, ATTENUATION_NEW, ABSORBING_CONDITIONS, SAVE_FORWARD,          &
+    ATTENUATION, ABSORBING_CONDITIONS, SAVE_FORWARD,          &
     OUTPUT_SEISMOS_ASCII_TEXT, OUTPUT_SEISMOS_SAC_ALPHANUM,                    &
     OUTPUT_SEISMOS_SAC_BINARY, ROTATE_SEISMOGRAMS_RT,                          &
     WRITE_SEISMOGRAMS_BY_MASTER, SAVE_ALL_SEISMOS_IN_ONE_FILE,                 &
@@ -618,7 +620,7 @@
       MOVIE_NORTH_DEG,MOVIE_SOUTH_DEG, RECORD_LENGTH_IN_MINUTES
   logical, intent(in) :: ELLIPTICITY,GRAVITY,ROTATION,TOPOGRAPHY,OCEANS,       &
       MOVIE_SURFACE, MOVIE_VOLUME,MOVIE_COARSE, RECEIVERS_CAN_BE_BURIED,       &
-      PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,ATTENUATION,ATTENUATION_NEW, &
+      PRINT_SOURCE_TIME_FUNCTION, SAVE_MESH_FILES,ATTENUATION, &
       ABSORBING_CONDITIONS,SAVE_FORWARD, OUTPUT_SEISMOS_ASCII_TEXT,            &
       OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY,                   &
       ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,                       &
@@ -669,7 +671,6 @@
   call adios_write (adios_handle, "PRINT_SOURCE_TIME_FUNCTION", PRINT_SOURCE_TIME_FUNCTION, adios_err)
   call adios_write (adios_handle, "SAVE_MESH_FILES", SAVE_MESH_FILES, adios_err)
   call adios_write (adios_handle, "ATTENUATION", ATTENUATION, adios_err)
-  call adios_write (adios_handle, "ATTENUATION_NEW", ATTENUATION_NEW, adios_err)
   call adios_write (adios_handle, "ABSORBING_CONDITIONS", ABSORBING_CONDITIONS, adios_err)
   call adios_write (adios_handle, "SAVE_FORWARD", SAVE_FORWARD, adios_err)
   call adios_write (adios_handle, "OUTPUT_SEISMOS_ASCII_TEXT", OUTPUT_SEISMOS_ASCII_TEXT, adios_err)

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/estimate_best_values_runs/estimate_best_values_runs.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/estimate_best_values_runs/estimate_best_values_runs.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/estimate_best_values_runs/estimate_best_values_runs.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -30,10 +30,11 @@
 
   program estimate_best_values_runs
 
+  use constants
+  use shared_parameters
+
   implicit none
 
-  include "../../../constants.h"
-
   integer, parameter :: NB_COLUMNS_TABLE = 10
 
 ! maximum total number of processors we want to see in the table
@@ -58,49 +59,50 @@
   integer :: BASE_VALUE
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          REFERENCE_1D_MODEL,THREE_D_MODEL,MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,RMOHO_FICTITIOUS_IN_MESHER
 
-  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
-          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE, &
-          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ATTENUATION,CASE_3D, &
-          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,first_time,HETEROGEN_3D_MANTLE
+!  logical TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE,ANISOTROPIC_INNER_CORE, &
+!          CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST,ROTATION,ISOTROPIC_3D_MANTLE, &
+!          TOPOGRAPHY,OCEANS,MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ATTENUATION,CASE_3D, &
+!          ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,HONOR_1D_SPHERICAL_MOHO,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,first_time,HETEROGEN_3D_MANTLE
 
-  character(len=150) LOCAL_PATH,MODEL
+!  character(len=150) LOCAL_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,nglob
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!               NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,nglob
 
   double precision :: static_memory_size
+
   integer :: NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
          NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUAT, &
          NSPEC_INNER_CORE_ATTENUATION, &
@@ -114,9 +116,10 @@
          NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
          NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION
 
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,EMULATE_ONLY,already_printed
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+  logical :: EMULATE_ONLY,already_printed
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
 
   integer :: c,counter,offset
 
@@ -168,35 +171,36 @@
 
 ! read the parameter file and compute additional parameters
     EMULATE_ONLY = .true.
-    call read_compute_parameters(MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
-          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
-          TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
-          ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
-          ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
-          MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
-          PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
-          ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
-          INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,LOCAL_PATH,MODEL,SIMULATION_TYPE,SAVE_FORWARD, &
-          NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
-          NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-          NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
-          NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
-          ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
-          DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
-          WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,EMULATE_ONLY)
-
+    call read_compute_parameters()
+!          MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA,RMOHO_FICTITIOUS_IN_MESHER, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,DT, &
+!          ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE,MOVIE_VOLUME_TYPE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH,MOVIE_START,MOVIE_STOP, &
+!          TRANSVERSE_ISOTROPY,ANISOTROPIC_3D_MANTLE, &
+!          ANISOTROPIC_INNER_CORE,CRUSTAL,ELLIPTICITY,GRAVITY,ONE_CRUST, &
+!          ROTATION,ISOTROPIC_3D_MANTLE,HETEROGEN_3D_MANTLE,TOPOGRAPHY,OCEANS,MOVIE_SURFACE, &
+!          MOVIE_VOLUME,MOVIE_COARSE,ATTENUATION_3D,RECEIVERS_CAN_BE_BURIED, &
+!          PRINT_SOURCE_TIME_FUNCTION,SAVE_MESH_FILES, &
+!          ATTENUATION,REFERENCE_1D_MODEL,THREE_D_MODEL,ABSORBING_CONDITIONS, &
+!          INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,LOCAL_PATH,MODEL,SIMULATION_TYPE,SAVE_FORWARD, &
+!          NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+!          NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!          NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX,NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+!          NSPEC1D_RADIAL,NGLOB1D_RADIAL,NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX,NGLOB, &
+!          ratio_sampling_array, ner, doubling_index,r_bottom,r_top,this_region_has_a_doubling,rmins,rmaxs,CASE_3D, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,ratio_divide_central_cube,HONOR_1D_SPHERICAL_MOHO,CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA,&
+!          DIFF_NSPEC1D_RADIAL,DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA,&
+!          WRITE_SEISMOGRAMS_BY_MASTER,SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE,EMULATE_ONLY)
+!
   if(first_time) then
     first_time = .false.
     if(ATTENUATION) then
@@ -208,23 +212,24 @@
 
 !! compute memory usage per processor core
 ! evaluate the amount of static memory needed by the solver
-  call memory_eval(OCEANS,ABSORBING_CONDITIONS,ATTENUATION,ANISOTROPIC_3D_MANTLE,&
-                   TRANSVERSE_ISOTROPY,ANISOTROPIC_INNER_CORE,ROTATION,&
-                   ONE_CRUST,doubling_index,this_region_has_a_doubling,&
-                   ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_sampling_array,&
-                   NSPEC,nglob,SIMULATION_TYPE,MOVIE_VOLUME,SAVE_FORWARD, &
-         NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
-         NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUAT, &
-         NSPEC_INNER_CORE_ATTENUATION, &
-         NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
-         NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
-         NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
-         NSPEC_CRUST_MANTLE_ADJOINT, &
-         NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
-         NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
-         NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
-         NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
-         NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION,static_memory_size)
+  call memory_eval(doubling_index,this_region_has_a_doubling, &
+                   ner,NEX_PER_PROC_XI,NEX_PER_PROC_ETA, &
+                   ratio_sampling_array,NPROCTOT, &
+                   NSPEC,NGLOB, &
+                   NSPECMAX_ANISO_IC,NSPECMAX_ISO_MANTLE,NSPECMAX_TISO_MANTLE, &
+                   NSPECMAX_ANISO_MANTLE,NSPEC_CRUST_MANTLE_ATTENUATION, &
+                   NSPEC_INNER_CORE_ATTENUATION, &
+                   NSPEC_CRUST_MANTLE_STR_OR_ATT,NSPEC_INNER_CORE_STR_OR_ATT, &
+                   NSPEC_CRUST_MANTLE_STR_AND_ATT,NSPEC_INNER_CORE_STR_AND_ATT, &
+                   NSPEC_CRUST_MANTLE_STRAIN_ONLY,NSPEC_INNER_CORE_STRAIN_ONLY, &
+                   NSPEC_CRUST_MANTLE_ADJOINT, &
+                   NSPEC_OUTER_CORE_ADJOINT,NSPEC_INNER_CORE_ADJOINT, &
+                   NGLOB_CRUST_MANTLE_ADJOINT,NGLOB_OUTER_CORE_ADJOINT, &
+                   NGLOB_INNER_CORE_ADJOINT,NSPEC_OUTER_CORE_ROT_ADJOINT, &
+                   NSPEC_CRUST_MANTLE_STACEY,NSPEC_OUTER_CORE_STACEY, &
+                   NGLOB_CRUST_MANTLE_OCEANS,NSPEC_OUTER_CORE_ROTATION, &
+                   NSPEC2D_BOTTOM,NSPEC2D_TOP, &
+                   static_memory_size)
 
   mem_per_core = static_memory_size/1073741824.d0
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/test_cache_size.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/test_cache_size.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Cluster/test_cache_size.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Profiles/write_profile.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Profiles/write_profile.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Profiles/write_profile.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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
@@ -77,54 +77,52 @@
 
 
 ! parameters read from parameter file
-  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
-          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
-          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
-          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
-          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
-          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
-          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
-          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
+!  integer MIN_ATTENUATION_PERIOD,MAX_ATTENUATION_PERIOD,NER_CRUST, &
+!          NER_80_MOHO,NER_220_80,NER_400_220,NER_600_400,NER_670_600,NER_771_670, &
+!          NER_TOPDDOUBLEPRIME_771,NER_CMB_TOPDDOUBLEPRIME,NER_OUTER_CORE, &
+!          NER_TOP_CENTRAL_CUBE_ICB,NEX_XI,NEX_ETA, &
+!          NPROC_XI,NPROC_ETA,NTSTEP_BETWEEN_OUTPUT_SEISMOS, &
+!          NTSTEP_BETWEEN_READ_ADJSRC,NSTEP,NSOURCES,NTSTEP_BETWEEN_FRAMES, &
+!          NTSTEP_BETWEEN_OUTPUT_INFO,NUMBER_OF_RUNS,NUMBER_OF_THIS_RUN,NCHUNKS,SIMULATION_TYPE, &
+!          MOVIE_VOLUME_TYPE,MOVIE_START,MOVIE_STOP,NOISE_TOMOGRAPHY
 
-  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
-          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
-          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
-          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
-          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
-          RMOHO_FICTITIOUS_IN_MESHER
+!  double precision DT,ANGULAR_WIDTH_XI_IN_DEGREES,ANGULAR_WIDTH_ETA_IN_DEGREES,CENTER_LONGITUDE_IN_DEGREES, &
+!          CENTER_LATITUDE_IN_DEGREES,GAMMA_ROTATION_AZIMUTH,ROCEAN,RMIDDLE_CRUST, &
+!          RMOHO,R80,R120,R220,R400,R600,R670,R771,RTOPDDOUBLEPRIME,RCMB,RICB, &
+!          R_CENTRAL_CUBE,RHO_TOP_OC,RHO_BOTTOM_OC,RHO_OCEANS,HDUR_MOVIE, &
+!          MOVIE_TOP,MOVIE_BOTTOM,MOVIE_WEST,MOVIE_EAST,MOVIE_NORTH,MOVIE_SOUTH, &
+!          RMOHO_FICTITIOUS_IN_MESHER
 
-  logical MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
-          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
-          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
-          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
-          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
-          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
+!  logical MOVIE_SURFACE,MOVIE_VOLUME,MOVIE_COARSE, &
+!          RECEIVERS_CAN_BE_BURIED,PRINT_SOURCE_TIME_FUNCTION, &
+!          SAVE_MESH_FILES,ABSORBING_CONDITIONS,INCLUDE_CENTRAL_CUBE,INFLATE_CENTRAL_CUBE,SAVE_FORWARD, &
+!          OUTPUT_SEISMOS_ASCII_TEXT,OUTPUT_SEISMOS_SAC_ALPHANUM,OUTPUT_SEISMOS_SAC_BINARY, &
+!          ROTATE_SEISMOGRAMS_RT,WRITE_SEISMOGRAMS_BY_MASTER,&
+!          SAVE_ALL_SEISMOS_IN_ONE_FILE,USE_BINARY_FOR_LARGE_FILE
 
-  character(len=150) OUTPUT_FILES,LOCAL_PATH,MODEL
+!  character(len=150) OUTPUT_FILES,LOCAL_PATH,MODEL
 
 ! parameters deduced from parameters read from file
-  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
+!  integer NPROC,NPROCTOT,NEX_PER_PROC_XI,NEX_PER_PROC_ETA,ratio_divide_central_cube
 
-  integer, external :: err_occurred
-
 ! this for all the regions
-  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
-               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
-               NSPEC2D_BOTTOM,NSPEC2D_TOP,NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
-               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
-               NGLOB
+!  integer, dimension(MAX_NUM_REGIONS) :: NSPEC,NSPEC2D_XI,NSPEC2D_ETA, &
+!               NSPEC2DMAX_XMIN_XMAX,NSPEC2DMAX_YMIN_YMAX, &
+!               NSPEC2D_BOTTOM,NSPEC2D_TOP,NSPEC1D_RADIAL,NGLOB1D_RADIAL, &
+!               NGLOB2DMAX_XMIN_XMAX,NGLOB2DMAX_YMIN_YMAX, &
+!               NGLOB
 
 ! computed in read_compute_parameters
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
-  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
-  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
-  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: ner,ratio_sampling_array
+!  integer, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: doubling_index
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: r_bottom,r_top
+!  logical, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: this_region_has_a_doubling
+!  double precision, dimension(MAX_NUMBER_OF_MESH_LAYERS) :: rmins,rmaxs
 
 
-  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
-  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
-  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
+!  integer, dimension(NB_SQUARE_CORNERS,NB_CUT_CASE) :: DIFF_NSPEC1D_RADIAL
+!  integer, dimension(NB_SQUARE_EDGES_ONEDIR,NB_CUT_CASE) :: DIFF_NSPEC2D_XI,DIFF_NSPEC2D_ETA
+!  logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
 
 
   integer i,j

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/convert_interpolated_chunk_to_ParaView/read_interpolated_kernel_for_one_chunk_with_binary_kernel_stored_only_and_VTK_output.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/convert_interpolated_chunk_to_ParaView/read_interpolated_kernel_for_one_chunk_with_binary_kernel_stored_only_and_VTK_output.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/convert_interpolated_chunk_to_ParaView/read_interpolated_kernel_for_one_chunk_with_binary_kernel_stored_only_and_VTK_output.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/create_slice_VTK.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/create_slice_VTK.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/VTK_ParaView/create_slice_VTK.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/constants_topo.h
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/constants_topo.h	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/constants_topo.h	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_slices.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_slices.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_slices.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_surface.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_surface.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_DX_to_AVS_surface.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_avs2dx_quads.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_epicenter_OpenDX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_epicenter_OpenDX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_epicenter_OpenDX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_main_cities_OpenDX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_main_cities_OpenDX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_lat_long_main_cities_OpenDX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_palette_GMT_OpenDX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_palette_GMT_OpenDX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_palette_GMT_OpenDX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_topo_bathy_to_OpenDX.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_topo_bathy_to_OpenDX.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/convert_topo_bathy_to_OpenDX.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/longlatdepth2xyz.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/longlatdepth2xyz.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/longlatdepth2xyz.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/Visualization/opendx_AVS/permute_cubit_2_opendx.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,6 +1,6 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/attenuation/attenuation_output.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/attenuation/attenuation_output.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/attenuation/attenuation_output.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -12,9 +12,10 @@
 !    However, the values here should match those which are output from attenuation_prem.c
 !    This code was used for testing the implementation of 3D attenuation
 !    Brian Savage, 22/03/04
+
+    use constants_solver
+
     implicit none
-    include "OUTPUT_FILES/values_from_mesher.h"
-    include "constants.h"
 
     integer i,j,k,ispec
     integer myrank, vnspec, process, iregion

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/create_specfem3D_gpu_cuda_method_stubs.pl
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/create_specfem3D_gpu_cuda_method_stubs.pl	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/create_specfem3D_gpu_cuda_method_stubs.pl	2013-08-26 11:20:57 UTC (rev 22730)
@@ -17,14 +17,14 @@
 /* 
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/extract_all_seismos_from_large_file.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/extract_all_seismos_from_large_file.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/extract_all_seismos_from_large_file.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/filter_station_list.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/filter_station_list.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/filter_station_list.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_NS.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_NS.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_NS.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_equator.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_equator.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_equator.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_one_fourth.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_one_fourth.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/generate_station_list_one_fourth.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/s362ani/program_test_s362ani.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/s362ani/program_test_s362ani.f90	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/s362ani/program_test_s362ani.f90	2013-08-26 11:20:57 UTC (rev 22730)
@@ -1,13 +1,13 @@
 !=====================================================================
 !
-!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0
 !          --------------------------------------------------
 !
 !          Main authors: Dimitri Komatitsch and Jeroen Tromp
 !                        Princeton University, USA
 !             and University of Pau / CNRS / INRIA, France
 ! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
-!                            April 2011
+!                            August 2013
 !
 ! 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

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/update_headers_change_word_f90.pl
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/update_headers_change_word_f90.pl	2013-08-26 11:12:47 UTC (rev 22729)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/SPECFEM3D_GLOBE_SUNFLOWER/utils/update_headers_change_word_f90.pl	2013-08-26 11:20:57 UTC (rev 22730)
@@ -16,39 +16,45 @@
 # in the code (which is dangerous, but really easier to program...)
 #
 
-      @objects = `ls ../src/*/*.f90 ../src/*/*.F90 ../src/*/*.c ../src/*/*.cu ../src/*/*.h.in ../src/*/*.h`;
+ at objects = `ls src/*/*.f90 src/*/*.F90 src/*/*.c src/*/*.cu src/*/*.h.in src/*/*.h setup/*.h.in`;
 
-      foreach $name (@objects) {
-            chop $name;
+foreach $name (@objects) {
+  chop $name;
+        
 # change tabs to white spaces
-            system("expand -2 < $name > _____tutu01_____");
-            $f90name = $name;
-            print STDOUT "Changing word in file $name ...\n";
+  system("expand -2 < $name > _____tutu01_____");
+  $f90name = $name;
+  print STDOUT "Changing word in file $name ...\n";
 
-            open(FILEF77,"<_____tutu01_____");
-            open(FILEF90,">$f90name");
+  open(FILEF77,"<_____tutu01_____");
+  open(FILEF90,">$f90name");
 
 # open the source file
-      while($line = <FILEF77>) {
-            chop $line;
+  while($line = <FILEF77>) {
+    chop $line;
 
 # suppress trailing white spaces and carriage return
-      $line =~ s/\s*$//;
+    $line =~ s/\s*$//;
 
-# change the version number and copyright information
+# converts tabs to space
+#      $line =~ s/\t/ /g;
+    
+# change the version number
+#    $line =~ s#!          S p e c f e m 3 D  G l o b e  V e r s i o n  5 . 1#!          S p e c f e m 3 D  G l o b e  V e r s i o n  6 . 0#og;
+
+# change the copyright information
+
 #      $line =~ s#!             and University of Pau / CNRS / INRIA, France#!             and CNRS / INRIA / University of Pau, France#og;
 #      $line =~ s#! \(c\) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA#! \(c\) Princeton University and CNRS / INRIA / University of Pau#og;
 #     $line =~ s#rmass_sigma#rmass_time_integral_of_sigma#og;
 
 # write the modified line to the output file
-      print FILEF90 "$line\n";
-
+    print FILEF90 "$line\n";
   }
 
-            close(FILEF77);
-            close(FILEF90);
+  close(FILEF77);
+  close(FILEF90);
+}
 
-      }
+system("rm -f _____tutu01_____");
 
-            system("rm -f _____tutu01_____");
-



More information about the CIG-COMMITS mailing list