/* Written by Vikas Varshney Dated Feb 22, 2007 Contact Info: vikas.varshney@gmail.com The main purpose of this simple code is to extract thermodynamic information such as Temperature, Pressure, Energy, etc from LAMMPS log files, to plot them as a function of timestep in a simple plotting programs such as xmgrace. Such plots are useful at initial stages of a simulation to make sure the system is equilibrated. To run this program please compile it as gcc -O3 thermo_extract.c -lm -o thermo_extract To extract temperature as a function of timestep, run the code as thermo_extract -p Temp -s/-m logfile1 logfile2 ... (all the log files) Time and temperature is output as 2 columns of data. It can be re-directed to a file for plotting. -p for thermo parameter to extract -s if the output format is single line, or -m is the output format is multi line Few points 1. The log file must contain a "thermo N" command where N is the frequency of the thermo output. 2. The name of the property "Temp" (in previous example) has to match the thermo property in the logfile. 3. The log file(s) can contain thermo info for multiple runs. 4. Currently, you can only use one parameter as input, so for extracting multiple properties, you have to run the code again. 5. The Program uses the following keywords to keep track of the data in the file. In general, these keywords are not used in input script (which in turn get printed in log file) but are worth mentioning. PLEASE avoid using "Dangerous", "Memory", "Step" and "Loop" in the input script "thermo" and "run" except when they are used to specify frequency of thermo output and total number of steps to be run, respectively. */ #include #include #include #include #include FILE *input; char filename_input[100]; char string1[100],*string2; char temp[80]; int j,k,check,timestep; double datapoint; int thermostylecounter,thermocounter,runcounter,totalsteps; int narg1; char *token; char templl[80]; int thermo[100]; int run[100]; void scan_first_part() { while(strcmp(temp,"Memory")) fscanf(input,"%s ",&temp); } void scan_data_multi(int temp1,char* chartemp) { totalsteps=run[temp1]/thermo[temp1]+1; for(j=0;j0) {} else { printf("Couldn't recognize parameter\n"); exit(1); } totalsteps=run[temp1]/thermo[temp1]+1; for(j=0;j