From owner-chemistry@ccl.net Thu May 9 07:43:00 2013 From: "Kanters, Rene rkanters,,richmond.edu" To: CCL Subject: CCL:G: Gausian 09 Easiest way to subtract structures/coordinates Message-Id: <-48663-130509063035-3577-ylS4OCx1pC8Po79X9csxag[A]server.ccl.net> X-Original-From: "Kanters, Rene" Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_A526E77202134A69BCAE22C6E72F66BDrichmondedu_" Date: Thu, 9 May 2013 10:30:26 +0000 MIME-Version: 1.0 Sent to CCL by: "Kanters, Rene" [rkanters ~~ richmond.edu] --_000_A526E77202134A69BCAE22C6E72F66BDrichmondedu_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear Anjan, Here is a perl script I wrote some time ago to do that. Cheers, Ren=E9 #! /usr/bin/perl ############################################### # script to take a gaussian log file output and generate structure # information (cartesian) for a new structure with a displacement # along a frequency coordinate in the direction along the '-v' vibration # for a displacement of '-d' times the vibrational vector # # command line arguments: # # -h : prints help and quits. # -d float : displacement along vibrational mode default 0.1 # -v int : vibration number to use default 1 # required : filename (only sees last one) ################################################ # $test =3D 0; # for debugging purposes (prints out extra stuff) # set up the defaults $vibration =3D 1; $displacement =3D 0.1; $file =3D ""; # 'constants' not using the 'use constant NAME =3D> value;' method. $C_STRUCTURE =3D "Standard orientation:"; $C_ENDSTRUCTURE =3D "---------"; $C_FREQUENCY =3D "Frequencies --"; while ($#ARGV >=3D 0) { if ($ARGV[0] eq "-d") { $displacement =3D $ARGV[1]; shift /a\ARGV; } elsif ($ARGV[0] eq "-v") { $vibration =3D $ARGV[1]; shift /a\ARGV; } elsif ($ARGV[0] eq "-h") { &usage(); exit;} else { $file =3D $ARGV[0];} shift /a\ARGV; } if ($file eq "") { &usage(); exit;} open(IN,$file) || die "Could not open file '$file'.\n"; while (1) { # read until I get a structure (should happen first) or a frequency until ($_ =3D , $_ =3D~ /$C_STRUCTURE/ or $_ =3D~ /$C_FREQUENCY/ or e= of) { } if ($_ =3D~ /$C_STRUCTURE/) { # READ THE STRUCTURE $nat =3D -1; # reset the atom index counter : only need last structur= e $at =3D (); # clear out the arrays of atomnumber, x, y and z $x =3D (); $y =3D (); $z =3D (); skiplines(4); # position read line to first atom in the list while ($_ =3D and not $_ =3D~ /$C_ENDSTRUCTURE/ ) { /a\tokens =3D split(' ', $_); $nat++; $at[$nat] =3D $tokens[1]; $xind =3D $#tokens - 2; # needed if the atomic type is missing (happe= ns sometimes). $x[$nat] =3D $tokens[$xind]; $y[$nat] =3D $tokens[$xind+1]; $z[$nat] =3D $tokens[$xind+2]; } } elsif ($_ =3D~ /$C_FREQUENCY/) { # READ THE FREQUENCY INFORMATION # since there are three vibrations per line, I can determine how # many of these I need to skip before I can read the frequency I need. $skipsize =3D 4 + ($nat+1) + 3; # skip rest header, vibrations and sta= rt header for ($i=3D0; $i; /a\tokens =3D split(' ',$_); if ($test eq 1 ) { print "input $_"; print "($x[$i],$y[$i],$z[$i]) + $displacement x ($tokens[$xind],$to= kens[$xind+1],$tokens[$xind+2])\n"; } printf "%4d % .6f % .6f % .6f\n",$at[$i], $x[$i]+$displacement*$to= kens[$xind], $y[$i]+$displacement*$tokens[$xind+1], $z[$i]+$displacement*$t= okens[$xind+2]; } exit; # AND WE ARE DONE!!!! } elsif (eof) { close IN; exit; } } ################################################## # skiplines : argument n: number of lines to skip ################################################## sub skiplines { local $n, $i; $n =3D shift(/a\_); for ($i=3D0;$i<$n;$i++) { || die "skiplines encountered EOF."; } } ################################################## # usage prints a message about how to use sp2g03 ################################################## sub usage { print < or use:E-mail to administrators: CHEMISTRY-REQUEST/a\ccl.net or usehttp://www.ccl.net/chemistry/sub_unsub.shtmlhttp://www.ccl.net/spammers.txt--_000_A526E77202134A69BCAE22C6E72F66BDrichmondedu_ Content-Type: text/html; charset="iso-8859-1" Content-ID: <277B10532EB38B4F9EA0BEACC3051E88/a\exchange.richmond.edu> Content-Transfer-Encoding: quoted-printable Dear Anjan,

