### Configuring Output Times with New Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/changes.rst.txt This example demonstrates how to configure output intervals using the updated parameter system. It sets the starting redshift, a list of target redshifts, and specifies one step for each interval. ```python dRedFrom = 49 # Start at z=49 dRedTo = [10,2,1,0.5,0] # Step to z=10, 2, 1, 0.5 and 0 nSteps = [1] * len(dRedTo) # Taking one step for each interval iOutInterval = 1 # Output every interval ``` -------------------------------- ### Specifying Steps for Redshift Intervals Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/changes.rst.txt This example shows the new method for specifying simulation steps across different redshift intervals. It defines the starting redshift and a list of target redshifts, with corresponding steps for each interval. ```python dRedFrom = 40 dRedTo = [10,0] nSteps = [60,100] ``` -------------------------------- ### Configure Output Times using Redshift in pkdgrav3 Source: https://pkdgrav3.readthedocs.io/en/latest/changes.html Set output times based on redshift. This example demonstrates specifying a start redshift, a list of target redshifts, and the number of steps for each interval. ```python dRedFrom = 49 # Start at z=49 dRedTo = [10,2,1,0.5,0] # Step to z=10, 2, 1, 0.5 and 0 nSteps = [1] * len(dRedTo) # Taking one step for each interval iOutInterval = 1 # Output every interval ``` -------------------------------- ### Build and Install pkdgrav3 Manually Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Commands to set up a virtual environment, build the project using CMake, and install the executable. ```bash cd $HOME/project/project1 python -m venv .venv source .venv/bin/activate python -m pip install -r $HOME/sources/pkdgrav3/requirements.txt cmake -S $HOME/sources/pkdgrav3 -B build cmake --build build cmake --install build --prefix $HOME/project/project1 ``` ```bash $HOME/project/project1/bin/pkdgrav3 ``` -------------------------------- ### Install dependencies on Ubuntu Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Install necessary build tools and libraries for PKDGRAV3 on Ubuntu 20.04 and 22.04. ```bash sudo apt update sudo apt install -y autoconf automake pkg-config cmake gcc g++ make gfortran git sudo apt install -y libfftw3-dev libfftw3-mpi-dev libgsl0-dev libboost-all-dev libhdf5-dev libmemkind-dev libhwloc-dev sudo apt install -y python3-dev cython3 python3-pip python3-numpy python3-ddt python3-nose python3-tomli ``` -------------------------------- ### Verify Homebrew Package Installation Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Checks the installation path and version of Python, FFTW, and Boost installed via Homebrew. ```bash brew --prefix python@3.12 fftw boost ``` -------------------------------- ### Install Python Dependencies Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Install all necessary Python packages for compiling, running, and testing pkdgrav3 using pip and the provided requirements.txt file. ```bash python -m pip install -r requirements.txt ``` -------------------------------- ### Locate Installed Executable Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Path to the pkdgrav3 binary after installation. ```bash $HOME/project/project1/bin/pkdgrav3 ``` -------------------------------- ### Project-Specific Build Workflow Source: https://pkdgrav3.readthedocs.io/en/latest/install.html A complete sequence for setting up a project-specific environment, building, and installing the pkdgrav3 executable. ```bash cd $HOME/project/project1 python -m venv .venv source .venv/bin/activate python -m pip install -r $HOME/sources/pkdgrav3/requirements.txt cmake -S $HOME/sources/pkdgrav3 -B build cmake --build build cmake --install build --prefix $HOME/project/project1 ``` -------------------------------- ### Install xmlrunner on Ubuntu Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Install the xmlrunner package required for running the test suite. ```bash sudo apt install -y python3-xmlrunner ``` ```bash pip3 install xmlrunner ``` -------------------------------- ### Configure Parallel Tipsy Output Path Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Example format string for achIoPath to enable parallel writing to separate files. ```text {name}.{step:05d}{type}.{i} ``` -------------------------------- ### Ubuntu Dependency Installation Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Commands to install required system packages and test suite dependencies on Ubuntu. ```bash sudo apt update sudo apt install -y autoconf automake pkg-config cmake gcc g++ make gfortran git sudo apt install -y libfftw3-dev libfftw3-mpi-dev libgsl0-dev libboost-all-dev libhdf5-dev libmemkind-dev libhwloc-dev sudo apt install -y python3-dev cython3 python3-pip python3-numpy python3-ddt python3-nose python3-tomli ``` ```bash sudo apt install -y python3-xmlrunner ``` ```bash pip3 install xmlrunner ``` -------------------------------- ### Install Homebrew Packages for pkdgrav3 Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Installs essential development packages using Homebrew on MacOS. Ensure Xcode is installed and launched at least once. ```bash brew install cmake boost fftw git gsl open-mpi hdf5-mpi python pyenv pyenv-virtualenv ``` -------------------------------- ### Verify Homebrew package paths Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Check the installation prefix for specific Homebrew packages. ```bash brew --prefix python@3.12 fftw boost ``` -------------------------------- ### Execute pkdgrav3 via uenv Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Commands to start the pkdgrav3 view or configure Slurm for batch execution. ```bash uenv start --view=pkdgrav3 pkdgrav3 pkdgrav3 cosmology.par ``` ```bash #SBATCH --uenv=pkdgrav3 --view=pkdgrav3 ``` -------------------------------- ### Manage Python Virtual Environment Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Commands to create, activate, and install required Python dependencies for the project. ```bash python -m venv /path/to/pkdgrav3/.venv ``` ```bash source /path/to/pkdgrav3/.venv/bin/activate ``` ```bash python -m pip install -r requirements.txt ``` -------------------------------- ### Install dependencies on MacOS via Homebrew Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Install required packages for PKDGRAV3 on MacOS using Homebrew. ```bash brew install cmake boost fftw git gsl open-mpi hdf5-mpi python pyenv pyenv-virtualenv ``` -------------------------------- ### Sample Unit Conversions for Planetary Simulations Source: https://pkdgrav3.readthedocs.io/en/latest/units.html Example output sets for dKpcUnit and dMsolUnit based on specific length, velocity, or mass unit inputs. ```text Length unit: 1 Earth radius, Velocity unit: 1 km/s dKpcUnit = 2.064688206889847e-13 dMsolUnit = 4.8006351375833994e-08 Length unit: 1 Astronomical unit, Velocity unit: 1 km/s dKpcUnit = 4.848101587970315e-09 dMsolUnit = 0.0011272388129170855 Length unit: 1 Astronomical unit, Mass unit: 1 Jupiter mass dKpcUnit = 4.848101587970315e-09 dMsolUnit = 0.0009548380607523638 ``` -------------------------------- ### Verify uenv2 on Piz Daint Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Check the installed version of uenv on the Daint system. ```bash [daint]$ uenv --version 8.1.0 ``` -------------------------------- ### Measure Power Spectrum Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Example workflow for loading a simulation file, decomposing the domain, building the tree, and measuring the power spectrum. ```python time = msr.load(name,nGridPk=nGridPk) msr.domain_decompose() msr.build_tree() (K,PK,N,*rest) = msr.measure_pk(nGridPk,L=L) with open(f'{name}.pk','w') as f: for k,pk,n in zip(K,PK,N): if n>0: f.write(f'{k} {pk} {n}\n') ``` -------------------------------- ### PKDGrav3 Cosmology Parameter File Configuration Source: https://pkdgrav3.readthedocs.io/en/latest/quickstart.html This is an example of the cosmology.par file used to configure PKDGrav3 simulations. It sets initial conditions, cosmological parameters, simulation behavior, and accuracy settings. ```python from accuracy import classic_theta_switch,classic_replicas_switch achOutName = "example" # Initial Condition dBoxSize = 2000 # Mpc/h nGrid = 128 # Simulation has nGrid^3 particles iLPT = 2 # LPT order for IC iSeed = 314159265 # Random seed dRedFrom = 49 # Starting redshift # Cosmology achTfFile = "euclid_z0_transfer_combined.dat" h = 0.67 dOmega0 = 0.32 dLambda = 0.68 dSigma8 = 0.83 dSpectral = 0.96 iStartStep = 0 nSteps = 100 dRedTo = 0.0 # Cosmological Simulation bComove = True # Use comoving coordinates bPeriodic = True # with a periodic box bEwald = True # enable Ewald periodic boundaries # Logging/Output iOutInterval = 10 #iCheckInterval = 10 bDoDensity = False bVDetails = True bOverwrite = True bParaRead = True # Read in parallel bParaWrite = False # Write in parallel (does not work on all file systems) #nParaRead = 8 # Limit number of simultaneous readers to this #nParaWrite = 8 # Limit number of simultaneous writers to this # Accuracy Parameters bEpsAccStep = True # Choose eps/a timestep criteria dTheta = classic_theta_switch() # 0.40, 0.55, 0.70 switch nReplicas = classic_replicas_switch() # 1 if theta > 0.52 otherwise 2 # Memory and performance bMemUnordered = True # iOrder replaced by potential and group id bNewKDK = True # No accelerations in the particle, dual tree possible ``` -------------------------------- ### Configure SLURM for pkdgrav3 Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/quickstart.rst.txt Example SLURM scripts for running pkdgrav3 on different node architectures. Ensure the MPI and thread counts match the hardware configuration. ```bash #!/bin/bash -l #SBATCH --nodes=10 #SBATCH --ntasks-per-node=1 --cpus-per-task=16 --ntasks-per-core=1 srun pkdgrav3 cosmology.par ``` ```bash #!/bin/bash -l #SBATCH --nodes=10 #SBATCH --ntasks-per-node=8 --cpus-per-task=16 --ntasks-per-core=1 srun pkdgrav3 cosmology.par ``` -------------------------------- ### Configure CMake for Dependencies Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Specify installation paths for optional libraries like FFTW and GSL when CMake fails to detect them automatically. ```bash cmake -DFFTW_ROOT=/path/to/fftw ``` ```bash cmake -DGSL_ROOT_DIR=/opt/gsl/2.5 ``` -------------------------------- ### uenv2 Version Verification Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Check the installed version of uenv on Eiger and Piz Daint systems. ```bash [eiger]$ uenv --version 8.1.0 ``` ```bash [daint]$ uenv --version 8.1.0 ``` -------------------------------- ### Check CMake Version Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Verify that CMake version 3.24 or newer is installed. This is a prerequisite for building pkdgrav3. ```bash pkdgrav3:~> cmake --version cmake version 3.26.0 ``` -------------------------------- ### Specify Redshift Intervals and Steps in pkdgrav3 Source: https://pkdgrav3.readthedocs.io/en/latest/changes.html Define simulation steps and redshift intervals. This example shows the new method for specifying synchronized steps and redshifts, replacing older parameters. ```python dRedFrom = 49 dRedTo = 0 nSteps = 160 nStepsSync = 60 dRedSync = 10 ``` ```python dRedFrom = 40 dRedTo = [10,0] nSteps = [60,100] ``` -------------------------------- ### Configure Spack for Homebrew packages Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Instruct Spack to use existing Homebrew installations for dependencies. ```bash spack external find --not-buildable cmake git gmake gsl hdf5 openmpi apple-clang gcc ``` -------------------------------- ### Units Calculator Sample Set 2 Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/units.rst.txt Example configuration for the units calculator tool, setting length unit to 1 Astronomical unit and velocity unit to 1 km/s. Provides the resulting dKpcUnit and dMsolUnit values. ```text Length unit: 1 Astronomical unit, Velocity unit: 1 km/s dKpcUnit = 4.848101587970315e-09 dMsolUnit = 0.0011272388129170855 ``` -------------------------------- ### Units Calculator Sample Set 3 Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/units.rst.txt Example configuration for the units calculator tool, setting length unit to 1 Astronomical unit and mass unit to 1 Jupiter mass. Provides the resulting dKpcUnit and dMsolUnit values. ```text Length unit: 1 Astronomical unit, Mass unit: 1 Jupiter mass dKpcUnit = 4.848101587970315e-09 dMsolUnit = 0.0009548380607523638 ``` -------------------------------- ### Units Calculator Sample Set 1 Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/units.rst.txt Example configuration for the units calculator tool, setting length unit to 1 Earth radius and velocity unit to 1 km/s. Provides the resulting dKpcUnit and dMsolUnit values. ```text Length unit: 1 Earth radius, Velocity unit: 1 km/s dKpcUnit = 2.064688206889847e-13 dMsolUnit = 4.8006351375833994e-08 ``` -------------------------------- ### I/O Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Configuration options for handling input and output files in PKDGrav3. ```APIDOC ## I/O Parameters ### Description Configuration options for handling input and output files in PKDGrav3. ### Parameters #### Input Parameters - **achInFile** (string) - Optional - Input file name. Defaults to 'none'. - **bInFileLC** (boolean) - Optional - Enable input light cone data. Defaults to False. #### Output Parameters - **achOutName** (string) - Optional - Base name for output files. Defaults to 'pkdgrav3'. - **achOutPath** (string) - Optional - Full path and name for output files, must include `{name}`, `{step}`, and `{type}`. Defaults to '{name}.{step:05d}{type}'. - **achIoPath** (string) - Optional - Overrides path for Tipsy outputs. Behaves like `achOutPath` but can include `{i}` for parallel writing. Defaults to `achOutPath`. - **achCheckpointPath** (string) - Optional - Overrides path for checkpoint outputs. Behaves like `achOutPath`. Defaults to `achOutPath`. - **achDataSubPath** (string) - Optional - Sub-path for data. Defaults to 'none'. - **bHDF5** (boolean) - Optional - Output in HDF5 format. Defaults to False. - **bDoublePos** (boolean) - Optional - Input/output double precision positions (standard format only). Defaults to False. - **bDoubleVel** (boolean) - Optional - Input/output double precision velocities (standard format only). Defaults to False. - **bDoSoftOutput** (boolean) - Optional - Enable soft outputs. Defaults to False. - **bDoDensity** (boolean) - Optional - Enable density outputs. Defaults to False. - **bDoAccOutput** (boolean) - Optional - Enable acceleration outputs. Defaults to False. - **bDoPotOutput** (boolean) - Optional - Enable potential outputs. Defaults to False. - **bDoRungOutput** (boolean) - Optional - Enable rung outputs. Defaults to False. - **bDoRungDestOutput** (boolean) - Optional - Enable rung destination outputs. Defaults to False. - **bStandard** (boolean) - Optional - Output in standard TIPSY binary format. Defaults to True. - **iCompress** (integer) - Optional - Compression format: 0=none, 1=gzip, 2=bzip2. Defaults to 0. #### Parallel Processing Parameters - **bParaRead** (boolean) - Optional - Enable parallel reading of files. Defaults to True. - **bParaWrite** (boolean) - Optional - Disable parallel writing of files. Defaults to False. - **nParaRead** (integer) - Optional - Number of threads for parallel read (0=unlimited). Defaults to 0. - **nParaWrite** (integer) - Optional - Number of threads for parallel write (0=unlimited). Defaults to 0. #### Interval Parameters - **iOutInterval** (integer) - Optional - Number of timesteps between snapshots. Defaults to 0. - **iCheckInterval** (integer) - Optional - Number of timesteps between checkpoints. Defaults to 0. - **iLogInterval** (integer) - Optional - Number of timesteps between logfile outputs. Defaults to 1. - **iPkInterval** (integer) - Optional - Number of timesteps between pk outputs. Defaults to 1. - **iDeltakInterval** (integer) - Optional - Number of timesteps between DeltaK outputs. Defaults to 0. #### Runtime Parameters - **iWallRunTime** (integer) - Optional - Maximum Wallclock time in minutes to run. Defaults to 0. - **iSignalSeconds** (integer) - Optional - Time in seconds before USR1 signal is sent for termination. Defaults to 0. #### Other Parameters - **lstOrbits** (list) - Optional - List of particle IDs to write to orbit file. Defaults to 'none'. ``` -------------------------------- ### Manage pkdgrav3 with Spack Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Commands for cloning Spack, adding the repository, and building within a local environment. ```bash git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git source spack/share/spack/setup-env.sh ``` ```bash spack repo add spack_repo ==> Added repo with namespace 'pkdgrav3'. ``` ```bash spack spec pkdgrav3 ``` ```bash cd /path/to/pkdgrav3 spack env activate . spack install pkdgrav3 ``` -------------------------------- ### Running and Developing with uenv Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Commands to execute pkdgrav3 via uenv or load development modules. ```bash uenv start --view=pkdgrav3 pkdgrav3 pkdgrav3 cosmology.par ``` ```bash #SBATCH --uenv=pkdgrav3 --view=pkdgrav3 ``` ```bash [daint]$ uenv start --view=modules pkdgrav3 [daint]$ module load boost cmake cray-mpich fftw gcc gsl hdf5 pkdgrav3-python ``` -------------------------------- ### Specify GSL Installation Path Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt If CMake cannot find GSL, provide the installation directory using the GSL_ROOT_DIR variable. Ensure gsl-config is in your PATH. ```bash cmake -DGSL_ROOT_DIR=/opt/gsl/2.5 ``` -------------------------------- ### Specify FFTW Installation Path Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt If CMake does not automatically detect FFTW, specify its root directory using the FFTW_ROOT variable. ```bash cmake -DFFTW_ROOT=/path/to/fftw ``` -------------------------------- ### Create Python Virtual Environment Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Create a dedicated Python virtual environment for pkdgrav3 to manage dependencies. ```bash python -m venv /path/to/pkdgrav3/.venv ``` -------------------------------- ### Configure and Build pkdgrav3 with CMake Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Use CMake to configure the build environment and then build the pkdgrav3 code. This process detects dependencies and compiles the project. ```bash cd /path/to/pkdgrav3 cmake -S . -B build cmake --build build ``` -------------------------------- ### Develop pkdgrav3 with uenv Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Use the modules view to access development tools within a user environment. ```bash [daint]$ uenv start --view=modules pkdgrav3 ``` -------------------------------- ### Add Custom Analysis Hook Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/analysis.rst.txt Example of adding a custom analysis hook using PKDGRAV.add_analysis. This class outputs a density grid at each simulation step. ```python from PKDGRAV import add_analysis, ASSIGNMENT_ORDER class MassGrid: grid = 0 order = ASSIGNMENT_ORDER.PCS def __init__(self,grid,order=ASSIGNMENT_ORDER.PCS): self.grid = grid self.order = order def __call__(self,msr,step,time,**kwargs): print('calculating density grid') msr.grid_create(self.grid) msr.assign_mass(order=self.order) msr.grid_write('output.{:05d}'.format(step)) msr.grid_delete() def ephemeral(self,msr,**kwargs): return msr.grid_ephemeral(self.grid) # To enable it, use: # add_analysis(MassGrid(nGrid)) ``` -------------------------------- ### Load PKDGRAV3 modules on Daint Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Load the required environment modules for compiling and running PKDGRAV3 on the Daint system. ```bash [daint]$ module load boost cmake cray-mpich fftw gcc gsl hdf5 pkdgrav3-python ``` -------------------------------- ### Override Restore Parameters in pkdgrav3 Source: https://pkdgrav3.readthedocs.io/en/latest/changes.html Modify the `msr.restore` call to override parameters. This example shows how to enable parallel reading and set the number of readers. ```python msr.restore(__file__) ``` ```python msr.restore(__file__,bParaRead=True,nParaRead=100) ``` -------------------------------- ### Derive Mass Unit (kpc & km/s) Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/units.rst.txt Calculates the mass unit when length is in kpc and velocity is in km/s, with G=1. This is a common setup for cosmological simulations. ```math G = 4.30091727063\times 10^{-9}~ ext{Mpc}~M_⊙^{-1}(\text{km}/\text{s})^2 = 4.30091727063\times 10^{-6}~ ext{kpc}~M_⊙^{-1}(\text{km}/\text{s})^2 ``` ```math M_{unit} = \frac{1}{4.30091727063\times 10^{-6}} = 2.32508541103\times 10^5~M_⊙ ``` -------------------------------- ### Initial Conditions Generation Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Configure the Initial Condition (IC) generator, supporting various perturbation theory orders and gas properties. ```APIDOC ## Initial Conditions Generation ### Description Configure the Initial Condition (IC) generator, which supports first order (Zeldovich), second order, and third order Lagrangian perturbation theory. Ensure cosmological parameters are properly set. ### Parameters #### Path Parameters - **dRedFrom** (float) - Optional - Specifies initial redshift for the simulation. - **nGrid** (integer) - Optional - Sets the grid size and hence the number of particles in the IC. For a grid size of N there will be N^3 particles. - **iSeed** (integer) - Optional - Random seed for IC generation. Default is 0. - **iLPT** (integer) - Optional - LPT order for IC generation. Default is 2. - **dInitialT** (float) - Optional - Initial temperature of the gas for generated ICs. Default is 100.0. #### Query Parameters - **bWriteIC** (Boolean) - Optional - Write IC after generating. Default is False. - **bFixedAmpIC** (Boolean) - Optional - Use fixed amplitude of 1 for ICs. Default is False. - **dFixedAmpPhasePI** (float) - Optional - Phase shift for fixed amplitude in units of PI. Default is 0.0. - **bICgas** (Boolean) - Optional - Enable/disable gas in the ICs. Default is False. ``` -------------------------------- ### Overriding Parameters During Restore Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/changes.rst.txt To override parameters during a restore call, add them as arguments. This example shows how to enable parallel reading and set the number of readers to 100. ```python msr.restore(__file__,bParaRead=True,nParaRead=100) ``` -------------------------------- ### Run pkdgrav3 with Checkpoint File Source: https://pkdgrav3.readthedocs.io/en/latest/changes.html Use this command to restart a simulation using a checkpoint file. The '.chk' file is the primary input. ```bash srun pkdgrav3 checkpoint.00010.chk ``` -------------------------------- ### SimpleCosmology Class Initialization Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Initializes the SimpleCosmology object with various density parameters and cosmological constants. ```APIDOC ## POST /cosmology/SimpleCosmology ### Description Initializes a new instance of the SimpleCosmology class with specified density parameters and physical constants. ### Method POST ### Parameters #### Request Body - **omega_matter** (number) - Required - Matter density Ωm - **omega_lambda** (number) - Optional - Dark energy density ΩΛ - **omega_baryon** (number) - Optional - Baryon density Ωb - **omega_radiation** (number) - Optional - Radiation density Ωγ - **omega_dark_energy** (number) - Optional - Dark energy density ΩDE - **w0** (number) - Optional - Dark energy equation of state parameter w0 - **wa** (number) - Optional - Dark energy equation of state parameter wa - **running** (number) - Optional - Running of the spectral index dns/dln k - **pivot** (number) - Optional - Pivot scale for the power spectrum kp - **comoving** (bool) - Optional - Whether to use comoving or physical units - **sigma8** (number) - Optional - Sigma8 σ8 - **As** (number) - Optional - Amplitude of the power spectrum As - **ns** (number) - Optional - Spectral index ns - **h** (number) - Optional - Hubble parameter h - **k** (number) - Optional - Array of wavenumbers k - **Tk** (number) - Optional - Array of transfer functions T(k) - **transfer_file** (str) - Optional - File name of the transfer function - **usecols** (tuple) - Optional - Columns to use in the transfer function file ``` -------------------------------- ### PKDGRAV.grid_create Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Creates a grid structure for mass assignment. ```APIDOC ## PKDGRAV.grid_create ### Description Create a grid for the mass assignment. ### Method PKDGRAV.grid_create ### Parameters #### Path Parameters - **grid** (integer) - The grid configuration or size. ### Request Example ```python PKDGRAV.grid_create(grid=128) ``` ### Response This method does not return a value. ``` -------------------------------- ### Spack Package Manager Commands Source: https://pkdgrav3.readthedocs.io/en/latest/install.html Commands for cloning Spack, adding the pkdgrav3 repository, and managing local development environments. ```bash git clone -c feature.manyFiles=true –depth=2 https://github.com/spack/spack.git source spack/share/spack/setup-env.sh ``` ```bash spack repo add spack_repo ``` ```bash spack spec pkdgrav3 ``` ```bash cd /path/to/pkdgrav3 spack env activate . spack install pkdgrav3 ``` -------------------------------- ### Configure dynamic accuracy parameters Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/extensions.rst.txt Use these functions to set dTheta and nReplicas for cosmological simulations. ```python from accuracy import classic_theta_switch,classic_replicas_switch dTheta = classic_theta_switch() nReplicas = classic_replicas_switch() ``` -------------------------------- ### Stellar Initial-Mass Function (IMF) Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Configure the stellar initial-mass function, including type and mass limits. ```APIDOC ## Stellar Initial-Mass Function (IMF) ### Parameters - **achIMFType** (string) - Optional - Type of IMF. Default: "chabrier" - **dIMFMinMass** (float) - Optional - Lower-mass limit of the IMF in Msol. Default: 0.1 - **dIMFMaxMass** (float) - Optional - Upper-mass limit of the IMF in Msol. Default: 100.0 - **dCCSNMinMass** (float) - Optional - Minimum mass for a star to end its life as a Core Collapse Supernova in Msol. Default: 6.0 - **dCCSNMaxMass** (float) - Optional - Maximum mass for a star to end its life as a Core Collapse Supernova in Msol. Default: 100.0 ``` -------------------------------- ### Periodic Boundary Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Settings for enabling and configuring periodic boundary conditions. ```APIDOC ## Periodic Boundaries ### bPeriodic - **Default**: False (Boolean) - **Description**: Enables periodic boundary conditions. If gravity is enabled, Ewald correction should also be enabled. ### dPeriod - **Default**: [1.0, 1.0, 1.0] - **Description**: The length of the periodic box in code units. Can be a single float for uniform dimensions or a list of three floats for x, y, and z dimensions. ``` -------------------------------- ### Import PKDGRAV for Analysis Mode Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Import the PKDGRAV module to enter analysis mode instead of simulation mode. This script is used to measure the power spectrum of a periodic simulation output. ```python # simulation mode is skipped when PKDGRAV imported import PKDGRAV as msr from sys import argv,exit # Name and grid size are required; box size is optional if len(argv)<=2: print(f"Usage: {argv[0]} [box-length]") exit(1) name=argv[1] nGridPk = int(argv[2]) L = 1 if len(argv)<4 else int(argv[3]) ``` -------------------------------- ### PKDGRAV.simulate Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Enters simulation mode directly. This is typically disabled when PKDGRAV is imported. ```APIDOC ## PKDGRAV.simulate ### Description Directly enter simulation mode. Normally simulation mode is disabled if PKDGRAV has been imported. Calling this function proceeds normally. ### Method APIDOC ### Endpoint PKDGRAV.simulate(**kwargs) ### Parameters #### Query Parameters - **kwargs** - Additional parameters to set for the simulation. ``` -------------------------------- ### Output and Logging Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/quickstart.rst.txt Parameters governing simulation output frequency, checkpointing, and logging behavior. ```APIDOC ## Output and Logging Parameters ### Parameters - **iOutInterval** (int) - Frequency of output writes in steps. - **iCheckInterval** (int) - Frequency of checkpoint writes in steps. - **bDoDensity** (bool) - Calculate and output SPH densities. Default: False. - **bVDetails** (bool) - Enable additional progress information. Default: True. - **bOverwrite** (bool) - Disable abnormal exit check. - **bParaRead** (bool) - Enable parallel file reading. Default: True. - **bParaWrite** (bool) - Enable parallel file writing. Default: False. - **nParaRead** (int) - Limit number of simultaneous readers. - **nParaWrite** (int) - Limit number of simultaneous writers. ``` -------------------------------- ### Gravity, Domains, Trees Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Parameters controlling gravitational softening, domain decomposition, and tree memory layout. ```APIDOC ## Gravity, Domains, Trees Parameters ### Description Parameters in this section are used to override the gravitational softening 𝜖, control the tree memory layout, as well as to control how often domain decomposition and tree building occur. ### Parameters - **dSoft** (float) - Default: 0.0 - Sets the gravitational softening length globally for all particles. - **dSoftMax** (float) - Default: 0.0 - Maximum comoving gravitational softening length (absolute or multiplier). - **bPhysicalSoft** (Boolean) - Default: False - Physical gravitational softening length. - **bSoftMaxMul** (Boolean) - Default: True - Use maximum comoving gravitational softening length as a multiplier. - **bDoGravity** (Boolean) - Default: True - If false, accelerations due to gravitational forces are not applied. - **nGridLin** (integer) - Default: 0 - Grid size for linear species (0=disabled). - **bDoLinPkOutput** (Boolean) - Default: False - Enable power spectrum output for linear species. - **dFracNoDomainDecomp** (float) - Default: 0.1 - Fraction of Active Particles for no domain decomposition. - **dFracNoDomainRootFind** (float) - Default: 0.1 - Fraction of Active Particles for no domain decomposition root finding. - **dFracNoDomainDimChoice** (float) - Default: 0.1 - Fraction of Active Particles for no domain decomposition dimension choice. - **iMaxRungDomainDecomp** (integer) - Default: 2147483648 - Rung above which no domain decomposition is performed. ``` -------------------------------- ### PKDGRAV.generate_ic Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Generates initial conditions for a cosmological simulation. ```APIDOC ## PKDGRAV.generate_ic ### Description Generate initial conditions for a cosmological simulation. ### Method PKDGRAV.generate_ic ### Parameters #### Path Parameters - **cosmology** (Cosmology) - The cosmology object. - **grid** (integer) - Grid size of the initial conditions. - **seed** (integer) - Random seed. - **z** (number) - Starting redshift. - **L** (number) - Length unit of the box. - **order** (integer) - Optional. IC order (1=Zeldovich, 2=2LPT, 3=3LPT). Defaults to None. - **fixed_amplitude** (Boolean) - Optional. Use fixed amplitude for the power spectrum. Defaults to False. - **phase_pi** (number) - Optional. Phase of the initial conditions in units of pi radians (normally 0 or 1). Defaults to 0.0. ### Request Example ```python from pkdgrav import Cosmology cosmo = Cosmology(Omega_m=0.3, Omega_L=0.7, H0=70) PKDGRAV.generate_ic(cosmology=cosmo, grid=512, seed=42, z=50.0, L=100.0, order=2) ``` ### Returns - **time** (number) - The simulation time. ``` -------------------------------- ### Restarting Simulation with Checkpoint File Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/changes.rst.txt Use the .chk file as input to restart a simulation. This command assumes the checkpoint file is named 'checkpoint.00010.chk'. ```bash srun pkdgrav3 checkpoint.00010.chk ``` -------------------------------- ### Configure uenv2 on Eiger Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Verification and shell configuration for uenv2 on the Eiger system. ```bash [eiger]$ uenv --version 8.1.0 ``` ```bash export PATH=$HOME/.local/$(uname -m)/bin:$PATH if test ${HOST##eiger} != $HOST ; then unset -f uenv fi ``` -------------------------------- ### Import HYDRO_MODEL Source: https://pkdgrav3.readthedocs.io/en/latest/parameters.html Import the HYDRO_MODEL enum to specify the hydrodynamics model. This is required before setting the hydro_model parameter. ```python from PKDGRAV import HYDRO_MODEL ``` -------------------------------- ### PKDGRAV.build_tree Source: https://pkdgrav3.readthedocs.io/en/latest/extensions.html Builds a tree structure within each domain of the simulation, potentially for Ewald summation. ```APIDOC ## PKDGRAV.build_tree ### Description Builds a tree in each domain. ### Method PKDGRAV.build_tree ### Parameters #### Path Parameters - **ewald** (Boolean) - Optional. Construct a moment for Ewald if true. ### Request Example ```python PKDGRAV.build_tree(ewald=True) ``` ### Response This method does not return a value. ``` -------------------------------- ### Manage pkdgrav3 Images with uenv Source: https://pkdgrav3.readthedocs.io/en/latest/_sources/install.rst.txt Commands to find and pull specific pkdgrav3 images on Daint and Eiger systems. ```bash [daint][dpotter@daint-ln003 ~]$ uenv image find service::pkdgrav3 uenv arch system id size(MB) date pkdgrav3/3.4:1824353160 gh200 daint ee775978c79587fb 4,044 2025-05-19 pkdgrav3/3.4:1825038404 gh200 daint 5e0b0ac41d73e4e5 3,866 2025-05-19 ``` ```bash [daint]$ uenv image pull service::pkdgrav3/3.4:1825038404 pulling 5e0b0ac41d73e4e5 100.00% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3867/3867 (0.00 MB/s) updating pkdgrav3/3.4:1825038404@daint%gh200 ``` ```bash [eiger]$ uenv image find service::pkdgrav3 uenv arch system id size(MB) date pkdgrav3/3.4:1825268321 zen2 eiger 09cbc44a4026a1f6 643 2025-05-19 pkdgrav3/3.4:1826427762 zen2 eiger c3268965cf74074c 643 2025-05-20 [eiger]$ uenv image pull service::pkdgrav3/3.4:1826427762 pulling c3268965cf74074c 100.00% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 644/644 (0.00 MB/s) updating pkdgrav3/3.4:1826427762@eiger%zen2 ``` -------------------------------- ### PKDGRAV3 Parameters Source: https://pkdgrav3.readthedocs.io/en/latest/genindex.html A list of parameters used in the PKDGRAV3 simulation code. ```APIDOC ## Parameters ### General Parameters - **dSNIaExpScale** (float) - Description not available - **dSNIaFBDelay** (float) - Description not available - **dSNIaMaxMass** (float) - Description not available - **dSNIaNumPerMass** (float) - Description not available - **dSNIaPLFinalTime** (float) - Description not available - **dSNIaPLInitTime** (float) - Description not available - **dSNIaPLScale** (float) - Description not available - **dSoft** (float) - Description not available - **dSoftMax** (float) - Description not available - **dSpectral** (float) - Description not available - **dStellarWindSpeed** (float) - Description not available - **dTau** (float) - Description not available - **dTheta** (float) - Description not available - **dTheta2** (float) - Description not available - **dTheta20** (float) - Description not available - **dTimeStepSmin** (float) - Description not available - **dVelocityDamper** (float) - Description not available - **dVelocityDamperEnd** (float) - Description not available - **dVelocityDamperEndTime** (float) - Description not available - **dxPeriod** (float) - Description not available - **dyPeriod** (float) - Description not available - **dzPeriod** (float) - Description not available - **fH_reion_eV_p_H** (float) - Description not available - **fH_reion_z** (float) - Description not available - **fHe_reion_eV_p_H** (float) - Description not available - **fHe_reion_z_centre** (float) - Description not available - **fHe_reion_z_sigma** (float) - Description not available - **fT_CMB_0** (float) - Description not available - **h** (float) - Description not available - **hLCP** (float) - Description not available - **hxLCP** (float) - Description not available - **hydro_model** (string) - Description not available - **hyLCP** (float) - Description not available - **hzLCP** (float) - Description not available - **iCacheMaxInflight** (integer) - Description not available - **iCacheSize** (integer) - Description not available - **iCheckInterval** (integer) - Description not available - **iCompress** (integer) - Description not available - **iDeltakInterval** (integer) - Description not available - **iKernelType** (integer) - Description not available - **iLogInterval** (integer) - Description not available - **iLowerGroupSizeThreshold** (integer) - Description not available - **iLPT** (integer) - Description not available - **iMaxRung** (integer) - Description not available - **iMaxRungDomainDecomp** (integer) - Description not available - **iOutInterval** (integer) - Description not available - **iPkInterval** (integer) - Description not available - **iPkOrder** (integer) - Description not available - **iSeed** (integer) - Description not available - **iSignalSeconds** (integer) - Description not available - **iStartStep** (integer) - Description not available - **iTimeStepCrit** (integer) - Description not available - **iUpperGroupSizeThreshold** (integer) - Description not available - **iWallRunTime** (integer) - Description not available - **iWorkQueueSize** (integer) - Description not available - **lstLightConeOctants** (list) - Description not available - **lstOrbits** (list) - Description not available - **nBinsPk** (integer) - Description not available - **nBucket** (integer) - Description not available - **nFoldPk** (integer) - Description not available - **nGrid** (integer) - Description not available - **nGridLin** (integer) - Description not available - **nGridPk** (integer) - Description not available - **nGroup** (integer) - Description not available - **nMemEphemeral** (integer) - Description not available - **nMinMembers** (integer) - Description not available - **nParaRead** (integer) - Description not available - **nParaWrite** (integer) - Description not available - **nPartColl** (integer) - Description not available - **nPartRhoLoc** (integer) - Description not available - **nReplicas** (integer) - Description not available - **nSideHealpix** (integer) - Description not available - **nSmooth** (integer) - Description not available - **nSteps** (integer) - Description not available - **nTreeBitsHi** (integer) - Description not available - **nTreeBitsLo** (integer) - Description not available - **nTruncateRung** (integer) - Description not available - **sqdegLCP** (float) - Description not available - **time_step** (float) - Description not available - **w0** (float) - Description not available - **wa** (float) - Description not available ```