diff --git a/src/Numerics.cc b/src/Numerics.cc
index 1639b9a..ee96348 100644
--- a/src/Numerics.cc
+++ b/src/Numerics.cc
@@ -1,12 +1,19 @@
-/*
-
- numerics.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifdef WITH_MPI
#ifdef MANNO
diff --git a/src/Numerics.hh b/src/Numerics.hh
index bfd93da..9bfb28c 100644
--- a/src/Numerics.hh
+++ b/src/Numerics.hh
@@ -1,12 +1,19 @@
-/*
-
- numerics.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __NUMERICS_HH
#define __NUMERICS_HH
diff --git a/src/cmake_config.hh.in b/src/cmake_config.hh.in
index 5162967..17b2d2a 100644
--- a/src/cmake_config.hh.in
+++ b/src/cmake_config.hh.in
@@ -1,3 +1,20 @@
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
+
#pragma once
diff --git a/src/constraints.cc b/src/constraints.cc
index 82bfa1d..fb59b10 100644
--- a/src/constraints.cc
+++ b/src/constraints.cc
@@ -1,12 +1,19 @@
-/*
-
- constraints.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include "constraints.hh"
diff --git a/src/constraints.hh b/src/constraints.hh
index 450ae13..6c42a05 100644
--- a/src/constraints.hh
+++ b/src/constraints.hh
@@ -1,12 +1,19 @@
-/*
-
- constraints.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
#include
diff --git a/src/convolution_kernel.cc b/src/convolution_kernel.cc
index 03a9c54..4a4efc9 100644
--- a/src/convolution_kernel.cc
+++ b/src/convolution_kernel.cc
@@ -1,11 +1,19 @@
-/*
-
- convolution_kernel.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions for cosmological simulations
-
- Copyright (C) 2010-23 Oliver Hahn
-
-*/
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include
#include
diff --git a/src/convolution_kernel.hh b/src/convolution_kernel.hh
index 30bb851..b0265f9 100644
--- a/src/convolution_kernel.hh
+++ b/src/convolution_kernel.hh
@@ -1,12 +1,19 @@
-/*
-
- convolution_kernel.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010-23 Oliver Hahn
-
-*/
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __CONVOLUTION_KERNELS_HH
#define __CONVOLUTION_KERNELS_HH
diff --git a/src/cosmology_calculator.hh b/src/cosmology_calculator.hh
index 53775d4..b1fa585 100644
--- a/src/cosmology_calculator.hh
+++ b/src/cosmology_calculator.hh
@@ -1,6 +1,6 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
-// Copyright (C) 2020 by Oliver Hahn
+// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/src/cosmology_parameters.cc b/src/cosmology_parameters.cc
index 61c456d..74d3fec 100644
--- a/src/cosmology_parameters.cc
+++ b/src/cosmology_parameters.cc
@@ -1,6 +1,6 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
-// Copyright (C) 2020 by Oliver Hahn
+// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/src/cosmology_parameters.hh b/src/cosmology_parameters.hh
index e43f33a..458e481 100644
--- a/src/cosmology_parameters.hh
+++ b/src/cosmology_parameters.hh
@@ -1,6 +1,6 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
-// Copyright (C) 2020 by Oliver Hahn
+// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/src/defaults.cc b/src/defaults.cc
index d0efe52..704179e 100644
--- a/src/defaults.cc
+++ b/src/defaults.cc
@@ -1,12 +1,19 @@
-/*
-
- defaults.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include "defaults.hh"
diff --git a/src/defaults.hh b/src/defaults.hh
index 0c99178..c11c22f 100644
--- a/src/defaults.hh
+++ b/src/defaults.hh
@@ -1,12 +1,19 @@
-/*
-
- defaults.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __DEFAULTS_HH
diff --git a/src/densities.cc b/src/densities.cc
index 83b8d1e..d59cdbf 100644
--- a/src/densities.cc
+++ b/src/densities.cc
@@ -1,15 +1,24 @@
-/*
-
- densities.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include
+#include "math/special.hh"
+
#include "densities.hh"
#include "random.hh"
#include "convolution_kernel.hh"
@@ -17,21 +26,8 @@
//TODO: this should be a larger number by default, just to maintain consistency with old default
#define DEF_RAN_CUBE_SIZE 32
-double Meyer_scaling_function( double k, double kmax )
-{
- constexpr double twopithirds{2.0*M_PI/3.0};
- constexpr double fourpithirds{4.0*M_PI/3.0};
- auto nu = []( double x ){ return x<0.0?0.0:(x<1.0?x:1.0); };
-
- k = std::abs(k)/kmax * fourpithirds;
-
- if( k < twopithirds ) return 1.0;
- else if( k< fourpithirds ){
- return std::cos( 0.5*M_PI * nu(3*k/(2*M_PI)-1.0) );
- }
- return 0.0;
-}
+/* interpolate upwards in the hierarchy */
template
void fft_coarsen(m1 &v, m2 &V)
{
@@ -89,13 +85,14 @@ void fft_coarsen(m1 &v, m2 &V)
val_fine *= val_phas * fftnorm / 8.0;
- if( i!=(int)nxF/2 && j!=(int)nyF/2 && k!=(int)nzF/2 ){
- RE(ccoarse[qc]) = val_fine.real();
- IM(ccoarse[qc]) = val_fine.imag();
- }else{
- RE(ccoarse[qc]) = 0.0;//val_fine.real();
- IM(ccoarse[qc]) = 0.0;//val_fine.imag();
- }
+ double blend_coarse_x = Meyer_scaling_function(kx, nxF / 2);
+ double blend_coarse_y = Meyer_scaling_function(ky, nyF / 2);
+ double blend_coarse_z = Meyer_scaling_function(kz, nzF / 2);
+
+ double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
+
+ RE(ccoarse[qc]) = val_fine.real() * blend_coarse;
+ IM(ccoarse[qc]) = val_fine.imag() * blend_coarse;
}
delete[] rfine;
@@ -117,6 +114,7 @@ void fft_coarsen(m1 &v, m2 &V)
FFTW_API(destroy_plan)(ipc);
}
+/* interpolate downwards in the hierarchy */
template
void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
{
@@ -124,6 +122,7 @@ void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
size_t nxf = v.size(0), nyf = v.size(1), nzf = v.size(2), nzfp = nzf + 2;
size_t mxf = v.margin(0), myf = v.margin(1), mzf = v.margin(2);
+ // adjust offsets to respect margins, all grids have 'margins' except basegrid (which is periodic)
if (!from_basegrid)
{
oxf += mxf/2;
@@ -216,16 +215,14 @@ void fft_interpolate(m1 &V, m2 &v, int margin, bool from_basegrid = false)
std::complex val(RE(ccoarse[qc]), IM(ccoarse[qc]));
val *= val_phas * 8.0;
- if(i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2){
- double blend_coarse_x = Meyer_scaling_function(kx, nxc / 2);
- double blend_coarse_y = Meyer_scaling_function(ky, nyc / 2);
- double blend_coarse_z = Meyer_scaling_function(kz, nzc / 2);
- double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
- double blend_fine = 1.0-blend_coarse;
+ double blend_coarse_x = Meyer_scaling_function(kx, nxc / 4);
+ double blend_coarse_y = Meyer_scaling_function(ky, nyc / 4);
+ double blend_coarse_z = Meyer_scaling_function(kz, nzc / 4);
+ double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
+ double blend_fine = 1.0-blend_coarse;
- RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real();
- IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag();
- }
+ RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real();
+ IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag();
}
delete[] rcoarse;
diff --git a/src/densities.hh b/src/densities.hh
index 0c0700a..918b9bb 100644
--- a/src/densities.hh
+++ b/src/densities.hh
@@ -1,12 +1,19 @@
-/*
-
- densities.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __DENSITIES_HH
#define __DENSITIES_HH
diff --git a/src/density_grid.hh b/src/density_grid.hh
index 7eba1e2..61d526f 100644
--- a/src/density_grid.hh
+++ b/src/density_grid.hh
@@ -1,3 +1,20 @@
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
+
#pragma once
#include
diff --git a/src/fd_schemes.hh b/src/fd_schemes.hh
index 1ad2dd9..f32010d 100644
--- a/src/fd_schemes.hh
+++ b/src/fd_schemes.hh
@@ -1,12 +1,19 @@
-/*
-
- fd_schemes.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __FD_SCHEMES_HH
#define __FD_SCHEMES_HH
diff --git a/src/general.hh b/src/general.hh
index f7eb32f..a71a3ad 100644
--- a/src/general.hh
+++ b/src/general.hh
@@ -1,12 +1,19 @@
-/*
-
- general.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
diff --git a/src/logger.cc b/src/logger.cc
index b60963a..4220af1 100644
--- a/src/logger.cc
+++ b/src/logger.cc
@@ -1,4 +1,4 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file)
//
diff --git a/src/logger.hh b/src/logger.hh
index 03f7960..38ee168 100644
--- a/src/logger.hh
+++ b/src/logger.hh
@@ -1,4 +1,4 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
// Copyright (C) 2020 by Oliver Hahn & Michael Michaux (this file)
//
diff --git a/src/main.cc b/src/main.cc
index 16dbf79..1f492ec 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,12 +1,19 @@
-/*
-
- main.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include
#include
diff --git a/src/math/special.hh b/src/math/special.hh
new file mode 100644
index 0000000..2080d12
--- /dev/null
+++ b/src/math/special.hh
@@ -0,0 +1,40 @@
+// This file is part of monofonIC (MUSIC2)
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2020 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
+#pragma once
+
+#include
+
+inline double Meyer_scaling_function( double k, double kmax )
+{
+ constexpr double twopithirds{2.0*M_PI/3.0};
+ constexpr double fourpithirds{4.0*M_PI/3.0};
+ auto nu = []( double x ){ return x<0.0?0.0:(x<1.0?x:1.0); };
+
+ k = std::abs(k)/kmax * 2 * M_PI;
+
+ if( k < twopithirds ) return 1.0;
+ else if( k< fourpithirds ){
+ return std::cos( 0.5*M_PI * nu(3*k/(2*M_PI)-1.0) );
+ }
+ return 0.0;
+}
+
+inline double Shannon_scaling_function( double k, double kmax )
+{
+ if( std::abs(k) < kmax ) return 1.0;
+ return 0.0;
+}
\ No newline at end of file
diff --git a/src/mesh.hh b/src/mesh.hh
index 7518a0f..72c3adf 100644
--- a/src/mesh.hh
+++ b/src/mesh.hh
@@ -1,12 +1,19 @@
-/*
-
- mesh.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
diff --git a/src/mg_interp.hh b/src/mg_interp.hh
index 7a601da..8bacff3 100644
--- a/src/mg_interp.hh
+++ b/src/mg_interp.hh
@@ -1,11 +1,19 @@
-/*
- * mg_interp.hh
- * FROLIC_mg
- *
- * Created by Oliver Hahn on 5/27/10.
- * Copyright 2010 KIPAC/Stanford University. All rights reserved.
- *
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __MG_INTERP_HH
#define __MG_INTERP_HH
diff --git a/src/mg_operators.hh b/src/mg_operators.hh
index c966b88..b2dee57 100644
--- a/src/mg_operators.hh
+++ b/src/mg_operators.hh
@@ -1,12 +1,19 @@
-/*
-
- mg_operators.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __MG_OPERATORS_HH
#define __MG_OPERATORS_HH
diff --git a/src/mg_solver.hh b/src/mg_solver.hh
index 89e4083..ea72922 100644
--- a/src/mg_solver.hh
+++ b/src/mg_solver.hh
@@ -1,12 +1,19 @@
-/*
-
- mg_solver.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
diff --git a/src/output.cc b/src/output.cc
index e10dea1..9e70dad 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -1,12 +1,19 @@
-/*
-
- output.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include "output.hh"
diff --git a/src/output.hh b/src/output.hh
index 027a3ce..1a04b9f 100644
--- a/src/output.hh
+++ b/src/output.hh
@@ -1,12 +1,19 @@
-/*
-
- output.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __OUTPUT_HH
#define __OUTPUT_HH
diff --git a/src/perturbation_theory.cc b/src/perturbation_theory.cc
index bbd4918..2f7b98b 100644
--- a/src/perturbation_theory.cc
+++ b/src/perturbation_theory.cc
@@ -1,12 +1,19 @@
-/*
-
- cosmology.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include
#include
diff --git a/src/perturbation_theory.hh b/src/perturbation_theory.hh
index 7a688ed..4fcf95b 100644
--- a/src/perturbation_theory.hh
+++ b/src/perturbation_theory.hh
@@ -1,12 +1,19 @@
-/*
-
- cosmology.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
diff --git a/src/physical_constants.hh b/src/physical_constants.hh
index ceec634..c212d0a 100644
--- a/src/physical_constants.hh
+++ b/src/physical_constants.hh
@@ -1,6 +1,6 @@
-// This file is part of monofonIC (MUSIC2)
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
-// Copyright (C) 2020 by Oliver Hahn
+// Copyright (C) 2010-2024 by Oliver Hahn
//
// monofonIC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/random_music.cc b/src/plugins/random_music.cc
index af35b3e..6eeb798 100644
--- a/src/plugins/random_music.cc
+++ b/src/plugins/random_music.cc
@@ -145,6 +145,7 @@ void RNG_music::parse_random_parameters(void)
void RNG_music::compute_random_numbers(void)
{
bool rndsign = pcf_->get_value_safe("random", "grafic_sign", false);
+ bool bUseNGenIC = pcf_->get_value_safe("random","coarse_ngenic",false);
std::vector randc(std::max(levelmax_, levelmin_seed_) + 1, (rng *)NULL);
@@ -156,7 +157,8 @@ void RNG_music::compute_random_numbers(void)
if (rngfnames_[levelmin_seed_].size() > 0)
randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign);
else
- randc[levelmin_seed_] = new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_]);
+ randc[levelmin_seed_] = new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_],
+ bUseNGenIC, true);
for (int i = levelmin_seed_ + 1; i <= levelmin_; ++i)
{
@@ -178,7 +180,7 @@ void RNG_music::compute_random_numbers(void)
randc[levelmin_seed_] = new rng(1 << levelmin_seed_, rngfnames_[levelmin_seed_], rndsign);
else
randc[levelmin_seed_] =
- new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_]); //, x0, lx );
+ new rng(1 << levelmin_seed_, ran_cube_size_, rngseeds_[levelmin_seed_], bUseNGenIC, true); //, x0, lx );
for (int ilevel = levelmin_seed_ - 1; ilevel >= (int)levelmin_; --ilevel)
{
@@ -205,7 +207,7 @@ void RNG_music::compute_random_numbers(void)
if (rngfnames_[levelmin_].size() > 0)
randc[levelmin_] = new rng(1 << levelmin_, rngfnames_[levelmin_], rndsign);
else
- randc[levelmin_] = new rng(1 << levelmin_, ran_cube_size_, rngseeds_[levelmin_]);
+ randc[levelmin_] = new rng(1 << levelmin_, ran_cube_size_, rngseeds_[levelmin_], bUseNGenIC, true);
}
store_rnd(levelmin_, randc[levelmin_]);
diff --git a/src/plugins/random_music_wnoise_generator.cc b/src/plugins/random_music_wnoise_generator.cc
index 6d7f405..ae75110 100644
--- a/src/plugins/random_music_wnoise_generator.cc
+++ b/src/plugins/random_music_wnoise_generator.cc
@@ -4,15 +4,24 @@
#include
#include
+#include "math/special.hh"
+
#include "random.hh"
#include "random_music_wnoise_generator.hh"
template
-void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator &R)
-{
- music::ulog.Print("Invoking the N-GenIC random number generator");
+void music_wnoise_generator:: gen_topgrid_NGenIC(size_t res, long baseseed) {
+ music::ulog.Print(
+ "Generating large-scale random numbers using N-GenIC RNG with seed %ld",
+ baseseed);
+ rnums_.push_back(new Meshvar(res, 0, 0, 0));
+ cubemap_[0] = 0; // create dummy map index
+ register_cube(0, 0, 0);
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // execute N-GenIC rando number generator
unsigned *seedtable = new unsigned[res * res];
gsl_rng *random_generator = gsl_rng_alloc(gsl_rng_ranlxd1);
@@ -39,91 +48,87 @@ void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator
for (j = 0; j < i + 1; j++)
seedtable[(res - 1 - j) * res + (res - 1 - i)] = 0x7fffffff * gsl_rng_uniform(random_generator);
}
+ gsl_rng_free( random_generator );
real_t *rnoise = new real_t[res * res * (res + 2)];
complex_t *knoise = reinterpret_cast(rnoise);
- double fnorm = 1. / sqrt(res * res * res);
+ double fnorm = pow((double)res, -1.5);
-// #warning need to check for race conditions below
- //#pragma omp parallel for
- for (size_t i = 0; i < res; i++)
- {
- int ii = (int)res - (int)i;
- if (ii == (int)res)
- ii = 0;
+ // launch threads with indendent RNGs
+ #pragma omp parallel
+ {
+ gsl_rng *thread_rng = gsl_rng_alloc(gsl_rng_ranlxd1);
- for (size_t j = 0; j < res; j++)
- {
- gsl_rng_set(random_generator, seedtable[i * res + j]);
+ #pragma omp for
+ for (size_t i = 0; i < res; i++) {
+ int ii = (int)res - (int)i;
+ if (ii == (int)res)
+ ii = 0;
- for (size_t k = 0; k < res / 2; k++)
- {
- double phase = gsl_rng_uniform(random_generator) * 2 * M_PI;
- double ampl;
- do
- ampl = gsl_rng_uniform(random_generator);
- while (ampl == 0);
+ for (size_t j = 0; j < res; j++) {
+ gsl_rng_set(thread_rng, seedtable[i * res + j]);
+ for (size_t k = 0; k < res / 2; k++) {
+ double phase = gsl_rng_uniform(thread_rng) * 2 * M_PI;
+ double ampl;
+ do {
+ ampl = gsl_rng_uniform(thread_rng);
+ } while (ampl == 0);
- if (i == res / 2 || j == res / 2 || k == res / 2)
- continue;
- if (i == 0 && j == 0 && k == 0)
- continue;
+ if (i == res / 2 || j == res / 2 || k == res / 2)
+ continue;
+ if (i == 0 && j == 0 && k == 0)
+ continue;
- T rp = -sqrt(-log(ampl)) * cos(phase) * fnorm;
- T ip = -sqrt(-log(ampl)) * sin(phase) * fnorm;
+ T rp = -sqrt(-log(ampl)) * cos(phase) * fnorm;
+ T ip = -sqrt(-log(ampl)) * sin(phase) * fnorm;
- if (k > 0)
- {
- RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
- IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
- }
- else /* k=0 plane needs special treatment */
- {
- if (i == 0)
- {
- if (j >= res / 2)
- continue;
- else
- {
- int jj = (int)res - (int)j; /* note: j!=0 surely holds at this point */
+ if (k > 0) {
+ RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
+ IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
+ } else /* k=0 plane needs special treatment */
+ {
+ if (i == 0) {
+ if (j >= res / 2) {
+ continue;
+ } else {
+ int jj =
+ (int)res - (int)j; /* note: j!=0 surely holds at this point */
- RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
- IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
+ RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
+ IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
- RE(knoise[(i * res + jj) * (res / 2 + 1) + k]) = rp;
- IM(knoise[(i * res + jj) * (res / 2 + 1) + k]) = -ip;
- }
- }
- else
- {
- if (i >= res / 2)
- continue;
- else
- {
- int ii = (int)res - (int)i;
- if (ii == (int)res)
- ii = 0;
- int jj = (int)res - (int)j;
- if (jj == (int)res)
- jj = 0;
+ RE(knoise[(i * res + jj) * (res / 2 + 1) + k]) = rp;
+ IM(knoise[(i * res + jj) * (res / 2 + 1) + k]) = -ip;
+ }
+ } else {
+ if (i >= res / 2) {
+ continue;
+ } else {
+ int ii = (int)res - (int)i;
+ if (ii == (int)res)
+ ii = 0;
+ int jj = (int)res - (int)j;
+ if (jj == (int)res)
+ jj = 0;
- RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
- IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
+ RE(knoise[(i * res + j) * (res / 2 + 1) + k]) = rp;
+ IM(knoise[(i * res + j) * (res / 2 + 1) + k]) = ip;
- if (ii >= 0 && ii < (int)res)
- {
- RE(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = rp;
- IM(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = -ip;
- }
- }
- }
- }
- }
- }
- }
+ if (ii >= 0 && ii < (int)res) {
+ RE(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = rp;
+ IM(knoise[(ii * res + jj) * (res / 2 + 1) + k]) = -ip;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ gsl_rng_free( thread_rng );
+ }
- delete[] seedtable;
+ delete[] seedtable;
//... perform FT to real space
fftw_plan_t plan = FFTW_API(plan_dft_c2r_3d)(res, res, res, knoise, rnoise, FFTW_ESTIMATE);
@@ -131,12 +136,11 @@ void rapid_proto_ngenic_rng(size_t res, long baseseed, music_wnoise_generator
FFTW_API(destroy_plan)(plan);
// copy to array that holds the random numbers
-
#pragma omp parallel for
for (int i = 0; i < (int)res; ++i)
for (size_t j = 0; j < res; ++j)
for (size_t k = 0; k < res; ++k)
- R(i, j, k) = rnoise[((size_t)i * res + j) * res + k];
+ (*this)(i, j, k) = -rnoise[((size_t)i * res + j) * (res + 2) + k];
delete[] rnoise;
}
@@ -152,7 +156,8 @@ music_wnoise_generator::music_wnoise_generator(unsigned res, unsigned cubesiz
}
template
-music_wnoise_generator::music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool zeromean)
+music_wnoise_generator::music_wnoise_generator( unsigned res, unsigned cubesize, long baseseed,
+ bool bUseNGenIC, bool zeromean )
: res_(res), cubesize_(cubesize), ncubes_(1), baseseed_(baseseed)
{
music::ilog.Print("Generating random numbers (2) with seed %ld", baseseed);
@@ -160,23 +165,20 @@ music_wnoise_generator::music_wnoise_generator(unsigned res, unsigned cubesiz
double mean = 0.0;
size_t res_l = res;
- bool musicnoise = true;
- if (!musicnoise)
- cubesize_ = res_;
-
- if (!musicnoise)
- music::elog.Print("This currently breaks compatibility. Need to disable by hand! Make sure to not check into repo");
+ if( bUseNGenIC ){
+ cubesize_ = res;
+ ncubes_ = 1;
+ }
initialize();
- if (musicnoise)
+ if( !bUseNGenIC ){
mean = fill_all();
- else
- {
- rnums_.push_back(new Meshvar(res, 0, 0, 0));
- cubemap_[0] = 0; // create dummy map index
- register_cube(0, 0, 0);
- rapid_proto_ngenic_rng( res_, baseseed_, *this );
+ }else{
+ music::ilog.Print("Using N-GenIC generator for top grid...");
+ mean = 0.0;
+ gen_topgrid_NGenIC( res_, baseseed_ );
+ zeromean = false;
}
if (zeromean)
@@ -603,9 +605,6 @@ music_wnoise_generator::music_wnoise_generator(music_wnoise_generator &rc,
{
int ii(i), jj(j), kk(k);
- // if( i==(int)nxc/2 ) continue;
- // if( j==(int)nyc/2 ) continue;
-
if (i > (int)nxc / 2)
ii += (int)nx / 2;
if (j > (int)nyc / 2)
@@ -627,18 +626,21 @@ music_wnoise_generator::music_wnoise_generator(music_wnoise_generator &rc,
val *= val_phas * sqrt8;
- // if (x0_ == NULL || lx_ == NULL){
- if (i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2)
- {
- RE(cfine[qf]) = val.real();
- IM(cfine[qf]) = val.imag();
- }
- else
- {
- RE(cfine[qf]) = val.real();
- IM(cfine[qf]) = 0.0;
- }
- // }
+ if(i != (int)nxc / 2 && j != (int)nyc / 2 && k != (int)nzc / 2){
+ double blend_coarse_x = Meyer_scaling_function(kx, nxc / 2);
+ double blend_coarse_y = Meyer_scaling_function(ky, nyc / 2);
+ double blend_coarse_z = Meyer_scaling_function(kz, nzc / 2);
+
+ // double blend_coarse_x = Shannon_scaling_function(kx, nxc / 2);
+ // double blend_coarse_y = Shannon_scaling_function(ky, nyc / 2);
+ // double blend_coarse_z = Shannon_scaling_function(kz, nzc / 2);
+
+ double blend_coarse = blend_coarse_x*blend_coarse_y*blend_coarse_z;
+ double blend_fine = std::sqrt(1.0-blend_coarse*blend_coarse);
+
+ RE(cfine[qf]) = blend_fine * RE(cfine[qf]) + blend_coarse * val.real();
+ IM(cfine[qf]) = blend_fine * IM(cfine[qf]) + blend_coarse * val.imag();
+ }
}
delete[] rcoarse;
diff --git a/src/plugins/random_music_wnoise_generator.hh b/src/plugins/random_music_wnoise_generator.hh
index 97687b3..7fde3d0 100644
--- a/src/plugins/random_music_wnoise_generator.hh
+++ b/src/plugins/random_music_wnoise_generator.hh
@@ -39,6 +39,9 @@ protected:
//! subtract a constant from an entire cube
void subtract_from_cube(int i, int j, int k, double val);
+ //! usees the N-GenIC random number generator to set up the top grid
+ void gen_topgrid_NGenIC( size_t res, long baseseed );
+
//! copy random numbers from a cube to a full grid array
template
void copy_cube(int i, int j, int k, C &dat)
@@ -127,7 +130,7 @@ public:
music_wnoise_generator(music_wnoise_generator &rc, unsigned cubesize, long baseseed, int *x0_ = NULL, int *lx_ = NULL, bool zeromean = true);
//! constructor
- music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool zeromean = true);
+ music_wnoise_generator(unsigned res, unsigned cubesize, long baseseed, bool bUseNGenIC, bool zeromean = true );
//! constructor to read white noise from file
music_wnoise_generator(unsigned res, std::string randfname, bool rndsign);
diff --git a/src/poisson.cc b/src/poisson.cc
index 38bb59e..ecee6df 100644
--- a/src/poisson.cc
+++ b/src/poisson.cc
@@ -1,12 +1,19 @@
-/*
-
- poisson.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
/****** ABSTRACT FACTORY PATTERN IMPLEMENTATION *******/
diff --git a/src/poisson.hh b/src/poisson.hh
index e1383bc..7e593fa 100644
--- a/src/poisson.hh
+++ b/src/poisson.hh
@@ -1,12 +1,19 @@
-/*
-
- poisson.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __POISSON_HH
#define __POISSON_HH
diff --git a/src/random.cc b/src/random.cc
index 2ecb486..725c840 100644
--- a/src/random.cc
+++ b/src/random.cc
@@ -1,11 +1,19 @@
-/*
-
- random.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions for cosmological simulations
-
- Copyright (C) 2010-23 Oliver Hahn
-
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include "random.hh"
diff --git a/src/random.hh b/src/random.hh
index 9f5df91..8bf7963 100644
--- a/src/random.hh
+++ b/src/random.hh
@@ -1,12 +1,19 @@
-/*
-
- random.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010-23 by Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
//... for testing purposes.............
// #define DEGRADE_RAND1
diff --git a/src/region_generator.cc b/src/region_generator.cc
index 196a6a6..d0c054f 100644
--- a/src/region_generator.cc
+++ b/src/region_generator.cc
@@ -1,3 +1,21 @@
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
+
+
#include
#include "region_generator.hh"
diff --git a/src/region_generator.hh b/src/region_generator.hh
index 9b46634..f7363fd 100644
--- a/src/region_generator.hh
+++ b/src/region_generator.hh
@@ -1,3 +1,20 @@
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
+
#ifndef __REGION_GENERATOR_HH
#define __REGION_GENERATOR_HH
diff --git a/src/schemes.hh b/src/schemes.hh
index 900118a..27d2700 100644
--- a/src/schemes.hh
+++ b/src/schemes.hh
@@ -1,11 +1,19 @@
-/*
- * schemes.hh
- * GravitySolver
- *
- * Created by Oliver Hahn on 2/1/10.
- * Copyright 2010 KIPAC/Stanford University. All rights reserved.
- *
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __SCHEME_HH
#define __SCHEME_HH
diff --git a/src/solver.hh b/src/solver.hh
index 51d506b..ec23f45 100644
--- a/src/solver.hh
+++ b/src/solver.hh
@@ -1,11 +1,19 @@
-/*
- * solver.h
- * GravitySolver
- *
- * Created by Oliver Hahn on 1/20/10.
- * Copyright 2010 KIPAC/Stanford University. All rights reserved.
- *
- */
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#pragma once
diff --git a/src/system_stat.hh b/src/system_stat.hh
index 1a30566..9df25cb 100644
--- a/src/system_stat.hh
+++ b/src/system_stat.hh
@@ -1,19 +1,20 @@
-// This file is part of MUSIC2
+// This file is part of MUSIC
// A software package to generate ICs for cosmological simulations
-// Copyright (C) 2020-23 by Oliver Hahn
+// Copyright (C) 2010-2024 by Oliver Hahn
//
-// MUSIC2 is free software: you can redistribute it and/or modify
+// monofonIC 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 3 of the License, or
// (at your option) any later version.
//
-// MUSIC2 is distributed in the hope that it will be useful,
+// monofonIC 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, see .
+
#pragma once
#ifdef __APPLE__
diff --git a/src/tests.hh b/src/tests.hh
index 565b533..5eee6aa 100644
--- a/src/tests.hh
+++ b/src/tests.hh
@@ -1,13 +1,19 @@
-/*
-
- tests.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
-
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#ifndef __TESTS_HH
#define __TESTS_HH
diff --git a/src/transfer_function.cc b/src/transfer_function.cc
index 84fd0a1..4d45504 100644
--- a/src/transfer_function.cc
+++ b/src/transfer_function.cc
@@ -1,12 +1,19 @@
-/*
-
- transfer_function.cc - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
#include "transfer_function.hh"
diff --git a/src/transfer_function.hh b/src/transfer_function.hh
index 0513557..2e4efaf 100644
--- a/src/transfer_function.hh
+++ b/src/transfer_function.hh
@@ -1,12 +1,20 @@
-/*
+// This file is part of MUSIC
+// A software package to generate ICs for cosmological simulations
+// Copyright (C) 2010-2024 by Oliver Hahn
+//
+// monofonIC 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 3 of the License, or
+// (at your option) any later version.
+//
+// monofonIC 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, see .
- transfer_function.hh - This file is part of MUSIC -
- a code to generate multi-scale initial conditions
- for cosmological simulations
-
- Copyright (C) 2010 Oliver Hahn
-
-*/
#pragma once
#include