7. Serial jobs
For this assignment, your task is to perform a parameter sweep calculation using a molecular dynamics simulation application to compute the pressure of Argon gas as a function of temperature and density.
The molecular simulation application is given to you and does not need to be changed. You can find it in /scinet/course/phy1610/lj/lj (the source code is in /scinet/course/phy1610/lj/src, but you do not need it).
This code can be used by passing parameters as command-line arguments:
argument 1: a folder name for output (1024 chars max, no spaces or tabs)
argument 2: substance (one of the following: LJ Ar CO2 He Kr Ne N2 O2 Xe)
argument 3: initial temperature (standard deviation of the velocities)
argument 4: density of the gas
argument 5: number of atoms
argument 6: runtime
argument 7: time step
argument 8: random number generator seed for initial conditions
argument 9: equilibration time
argument 10: T or F, whether a file with the trajectory of all atoms should be produced.
E.g. the command line "./lj argonoutput Ar 100 2.5 500 12 0.005 17 3.0 F" would run a simulation of an Argon gas at a temperature of 100 Kelvin and with a density of 2.5 mol/l containing 500 atoms, for 12 picoseconds using a time step of 0.005 picoseconds, starting with velocity randomly drawn using a random seed of 17, and furthermore producing measurements only after the system is equilibrated for 3 picosecond, and without writing a trajectory file.
The output of 'lj' has three parts:
- A file "output.dat" is written in the output folder, containing lines with: time, total energy, potential energy, kinetic energy, temperature, pressure A final line will have the averages of total energy, potential energy, kinetic energy, temperature, pressure.
- A trajectory file output.xsf is written too. Not created if the output folder name starts with '-', or if the traject parameter is 'F'.
- A JSON file report.json is written in the output folder at the end of the simulation, containing the parameters and the averaged measured quantities (e.i., energies, temperature, pressure) over the simulation run.
The scan you are to perform consists of simulation of 500 Argon atoms running for 2000 ps with an equilibration time of 1000 ps, using a timestep of 0.025 ps. The random seeds should run from 1 to 9, initial densities from 1.0 to 10.0 mol/l and initial temperatures from 80 to 350 K. There should be 9 values for the seeds, 10 for the densities and 10 for the initial temperature, leading to 900 runs of 'lj'.
In particular you should
- Write a c++ program to create a file with a list of subjobs, i.e., a list of command lines that would produce the parameter scan.
- Write a SLURM job script for the teach cluster to perform these jobs by passing it to GNU Parallel. The SLURM job should be using 16 cores at the same time, and GNU parallel should write out the lob log to a file.
- Submit the job on the Teach cluster.
- Write a c++ program to read in the result for the average pressure from the json file produced by each subjob, take the average over the seeds for each combination of the density and temperature, and write that out to a results text file, with each line containing the density, initial temperature, and average presssure.
Continue using git, and good programming practices. Please submit your git log, the two c++ programs, the slurm job script, the GNU parallel job log file, and the results file.