
Importing Single Value from File
vmmr5596
I've been carrying out some DFT calculations on a molecule and I have data files for which I'd like to automate the data extraction process. I'm attaching 2 sample files. I've used IGOR to extract multiple columns and rows of data, but my approach does not seem to be working for this particular set of files.
The value I'm interested is the "Total Energy" found in row 565 in the c1_gnd.txt file or row 564 in the c2_gnd.txt files I've attached.
What I'd like to do, is be able to extract that value from the text file and append that value to a wave in Igor. Since I have multiple files containing this information, the next step would be to cycle through the various files and extract the value from each and sequentially append them to the same wave. The complication with this particular set of files is that the position of the row containing the "Total Energy" value, changes by a row or two sometimes because of the number of iterations required to complete the previous calculations.
Any ideas?
Thanks!
A.G.
WaveMetrics, Inc.
September 22, 2016 at 03:27 pm - Permalink
Is there an easy way to accomplish this?
Here's the code:
Here's a link to the original thread where found it:
http://www.igorexchange.com/node/1903
Thanks!
September 22, 2016 at 04:07 pm - Permalink
Input all the .txt files (yes you can select lots of them, see '/MULT' in
open
)) line by line , parse the lines for the 'Total Energy' keyword) and append (insertpoints
) the result to the 'total energy wave'. Most likely do the same for the 'configuration', i.e. the filename, (text-)wave. Thestringmatch
command might become handy and think of '*' as a wildcard -- or maybestringbykey
.If you need several values, I would also recommend A.G.'s procedure to import all parameters one a file is open.
Have a look at the manual or the help file ;-) or ask here for further advice.
HJ
September 22, 2016 at 04:32 pm - Permalink