in reply to Re^5: Making commond for large number of files
in thread Making commond for large number of files
I am really apologized for this inconvenience. But thank you very much for your help.
Exactly this is what I want with little addition:
File with minimum energy 1 10 20 30 40 2 20 30 45 50 Another file 1 10 11 50 50 2 20 21 60 60 I want: R 11 100 30 R 21 120 5 30 = (50 + 50) - (30 + 40) 5 = (60 + 60) - (45 + 50) Where 100 = 50 + 50 120 = 60 + 60 .
I further explain in detail.
The below code which I have already posted (I am posting again)is giving me an output file with Bond Length R, Delocalization Range and Sum of EDRA and EDRB ($4+$5).
use strict; # Find the lowest-energy geometry # Prepare array EDRvars0 containg the EDR at each u from that geometrr +y open(F,">results.txt"); print F "# Bond_length Delocalization_length EDR \n"; # Loop over all log files foreach my $f (<*log>){ my $c=`grep -c "Normal term" $f`; chomp($c); # Avoid files that do +dn't converge if($c>0){ # Find the bond length. We assume this is built into the file +name my $R = $f; $R=~s/.log//; $R=~s/.*_//; # Find the U valnes my $Ustr = `grep -A37 "EDR alpha" $f | tail -n35|awk "{print \ +\\$3}"`; my @Uvars = split(/\n/,$Ustr); # Convert them into an array my $NU = scalar(@Uvars); # That array has $NU elements # Find the <EDR(u)> and sum alpha and beta my $EDRstr = `grep -A37 "EDR alpha" $f | tail -n35|awk "{print + \\\$4+\\\$5}"`; my @EDRvars = split(/\n/,$EDRstr); # Print the outputs foreach my $i(0..$NU-1){ print F sprintf("%8.3E %12.6E %12.6E\n",$R,$Uvars[$i],$EDR +vars[$i]); } } } close(F);
The out put is like this:
R U EDR(that is EDRA+EDRB)Now in this output I want to add another column Delta EDR that gives me the difference in ERD of any file and EDR of lowest energy file. Like:
R U EDR(that is EDRA+EDRB) Delta EDR (That is {(<EDRA>+<EDRB>)each file}-{(<EDRA>+<EDRB>)file with minimum energy})Mean I want to edit the above code in such a way that it give me fifth column in out put containing the {(<EDRA>+<EDRB>)each file}-{(<EDRA>+<EDRB>)file with minimum energy}).
I am waiting your kind reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Making commond for large number of files
by GotToBTru (Prior) on Apr 22, 2015 at 14:53 UTC |