C2110 UNIX and programming Lesson 11 / Module 1 PS / 2020 Distance form of teaching: Revl Petr Kulhánek kulhanek@chemi.muni.cz National Center for Biomolecular Research, Faculty of Science Masaryk University, Kamenice 5, CZ-62500 Brno 10 UNIX and programming Lesson 11/ Modul 1 Bash + AWK + Gnuplot The data is in the directory: /home/kulhanek/Documents/C2110/Lessonll 10 UNIX and programming Lesson 11/ Modul 1 Exercise 1 l. The prod006.out file contains results from molecular dynamics. The task is to extract the dependence of the temperature of the simulated system on time from the file and save this data to the file temp.out which will contain exactly two columns. The first column will be the time and the second column will be the temperature. time temperature NSTEP = Etot BOND 1-4 NB = EELEC = 500 TIME (PS) 942.6248 51.3204 17.7099 ■494 .7423 EKtot ANGLE 1-4 EEL EGB 0.500 TEMP(K) = 288.02 151.0990 EPtot 292.3619 DIHED 981.4071 VDWAALS -164.7991 RESTRAINT PRESS 0.0 791.5258 176.5980 -68.3301 0.1822 EAMBER (non-restraint) 791.3436 For analysis of rst.out file, use language awk. Compare the solution with bash implementation. 2. Display the temperature profile over time in the form of a graph. 10 UNIX and programming Lesson 11/ Modul 1 Exercise 2 1. From file prod006.out extract the dependence of total energy (Etot), kinetic energy (EKtot) and potential energy (EPtot) on time. Display the course of individual energies in gnuplot and save it to energy.png file. Verify that the sum of potential and kinetic energy equals total energy. time NSTEP = Etot BOND 1-4 NB = EELEC = 500 TIME (PS) = 942.6248 EKtot 51.3204 ANGLE 17.7099 1-4 EEL = -494.7423 EGB 0.500 TEMP (K) = 288.02 151.0990 EPtot 292.3619 DIHED 981.4071 VDWAALS -164.7991 RESTRAINT PRESS 0.0 791.5258 176.5980 -68.3301 0.1822 EAMBER (non-restraint) 791.3436 Exercise 3 1. Write script(s) that will print a series of numbers 3n for n from 1 to N to data.txt file. (10 points). The number N is entered by the user as the first argument of the script (5 points). Entry treatment (5 points). View in gnuplot the number series saved in the data.txt file, use non-interactive display (10 points). Example of assignment for exam. 10 UNIX and programming Lesson 11/ Modul 1 -5- Exercise 4 1. Draw an equilateral right triangle in the file, the outline of which will be from the characters "*"(5 points) and fill with "@" characters (10 points). The length of the triangle cathetus and the file name are entered by the user interactively after starting the script (5 points). Input treatment: The triangle must contain at least one "@" character (5 points). The script will not allow writing to an existing file (5 points). Example of assignment for exam. 10 UNIX and programming Lesson 11/ Modul 1 Exercise 5 1. Finds all files with extensions .hpp and .cpp in the specified directory and write their number in total and then separately for .hpp and .cpp files to standard output (10 points), then the total number of lines in all found files and then separately for. hpp and .cpp files (10 points). Save the report in the file "summary.txt" (5 points). Analysed directory is specified as the first argument of the script. Input treatment (5 points): The analyzed directory must exist. Test data can be found in the directory pmflib. Example of assignment for exam. 10 UNIX and programming Lesson 11/ Modul 1 Exercise 6 1. Write awk script, which extracts from a file with quantum-mechanical analysis of the molecular complex by SAPTO method the components of interaction energy in kcal / mol in the section "SAPT Results" at the end of the file. Specifically, electrostatics, exchange, induction and dispersion energies. The last column will contain the total interaction energy (Total SAPTO). You can find the test data in the "saptO" directory. 2. Write bash script which performs the above analysis for all files ending ".out" The first column will be the name of the analyzed complex (filename without ending ".out") and then individual components of the interaction energy. Save the result to the text file "results.txt". The data is in the "saptO" directory. 10 UNIX and programming Lesson 11/ Modul 1 -8-