Jump to content

Talk:Mod:Hunt Research Group/NBO Matlab Code

From ChemWiki

Links to files

NBO_E2_Vals_File.m link

NBO_E2_Vals_Folder_mac.m link

NBO_E2_Vals_Folder_win.m link

Test_NBO_log_file link

What it does(Roughly)

This code works on *.log files produced from an NBO calculation in which an E(2) analysis was done (may not be the case if you used the density=check keyword). An E2 analysis involves partitioning your system up into "units" (which should correspond to individual molecules) and calculating a measure of the stabilisation from orbital overlap between these units.

The main purpose of the code is to separate inter-molecular orbital overlap into hydrogen-bonding and non-hydrogen bonding components, and also to try to correlate the total intermolecular e2 stabilisation energy with properties of a system (e.g the amount of charge transferred or association energy).

For each file it outputs the following information (as a matlab variable, and also a comma delimited text file) for every pair of units:

1) The sum of donor-->acceptor E2 energies.

2) The value of the strongest donor-->acceptor E2 energy.

3) The atoms involved in the strongest donor-->acceptor E2 energy.

4) The sum of donor-->acceptor E2 energies for ONLY interactions where the acceptor orbital has hydrogen contributions.

5) The value of the strongest donor-->acceptor E2 energy, for ONLY interactions where the acceptor orbital has hydrogen contributions.

6) The atoms involved in the strongest donor-->acceptor E2 energy, for ONLY interactions where the acceptor orbital has hydrogen contributions.

Output 1) should be a measure of the total covalent stabilisation between the two units. Output 4) should be a measure of the stabilisation between the units as a result of the covalent part of intermolecular hydrogen bonding.

The code is meant to be run on lots of conformers of a single system at once. e.g a range of ion pair structures for [BMIM] Cl, and will tabulate the results in a form thats easy to paste into excel.

Running The Code

Quick Start Guide

1) Download NBO_E2_Vals_File.m and either NBO_E2_Vals_Folder_mac.m (if on a mac) or NBO_E2_Vals_Folder_win.m (if on windows).

2) Optionally download this test file link

3) Save both the .m files in your matlab folder (or somewhere else if you know what your doing matlab wise). By default this will be located in User/Documents/Matlab.

4) Save either the test file(recommended) or some other NBO files into any folder you want (an empty folder will be best).

5) Create a cell array variable in matlab containing the full path to the FOLDER in step 4). e.g on the matlab command line i type:

folder={'/Users/rf614/Work/Random_Coding/Analyse_E2_Code/Test_Files/BMIM_Cl'}

6) Run the code on the folder by typing the following on the matlab command line (im assuming the mac version of the code is being used) :

[output_var] = NBO_E2_Vals_Folder_mac(folder)

7) All the output info will be stored in the variable output_var, and also in a comma delimited text file ( output_file.txt) which was saved to your current working directory. If your not sure which one that is type on the matlab command line:

pwd

8) NOTE: When running it on your own jobs each folder needs to have only 1 type of system in it. i.e dont have a folder with BMIM Cl and BMIM CCN3 conformers. If you want to do a range of different systems simulatneously you need to use 1 folder per system (see below).

9) See below for an explanation of the output format.

Running On Multiple Folders

This is almost exactly the same as the "Quick Start Guide" for a single file. Except: 1) In step 5 above create a string variable for each folder and then combine these into a cell array, e.g write the following on the command line

folder1 = '/Users/rf614/Work/Random_Coding/Analyse_E2_Code/Test_Files/BMIM_Cl'

folder2 = '/Users/rf614/Work/Random_Coding/Analyse_E2_Code/Test_Files/BMIM_CCN3'

folders = {folder1 folder2}

2) In step 6 type (assuming same naming as above):

[output_var] = NBO_E2_Vals_Folder_mac(folders)

Bugs/Things to be aware of

Currently no known bugs.

1)Important that only one type of system is in each folder. The reason being that in working out the molecular identity of "units" (for row 2 of the output table) only the first file in the folder is used. This might also be a problem for a single system (e.g BMIM Cl), as i dont know how NBO splits the system up into units, or how it determines which molecule is unit 1 and which is unit 2 etc.. To double check the unit naming is consistent for all files in a folder, you can simply run "grep 'Molecular unit' *.log" in the relevant folder.

2)Theres a variable called "max_numb_frags" in the NBO_Folder code. Its currently set to 4 meaning the code will work on systems with 1,2,3 or 4 molecules. Obviously if your systems larger you have to edit this variable appropriately.

The Output Table Format

I'll assume the code has been run on multiple folders in this explanation, and also that the comma delimited output file is being used rather than the matlab variable. Firstly:

Row 1: This will just say all_e2_info* in every column. Delete the row.

(the new) Row 1,Column 1: will display the first folder name you entered (folder 1 in the "running on multiple folders" section). All columns from here until the point where the name of folder 2 (row 1,column n) is listed correspond to the E2 info from the first folder.

Row 1,: The first row contains 6 different sub-headings. The meaning of these is explained in the "What it does(Roughly)" section and below.

Row 2: First column is obvious. 2nd column labels the donor and acceptor for each interaction, in the format "Donor-->Acceptor".NOTE The code takes these ONLY from the first file it reads.

sum E2 vals (All) columns: Simply the sum of all E(2) energies in kJ per mol for the donor-->acceptor defined at the top of each column (row 2).

strongest E2 vals (All) columns: Highest energy for a single Donor->acceptor interaction (kJ mol^{-1}) for the units defined in row 2.

strongest E2 vals INFO (All):The line of the .log file from which the "strongest E2 vals (All)" was taken. Contains information on the oribtals involved in the D->A interaction

sum E2 vals (Hydrogen): The sum of all e(2) interaction energies where the acceptor orbital has a hydrogen contribution (e.g a C-H antibonding orbital acts as the acceptor). Identified in the code by searching for a "H" in the acceptor orbital column of the .log file.

strongest E2 vals (Hydrogen) columns: Same as the "(All)" case but the acceptor orbital must have a hydrogen contribution.

strongest E2 vals INFO (Hydrogen): Same as the "(All)" case, but the acceptor orbital must have a hydrogen contribution.