! ! CDDL HEADER START ! ! The contents of this file are subject to the terms of the Common Development ! and Distribution License Version 1.0 (the "License"). ! ! You can obtain a copy of the license at ! http://www.opensource.org/licenses/CDDL-1.0. See the License for the ! specific language governing permissions and limitations under the License. ! ! When distributing Covered Code, include this CDDL HEADER in each file and ! include the License file in a prominent location with the name LICENSE.CDDL. ! If applicable, add the following below this CDDL HEADER, with the fields ! enclosed by brackets "[]" replaced with your own identifying information: ! ! ! CDDL HEADER END ! ! ! Copyright (c) 2012, Mark R. Gilbert, CCFE Fusion Association. All rights reserved. ! ! Contributors: ! Mark R. Gilbert ! !**************************************************************************** !** !** MODULE model_driver_PF_cubic_splines !** !** EAM-like potential with cubic splines representing knot functions !** magnetic ability also available via B parameter !** !** Language: Fortran 90 !** !** !** !**************************************************************************** #include "KIM_API_status.h" #define THIS_FILE_NAME __FILE__ #define TRUEFALSE(TRUTH) merge(1,0,(TRUTH)) module model_driver_pf_cubic_splines use KIM_API implicit none save private public Compute_Energy_Forces, & model_cutoff, & Destroy, & nknotv, nknotp,interpolate_num, & vknotcoeff,vknotpoint,linear_interpolate, r1,r2,A,B,Z,a_rho,a_inter, & pknotcoeff,pknotpoint ! Below are the definitions and values of all Model parameters integer, parameter :: DIM=3 ! dimensionality of space integer, parameter :: speccode = 1 ! internal species code double precision:: model_cutoff ! cutoff radius ! in angstroms double precision :: model_cutsq double precision , parameter :: pc=1.0d0,pi=3.141592653589793d0 ! electric constant and electron charge ( units of double precision , parameter :: E_0=8.854187817d-12,Ec=1.60217653d-19 !bohr constant in angstroms double precision , parameter :: a_B=0.5291772108d0 ! constants of biersack-ziegler coulomb potential double precision , parameter :: p1=0.1818d0,p2=0.5099d0,p3=0.2802d0,p4=0.02817d0 double precision , parameter :: Bt1=-3.2d0,Bt2=-0.9423d0,Bt3=-0.4029d0,Bt4=-0.2016d0 ! ! new variables for general potential - to be read in - 12/10/06 double precision :: A, B, Z,r1,r2,a_inter(7),a_rho integer :: nknotv,nknotp,interpolate_num LOGICAL :: linear_interpolate double precision , allocatable :: vknotcoeff(:), vknotpoint(:), & pknotcoeff(:), pknotpoint(:) contains !------------------------------------------------------------------------------- ! ! Calculate pair potential phi(r) ! !------------------------------------------------------------------------------- subroutine calc_phi(r,phi) implicit none !-- Transferred variables double precision, intent(in) :: r double precision, intent(out) :: phi double precision :: a_s,phi_r,B_Zpre integer :: i !-- Local variables ! if (r .gt. model_cutoff) then ! Argument exceeds cutoff radius phi = 0.d0 else IF (r>=r2) THEN phi=0.d0 DO i=1,nknotv IF (r if (r .gt. model_cutoff) then ! Argument exceeds cutoff radius phi = 0.d0 dphi = 0.d0 else IF (r>=r2) THEN dphi=0.d0 phi=0.d0 DO i=1,nknotv IF (r if (r .gt. model_cutoff) then ! Argument exceeds cutoff radius g = 0.d0 else g = 0.d0 DO i=1,nknotp IF (r if (r .gt. model_cutoff) then ! Argument exceeds cutoff radius dg = 0.d0 else dg = 0.d0 DO i=1,nknotp IF (r IF (rho IF(rho.le.1e-10) THEN dU=0d0 U=0.d0 ELSE IF (rho IF(rho.le.1e-10) THEN dU=0d0 U=0.d0 ddU=0.d0 ELSE IF (rho