Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot version #69

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions CoLoRe_snap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
########## User-definable stuff ##########
#
###Compiler and compilation options
COMP_SER = gcc
COMP_MPI = mpicc
OPTIONS = -Wall -Wno-format-overflow -O3 -std=c99
#
### Behavioural flags
#Use double precision integer (enable in general)
DEFINEFLAGS += -D_LONGIDS
#Use normalized bias model
DEFINEFLAGS += -D_BIAS_MODEL_1
#Use linear bias model
#DEFINEFLAGS += -D_BIAS_MODEL_3
#Use new lensing method
#DEFINEFLAGS += -D_USE_FAST_LENSING
#Generate debug help. Only useful for development
DEFINEFLAGS += -D_DEBUG
#Use double precision floating point? Set to "yes" or "no"
USE_SINGLE_PRECISION = yes
#Compile with HDF5 capability? Set to "yes" or "no"
USE_HDF5 = no
#Use OMP parallelization? Set to "yes" or "no"
USE_OMP = yes
#Use MPI parallelization? Set to "yes" or "no"
USE_MPI = no
#
###Path to libraries and headers
###If two or more of the dependencies reside in the same paths, only
###one instance is necessary.
#GSL
#GSL_INC = -I/add/path
#GSL_LIB = -L/add/path
GSL_INC = -I/home/damonge/include
GSL_LIB = -L/home/damonge/lib
#FFTW
FFTW_INC =
FFTW_LIB =
#cfitsio
FITS_INC =
FITS_LIB =
#cfitsio
HDF5_INC =
HDF5_LIB =
#libconfig
CONF_INC =
CONF_LIB =
#
########## End of user-definable ##########

USE_FITS = yes
DEFINEFLAGS += -DHAVE_INLINE -DGSL_RANGE_CHECK_OFF

ifeq ($(strip $(USE_OMP)),yes)
OPTIONS += -fopenmp
DEFINEFLAGS += -D_HAVE_OMP
endif #OMP

ifeq ($(strip $(USE_MPI)),yes)
DEFINEFLAGS += -D_HAVE_MPI
COMP_PAR = $(COMP_MPI)
else #MPI
COMP_PAR = $(COMP_SER)
endif #MPI

ifeq ($(strip $(USE_SINGLE_PRECISION)),yes)
DEFINEFLAGS += -D_SPREC

ifeq ($(strip $(USE_OMP)),yes)
LIB_FFTW += -lfftw3f_omp
endif #OMP
ifeq ($(strip $(USE_MPI)),yes)
LIB_FFTW += -lfftw3f_mpi
endif #MPI
LIB_FFTW += -lfftw3f

else #SINGLE_PRECISION

ifeq ($(strip $(USE_OMP)),yes)
LIB_FFTW += -lfftw3_omp
endif #OMP
ifeq ($(strip $(USE_MPI)),yes)
LIB_FFTW += -lfftw3_mpi
endif #MPI

endif #SINGLE_PRECISION

# for fftlog
LIB_FFTW += -lfftw3

OPTIONS += $(DEFINEFLAGS)

INC_ALL = -I./src $(GSL_INC) $(FFTW_INC) $(FITS_INC) $(HDF5_INC) $(CONF_INC)
LIB_ALL = $(GSL_LIB) $(FFTW_LIB) $(FITS_LIB) $(HDF5_LIB) $(CONF_LIB) -lconfig -lgsl -lgslcblas $(LIB_FFTW) -lcfitsio
ifeq ($(strip $(USE_HDF5)),yes)
DEFINEFLAGS += -D_HAVE_HDF5
LIB_ALL += -lhdf5 -lhdf5_hl -lz
endif #HDF5
ifeq ($(strip $(USE_FITS)),yes)
DEFINEFLAGS += -D_HAVE_FITS
#LIB_ALL += -lcfitsio
endif #FITS
LIB_ALL += -lm

COMMONO = src/common.o
COSMOMADO = src/cosmo_mad.o
COSMOO = src/cosmo.o
FOURIERO = src/fourier.o
DENSO = src/density.o
SRCSO = src/srcs.o
IOO = src/io.o
MAIN = src/main.c
OFILES = $(COMMONO) $(COSMOMADO) $(COSMOO) $(FOURIERO) $(DENSO) $(IOO) $(SRCSO)

EXEC = CoLoRe

default : $(EXEC)

%.o : %.c
$(COMP_CC) $(OPTIONS) $(INC_ALL) -c $< -o $@

$(OFILES) : COMP_CC := $(COMP_PAR)

$(EXEC) : $(OFILES)
$(COMP_PAR) $(OPTIONS) $(INC_ALL) $(OFILES) $(MAIN) -o $(EXEC) $(LIB_ALL)

clean :
rm -f src/*.o

cleaner :
rm -f *~ src/*.o src/*~ $(EXEC)
388 changes: 388 additions & 0 deletions CoLoRe_snap/example_CoLoRe.ipynb

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions CoLoRe_snap/param_example.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
global:
{
#Output prefix. Output will be in prefix_<node ID>.<fits/txt>
prefix_out= "colore_out";
#Output format. Select HDF5, FITS or ASCII
output_format= "FITS";
#Output Gaussian overdensity field at z=0?
output_density= true
#Path to power spectrum at z=0. Power spectrum file must
#be in CAMB format: k (h/Mpc), P(k) (Mpc/h)^3.
pk_filename= "pk.dat"
#Box size (in Mpc/h)
l_box= 1000.0
#Snapshot redshift
z_snap= 0.0
#RNG seed note that output will depend on number of nodes, etc not only
#on the RNG seed
seed= 1003
}

field_par:
{
#Extra Gaussian smoothing scale [Mpc/h] (set to a
#negative value if you don't want any smoothing)
r_smooth= 0.001
#Do you want to smooth the Newtonian potential as well?
smooth_potential= true
#Will use a Cartesian grid with n_grid^3 cells
n_grid= 256
#Density field type
# 0-lognormal
# 1-1LPT
# 2-2LPT
dens_type= 1
#If dens_type==1 or 2, buffer size (fraction per particle)
lpt_buffer_fraction= 0.6
#If dens_type==1 or 2, scheme to interpolate particle
#positions into a grid
# 0-NGP
# 1-CIC
# 2-TSC
lpt_interp_type= 1
#Set to 1 if you want to output the LPT particle positions
output_lpt= 0
}

cosmo_par:
{
#Non-relativistic matter
omega_M= 0.3
#Dark energy
omega_L= 0.7
#Baryons
omega_B= 0.05
#Hubble parameter (in units of 100 km/s/Mpc)
h= 0.7
#Dark energy equation of state
w= -1.0
#Primordial scalar spectral index, used only to extrapolate
#P(k) at low k end (-3 used at high k end)
ns= 0.96
#Power spectrum normalization. The input power spectrum will be
#renormalized to this sigma8
sigma_8= 0.848104
}

#For each galaxy population, create a section called srcsX, starting with X=1
srcs1:
{
#Number density (in (h/Mpc)^3)
ndens= 2E-3
#Value of linear bias
bias= 2.0
# Minimum value of density to start populating cells
threshold= -1.0
}

srcs2:
{
ndens= 5E-3
bias= 1.0
threshold= -1.0
}
Loading