1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
+ |
|
43 |
|
module shapes |
44 |
|
|
45 |
|
use force_globals |
48 |
|
use vector_class |
49 |
|
use simulation |
50 |
|
use status |
51 |
+ |
use lj |
52 |
|
#ifdef IS_MPI |
53 |
|
use mpiSimulation |
54 |
|
#endif |
67 |
|
|
68 |
|
public :: do_shape_pair |
69 |
|
public :: newShapeType |
70 |
+ |
public :: complete_Shape_FF |
71 |
|
|
72 |
|
|
73 |
|
type, private :: Shape |
104 |
|
type(ShapeList), save :: ShapeMap |
105 |
|
|
106 |
|
integer :: lmax |
63 |
– |
real (kind=dp), allocatable, dimension(:,:) :: plm_i, dlm_i, plm_j, dlm_j |
64 |
– |
real (kind=dp), allocatable, dimension(:) :: tm_i, dtm_i, um_i, dum_i |
65 |
– |
real (kind=dp), allocatable, dimension(:) :: tm_j, dtm_j, um_j, dum_j |
107 |
|
|
108 |
|
contains |
109 |
|
|
112 |
|
nRangeFuncs, RangeFuncLValue, RangeFuncMValue, RangeFunctionType, & |
113 |
|
RangeFuncCoefficient, nStrengthFuncs, StrengthFuncLValue, & |
114 |
|
StrengthFuncMValue, StrengthFunctionType, StrengthFuncCoefficient, & |
115 |
< |
myAtid, status) |
115 |
> |
myATID, status) |
116 |
|
|
117 |
|
integer :: nContactFuncs |
118 |
|
integer :: nRangeFuncs |
119 |
|
integer :: nStrengthFuncs |
120 |
|
integer :: shape_ident |
121 |
|
integer :: status |
122 |
< |
integer :: myAtid |
122 |
> |
integer :: myATID |
123 |
|
integer :: bigL |
124 |
|
integer :: bigM |
125 |
|
integer :: j, me, nShapeTypes, nLJTypes, ntypes, current, alloc_stat |
145 |
|
call getMatchingElementList(atypes, "is_Shape", .true., & |
146 |
|
nShapeTypes, MatchList) |
147 |
|
|
148 |
< |
call getMatchingElementList(atypes, "is_LJ", .true., & |
148 |
> |
call getMatchingElementList(atypes, "is_LennardJones", .true., & |
149 |
|
nLJTypes, MatchList) |
150 |
|
|
151 |
|
ShapeMap%n_shapes = nShapeTypes + nLJTypes |
154 |
|
|
155 |
|
ntypes = getSize(atypes) |
156 |
|
|
157 |
< |
allocate(ShapeMap%atidToShape(ntypes)) |
157 |
> |
allocate(ShapeMap%atidToShape(0:ntypes)) |
158 |
|
end if |
159 |
|
|
160 |
|
ShapeMap%currentShape = ShapeMap%currentShape + 1 |
167 |
|
return |
168 |
|
endif |
169 |
|
|
170 |
< |
call getElementProperty(atypes, myAtid, "c_ident", me) |
170 |
> |
call getElementProperty(atypes, myATID, 'c_ident', me) |
171 |
> |
|
172 |
|
ShapeMap%atidToShape(me) = current |
173 |
|
ShapeMap%Shapes(current)%atid = me |
174 |
|
ShapeMap%Shapes(current)%nContactFuncs = nContactFuncs |
228 |
|
integer, intent(out) :: stat |
229 |
|
integer :: alloc_stat |
230 |
|
|
231 |
+ |
stat = 0 |
232 |
|
if (associated(myShape%contactFuncLValue)) then |
233 |
|
deallocate(myShape%contactFuncLValue) |
234 |
|
endif |
294 |
|
stat = -1 |
295 |
|
return |
296 |
|
endif |
297 |
< |
|
297 |
> |
|
298 |
|
if (associated(myShape%strengthFuncLValue)) then |
299 |
|
deallocate(myShape%strengthFuncLValue) |
300 |
|
endif |
327 |
|
stat = -1 |
328 |
|
return |
329 |
|
endif |
330 |
+ |
|
331 |
+ |
return |
332 |
|
|
333 |
|
end subroutine allocateShape |
334 |
|
|
335 |
< |
subroutine init_Shape_FF(status) |
335 |
> |
subroutine complete_Shape_FF(status) |
336 |
|
integer :: status |
337 |
|
integer :: i, j, l, m, lm, function_type |
338 |
< |
real(kind=dp) :: bigSigma, myBigSigma, thisSigma, coeff, Phunc, spi |
294 |
< |
real(kind=dp) :: costheta, cpi, theta, Pi, phi, thisDP |
338 |
> |
real(kind=dp) :: thisDP, sigma |
339 |
|
integer :: alloc_stat, iTheta, iPhi, nSteps, nAtypes, thisIP, current |
340 |
|
logical :: thisProperty |
341 |
|
|
298 |
– |
Pi = 4.0d0 * datan(1.0d0) |
299 |
– |
|
342 |
|
status = 0 |
343 |
|
if (ShapeMap%currentShape == 0) then |
344 |
|
call handleError("init_Shape_FF", "No members in ShapeMap") |
345 |
|
status = -1 |
346 |
|
return |
347 |
|
end if |
348 |
< |
|
307 |
< |
bigSigma = 0.0d0 |
308 |
< |
do i = 1, ShapeMap%currentShape |
309 |
< |
|
310 |
< |
! Scan over theta and phi to |
311 |
< |
! find the largest contact in any direction.... |
312 |
< |
|
313 |
< |
myBigSigma = 0.0d0 |
314 |
< |
|
315 |
< |
do iTheta = 0, nSteps |
316 |
< |
theta = (Pi/2.0d0)*(dble(iTheta)/dble(nSteps)) |
317 |
< |
costheta = cos(theta) |
318 |
< |
|
319 |
< |
call Associated_Legendre(costheta, ShapeMap%Shapes(i)%bigL, & |
320 |
< |
ShapeMap%Shapes(i)%bigM, lmax, plm_i, dlm_i) |
321 |
< |
|
322 |
< |
do iPhi = 0, nSteps |
323 |
< |
phi = -Pi + 2.0d0 * Pi * (dble(iPhi)/dble(nSteps)) |
324 |
< |
cpi = cos(phi) |
325 |
< |
spi = sin(phi) |
326 |
< |
|
327 |
< |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(i)%bigM, & |
328 |
< |
CHEBYSHEV_TN, tm_i, dtm_i) |
329 |
< |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(i)%bigM, & |
330 |
< |
CHEBYSHEV_UN, um_i, dum_i) |
331 |
< |
|
332 |
< |
thisSigma = 0.0d0 |
333 |
< |
|
334 |
< |
do lm = 1, ShapeMap%Shapes(i)%nContactFuncs |
335 |
< |
|
336 |
< |
l = ShapeMap%Shapes(i)%ContactFuncLValue(lm) |
337 |
< |
m = ShapeMap%Shapes(i)%ContactFuncMValue(lm) |
338 |
< |
coeff = ShapeMap%Shapes(i)%ContactFuncCoefficient(lm) |
339 |
< |
function_type = ShapeMap%Shapes(i)%ContactFunctionType(lm) |
340 |
< |
|
341 |
< |
if ((function_type .eq. SH_COS).or.(m.eq.0)) then |
342 |
< |
Phunc = coeff * tm_i(m) |
343 |
< |
else |
344 |
< |
Phunc = coeff * spi * um_i(m-1) |
345 |
< |
endif |
346 |
< |
|
347 |
< |
thisSigma = thisSigma + plm_i(l,m)*Phunc |
348 |
< |
enddo |
349 |
< |
|
350 |
< |
if (thisSigma.gt.myBigSigma) myBigSigma = thisSigma |
351 |
< |
enddo |
352 |
< |
enddo |
353 |
< |
|
354 |
< |
if (myBigSigma.gt.bigSigma) bigSigma = myBigSigma |
355 |
< |
enddo |
356 |
< |
|
348 |
> |
|
349 |
|
nAtypes = getSize(atypes) |
350 |
|
|
351 |
|
if (nAtypes == 0) then |
353 |
|
return |
354 |
|
end if |
355 |
|
|
356 |
< |
do i = 1, nAtypes |
356 |
> |
! atypes comes from c side |
357 |
> |
do i = 0, nAtypes |
358 |
|
|
359 |
< |
call getElementProperty(atypes, i, "is_LJ", thisProperty) |
359 |
> |
call getElementProperty(atypes, i, "is_LennardJones", thisProperty) |
360 |
|
|
361 |
|
if (thisProperty) then |
362 |
|
|
369 |
|
|
370 |
|
ShapeMap%Shapes(current)%isLJ = .true. |
371 |
|
|
372 |
< |
call getElementProperty(atypes, i, "lj_epsilon", thisDP) |
373 |
< |
ShapeMap%Shapes(current)%epsilon = thisDP |
381 |
< |
|
382 |
< |
call getElementProperty(atypes, i, "lj_sigma", thisDP) |
383 |
< |
ShapeMap%Shapes(current)%sigma = thisDP |
384 |
< |
if (thisDP .gt. bigSigma) bigSigma = thisDP |
372 |
> |
ShapeMap%Shapes(current)%epsilon = getEpsilon(thisIP) |
373 |
> |
ShapeMap%Shapes(current)%sigma = getSigma(thisIP) |
374 |
|
|
375 |
|
endif |
376 |
|
|
378 |
|
|
379 |
|
haveShapeMap = .true. |
380 |
|
|
381 |
< |
end subroutine init_Shape_FF |
381 |
> |
end subroutine complete_Shape_FF |
382 |
|
|
383 |
|
subroutine do_shape_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
384 |
|
pot, A, f, t, do_pot) |
385 |
|
|
386 |
+ |
INTEGER, PARAMETER:: LMAX = 64 |
387 |
+ |
INTEGER, PARAMETER:: MMAX = 64 |
388 |
+ |
|
389 |
|
integer, intent(in) :: atom1, atom2 |
390 |
|
real (kind=dp), intent(inout) :: rij, r2 |
391 |
|
real (kind=dp), dimension(3), intent(in) :: d |
392 |
|
real (kind=dp), dimension(3), intent(inout) :: fpair |
393 |
< |
real (kind=dp) :: pot, vpair, sw |
393 |
> |
real (kind=dp) :: pot, vpair, sw, dswdr |
394 |
|
real (kind=dp), dimension(9,nLocal) :: A |
395 |
|
real (kind=dp), dimension(3,nLocal) :: f |
396 |
|
real (kind=dp), dimension(3,nLocal) :: t |
401 |
|
integer :: l, m, lm, id1, id2, localError, function_type |
402 |
|
real (kind=dp) :: sigma_i, s_i, eps_i, sigma_j, s_j, eps_j |
403 |
|
real (kind=dp) :: coeff |
404 |
+ |
real (kind=dp) :: pot_temp |
405 |
|
|
406 |
|
real (kind=dp) :: dsigmaidx, dsigmaidy, dsigmaidz |
407 |
|
real (kind=dp) :: dsigmaidux, dsigmaiduy, dsigmaiduz |
420 |
|
|
421 |
|
real (kind=dp) :: xi, yi, zi, xj, yj, zj, xi2, yi2, zi2, xj2, yj2, zj2 |
422 |
|
|
423 |
+ |
real (kind=dp) :: sti2, stj2 |
424 |
+ |
|
425 |
|
real (kind=dp) :: proji, proji3, projj, projj3 |
426 |
|
real (kind=dp) :: cti, ctj, cpi, cpj, spi, spj |
427 |
|
real (kind=dp) :: Phunc, sigma, s, eps, rtdenom, rt |
480 |
|
real (kind=dp) :: fxji, fyji, fzji, fxjj, fyjj, fzjj |
481 |
|
real (kind=dp) :: fxradial, fyradial, fzradial |
482 |
|
|
483 |
+ |
real (kind=dp) :: plm_i(0:LMAX,0:MMAX), dlm_i(0:LMAX,0:MMAX) |
484 |
+ |
real (kind=dp) :: plm_j(0:LMAX,0:MMAX), dlm_j(0:LMAX,0:MMAX) |
485 |
+ |
real (kind=dp) :: tm_i(0:MMAX), dtm_i(0:MMAX), um_i(0:MMAX), dum_i(0:MMAX) |
486 |
+ |
real (kind=dp) :: tm_j(0:MMAX), dtm_j(0:MMAX), um_j(0:MMAX), dum_j(0:MMAX) |
487 |
+ |
|
488 |
|
if (.not.haveShapeMap) then |
489 |
|
call handleError("calc_shape", "NO SHAPEMAP!!!!") |
490 |
|
return |
492 |
|
|
493 |
|
!! We assume that the rotation matrices have already been calculated |
494 |
|
!! and placed in the A array. |
495 |
< |
|
495 |
> |
|
496 |
|
r3 = r2*rij |
497 |
|
r5 = r3*r2 |
498 |
|
|
514 |
|
#endif |
515 |
|
|
516 |
|
! use the atid to find the shape type (st) for each atom: |
517 |
– |
|
517 |
|
st1 = ShapeMap%atidToShape(atid1) |
518 |
|
st2 = ShapeMap%atidToShape(atid2) |
519 |
< |
|
519 |
> |
|
520 |
|
if (ShapeMap%Shapes(st1)%isLJ) then |
521 |
+ |
|
522 |
|
sigma_i = ShapeMap%Shapes(st1)%sigma |
523 |
|
s_i = ShapeMap%Shapes(st1)%sigma |
524 |
|
eps_i = ShapeMap%Shapes(st1)%epsilon |
559 |
|
zi = a(7,atom1)*d(1) + a(8,atom1)*d(2) + a(9,atom1)*d(3) |
560 |
|
|
561 |
|
#endif |
562 |
< |
|
562 |
> |
|
563 |
|
xi2 = xi*xi |
564 |
|
yi2 = yi*yi |
565 |
< |
zi2 = zi*zi |
566 |
< |
|
567 |
< |
proji = sqrt(xi2 + yi2) |
568 |
< |
proji3 = proji*proji*proji |
569 |
< |
|
565 |
> |
zi2 = zi*zi |
566 |
|
cti = zi / rij |
567 |
+ |
|
568 |
+ |
if (cti .gt. 1.0_dp) cti = 1.0_dp |
569 |
+ |
if (cti .lt. -1.0_dp) cti = -1.0_dp |
570 |
+ |
|
571 |
|
dctidx = - zi * xi / r3 |
572 |
|
dctidy = - zi * yi / r3 |
573 |
|
dctidz = 1.0d0 / rij - zi2 / r3 |
574 |
< |
dctidux = yi / rij |
575 |
< |
dctiduy = -xi / rij |
576 |
< |
dctiduz = 0.0d0 |
574 |
> |
dctidux = - (zi * xi2) / r3 |
575 |
> |
dctiduy = - (zi * yi2) / r3 |
576 |
> |
dctiduz = zi / rij - (zi2 * zi) / r3 |
577 |
> |
|
578 |
> |
! this is an attempt to try to truncate the singularity when |
579 |
> |
! sin(theta) is near 0.0: |
580 |
> |
|
581 |
> |
sti2 = 1.0_dp - cti*cti |
582 |
> |
if (dabs(sti2) .lt. 1.0d-12) then |
583 |
> |
proji = sqrt(rij * 1.0d-12) |
584 |
> |
dcpidx = 1.0d0 / proji |
585 |
> |
dcpidy = 0.0d0 |
586 |
> |
dcpidux = xi / proji |
587 |
> |
dcpiduy = 0.0d0 |
588 |
> |
dspidx = 0.0d0 |
589 |
> |
dspidy = 1.0d0 / proji |
590 |
> |
dspidux = 0.0d0 |
591 |
> |
dspiduy = yi / proji |
592 |
> |
else |
593 |
> |
proji = sqrt(xi2 + yi2) |
594 |
> |
proji3 = proji*proji*proji |
595 |
> |
dcpidx = 1.0d0 / proji - xi2 / proji3 |
596 |
> |
dcpidy = - xi * yi / proji3 |
597 |
> |
dcpidux = xi / proji - (xi2 * xi) / proji3 |
598 |
> |
dcpiduy = - (xi * yi2) / proji3 |
599 |
> |
dspidx = - xi * yi / proji3 |
600 |
> |
dspidy = 1.0d0 / proji - yi2 / proji3 |
601 |
> |
dspidux = - (yi * xi2) / proji3 |
602 |
> |
dspiduy = yi / proji - (yi2 * yi) / proji3 |
603 |
> |
endif |
604 |
|
|
605 |
|
cpi = xi / proji |
579 |
– |
dcpidx = 1.0d0 / proji - xi2 / proji3 |
580 |
– |
dcpidy = - xi * yi / proji3 |
606 |
|
dcpidz = 0.0d0 |
607 |
< |
dcpidux = xi * yi * zi / proji3 |
583 |
< |
dcpiduy = -zi * (1.0d0 / proji - xi2 / proji3) |
584 |
< |
dcpiduz = -yi * (1.0d0 / proji - xi2 / proji3) - (xi2 * yi / proji3) |
607 |
> |
dcpiduz = 0.0d0 |
608 |
|
|
609 |
|
spi = yi / proji |
587 |
– |
dspidx = - xi * yi / proji3 |
588 |
– |
dspidy = 1.0d0 / proji - yi2 / proji3 |
610 |
|
dspidz = 0.0d0 |
611 |
< |
dspidux = -zi * (1.0d0 / proji - yi2 / proji3) |
591 |
< |
dspiduy = xi * yi * zi / proji3 |
592 |
< |
dspiduz = xi * (1.0d0 / proji - yi2 / proji3) + (xi * yi2 / proji3) |
611 |
> |
dspiduz = 0.0d0 |
612 |
|
|
613 |
< |
call Associated_Legendre(cti, ShapeMap%Shapes(st1)%bigL, & |
614 |
< |
ShapeMap%Shapes(st1)%bigM, lmax, plm_i, dlm_i) |
613 |
> |
call Associated_Legendre(cti, ShapeMap%Shapes(st1)%bigM, & |
614 |
> |
ShapeMap%Shapes(st1)%bigL, LMAX, & |
615 |
> |
plm_i, dlm_i) |
616 |
|
|
617 |
< |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(st1)%bigM, & |
617 |
> |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(st1)%bigM, MMAX, & |
618 |
|
CHEBYSHEV_TN, tm_i, dtm_i) |
619 |
< |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(st1)%bigM, & |
619 |
> |
call Orthogonal_Polynomial(cpi, ShapeMap%Shapes(st1)%bigM, MMAX, & |
620 |
|
CHEBYSHEV_UN, um_i, dum_i) |
621 |
|
|
622 |
|
sigma_i = 0.0d0 |
665 |
|
dPhuncdUz = coeff*(spi * dum_i(m-1)*dcpiduz + dspiduz *um_i(m-1)) |
666 |
|
endif |
667 |
|
|
668 |
< |
sigma_i = sigma_i + plm_i(l,m)*Phunc |
668 |
> |
sigma_i = sigma_i + plm_i(m,l)*Phunc |
669 |
> |
|
670 |
> |
dsigmaidx = dsigmaidx + plm_i(m,l)*dPhuncdX + & |
671 |
> |
Phunc * dlm_i(m,l) * dctidx |
672 |
> |
dsigmaidy = dsigmaidy + plm_i(m,l)*dPhuncdY + & |
673 |
> |
Phunc * dlm_i(m,l) * dctidy |
674 |
> |
dsigmaidz = dsigmaidz + plm_i(m,l)*dPhuncdZ + & |
675 |
> |
Phunc * dlm_i(m,l) * dctidz |
676 |
|
|
677 |
< |
dsigmaidx = dsigmaidx + plm_i(l,m)*dPhuncdX + & |
678 |
< |
Phunc * dlm_i(l,m) * dctidx |
679 |
< |
dsigmaidy = dsigmaidy + plm_i(l,m)*dPhuncdY + & |
680 |
< |
Phunc * dlm_i(l,m) * dctidy |
681 |
< |
dsigmaidz = dsigmaidz + plm_i(l,m)*dPhuncdZ + & |
682 |
< |
Phunc * dlm_i(l,m) * dctidz |
656 |
< |
|
657 |
< |
dsigmaidux = dsigmaidux + plm_i(l,m)* dPhuncdUx + & |
658 |
< |
Phunc * dlm_i(l,m) * dctidux |
659 |
< |
dsigmaiduy = dsigmaiduy + plm_i(l,m)* dPhuncdUy + & |
660 |
< |
Phunc * dlm_i(l,m) * dctiduy |
661 |
< |
dsigmaiduz = dsigmaiduz + plm_i(l,m)* dPhuncdUz + & |
662 |
< |
Phunc * dlm_i(l,m) * dctiduz |
677 |
> |
dsigmaidux = dsigmaidux + plm_i(m,l)* dPhuncdUx + & |
678 |
> |
Phunc * dlm_i(m,l) * dctidux |
679 |
> |
dsigmaiduy = dsigmaiduy + plm_i(m,l)* dPhuncdUy + & |
680 |
> |
Phunc * dlm_i(m,l) * dctiduy |
681 |
> |
dsigmaiduz = dsigmaiduz + plm_i(m,l)* dPhuncdUz + & |
682 |
> |
Phunc * dlm_i(m,l) * dctiduz |
683 |
|
|
684 |
|
end do |
685 |
|
|
707 |
|
dPhuncdUz = coeff*(spi * dum_i(m-1)*dcpiduz + dspiduz *um_i(m-1)) |
708 |
|
endif |
709 |
|
|
710 |
< |
s_i = s_i + plm_i(l,m)*Phunc |
710 |
> |
s_i = s_i + plm_i(m,l)*Phunc |
711 |
|
|
712 |
< |
dsidx = dsidx + plm_i(l,m)*dPhuncdX + & |
713 |
< |
Phunc * dlm_i(l,m) * dctidx |
714 |
< |
dsidy = dsidy + plm_i(l,m)*dPhuncdY + & |
715 |
< |
Phunc * dlm_i(l,m) * dctidy |
716 |
< |
dsidz = dsidz + plm_i(l,m)*dPhuncdZ + & |
717 |
< |
Phunc * dlm_i(l,m) * dctidz |
712 |
> |
dsidx = dsidx + plm_i(m,l)*dPhuncdX + & |
713 |
> |
Phunc * dlm_i(m,l) * dctidx |
714 |
> |
dsidy = dsidy + plm_i(m,l)*dPhuncdY + & |
715 |
> |
Phunc * dlm_i(m,l) * dctidy |
716 |
> |
dsidz = dsidz + plm_i(m,l)*dPhuncdZ + & |
717 |
> |
Phunc * dlm_i(m,l) * dctidz |
718 |
|
|
719 |
< |
dsidux = dsidux + plm_i(l,m)* dPhuncdUx + & |
720 |
< |
Phunc * dlm_i(l,m) * dctidux |
721 |
< |
dsiduy = dsiduy + plm_i(l,m)* dPhuncdUy + & |
722 |
< |
Phunc * dlm_i(l,m) * dctiduy |
723 |
< |
dsiduz = dsiduz + plm_i(l,m)* dPhuncdUz + & |
724 |
< |
Phunc * dlm_i(l,m) * dctiduz |
719 |
> |
dsidux = dsidux + plm_i(m,l)* dPhuncdUx + & |
720 |
> |
Phunc * dlm_i(m,l) * dctidux |
721 |
> |
dsiduy = dsiduy + plm_i(m,l)* dPhuncdUy + & |
722 |
> |
Phunc * dlm_i(m,l) * dctiduy |
723 |
> |
dsiduz = dsiduz + plm_i(m,l)* dPhuncdUz + & |
724 |
> |
Phunc * dlm_i(m,l) * dctiduz |
725 |
|
|
726 |
|
end do |
727 |
|
|
749 |
|
dPhuncdUz = coeff*(spi * dum_i(m-1)*dcpiduz + dspiduz *um_i(m-1)) |
750 |
|
endif |
751 |
|
|
752 |
< |
eps_i = eps_i + plm_i(l,m)*Phunc |
752 |
> |
eps_i = eps_i + plm_i(m,l)*Phunc |
753 |
|
|
754 |
< |
depsidx = depsidx + plm_i(l,m)*dPhuncdX + & |
755 |
< |
Phunc * dlm_i(l,m) * dctidx |
756 |
< |
depsidy = depsidy + plm_i(l,m)*dPhuncdY + & |
757 |
< |
Phunc * dlm_i(l,m) * dctidy |
758 |
< |
depsidz = depsidz + plm_i(l,m)*dPhuncdZ + & |
759 |
< |
Phunc * dlm_i(l,m) * dctidz |
754 |
> |
depsidx = depsidx + plm_i(m,l)*dPhuncdX + & |
755 |
> |
Phunc * dlm_i(m,l) * dctidx |
756 |
> |
depsidy = depsidy + plm_i(m,l)*dPhuncdY + & |
757 |
> |
Phunc * dlm_i(m,l) * dctidy |
758 |
> |
depsidz = depsidz + plm_i(m,l)*dPhuncdZ + & |
759 |
> |
Phunc * dlm_i(m,l) * dctidz |
760 |
|
|
761 |
< |
depsidux = depsidux + plm_i(l,m)* dPhuncdUx + & |
762 |
< |
Phunc * dlm_i(l,m) * dctidux |
763 |
< |
depsiduy = depsiduy + plm_i(l,m)* dPhuncdUy + & |
764 |
< |
Phunc * dlm_i(l,m) * dctiduy |
765 |
< |
depsiduz = depsiduz + plm_i(l,m)* dPhuncdUz + & |
766 |
< |
Phunc * dlm_i(l,m) * dctiduz |
761 |
> |
depsidux = depsidux + plm_i(m,l)* dPhuncdUx + & |
762 |
> |
Phunc * dlm_i(m,l) * dctidux |
763 |
> |
depsiduy = depsiduy + plm_i(m,l)* dPhuncdUy + & |
764 |
> |
Phunc * dlm_i(m,l) * dctiduy |
765 |
> |
depsiduz = depsiduz + plm_i(m,l)* dPhuncdUz + & |
766 |
> |
Phunc * dlm_i(m,l) * dctiduz |
767 |
|
|
768 |
|
end do |
769 |
|
|
816 |
|
xj2 = xj*xj |
817 |
|
yj2 = yj*yj |
818 |
|
zj2 = zj*zj |
799 |
– |
|
800 |
– |
projj = sqrt(xj2 + yj2) |
801 |
– |
projj3 = projj*projj*projj |
802 |
– |
|
819 |
|
ctj = zj / rij |
820 |
+ |
|
821 |
+ |
if (ctj .gt. 1.0_dp) ctj = 1.0_dp |
822 |
+ |
if (ctj .lt. -1.0_dp) ctj = -1.0_dp |
823 |
+ |
|
824 |
|
dctjdx = - zj * xj / r3 |
825 |
|
dctjdy = - zj * yj / r3 |
826 |
|
dctjdz = 1.0d0 / rij - zj2 / r3 |
827 |
< |
dctjdux = yj / rij |
828 |
< |
dctjduy = -xj / rij |
829 |
< |
dctjduz = 0.0d0 |
827 |
> |
dctjdux = - (zi * xj2) / r3 |
828 |
> |
dctjduy = - (zj * yj2) / r3 |
829 |
> |
dctjduz = zj / rij - (zj2 * zj) / r3 |
830 |
|
|
831 |
+ |
! this is an attempt to try to truncate the singularity when |
832 |
+ |
! sin(theta) is near 0.0: |
833 |
+ |
|
834 |
+ |
stj2 = 1.0_dp - ctj*ctj |
835 |
+ |
if (dabs(stj2) .lt. 1.0d-12) then |
836 |
+ |
projj = sqrt(rij * 1.0d-12) |
837 |
+ |
dcpjdx = 1.0d0 / projj |
838 |
+ |
dcpjdy = 0.0d0 |
839 |
+ |
dcpjdux = xj / projj |
840 |
+ |
dcpjduy = 0.0d0 |
841 |
+ |
dspjdx = 0.0d0 |
842 |
+ |
dspjdy = 1.0d0 / projj |
843 |
+ |
dspjdux = 0.0d0 |
844 |
+ |
dspjduy = yj / projj |
845 |
+ |
else |
846 |
+ |
projj = sqrt(xj2 + yj2) |
847 |
+ |
projj3 = projj*projj*projj |
848 |
+ |
dcpjdx = 1.0d0 / projj - xj2 / projj3 |
849 |
+ |
dcpjdy = - xj * yj / projj3 |
850 |
+ |
dcpjdux = xj / projj - (xj2 * xj) / projj3 |
851 |
+ |
dcpjduy = - (xj * yj2) / projj3 |
852 |
+ |
dspjdx = - xj * yj / projj3 |
853 |
+ |
dspjdy = 1.0d0 / projj - yj2 / projj3 |
854 |
+ |
dspjdux = - (yj * xj2) / projj3 |
855 |
+ |
dspjduy = yj / projj - (yj2 * yj) / projj3 |
856 |
+ |
endif |
857 |
+ |
|
858 |
|
cpj = xj / projj |
812 |
– |
dcpjdx = 1.0d0 / projj - xj2 / projj3 |
813 |
– |
dcpjdy = - xj * yj / projj3 |
859 |
|
dcpjdz = 0.0d0 |
860 |
< |
dcpjdux = xj * yj * zj / projj3 |
816 |
< |
dcpjduy = -zj * (1.0d0 / projj - xj2 / projj3) |
817 |
< |
dcpjduz = -yj * (1.0d0 / projj - xj2 / projj3) - (xj2 * yj / projj3) |
860 |
> |
dcpjduz = 0.0d0 |
861 |
|
|
862 |
|
spj = yj / projj |
820 |
– |
dspjdx = - xj * yj / projj3 |
821 |
– |
dspjdy = 1.0d0 / projj - yj2 / projj3 |
863 |
|
dspjdz = 0.0d0 |
864 |
< |
dspjdux = -zj * (1.0d0 / projj - yj2 / projj3) |
865 |
< |
dspjduy = xj * yj * zj / projj3 |
866 |
< |
dspjduz = xj * (1.0d0 / projj - yi2 / projj3) + (xj * yj2 / projj3) |
864 |
> |
dspjduz = 0.0d0 |
865 |
> |
|
866 |
> |
|
867 |
> |
write(*,*) 'dcpdu = ' ,dcpidux, dcpiduy, dcpiduz |
868 |
> |
write(*,*) 'dcpdu = ' ,dcpjdux, dcpjduy, dcpjduz |
869 |
> |
call Associated_Legendre(ctj, ShapeMap%Shapes(st2)%bigM, & |
870 |
> |
ShapeMap%Shapes(st2)%bigL, LMAX, & |
871 |
> |
plm_j, dlm_j) |
872 |
|
|
873 |
< |
call Associated_Legendre(ctj, ShapeMap%Shapes(st2)%bigL, & |
828 |
< |
ShapeMap%Shapes(st2)%bigM, lmax, plm_j, dlm_j) |
829 |
< |
|
830 |
< |
call Orthogonal_Polynomial(cpj, ShapeMap%Shapes(st2)%bigM, & |
873 |
> |
call Orthogonal_Polynomial(cpj, ShapeMap%Shapes(st2)%bigM, MMAX, & |
874 |
|
CHEBYSHEV_TN, tm_j, dtm_j) |
875 |
< |
call Orthogonal_Polynomial(cpj, ShapeMap%Shapes(st2)%bigM, & |
875 |
> |
call Orthogonal_Polynomial(cpj, ShapeMap%Shapes(st2)%bigM, MMAX, & |
876 |
|
CHEBYSHEV_UN, um_j, dum_j) |
877 |
|
|
878 |
|
sigma_j = 0.0d0 |
921 |
|
dPhuncdUz = coeff*(spj * dum_j(m-1)*dcpjduz + dspjduz *um_j(m-1)) |
922 |
|
endif |
923 |
|
|
924 |
< |
sigma_j = sigma_j + plm_j(l,m)*Phunc |
924 |
> |
sigma_j = sigma_j + plm_j(m,l)*Phunc |
925 |
|
|
926 |
< |
dsigmajdx = dsigmajdx + plm_j(l,m)*dPhuncdX + & |
927 |
< |
Phunc * dlm_j(l,m) * dctjdx |
928 |
< |
dsigmajdy = dsigmajdy + plm_j(l,m)*dPhuncdY + & |
929 |
< |
Phunc * dlm_j(l,m) * dctjdy |
930 |
< |
dsigmajdz = dsigmajdz + plm_j(l,m)*dPhuncdZ + & |
931 |
< |
Phunc * dlm_j(l,m) * dctjdz |
926 |
> |
dsigmajdx = dsigmajdx + plm_j(m,l)*dPhuncdX + & |
927 |
> |
Phunc * dlm_j(m,l) * dctjdx |
928 |
> |
dsigmajdy = dsigmajdy + plm_j(m,l)*dPhuncdY + & |
929 |
> |
Phunc * dlm_j(m,l) * dctjdy |
930 |
> |
dsigmajdz = dsigmajdz + plm_j(m,l)*dPhuncdZ + & |
931 |
> |
Phunc * dlm_j(m,l) * dctjdz |
932 |
|
|
933 |
< |
dsigmajdux = dsigmajdux + plm_j(l,m)* dPhuncdUx + & |
934 |
< |
Phunc * dlm_j(l,m) * dctjdux |
935 |
< |
dsigmajduy = dsigmajduy + plm_j(l,m)* dPhuncdUy + & |
936 |
< |
Phunc * dlm_j(l,m) * dctjduy |
937 |
< |
dsigmajduz = dsigmajduz + plm_j(l,m)* dPhuncdUz + & |
938 |
< |
Phunc * dlm_j(l,m) * dctjduz |
933 |
> |
dsigmajdux = dsigmajdux + plm_j(m,l)* dPhuncdUx + & |
934 |
> |
Phunc * dlm_j(m,l) * dctjdux |
935 |
> |
dsigmajduy = dsigmajduy + plm_j(m,l)* dPhuncdUy + & |
936 |
> |
Phunc * dlm_j(m,l) * dctjduy |
937 |
> |
dsigmajduz = dsigmajduz + plm_j(m,l)* dPhuncdUz + & |
938 |
> |
Phunc * dlm_j(m,l) * dctjduz |
939 |
|
|
940 |
|
end do |
941 |
|
|
963 |
|
dPhuncdUz = coeff*(spj * dum_j(m-1)*dcpjduz + dspjduz *um_j(m-1)) |
964 |
|
endif |
965 |
|
|
966 |
< |
s_j = s_j + plm_j(l,m)*Phunc |
966 |
> |
s_j = s_j + plm_j(m,l)*Phunc |
967 |
|
|
968 |
< |
dsjdx = dsjdx + plm_j(l,m)*dPhuncdX + & |
969 |
< |
Phunc * dlm_j(l,m) * dctjdx |
970 |
< |
dsjdy = dsjdy + plm_j(l,m)*dPhuncdY + & |
971 |
< |
Phunc * dlm_j(l,m) * dctjdy |
972 |
< |
dsjdz = dsjdz + plm_j(l,m)*dPhuncdZ + & |
973 |
< |
Phunc * dlm_j(l,m) * dctjdz |
968 |
> |
dsjdx = dsjdx + plm_j(m,l)*dPhuncdX + & |
969 |
> |
Phunc * dlm_j(m,l) * dctjdx |
970 |
> |
dsjdy = dsjdy + plm_j(m,l)*dPhuncdY + & |
971 |
> |
Phunc * dlm_j(m,l) * dctjdy |
972 |
> |
dsjdz = dsjdz + plm_j(m,l)*dPhuncdZ + & |
973 |
> |
Phunc * dlm_j(m,l) * dctjdz |
974 |
|
|
975 |
< |
dsjdux = dsjdux + plm_j(l,m)* dPhuncdUx + & |
976 |
< |
Phunc * dlm_j(l,m) * dctjdux |
977 |
< |
dsjduy = dsjduy + plm_j(l,m)* dPhuncdUy + & |
978 |
< |
Phunc * dlm_j(l,m) * dctjduy |
979 |
< |
dsjduz = dsjduz + plm_j(l,m)* dPhuncdUz + & |
980 |
< |
Phunc * dlm_j(l,m) * dctjduz |
975 |
> |
dsjdux = dsjdux + plm_j(m,l)* dPhuncdUx + & |
976 |
> |
Phunc * dlm_j(m,l) * dctjdux |
977 |
> |
dsjduy = dsjduy + plm_j(m,l)* dPhuncdUy + & |
978 |
> |
Phunc * dlm_j(m,l) * dctjduy |
979 |
> |
dsjduz = dsjduz + plm_j(m,l)* dPhuncdUz + & |
980 |
> |
Phunc * dlm_j(m,l) * dctjduz |
981 |
|
|
982 |
|
end do |
983 |
|
|
1005 |
|
dPhuncdUz = coeff*(spj * dum_j(m-1)*dcpjduz + dspjduz *um_j(m-1)) |
1006 |
|
endif |
1007 |
|
|
1008 |
< |
eps_j = eps_j + plm_j(l,m)*Phunc |
1008 |
> |
write(*,*) 'l,m = ', l, m, coeff, dPhuncdUx, dPhuncdUy, dPhuncdUz |
1009 |
> |
|
1010 |
> |
eps_j = eps_j + plm_j(m,l)*Phunc |
1011 |
|
|
1012 |
< |
depsjdx = depsjdx + plm_j(l,m)*dPhuncdX + & |
1013 |
< |
Phunc * dlm_j(l,m) * dctjdx |
1014 |
< |
depsjdy = depsjdy + plm_j(l,m)*dPhuncdY + & |
1015 |
< |
Phunc * dlm_j(l,m) * dctjdy |
1016 |
< |
depsjdz = depsjdz + plm_j(l,m)*dPhuncdZ + & |
1017 |
< |
Phunc * dlm_j(l,m) * dctjdz |
1012 |
> |
depsjdx = depsjdx + plm_j(m,l)*dPhuncdX + & |
1013 |
> |
Phunc * dlm_j(m,l) * dctjdx |
1014 |
> |
depsjdy = depsjdy + plm_j(m,l)*dPhuncdY + & |
1015 |
> |
Phunc * dlm_j(m,l) * dctjdy |
1016 |
> |
depsjdz = depsjdz + plm_j(m,l)*dPhuncdZ + & |
1017 |
> |
Phunc * dlm_j(m,l) * dctjdz |
1018 |
|
|
1019 |
< |
depsjdux = depsjdux + plm_j(l,m)* dPhuncdUx + & |
1020 |
< |
Phunc * dlm_j(l,m) * dctjdux |
1021 |
< |
depsjduy = depsjduy + plm_j(l,m)* dPhuncdUy + & |
1022 |
< |
Phunc * dlm_j(l,m) * dctjduy |
1023 |
< |
depsjduz = depsjduz + plm_j(l,m)* dPhuncdUz + & |
1024 |
< |
Phunc * dlm_j(l,m) * dctjduz |
1019 |
> |
depsjdux = depsjdux + plm_j(m,l)* dPhuncdUx + & |
1020 |
> |
Phunc * dlm_j(m,l) * dctjdux |
1021 |
> |
depsjduy = depsjduy + plm_j(m,l)* dPhuncdUy + & |
1022 |
> |
Phunc * dlm_j(m,l) * dctjduy |
1023 |
> |
depsjduz = depsjduz + plm_j(m,l)* dPhuncdUz + & |
1024 |
> |
Phunc * dlm_j(m,l) * dctjduz |
1025 |
|
|
1026 |
|
end do |
1027 |
|
|
1077 |
|
depsduyj = eps_i * depsjduy / (2.0d0 * eps) |
1078 |
|
depsduzj = eps_i * depsjduz / (2.0d0 * eps) |
1079 |
|
|
1080 |
+ |
!!$ write(*,*) 'depsidu = ', depsidux, depsiduy, depsiduz |
1081 |
+ |
!!$ write(*,*) 'depsjdu = ', depsjdux, depsjduy, depsjduz |
1082 |
+ |
!!$ |
1083 |
+ |
!!$ write(*,*) 'depsdui = ', depsduxi, depsduyi, depsduzi |
1084 |
+ |
!!$ write(*,*) 'depsduj = ', depsduxj, depsduyj, depsduzj |
1085 |
+ |
!!$ |
1086 |
+ |
!!$ write(*,*) 's, sig, eps = ', s, sigma, eps |
1087 |
+ |
|
1088 |
|
rtdenom = rij-sigma+s |
1089 |
|
rt = s / rtdenom |
1090 |
|
|
1109 |
|
rt12 = rt6*rt6 |
1110 |
|
rt126 = rt12 - rt6 |
1111 |
|
|
1112 |
+ |
pot_temp = 4.0d0 * eps * rt126 |
1113 |
+ |
|
1114 |
+ |
vpair = vpair + pot_temp |
1115 |
|
if (do_pot) then |
1116 |
|
#ifdef IS_MPI |
1117 |
< |
pot_row(atom1) = pot_row(atom1) + 2.0d0*eps*rt126*sw |
1118 |
< |
pot_col(atom2) = pot_col(atom2) + 2.0d0*eps*rt126*sw |
1117 |
> |
pot_row(atom1) = pot_row(atom1) + 0.5d0*pot_temp*sw |
1118 |
> |
pot_col(atom2) = pot_col(atom2) + 0.5d0*pot_temp*sw |
1119 |
|
#else |
1120 |
< |
pot = pot + 4.0d0*eps*rt126*sw |
1120 |
> |
pot = pot + pot_temp*sw |
1121 |
|
#endif |
1122 |
|
endif |
1123 |
+ |
|
1124 |
+ |
!!$ write(*,*) 'drtdu, depsdu = ', drtduxi, depsduxi |
1125 |
|
|
1126 |
|
dvdxi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdxi + 4.0d0*depsdxi*rt126 |
1127 |
|
dvdyi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdyi + 4.0d0*depsdyi*rt126 |
1140 |
|
! do the torques first since they are easy: |
1141 |
|
! remember that these are still in the body fixed axes |
1142 |
|
|
1085 |
– |
txi = dvduxi * sw |
1086 |
– |
tyi = dvduyi * sw |
1087 |
– |
tzi = dvduzi * sw |
1143 |
|
|
1144 |
< |
txj = dvduxj * sw |
1145 |
< |
tyj = dvduyj * sw |
1146 |
< |
tzj = dvduzj * sw |
1144 |
> |
!!$ write(*,*) 'sw = ', sw |
1145 |
> |
!!$ write(*,*) 'dvdu1 = ', dvduxi, dvduyi, dvduzi |
1146 |
> |
!!$ write(*,*) 'dvdu2 = ', dvduxj, dvduyj, dvduzj |
1147 |
> |
!!$ |
1148 |
> |
txi = (dvduzi - dvduyi) * sw |
1149 |
> |
tyi = (dvduxi - dvduzi) * sw |
1150 |
> |
tzi = (dvduyi - dvduxi) * sw |
1151 |
|
|
1152 |
+ |
txj = (dvduzj - dvduyj) * sw |
1153 |
+ |
tyj = (dvduxj - dvduzj) * sw |
1154 |
+ |
tzj = (dvduyj - dvduxj) * sw |
1155 |
+ |
|
1156 |
+ |
!!$ txi = -dvduxi * sw |
1157 |
+ |
!!$ tyi = -dvduyi * sw |
1158 |
+ |
!!$ tzi = -dvduzi * sw |
1159 |
+ |
!!$ |
1160 |
+ |
!!$ txj = dvduxj * sw |
1161 |
+ |
!!$ tyj = dvduyj * sw |
1162 |
+ |
!!$ tzj = dvduzj * sw |
1163 |
+ |
|
1164 |
+ |
write(*,*) 't1 = ', txi, tyi, tzi |
1165 |
+ |
write(*,*) 't2 = ', txj, tyj, tzj |
1166 |
+ |
|
1167 |
|
! go back to lab frame using transpose of rotation matrix: |
1168 |
|
|
1169 |
|
#ifdef IS_MPI |
1227 |
|
fyji = -fyjj |
1228 |
|
fzji = -fzjj |
1229 |
|
|
1230 |
< |
fxradial = fxii + fxji |
1231 |
< |
fyradial = fyii + fyji |
1232 |
< |
fzradial = fzii + fzji |
1230 |
> |
fxradial = 0.5_dp * (fxii + fxji) |
1231 |
> |
fyradial = 0.5_dp * (fyii + fyji) |
1232 |
> |
fzradial = 0.5_dp * (fzii + fzji) |
1233 |
|
|
1234 |
|
#ifdef IS_MPI |
1235 |
|
f_Row(1,atom1) = f_Row(1,atom1) + fxradial |
1264 |
|
fpair(3) = fpair(3) + fzradial |
1265 |
|
|
1266 |
|
endif |
1267 |
< |
|
1267 |
> |
|
1268 |
|
end subroutine do_shape_pair |
1269 |
|
|
1270 |
< |
SUBROUTINE Associated_Legendre(x, l, m, lmax, plm, dlm) |
1271 |
< |
|
1270 |
> |
SUBROUTINE Associated_Legendre(x, l, m, lmax, plm, dlm) |
1271 |
> |
|
1272 |
|
! Purpose: Compute the associated Legendre functions |
1273 |
|
! Plm(x) and their derivatives Plm'(x) |
1274 |
|
! Input : x --- Argument of Plm(x) |
1285 |
|
! The original Fortran77 codes can be found here: |
1286 |
|
! http://iris-lee3.ece.uiuc.edu/~jjin/routines/routines.html |
1287 |
|
|
1288 |
< |
real (kind=8), intent(in) :: x |
1288 |
> |
real (kind=dp), intent(in) :: x |
1289 |
|
integer, intent(in) :: l, m, lmax |
1290 |
< |
real (kind=8), dimension(0:lmax,0:m), intent(out) :: PLM, DLM |
1290 |
> |
real (kind=dp), dimension(0:lmax,0:m), intent(out) :: PLM, DLM |
1291 |
|
integer :: i, j, ls |
1292 |
< |
real (kind=8) :: xq, xs |
1292 |
> |
real (kind=dp) :: xq, xs |
1293 |
|
|
1294 |
|
! zero out both arrays: |
1295 |
|
DO I = 0, m |
1296 |
|
DO J = 0, l |
1297 |
< |
PLM(J,I) = 0.0D0 |
1298 |
< |
DLM(J,I) = 0.0D0 |
1297 |
> |
PLM(J,I) = 0.0_dp |
1298 |
> |
DLM(J,I) = 0.0_dp |
1299 |
|
end DO |
1300 |
|
end DO |
1301 |
|
|
1328 |
|
DO I = 1, l |
1329 |
|
PLM(I, I) = -LS*(2.0D0*I-1.0D0)*XQ*PLM(I-1, I-1) |
1330 |
|
enddo |
1331 |
< |
|
1331 |
> |
|
1332 |
|
DO I = 0, l |
1333 |
|
PLM(I, I+1)=(2.0D0*I+1.0D0)*X*PLM(I, I) |
1334 |
|
enddo |
1335 |
< |
|
1335 |
> |
|
1336 |
|
DO I = 0, l |
1337 |
|
DO J = I+2, m |
1338 |
|
PLM(I, J)=((2.0D0*J-1.0D0)*X*PLM(I,J-1) - & |
1339 |
|
(I+J-1.0D0)*PLM(I,J-2))/(J-I) |
1340 |
|
end DO |
1341 |
|
end DO |
1342 |
< |
|
1342 |
> |
|
1343 |
|
DLM(0, 0)=0.0D0 |
1270 |
– |
|
1344 |
|
DO J = 1, m |
1345 |
|
DLM(0, J)=LS*J*(PLM(0,J-1)-X*PLM(0,J))/XS |
1346 |
|
end DO |
1347 |
< |
|
1347 |
> |
|
1348 |
|
DO I = 1, l |
1349 |
|
DO J = I, m |
1350 |
|
DLM(I,J) = LS*I*X*PLM(I, J)/XS + (J+I)*(J-I+1.0D0)/XQ*PLM(I-1, J) |
1351 |
|
end DO |
1352 |
|
end DO |
1353 |
< |
|
1353 |
> |
|
1354 |
|
RETURN |
1355 |
|
END SUBROUTINE Associated_Legendre |
1356 |
|
|
1357 |
|
|
1358 |
< |
subroutine Orthogonal_Polynomial(x, m, function_type, pl, dpl) |
1358 |
> |
subroutine Orthogonal_Polynomial(x, m, mmax, function_type, pl, dpl) |
1359 |
|
|
1360 |
|
! Purpose: Compute orthogonal polynomials: Tn(x) or Un(x), |
1361 |
|
! or Ln(x) or Hn(x), and their derivatives |
1377 |
|
! http://iris-lee3.ece.uiuc.edu/~jjin/routines/routines.html |
1378 |
|
|
1379 |
|
real(kind=8), intent(in) :: x |
1380 |
< |
integer, intent(in):: m |
1380 |
> |
integer, intent(in):: m, mmax |
1381 |
|
integer, intent(in):: function_type |
1382 |
< |
real(kind=8), dimension(0:m), intent(inout) :: pl, dpl |
1382 |
> |
real(kind=8), dimension(0:mmax), intent(inout) :: pl, dpl |
1383 |
|
|
1384 |
|
real(kind=8) :: a, b, c, y0, y1, dy0, dy1, yn, dyn |
1385 |
|
integer :: k |
1423 |
|
DY0 = DY1 |
1424 |
|
DY1 = DYN |
1425 |
|
end DO |
1426 |
+ |
|
1427 |
+ |
|
1428 |
|
RETURN |
1429 |
|
|
1430 |
|
end subroutine Orthogonal_Polynomial |
1431 |
|
|
1432 |
|
end module shapes |
1358 |
– |
|
1359 |
– |
subroutine makeShape(nContactFuncs, ContactFuncLValue, & |
1360 |
– |
ContactFuncMValue, ContactFunctionType, ContactFuncCoefficient, & |
1361 |
– |
nRangeFuncs, RangeFuncLValue, RangeFuncMValue, RangeFunctionType, & |
1362 |
– |
RangeFuncCoefficient, nStrengthFuncs, StrengthFuncLValue, & |
1363 |
– |
StrengthFuncMValue, StrengthFunctionType, StrengthFuncCoefficient, & |
1364 |
– |
myAtid, status) |
1365 |
– |
|
1366 |
– |
use definitions |
1367 |
– |
use shapes, only: newShapeType |
1368 |
– |
|
1369 |
– |
integer :: nContactFuncs |
1370 |
– |
integer :: nRangeFuncs |
1371 |
– |
integer :: nStrengthFuncs |
1372 |
– |
integer :: status |
1373 |
– |
integer :: myAtid |
1374 |
– |
|
1375 |
– |
integer, dimension(nContactFuncs) :: ContactFuncLValue |
1376 |
– |
integer, dimension(nContactFuncs) :: ContactFuncMValue |
1377 |
– |
integer, dimension(nContactFuncs) :: ContactFunctionType |
1378 |
– |
real(kind=dp), dimension(nContactFuncs) :: ContactFuncCoefficient |
1379 |
– |
integer, dimension(nRangeFuncs) :: RangeFuncLValue |
1380 |
– |
integer, dimension(nRangeFuncs) :: RangeFuncMValue |
1381 |
– |
integer, dimension(nRangeFuncs) :: RangeFunctionType |
1382 |
– |
real(kind=dp), dimension(nRangeFuncs) :: RangeFuncCoefficient |
1383 |
– |
integer, dimension(nStrengthFuncs) :: StrengthFuncLValue |
1384 |
– |
integer, dimension(nStrengthFuncs) :: StrengthFuncMValue |
1385 |
– |
integer, dimension(nStrengthFuncs) :: StrengthFunctionType |
1386 |
– |
real(kind=dp), dimension(nStrengthFuncs) :: StrengthFuncCoefficient |
1387 |
– |
|
1388 |
– |
call newShapeType(nContactFuncs, ContactFuncLValue, & |
1389 |
– |
ContactFuncMValue, ContactFunctionType, ContactFuncCoefficient, & |
1390 |
– |
nRangeFuncs, RangeFuncLValue, RangeFuncMValue, RangeFunctionType, & |
1391 |
– |
RangeFuncCoefficient, nStrengthFuncs, StrengthFuncLValue, & |
1392 |
– |
StrengthFuncMValue, StrengthFunctionType, StrengthFuncCoefficient, & |
1393 |
– |
myAtid, status) |
1394 |
– |
|
1395 |
– |
return |
1396 |
– |
end subroutine makeShape |