********************************************* HOW TO USE LIFETIME-CORRECTION2 Lance Edens and Tiecheng Zhou 2016.1011/2015.1102 ******************************************** This program performs a dynamics based correction that removes artificial transient breaks and bonds in a network. It outputs corrected files and average lifetimes for the hydrogen bond network along with a list of hydrogen bond switching events. Lifetime-correction2 can only be used for systems of pure solvent, but can be run in parallel. Note: This procedure requires Message Passage Interface (MPI) headers. 1) files to be read: A. GraphGeod files from the ChemNetworks they should contain the atom-id information, so it should have at least 7 columns, e.g 12 34 0 0 0 2 1 1.053 120.3 water 12 is H-bonded with water 34, the atom (#2, e.g 'H') from water 12 and atom (#1, e.g 'O') from water 34 the HB distance is 1.053 and the HB angle is 120.3 B. an input-file, see example of 'input-corr' below: [NUMBER OF NODES] 216 //the largest molecule id from ChemNetworks, // usually it is equal to the # of molecules in the system [NUMBER OF SNAPS] 100 //the total # of snapshots [MODE] 0 //run this code with several modes: // mode 0 (no correction) or // 1 (correct for transient breaks) or // 2 (correct for transient bonds) or // 3 (correct for both) [IDS OF SOLVENT1] 1 215 //the initial and the final molecule ids for solvent1, // only read continuous ids, compatible with ChemNetworks output [ATOMS OF SOLVENT1] 3 OW HW HW //the atom label of solvent1, used to identify the atom id, // so should be in the same order as in the ChemNetworks [IDS OF SOLVENT2] 216 216 //the initial and the final molecule ids for solvent2 [ATOMS OF SOLVENT2] 3 OW HW HW //the atom label of solvent2 [LIFETIME OF SOLVENT1 SOLVENT1] 1 10 5 //correction parameters for H-bond for solvent1 with solvent1. // the first number can be '1' (calculate lifetime) or // '0' (don't calculate lifetime), // the second number is PERSISTENCE (used to for transient bonds), // and the third number is TOLERANCE (used for transient breaks) [LIFETIME OF SOLVENT2 SOLVENT2] 1 15 5 [LIFETIME OF SOLVENT1 SOLVENT2] 1 20 5 //the first solvent is the target molecule to be analyzed [LIFETIME OF SOLVENT2 SOLVENT1] 1 25 5 [END] //at the end of the inputfile, everything after this line is ignored C. To start the lifetime correction, see either 2) or 3). The results are covered in 4). ---------------------------------------------------- 2) how to use this code (automated process): A. Check that the following files are in the same directory as lifetime.bash .GraphGeod outputs from ChemNetworks input file (input-corr) conversion C file (convert-GraphGeod-MPI.c) lifetime correction executable (lifetime_corr2.exe- compile using the Makefile) lifetime submission script (lifetimes.pbs) average lifetime counter executable for lifetime-correction2 (count_lifetime2.exe) Note: this process uses mpicc to compile convert-GraphGeod-MPI.c B. Run the bash script lifetime.bash #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 where #1,#2, ect. are optional command line inputs the command line inputs must be entered in order for example, changing #4 requires entering #1 #2 #3 #4, but does not require entering #5 through #10 any inputs not entered will revert to a “default” value The command line inputs are as follows: #1: number of compute nodes for the conversion program (default=1) #2: number of processors per node or the conversion program (default=1) #3: Input control filename (default=“input-corr”) #4: number of molecules (default=value of “NODES” in file #3) #5: number of snapshots (default=value of “SNAPS” in file #3) $6: erase previous output files (No=0/Yes=1) (default=0) #7: convert files (No=0/Yes=1) (default=1) #8: lifetime correction (No=0/Yes=1) (default=1) #9: Input .GraphGeod files: replace numbers with %d (default="water.input.water%d.xyz.water%d.xyz.GraphGeod”) #10: Number of %d in .GraphGeod filename (default=2) ---------------------------------------------------- 3) how to use this code (manual process): A.run conversion program convert-GraphGeod-MPI.c Requires Message Passage Interface (MPI) to compile The total number of threads must be input during the run of the executable The variable tsnap must equal the total number of snapshots The variable nmol must equal the total number of molecules This program converts GraphGeod files to GG files. GG files: named “mol.molecular_number.GG” where each file should have four columns Example: in mol12.GG (where “12” is the molecule number) 500 34 2 1 where water 500 is the snapshot number, 34 is the H-bonded water partner, 2 is the atom(e.g 'H') from water 12 1 is the atom(e.g 'O') from water 34 B.before running lifetime-correction2 code check the values in the inputfile are reasonable check the global variables in 'head.h', make sure the check that .GG files are in the same directory as lifetime_corr2.exe C.compile the code and run the code compile the code by simply typing 'make' in the command line: $ make, the actual compiling commands are in 'Makefile' execute the code by: $ ./lifetime_corr2.exe input-corr here input-corr is the input-file name D.run the code using 4 steps step0, using MODE '0' to determine the parameters, PERSISTENCE and TOLERANCE they can be chosen as the average HB lifetime and average break duration step1, using MODE '0' to analyze the original lifetimes after choosing the proper parameters step2, using MODE '1' to correct for transient breaks note that the corrected .GG files are named with suffix '*-updated' so need to rename them to use the same code step3, using MODE '2' to correct for transient bonds step2 and step3 can be combined if MODE '3' is used, which is correct both step4, using MODE '0' to analyze the corrected lifetimes ---------------------------------------------------- 4) analyze the results A. After running this code, you should get output files from step0, step1 and step4 (the files are empty if running MODE 1, 2, or 3) There are Degrees-suffix, Lifetimes-suffix, and Switches-suffix, suffix meaning: e.g. Degrees-1-2, the degree of solvent1 from solvent2 B. In the Degrees file, there will be: the total-degree-distribution, the donating-degree-distribution, the accepting-degree-distribution, with respect to each atom from the target molecule The Degrees can be directly copied to Excel, C. In the Lifetimes file provide all the information of the bonded Hydrogen bond durations Example format: ’12 34 2 1 3 19 R Y', means water 12 is H-bonded with water 34, using atom2 and atom1 respectively, from snapshot 3 to 19, it is a Real(R) HB [or Transient(T)], and after this period it changes its HB partner Yes (Y) [or No (N)] another code called 'count_lifetime2.c’ can be used to calculate the weighted average to use count_lifetime2.c, the single lifetime values (stop snapshot - start snapshot +1 ) must be moved/copied to their own file this can be done with the command $ awk '$6-$5+1 >= 0 {print $6-$5+1}' Lifetimes-1-1 > only-lifetimes) D. The Switch files provide information for all the captured HB breakage events Example format: R Y 12 44 49 1 100 5141 5401 6605 means this event was Real (R) [vs Transient (T)] that switched partners (Yes (Y) vs No (N) for keeping the same partners) for water 12 that was initially bonded to water 44 but switched to water 49 where water 12’s atom1 (the atom involved in the switching for molecule 12) was bonded to water 44 starting at snapshot 100 but broke with water 44 at ending snapshot 5141 and bonded with water 49 at starting snapshot 5401 but broke with water 49 at ending snapshot 6605. The break duration is then column 9 - column 8 (260 snapshots in the example)