Here is a perl script I wrote some time ago to do that.

Cheers,
Ren=E9


#! /usr/bin/per= l
###############= ################################
# script to tak= e a gaussian log file output and generate structure
# information (= cartesian) for a new structure with a displacement
# along a frequ= ency coordinate in the direction along the '-v' vibration
# for a displac= ement of '-d' times the vibrational vector
#
# command line = arguments:
#
# -h   &nb= sp;    : prints help and quits.
# -d float &nbs= p;: displacement along vibrational mode default 0.1
# -v int  =  : vibration number to use default 1
# required : fi= lename (only sees last one)
###############= #################################

#
$test =3D 0; &n= bsp;# for debugging purposes (prints out extra stuff)

# set up the de= faults
$vibration =3D = 1;
$displacement = =3D 0.1;
$file =3D "= ;";

# 'constants' n= ot using the 'use constant NAME =3D> value;' method.
$C_STRUCTURE = =3D "Standard orientation:";
$C_ENDSTRUCTURE= =3D "---------";
$C_FREQUENCY = =3D "Frequencies --";

while ($#ARGV &= gt;=3D 0) {
  if ($ARG= V[0] eq "-d")    { $displacement =3D $ARGV[1]; shift /a\A= RGV; }
  elsif ($= ARGV[0] eq "-v") { $vibration =3D $ARGV[1]; shift /a\ARGV; }=
  elsif ($= ARGV[0] eq "-h") { &usage(); exit;}
  else { $= file =3D $ARGV[0];}
  shift /a\A= RGV;
}

