exercises:2017_ethz_mmm:replica_2017
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
exercises:2017_ethz_mmm:replica_2017 [2017/04/07 10:49] – created dpasserone | exercises:2017_ethz_mmm:replica_2017 [2017/05/11 08:29] – dpasserone | ||
---|---|---|---|
Line 32: | Line 32: | ||
7) Change your password as in point 4) using TMP-PASSW2 as old password and set EMPA-PASSW | 7) Change your password as in point 4) using TMP-PASSW2 as old password and set EMPA-PASSW | ||
+ | </ | ||
============================================ | ============================================ | ||
Line 55: | Line 56: | ||
</ | </ | ||
+ | ===== Running the job ===== | ||
+ | The script contains the directives for the queuing system, including 16 cores on one nodes reserved for the job. | ||
+ | |||
+ | <code bash> | ||
+ | #=== job name: | ||
+ | #PBS -N parallel | ||
+ | #=== wall time limit (h:m:s) | ||
+ | #PBS -l walltime=1: | ||
+ | #choice of the number of nodes and proc. per node | ||
+ | #PBS -l nodes=1: | ||
+ | #PBS -q short | ||
+ | #which queue | ||
+ | #=== memory usage | ||
+ | ##PBS -l mem=1024mb | ||
+ | #=== join stdout and stderr | ||
+ | #PBS -j oe | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # set environment variables | ||
+ | # | ||
+ | |||
+ | module unload mvapich2 | ||
+ | module load openmpi | ||
+ | module load lammps/ | ||
+ | cd $PBS_O_WORKDIR | ||
+ | |||
+ | rm parallel.o* log.* screen* | ||
+ | |||
+ | mpiexec -np 16 lmp_mpi -partition 16x1 -in input | ||
+ | </ | ||
+ | |||
+ | The last line is the command to run a parallel lammps job with the input file '' | ||
+ | |||
+ | ===== The input file for lammps ===== | ||
+ | |||
+ | |||
+ | The file input contains information for the program **lammps**. Details on the documentation can be found [[http:// | ||
+ | |||
+ | There is an initialization section, showing the kind of units (see [[http:// | ||
+ | |||
+ | < | ||
+ | # Initialization | ||
+ | units metal | ||
+ | dimension | ||
+ | boundary | ||
+ | atom_style | ||
+ | </ | ||
+ | |||
+ | In the second part of the input file a spherical region is defined (to confine the cluster). Then the atoms are read from '' | ||
+ | |||
+ | |||
+ | < | ||
+ | region rs sphere 0 0 0 12.66 | ||
+ | read_data | ||
+ | mass 1 39.948 | ||
+ | </ | ||
+ | |||
+ | Then, we define the parameters for the Lennard-Jones potential. The units are **eV** for epsilon, and angstrom for **sigma**. | ||
+ | The last number is the cutoff, in Angstrom. | ||
+ | |||
+ | < | ||
+ | pair_style lj/cut 8.5 | ||
+ | pair_coeff 1 1 0.01042 3.405 8.5 | ||
+ | </ | ||
+ | |||
+ | Then, we initialize the '' | ||
+ | |||
+ | < | ||
+ | variable i equal part | ||
+ | variable t world 2.00 2.44 2.98 3.64 4.45 5.43 6.63 8.09 9.88 | ||
+ | velocity | ||
+ | velocity all zero linear | ||
+ | velocity all zero angular | ||
+ | fix 1 all nvt temp $t $t 0.1 | ||
+ | fix 2 all wall/region rs harmonic 2.0 0.0 0.4 | ||
+ | </ | ||
+ | |||
+ | The next section is about writing out each 1000 steps the relevant information about temperature and energy. We also dump a restart file at the end, and every 10000 steps a structure in xyz format. | ||
+ | |||
+ | < | ||
+ | thermo | ||
+ | thermo_style | ||
+ | thermo_modify | ||
+ | restart 5000000 restart.* | ||
+ | dump 2 all xyz 10000 structure_$i.xyz | ||
+ | dump_modify | ||
+ | </ | ||
+ | |||
+ | Finally, this is the command to run the tempering, with an exchange move attempted every 1000 step of molecular dynamics and an initial temperature $t that is different from replica to replica. The last numbers are random seeds that are used for choosing which replica to exchange and for the Metropolis criterion. | ||
+ | |||
+ | < | ||
+ | temper 5000000 1000 $t 1 3678 3490 | ||
+ | </ | ||
+ | |||
+ | ===== Adapting the output files ===== | ||
+ | |||
+ | We must now make some postprocessing on the output files. The goal is to performs averages at different temperatures. These averages are enhanced by the exchanges that were performed between different molecular dynamics replica. Note that temperature is set by a thermostat. | ||
+ | |||
+ | <note tip> | ||
+ | **Example**. Processor 0 starts with temperature T0=2 K, processor 1 with temperature T1=2.44 K. | ||
+ | After 1000 steps, an exchange step is attempted and accepted with some probability (see theory slides, and also the paper | ||
+ | [[doi> | ||
+ | But you can see it also as the **configurations** of T0=2 K and the one of T1=2.44 K are changing, thus improving the sampling at both temperature. | ||
+ | </ | ||
+ | |||
+ | The script '' | ||
+ | |||
+ | <note tip> | ||
+ | - prunes the '' | ||
+ | - For all the '' | ||
+ | - Compute the **q4** order parameter for all structure files and create '' | ||
+ | - now paste the '' | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Reordering the replica: one temperature, | ||
+ | |||
+ | At this point, we have a set of '' | ||
+ | |||
+ | <note tip> | ||
+ | * Consider each file t_q4_epot_etot.*.out (processor by processor). Say you consider the number 5 (6th replica): '' | ||
+ | * At the step 50000, the file shows the following line: | ||
+ | '' | ||
+ | |||
+ | indicating a temperature of 6.7133746. | ||
+ | * The file '' | ||
+ | '' | ||
+ | |||
+ | indicating that at the 6th replica (column **7**), we have the temperature **6**, which is (see input file) T=6.63 K. Meaning that at step 50000, the thermostat is keeping replica 5 around the temperature T=6.63 K. | ||
+ | * This means that this line has to be stored in the temperature file number **6**. | ||
+ | </ | ||
+ | |||
+ | At the end of the above procedure performed by the small script section: | ||
+ | <code bash> | ||
+ | NP=16 | ||
+ | NP1=$[NP-1] | ||
+ | rm torder* | ||
+ | for repl in `seq 0 $NP1` | ||
+ | do | ||
+ | echo $repl | ||
+ | awk -v rep=$repl ' | ||
+ | i=0 | ||
+ | for a in `cat rep_$repl` | ||
+ | do | ||
+ | i=$[i+1] | ||
+ | head -$i t_q4_epot_etot.$repl.out | tail -1 >> torder.$a | ||
+ | done | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | we will have a set of files, one for each temperature. The file **torder.6** (showing the temperature log around **T=6.63 K** shows something like that: | ||
+ | < | ||
+ | 110000 6.0832407 0.188 -1.7669426 -1.7378488 | ||
+ | 300000 5.3292135 0.189 -1.7741021 -1.7486144 | ||
+ | 460000 7.270977 0.188 -1.7594967 -1.7247223 | ||
+ | 850000 5.547995 0.189 -1.7583209 -1.7317869 | ||
+ | 900000 6.0463203 0.190 -1.7563726 -1.7274553 | ||
+ | 1100000 7.4527984 0.189 -1.7608437 -1.7251998 | ||
+ | 1160000 7.660013 0.189 -1.7653205 -1.7286855 | ||
+ | 1290000 7.634912 0.188 -1.7551173 -1.7186023 | ||
+ | 1520000 6.7791476 0.190 -1.7719473 -1.7395252 | ||
+ | 1530000 5.562028 0.189 -1.7551797 -1.7285786 | ||
+ | 1540000 5.9499865 0.189 -1.7682706 -1.739814 | ||
+ | 1560000 8.0181451 0.186 -1.7549744 -1.7166267 | ||
+ | 1670000 6.4413007 0.189 -1.7601051 -1.7292988 | ||
+ | 1740000 5.5362416 0.188 -1.7592589 -1.7327812 | ||
+ | 1750000 6.8539271 0.189 -1.7645124 -1.7317327 | ||
+ | 2030000 7.8928443 0.188 -1.7657447 -1.7279962 | ||
+ | 2040000 5.3275227 0.189 -1.763795 -1.7383155 | ||
+ | 2100000 5.7265507 0.189 -1.7645332 -1.7371452 | ||
+ | 2550000 8.1985344 0.189 -1.7581595 -1.7189489 | ||
+ | 2580000 7.3481203 0.190 -1.7668799 -1.7317366 | ||
+ | 2780000 6.7587102 0.189 -1.7581622 -1.7258378 | ||
+ | 2800000 7.1581346 0.188 -1.7609368 -1.7267022 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | As you see, the number of steps is not ordered. This is easily achieved by the last part of the script '' | ||
+ | |||
+ | <code bash> | ||
+ | for repl in `seq 0 $NP1` | ||
+ | do | ||
+ | sort -nk1 torder.$repl > temp | ||
+ | mv temp torder.$repl | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | and now the same file **torder.6** shows the following lines: | ||
+ | < | ||
+ | 0 6.5781351 0.191 -1.7950808 -1.7636201 | ||
+ | 10000 5.4632389 0.188 -1.7609687 -1.7348401 | ||
+ | 20000 5.498244 0.189 -1.7597787 -1.7334826 | ||
+ | 30000 5.5142334 0.190 -1.7559687 -1.7295962 | ||
+ | 40000 7.4876442 0.189 -1.7622814 -1.7264708 | ||
+ | 50000 6.7133746 0.189 -1.7636174 -1.7315099 | ||
+ | 60000 5.9256132 0.188 -1.7593177 -1.7309777 | ||
+ | 70000 5.8414791 0.182 -1.7619757 -1.7340381 | ||
+ | 80000 3.9373038 0.189 -1.7687489 -1.7499183 | ||
+ | 90000 9.949782 0.189 -1.7640962 -1.7165101 | ||
+ | 100000 7.5855163 0.189 -1.7616613 -1.7253826 | ||
+ | 110000 6.0832407 0.188 -1.7669426 -1.7378488 | ||
+ | 120000 7.047375 0.189 -1.7588753 -1.7251703 | ||
+ | 130000 6.3651424 0.188 -1.7596141 -1.729172 | ||
+ | 140000 8.268057 0.188 -1.7647263 -1.7251833 | ||
+ | 150000 5.9081219 0.189 -1.7641776 -1.7359213 | ||
+ | 160000 5.2026849 0.188 -1.7603192 -1.7354367 | ||
+ | 170000 7.1694387 0.190 -1.762217 -1.7279282 | ||
+ | 180000 5.3619579 0.188 -1.7596472 -1.7340029 | ||
+ | 190000 7.9061423 0.188 -1.7631399 -1.7253278 | ||
+ | 200000 8.0048742 0.188 -1.7612416 -1.7229573 | ||
+ | 210000 9.5218385 0.189 -1.758481 -1.7129416 | ||
+ | 220000 6.3793891 0.189 -1.7658995 -1.7353892 | ||
+ | 230000 7.5105967 0.189 -1.7545324 -1.7186121 | ||
+ | 240000 7.6066407 0.188 -1.7643938 -1.7280141 | ||
+ | 250000 5.969687 0.189 -1.7611185 -1.7325677 | ||
+ | 260000 6.6266784 0.189 -1.761914 -1.730221 | ||
+ | 270000 6.8500414 0.181 -1.7615648 -1.7288036 | ||
+ | 280000 4.0299504 0.187 -1.7663177 -1.747044 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===== Extract averages ===== | ||
+ | Now we are ready to extract averages at each temperature. This is achieved by the m_* function **m_average** (hint: look for the code of this function in the file ''/ | ||
+ | |||
+ | <code bash> | ||
+ | . / | ||
+ | rm averages_t_q4_epot_etot | ||
+ | for a in torder.? torder.?? | ||
+ | do | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | echo $t $q4 $epot $etot >> averages_t_q4_epot_etot | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | At this point you have a file '' | ||
+ | |||
+ | |||
+ | |||
+ | ===== ASSIGNMENTS ===== | ||
+ | |||
+ | <note important> | ||
+ | - Using '' | ||
+ | - Compare using gnuplot the plot of the nsteps vs. potential energy (columns 1 and 4) for '' | ||
+ | - Plot the '' | ||
+ | - Using the averages file, try to reproduce figure 2, top panel of the paper [[doi> | ||
+ | - ** ADVANCED **. Describe what you would need to reproduce Fig. 1 of the same paper. What does this figure show? Find the reference to this figure in the text of the paper. | ||
+ | - ** ADVANCED **. Using the '' | ||
+ | </ |
exercises/2017_ethz_mmm/replica_2017.txt · Last modified: 2020/08/21 10:15 by 127.0.0.1