Ejemplo n.º 1
0
                        sys.exit(2)
            if i<9:
                mode = 'm0' + str(i+1)
            else:
                mode = 'm' + str(i+1)
            file = filename.replace('template', mode + step)

            to_file(s, file)
#
# start of main program
#

# read input from Gaussian formatted checkpoint file, name of
# file is the first argument to this script.
print get_gaussian_results.__doc__
h,atom_l,mass_l,cart_l=get_gaussian_results(sys.argv[1])
print 'Hessian=',h
print 'List of atoms=',atom_l
print 'Atomic masses=',mass_l
print 'Atomic Cartesian coordinates (in Angstrom):'
i=0
for atom in atom_l:
    print "%s%18.8f%14.8f%14.8f" % (atom,cart_l[i:i+3][0]*au2ang,
                                    cart_l[i:i+3][1]*au2ang,
                                    cart_l[i:i+3][2]*au2ang)
    i+=3

print compute_normal_coord.__doc__
Q,f=compute_normal_coord(h,mass_l)
print "freq=",f*au2cm
print 'zpve=',sum(f)/2*au2kcal,'kcal/mole'
    sys.exit(0)

filename=sys.argv[1]
mode=int(sys.argv[2])
print 'Gaussian formatted checkpoint file:',filename
print 'XYZ structures created for normal mode:',mode

def generate_mode_sequence(atom_l,cart_l,Q,mode):
    nsteps=15
    nr_atoms=len(atom_l)
    (N,nr_modes)=shape(Q)

    out=open('normal_mode_sequence_m'+str(mode)+'.xyz','w')

    for i in range(nsteps):
        factor = 10.0*sin( pi* (float(i)/float(nsteps)-0.5) )
        xyz = cart_l[:] + factor*Q[:,mode-1]

        out.write(str(nr_atoms)+2*'\n')
        for k in range(nr_atoms):
            line='%s%20.8f%20.8f%20.8f\n' %  \
                (atom_l[k],xyz[k*3]*au2ang,xyz[k*3+1]*au2ang,xyz[k*3+2]*au2ang)
            out.write(line)

h,atom_l,mass_l,cart_l=get_gaussian_results(filename)
Q,f=compute_normal_coord(h,mass_l)
print "freq=",f[mode-1]*au2cm
generate_mode_sequence(atom_l,cart_l,Q,mode)

print '*** End of program ***'