if ($file eq &q= uot;") { &usage(); exit;}

open(IN,$file) = || die "Could not open file '$file'.\n";

while (1) {
  # read u= ntil I get a structure (should happen first) or a frequency
  until ($= _ =3D <IN>, $_ =3D~ /$C_STRUCTURE/ or $_ =3D~ /$C_FREQUENCY/ or eof) = { }
  if ($_ = =3D~ /$C_STRUCTURE/) {  # READ THE STRUCTURE
    $= nat =3D -1;   # reset the atom index counter : only need last structur= e
    $= at =3D ();    # clear out the arrays of atomnumber, x, y and z
    $= x =3D ();
    $= y =3D ();
    $= z =3D ();
    s= kiplines(4); # position read line to first atom in the list
    w= hile ($_ =3D <IN> and not $_ =3D~ /$C_ENDSTRUCTURE/ ) {
    &= nbsp; /a\tokens =3D split(' ', $_);
    &= nbsp; $nat++;
    &= nbsp; $at[$nat] =3D $tokens[1];
    &= nbsp; $xind =3D $#tokens - 2; # needed if the atomic type is missing (happe= ns sometimes).
    &= nbsp; $x[$nat] =3D $tokens[$xind];
    &= nbsp; $y[$nat] =3D $tokens[$xind+1];
    &= nbsp; $z[$nat] =3D $tokens[$xind+2];
    }=
  } elsif = ($_ =3D~ /$C_FREQUENCY/) { # READ THE FREQUENCY INFORMATION
    #= since there are three vibrations per line, I can determine how
    #= many of these I need to skip before I can read the frequency I need.
    $= skipsize =3D 4 + ($nat+1) + 3;  # skip rest header, vibrat= ions and start header
    f= or ($i=3D0; $i<int($vibration/3); $i++) { skiplines($skipsize); = }
   &n= bsp;
    s= kiplines(4);
    $= xind =3D 2 + (($vibration-1) % 3) * 3; # position in the tokens of vib = vector
    i= f ($test eq 1) { print "vibration =3D $vibration, xind =3D $xind\n&quo= t;; }
    f= or ($i=3D0;$i<=3D$nat;$i++) {
    &= nbsp; $_ =3D <IN>;
    &= nbsp; /a\tokens =3D split(' ',$_);
    &= nbsp; if ($test eq 1 ) {
    &= nbsp;   print "input $_";
    &= nbsp;   print "($x[$i],$y[$i],$z[$i]) + $displacement x ($tok= ens[$xind],$tokens[$xind+1],$tokens[$xind+2])\n";
    &= nbsp; }
    &= nbsp; printf "%4d  % .6f  % .6f  % .6f\n",$at[$i],= $x[$i]+$displacement*$tokens[$xind], $y[$i]+$displacement*$tokens[= $xind+1], $z[$i]+$displacement*$tokens[$xind+2];
    }=
    e= xit; # AND WE ARE DONE!!!!
  } elsif = (eof) { close IN; exit; }
}

###############= ###################################
# skiplines : a= rgument n: number of lines to skip
###############= ###################################
sub skiplines {=
  local $n= , $i;
  $n =3D s= hift(/a\_);
  for ($i= =3D0;$i<$n;$i++) { <IN> || die "skiplines encountered= EOF."; }
}


###############= ###################################
# usage prints = a message about how to use sp2g03
###############= ###################################
sub usage {
print <<E= NDUSAGE;
Usage: nfreq [-= h] [-d displacement] [-v vibrationnnumber] filename

-d : displaceme= nt step along vibrational mode default 0.1
-v : index of v= ibrational mode to follow default 1
-h : prints thi= s help

Will create the= structure '-d' along the '-v'th vibrational mode of the stucture.
ENDUSAGE=
}


On May 8, 2013, at 3:58 PM, Anjan Roy aroy6|,|uic.edu wrote:


Sent to CCL by: "Anjan  Roy" [aroy6!^!uic.edu]
Hello,

My Gaussian 09 opimization returns a negative frequency, one solution sugge= sted
was to distort the molecule in the direction if the negative freq motion. C= ould
someone kindly suggest how I can do this by subtracting structures in the <= br> command line or by way of a GUI.

thank you

Anjan



-=3D This is automatically added to each message by the mailing script =3D-=
E-mail to subscribers: CHEMISTRY/a\ccl.n= et or use:
     http://www.ccl.net/cgi-bin/ccl/send_ccl_message

E-mail to administrators: CHEM= ISTRY-REQUEST/a\ccl.net or use
     http://www.ccl.net/cgi-bin/ccl/send_ccl_message
     http://www.ccl.net/chemistry/sub_unsub.shtml

Before posting, check wait time at: http://w= ww.ccl.net

Job: http://www.ccl.net/jobs
Conferences: http://server.ccl.net/chemistry/announcements/conferences/

Search Messages: http://www.ccl.net/chemistry/searchccl/index.shtml
     h= ttp://www.ccl.net/spammers.txt

RTFI: http:= //www.ccl.net/chemistry/aboutccl/instructions/



--_000_A526E77202134A69BCAE22C6E72F66BDrichmondedu_--