This code is provided for illustration only.  I took the public code
described in Crocce, Pueblas and Scoccimarro 2006, MNRAS, 373, 369
(and available from: http://cosmo.nyu.edu/roman/2LPT/), and made some
relatively small modifications to their code to allow it to read
Panphasia descriptors.

In addition I wrote a new subroutine, in the file set_up_wn_field.f, which
is called from the main program and computes the correct phases for a
given input descriptor and passes them back to the main program.


The code is provided with two example input files.

(1) run_zeld.sh   which sets up a 500 Mpc/h on a side periodic volume using the 
descriptor for the MW7 simulation described in Jenkins 2013.

(2) dove_example384.sh   set up the DOVE volume - a 70.4 Mpc/h on a side
period volume, also described in Jenkins 2013.  Running these initial conditions
to redshift zero using Gadget2, I was able to locate the Milky-way mass halo
studied in detail in Jenkins 2013, close to the expected location. It is only
resolved with about 2000 particles however.

---------------------------------------------------------------------------------
Testing of this code
--------------------

 For the run_zeld.sh the code produces Zeldovich initial conditions
that agree very well with ARJ's IC_Gen_2lpt code when also producing
Zeldovich initial conditions.  

The initial conditions produced by dove_example384.sh and run with
Gadget2 do recover the Milky-way mass halo position and mass matching
table 5 of Jenkins 2013.  The Gadget2 parameter file used is available
at: Gadget2/dove_cps_384.param.  The halo is reproduced with only
2000 particles within M200.

Otherwise this code has not been tested. It is possible that my
modifications may have introduced bugs into the general operation of
this code.  If this code is to be used for scientific purposes the
code should be fully tested by the user first. Please let me know if
you find any such bugs and I will revise the code.  When used full
credit should be given to Crocce, Pueblas and Scoccimarro 2006, MNRAS,
373, 369 and Jenkins 2013.


 ARJ   24/6/2013  A.R.Jenkins@durham.ac.uk


------------ Original README2 file below -----------------------------------



This is for the intel compiler (ifort) version of the code, 2lpt_ic2.f

- To be able to compile the code, you should have FFTW 2.1.5 installed in your system
(go to fftw.org if you don't have it)

- If your installation of FFTW is not in the standard directory, change the first line
in 2lpt_ic2.f to get the info file from the appropriate directory

- To compile the 2LPT code with ifort,

ifort -O4 -o 2lpt_ic2.exe 2lpt_ic2.f  -lsrfftw -lsfftw

the last two flags assume FFTW is installed in both single and double precision,
thus the "s" is appended to pick up the single precision version of the library. 
You want fftw compiled for 64 bits to run the code for large particle numbers. 
If you installed the 64 bit version in a different directory add e.g. -L/usr/local/lib64 after .f

- See the shell script run_2lpt2.sh for running an example.

- The code uses about 24*Npar bytes if disk mode is enabled (this will create 3 files with  total size
12*Npar bytes in your output directory that you can discard after the code finishes), if disk mode is 
not enabled it uses 36*Npar bytes.

