2
c ---------------------------------------------------------------------
3
c computes the xyz coords along the imode normal mode
4
c ---------------------------------------------------------------------
6
subroutine raman_modestep(rtdb,nat3,natom,geom,rmmodes,imode,
7
& iii,first,eigenvecs,eigenvals,ncoords,rminfo,step_size)
13
#include "mafdecls.fh"
16
#include "nwc_const.fh"
21
integer iii ! step number which determines sign
22
integer imode ! mode cordinates are dipsplaced along
23
integer iatom, ixyz, ivec ! counting index
24
integer geom ! [input] geom handle
25
integer rtdb ! [input] rtdb handle
26
integer natom ! [input] number of atoms
27
integer nat3 ! [input] 3*number of atoms
28
integer first ! first mode to consider in aoresponse (default =7 ramana =1 hyperraman)
29
integer tmpmode ! set to fill rminfo from 1 ( not 7 for raman calc)
30
integer rmmodes ! # of raman active modes
32
double precision rminfo(rmmodes,4) ! data for raman spec
33
double precision step_size ! multiplictive factor for step along normal mode
34
double precision sign,bohr2ang ! sign of the step , unit conversion
35
double precision eigenvecs(nat3,nat3) ! [input](xyz&atom,mode)
36
double precision eigenvals(nat3) ! [input] (mode)
37
double precision ncoords(3,natom) ! [scratch] coords after step
38
double precision steps(3,natom) ! [scratch] step generated by vector and scaled
40
parameter (bohr2ang=0.52917724924D+00) ! CONVERSION OF BOHR to ANGSTROMS
41
c -------------determine sign of the step---------------------------------
47
c --- save imode values in rminfo ---
49
rminfo(tmpmode,1) = eigenvals(imode)
50
c --------------------------------------------------------------------
54
steps(ixyz,iatom)=sign*step_size*eigenvecs(ivec,imode)
59
call daxpy(nat3,1.0d00,steps,1,ncoords,1) ! mult coords
60
if (.not. geom_cart_coords_set(geom,ncoords))
61
$ call errquit('raman_modestep: bad geom',0, GEOM_ERR)
66
c --------------------------------------------------------------------
67
c Finite differencing for Raman Scattering Calculations
68
c --------------------------------------------------------------------
70
subroutine fd_raman(rtdb,imode,rmmodes,natom,nat3,alfarex2,
71
& alfarimx2,step_size,rminfo,eigenvecs,mass)
77
#include "mafdecls.fh"
84
integer rmmodes ! # modes used in raman calculation (3N-6)
85
integer i,j,m,ii,jj,mm,ivec ! counting indexes
86
integer rtdb ! [input] rtdb handle
87
integer imode ! mode #
88
integer natom ! [input] number of atoms
89
integer nat3 ! [input] 3*number of atoms
91
double precision rminfo(rmmodes,4) ! raman data
92
double precision step_size,stepsize ! [input] step of finite differencing
93
c double precision laser(nfreq) ! [input] frequency used in AORESPONSE
94
double precision eigenvecs(nat3,nat3) ! [input](xyz&atom,mode)
95
double precision tmode(3,natom) ! [input](atom#,xyz)
96
double precision mass(natom) ! [input](atom#)
97
double precision norm ! constant
98
double precision fdipol(3,3), fdrpol(3,3) ! finite difference
99
double precision alfarex2(6,3), alfarimx2(6,3) ! AORESPONSE date for plus and minus step
100
double precision ar2, ai2, gr2, gi2 ! alpha and g for imode
101
double precision zero, one, two, three, six, seven,
102
& fourty_five, bohr2ang
103
parameter (zero=0.0D+00, one=1.0D+00, two=2.0D+00, three=3.0D+00,
104
& six=6.0D+00, seven=7.0D+00, fourty_five=45.0D+00)
105
parameter (bohr2ang=0.52917724924D+00) ! CONVERSION OF BOHR to ANGSTROMS
107
debug = ( .false. .and. ga_nodeid().eq.0 )
108
c --------------------------------------------------------------------
109
call dfill(9,0.0D+00,fdrpol,1) ! real fdipole polariability for
110
call dfill(9,0.0D+00,fdipol,1) ! imaginary fdipole polariability for
111
call dfill(3*natom,0.0D+00,tmode,1) !
117
ar2 = zero ! alpha real
118
gr2 = zero ! gradient real
119
ai2 = zero ! alpha imaginaruy
120
gi2 = zero ! gradient imaginary
122
c -----------mass weight the normal coordinates--------------------------------
127
tmode(j,i) = eigenvecs(ivec,imode)*sqrt(mass(i))
131
c ---calculate the norm of the qmass---
133
norm = norm + tmode(1,i)*tmode(1,i) +
134
* tmode(2,i)*tmode(2,i) + tmode(3,i)*tmode(3,i)
140
tmode(j,i)= tmode(j,i)/norm
146
tmode(j,i) = tmode(j,i)/sqrt(mass(i))
152
norm = norm + tmode(1,i)*tmode(1,i) + tmode(2,i)*tmode(2,i)
153
* + tmode(3,i)*tmode(3,i)
155
c --- calculate stepsize ---
156
stepsize = step_size/sqrt(norm)
158
if (ga_nodeid().eq.0) write(luout,*) 'Stepsize :',stepsize
159
c --------------------------------------------------------------------
164
c difference polaraizability (real)
165
fdrpol(ii,jj) = alfarex2(ii,jj) - alfarex2(ii+3,jj)
166
c difference polaraizability (imaginary)
167
fdipol(ii,jj) = alfarimx2(ii,jj) - alfarimx2(ii+3,jj)
169
fdrpol(ii,jj) = ( fdrpol(ii,jj)*(bohr2ang**2) )/(two*stepsize)
170
fdipol(ii,jj) = ( fdipol(ii,jj)*(bohr2ang**2) )/(two*stepsize)
173
c ----------calculate a and g for real and impaginary--------
174
ar2 = ( ( (fdrpol(i,j)+fdrpol(i+1,j+1)+fdrpol(i+2,j+2))/three)
175
* *( (fdrpol(i,j)+fdrpol(i+1,j+1)+fdrpol(i+2,j+2))/three) )
177
gr2 = ( ( ((fdrpol(i,j) - fdrpol(i+1,j+1))**2)
178
* + ((fdrpol(i+1,j+1) - fdrpol(i+2,j+2))**2)
179
* + ((fdrpol(i+2,j+2) - fdrpol(i,j ))**2) )
180
* + ( six*((fdrpol(i,j+1) * fdrpol(i,j+1))
181
* + (fdrpol(i+2,j) * fdrpol(i+2,j))
182
* + (fdrpol(i+1,j+2) * fdrpol(i+1,j+2))) ) )/two
184
ai2 = ( ( (fdipol(i,j)+fdipol(i+1,j+1)+fdipol(i+2,j+2))/three)
185
* *( (fdipol(i,j)+fdipol(i+1,j+1)+fdipol(i+2,j+2))/three) )
187
gi2 = ( ( ((fdipol(i,j) - fdipol(i+1,j+1))**2)
188
* + ((fdipol(i+1,j+1) - fdipol(i+2,j+2))**2)
189
* + ((fdipol(i+2,j+2) - fdipol(i,j ))**2) )
190
* + ( six*((fdipol(i,j+1) * fdipol(i,j+1))
191
* + (fdipol(i+2,j) * fdipol(i+2,j))
192
* + (fdipol(i+1,j+2) * fdipol(i+1,j+2))) ) )/two
193
c --------------------------------------------------------------------
195
write(luout,*) 'alfarimx2'
196
call output(alfarimx2,1,6,1,3,6,3,1)
197
write(luout,*) 'alfarex2'
198
call output(alfarex2,1,6,1,3,6,3,1)
199
write(luout,*) 'fdrpol'
200
call output(fdrpol,1,3,1,3,3,3,1)
201
write(luout,*) 'fdipol'
202
call output(fdipol,1,3,1,3,3,3,1)
203
write(luout,*) 'ar2=',ar2
204
write(luout,*) 'gr2=',gr2
205
write(luout,*) 'ai2=',ai2
206
write(luout,*) 'gi2=',gi2
207
write(luout,*) 'stepsize=',stepsize
209
rminfo(m,2) = fourty_five*ar2 + seven*gr2 ! real component
210
rminfo(m,3) = fourty_five*ai2 + seven*gi2 ! imaginary component
211
rminfo(m,4) = fourty_five*ar2 + seven*gr2 + fourty_five*ai2 +
212
& seven*gi2 ! total fdipole_polarizability_derivative
213
c------------ print result from finite difference ---------------------
214
if (ga_nodeid().eq.0) write(luout,9001) rminfo(m,1),rminfo(m,2)
215
if (ga_nodeid().eq.0) write(luout,9002) rminfo(m,1),rminfo(m,3)
216
if (ga_nodeid().eq.0) write(luout,9003) rminfo(m,1),rminfo(m,4)
217
c --------------- save the rminfo for restart -------------------------
218
if (.not. rtdb_put(rtdb, 'raman:rminfo ', mt_dbl,
219
& rmmodes*4, rminfo))
220
& call errquit('FD_raman:failed to write rminfo', 0, RTDB_ERR)
221
c --------------------------------------------------------------------
222
9001 FORMAT(/1X,F7.2,2X,'REAL ',2X,F24.6/)
223
9002 FORMAT(/1X,F7.2,2X,'IMAGINARY',2X,F24.6/)
224
9003 FORMAT(/1X,F7.2,2X,'TOTAL ',2X,F24.6/)
228
c --------------------------------------------------------------------
229
c calculate absolute differential raman scattering cross section.
230
c Producing a raman scattering output file
231
c --------------------------------------------------------------------
233
subroutine raman_scattering(rtdb,start,last,rmmodes,nfreq,plot,
234
& line,width,laser,rminfo)
243
character*16 plot, line
245
integer rmmodes ! number or raman active modes
246
integer rtdb ! [input] rtdb handle
247
integer nfreq ! [input] number of excitation freqencies
248
integer i,j ! counting indexes
249
integer numpts ! number of points in plot
250
integer last ! [input] last mode to calculate for aoresponse
251
integer begin ! first=begin if not restarting, else modified
252
integer start ! [input] first mode to use in calculation of plot
255
Double precision laser(nfreq) ! [input] laser used in AORESPONSE calculation
256
Double precision width ! [input] line width
257
Double precision rminfo(rmmodes,4) ! raman data
258
c Double precision freq(rmmodes) ! [input] number of excitation frequencies used in AORESPONSE
259
Double precision tempfc, frq4th
260
Double precision crs_real(rmmodes) ! real differential cross section
261
Double precision crs_imag(rmmodes) ! imaginary differential cross section
262
Double precision crs_tot(rmmodes) ! total differential cross section
263
Double precision frq, frqmin, frqmax, dfrq ! current, minimum, maximum and step of frequency
264
Double precision afac, bfac, factor ! lineshape factors.
265
Double precision conv_tot, conv_real, conv_imag !
266
Double precision lambda ! exciation inverse wavenumber (1/cm)
267
Double precision widthfac, pi, planck, boltz, speed, epsilon0
268
Double precision avogadro, nm2icm, temp, scale, amu,au2nm
269
Double precision exparg, conver, zero, two, one, forty_five
271
character*255 filename
273
parameter (unitno = 77)
275
parameter (widthfac = 2.35482D+00)
276
parameter (zero = 0.0D+00, one = 1.0D+00,
277
* two = 2.0D+00, forty_five = 45.0D+00)
278
parameter (pi = 3.14159265358979323846D+00)
279
parameter (planck = 6.6260755D-34) ! plank's constant (J*sec)
280
parameter (boltz = 1.3806580D-23) ! bolztmann's constant (J/K)
281
parameter (speed = 2.99792458D+08) ! speed of light (m/sec)
282
parameter (epsilon0 = 8.8541878D-12) ! free permitivity (J^-1C^2m^-1)
283
parameter (avogadro = 6.02214199D+23) ! avagadro's number (unitless)
284
parameter (amu = (one/avogadro)*1.0D-03 ) ! atomic mass unit
285
parameter (au2nm =45.563353D+00) ! converion factor from au to nm
286
parameter (nm2icm = 1.0D+07) !converion factor from nm to 1/cm
287
parameter (temp = 3.0D+02) ! tempature (k)
288
parameter (scale = 1.0D+34)
289
parameter (exparg = (planck*speed*100.0D+00)/boltz )
290
parameter (conver = ( (two*planck*pi*pi)/speed*1.0D-40)/amu ) ! conver = 2*planck_h*pi^2/c * 10^40/atomic_mass_unit
291
parameter (numpts = 1000)
294
debug = .false. ! produce debug output
296
c ----------outline and units of the calculation:---------------------
297
c d(sigma)/d(omega) = h/(8*(epsilon0)^2 *c) *(lambda-lambda_z)^4/lambda_z
298
c /(1-exp(-h*c*lambda_z/(kT))*(scattering factor)/45
299
c differential cross sections:
300
c - constant pre-factor for differential scattering cross sections:
301
c h/(8*(epsilon0)^2*c) = 3.524100053d-21 J^3*s^2*m/C^4
302
c - lambda_t is given in [1/m^3]
303
c - squared polarizability derivatives have to be given in
304
c [C^2*m^2/V^2/kg], but they are given as squared derivatives of
305
c polarizability volumes in [Angstrom^4/amu].
306
c conversion factor: (4*pi*epsilon0)^2*10^-40{Angstrom^4/m^4}
307
c /atomic_mass_unit{amu/kg}
308
c --------------------------------------------------------------------
311
write(6,*) "rmmodes",rmmodes
313
write(6,*) "laser",laser(ifreq)
316
call output(rminfo,1,rmmodes,1,4,rmmodes,4,1)
319
c --- write raman scattering data to file ---
321
call util_file_name(plot,.false.,.false.,filename)
322
open(unitno, status='unknown', form='formatted',file=filename)
324
write(unitno,9002) plot
326
write(unitno,9003) au2nm/laser(ifreq)
328
write(unitno,9004) line
329
write(unitno,9005) width
330
write(unitno,9010) rmmodes
332
if (plot =='normal') then
335
write(unitno,9012) i, rminfo(i,1), rminfo(i,4)
338
else if (plot =='resonance') then
341
write(unitno,9014) i, rminfo(i,1), rminfo(i,4),
342
& rminfo(i,2), rminfo(i,3)
347
c ----------convert laser from au. -> nm -> 1/cm ----------------------------
349
lambda = nm2icm/(au2nm/laser(1))
351
c ------------Calculate differential cross section-----------------------
357
tempfc=1.0D+06/(one-exp(-exparg*rminfo(i,1)/temp))
358
frq4th = (lambda-rminfo(i,1))**4
359
crs_tot(i) = tempfc*frq4th*conver*rminfo(i,4)/
360
* (forty_five*rminfo(i,1))
361
if (plot == 'resonance') then
362
crs_real(i) = tempfc*frq4th*conver*rminfo(i,2)/
363
* (forty_five*rminfo(i,1))
364
crs_imag(i) = tempfc*frq4th*conver*rminfo(i,3)/
365
* (forty_five*rminfo(i,1))
369
frqmin = rminfo(1,1) - 60.0D+00 ! determine plot minimum
370
frqmax = rminfo(rmmodes,1) + 60.0D+00 ! determine plot maximum
371
dfrq = ((frqmax-frqmin)) / (numpts-1) !energy steps determined by numpts
373
c ------calculate lineshape factors for the plot-----------------------
375
if (line == 'lorentzian') then
376
afac = width/(two*pi)
380
if (line == 'gaussian') then
381
width = width/widthfac
382
afac = one/(sqrt(two*pi)*width)
383
bfac = one/(two*width**two)
386
c ----------- make the plot---------------------------------------
388
do i=1,numpts ! loop over number of points
392
frq = frqmin + i*dfrq
393
do j=start,rmmodes ! loop over number of raman active modes
394
if (line == 'lorentzian') then
395
factor = scale*afac/((frq-rminfo(j,1))**2 + bfac**2)
396
else if (line == 'gaussian') then
397
factor = scale*afac*exp(-bfac* (frq-rminfo(j,1))**2)
399
conv_tot = conv_tot + factor*crs_tot(j)
400
if (plot == 'resonance') then
401
conv_real = conv_real + factor*crs_real(j)
402
conv_imag = conv_imag + factor*crs_imag(j)
404
end do ! end loop over rmmodes
406
if (plot == 'normal' ) then
407
write (unitno,9017) frq, conv_tot
408
else if (plot =='resonance') then
409
write(unitno,9018) frq, conv_tot, conv_real, conv_imag
411
end do ! end loop over numpts
415
write(luout,22) filename(1:inp_strlen(filename))
416
22 format(/' Raman scattering data written to ',a/)
417
call util_flush(luout)
419
c --------------------------------------------------------------------
420
9002 FORMAT(/1X,60(1H-)/5X,A16,'Raman Scattering Plot'/1X,60(1H-))
421
9003 FORMAT(1X,'Excitation wavelength',F8.2,1X,'nm')
422
9004 FORMAT(1X,'Convolution lineshape is ',A12)
423
9005 FORMAT(1X,'FWHM',F8.2,1X,' 1/cm'/1X,60(1H-))
424
9006 FORMAT(1X,60(1H-))
425
9010 FORMAT(1X,60(1H-)/1X,'# of frequencies : ',I5)
426
9011 FORMAT(1X,60(1H-)/1X,'# freq [ 1/cm] S [Ang**4/amu]'/
428
9012 FORMAT(1X,I3,F9.2,F14.4)
429
9013 FORMAT(1X,60(1H-)/'# freq [ 1/cm] S-tot [a.u.]',
430
* 'S-real [a.u.] S-imag [a.u.]'/1X,60(1H-))
431
9014 FORMAT(1X,I3,F9.2,3F14.4)
432
9015 FORMAT(1X,I4,F10.2,2E12.4)
433
9016 FORMAT(1X,F10.2,3E12.4)
434
9017 FORMAT(1X,F8.2,G14.4)
435
9018 FORMAT(1X,F8.2,3G14.4)
439
c ----------------end raman_scattering---------------------------------------
441
subroutine raman_save(rtdb,ii,junk3,junk4)
444
#include "errquit.fh"
446
#include "mafdecls.fh"
449
#include "nwc_const.fh"
453
integer i,j,n,ii ! counting indexes
454
integer rtdb ! [input] rtdb handle
455
double precision alfare(3,3),alfaim(3,3) ! [aoresponse] real and imaginary polarizanbility
456
double precision junk3(6,3),junk4(6,3) ! temp. arrays for FD of polarizanbility
460
debug = (.false. .and. ga_nodeid().eq.0) ! produce debug output
461
status = rtdb_parallel(.true.)
462
c -------------get raman ploarizability from rtdb ----------------------------
463
if (.not. rtdb_get(rtdb, 'raman:alfare ', mt_dbl, 9, alfare))
464
& call errquit('raman_save:failed to get alfare', 1, RTDB_ERR)
465
if (.not. rtdb_get(rtdb, 'raman:alfaim ', mt_dbl, 9, alfaim))
466
& call errquit('raman_save:failed to get alfaim', 2, RTDB_ERR)
472
junk3(n,j)= alfare(i,j) ! add AORESPONSE real data to array for finite_differencing
473
junk4(n,j)= alfaim(i,j) ! add AORESPONSE imaginary data to array for finite_differencing
476
c -------------delete raman ploarizability from rtdb ----------------------------
478
write(luout,*) 'junk3'
479
call output(junk3,1,6,1,3,6,3,1)
480
write(luout,*) 'junk4'
481
call output(junk4,1,6,1,3,6,3,1)
482
write(luout,*) 'alfare'
483
call output(alfare,1,3,1,3,3,3,1)
484
write(luout,*) 'alfaim'
485
call output(alfaim,1,3,1,3,3,3,1)
490
c ----------------end raman_save------------------------------------------------
491
c $Id: raman.F 21176 2011-10-10 06:35:49Z d3y133 $