diff options
Diffstat (limited to 'src/labat/grad.f')
| -rw-r--r-- | src/labat/grad.f | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/labat/grad.f b/src/labat/grad.f new file mode 100644 index 0000000..845ed5a --- /dev/null +++ b/src/labat/grad.f | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | subroutine grad(r,db,i,imin,imax,done,gradd,gradup,graddn) | ||
| 2 | c grad calculates the derivative of db with respect to r, at | ||
| 3 | c position r(i). | ||
| 4 | c input r : radial coordinate (array) | ||
| 5 | c input db : spin-up and down densities (array) | ||
| 6 | c input i : counter, i.e. current position = r(i) | ||
| 7 | c input imin : min value of i | ||
| 8 | c input imax : max value of i | ||
| 9 | c in/output done : true if density is splined | ||
| 10 | c output gradd : grad(density) | ||
| 11 | c output gradup,graddn : grad(density), spin up and down | ||
| 12 | implicit logical (a-z) | ||
| 13 | logical done | ||
| 14 | double precision r,db,gradd,gradup,graddn,db2,deriv | ||
| 15 | integer i,imin,imax | ||
| 16 | dimension r(561),db(2,561),db2(2,561) | ||
| 17 | common/ggagra/db2 | ||
| 18 | if (.not.done) then | ||
| 19 | call spline(r,imin+1,imax,db,db2) | ||
| 20 | done = .true. | ||
| 21 | endif | ||
| 22 | gradup = deriv(r,db,db2,1,i,imin,imax) | ||
| 23 | graddn = deriv(r,db,db2,-1,i,imin,imax) | ||
| 24 | gradd = gradup + graddn | ||
| 25 | return | ||
| 26 | end | ||
