! ! 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 ! Ryan S. Elliott ! ! Converted to be compatible with KIM API 2.0 by Daniel S. Karls (UMinn) !**************************************************************************** !** !** MODULE eam_magnetic_cubic !** !** EAM-like potential with cubic splines representing knot functions !** magnetic ability also available via B parameter !** !** Language: Fortran 2003 !** !** !** !**************************************************************************** module eam_magnetic_cubic use, intrinsic :: iso_c_binding use kim_model_driver_headers_module implicit none save private public Compute_Energy_Forces, & compute_arguments_create, & compute_arguments_destroy, & destroy, & speccode, & buffer_type type, bind(c) :: buffer_type real(c_double) :: influence_distance real(c_double) :: cutoff(1) ! cutoff radius in angstroms real(c_double) :: cutsq(1) ! new variables for general potential - to be read in - 12/10/06 real(c_double) :: A, B,Z,r1,r2,a_inter(7),a_rho integer(c_int) :: nknotv,nknotp,interpolate_num logical(c_bool) :: linear_interpolate type(c_ptr) :: vknotcoeff, vknotpoint, pknotcoeff, pknotpoint integer(c_int) :: & model_will_not_request_neighbors_of_noncontributing_particles(1) end type buffer_type ! Below are the definitions and values of all Model parameters integer(c_int), parameter :: cd = c_double ! used for literal constants integer(c_int), parameter :: DIM=3 ! dimensionality of space integer(c_int), parameter :: speccode = 1 ! internal species code real(c_double) , parameter :: pc=1.0_cd, pi=3.141592653589793_cd ! electric constant (in F/m) and electron charge (in C) real(c_double) , parameter :: E_0=8.854187817e-12_cd, Ec=1.60217653e-19_cd ! Length conversion factor (multiply by this to convert from Bohr to Angstroms) real(c_double) , parameter :: a_B=0.5291772108_cd ! constants of biersack-ziegler coulomb potential real(c_double) , parameter :: p1=0.1818_cd, p2=0.5099_cd, p3=0.2802_cd, p4=0.02817_cd real(c_double) , parameter :: Bt1=-3.2_cd, Bt2=-0.9423_cd, Bt3=-0.4029_cd, Bt4=-0.2016_cd ! contains !------------------------------------------------------------------------------- ! ! Calculate pair potential phi(r) ! !------------------------------------------------------------------------------- ! The "recursive" keyword is added below make this routine thread safe recursive subroutine calc_phi(r,buf,phi) implicit none !-- Transferred variables real(c_double), intent(in) :: r type(buffer_type), intent(in) :: buf real(c_double), intent(out) :: phi !-- Local variables real(c_double) :: a_s,phi_r,B_Zpre integer(c_int) :: i real(c_double), pointer :: vknotcoeff(:), vknotpoint(:) ! Set local pointers to buffer spline pointers call c_f_pointer(buf%vknotcoeff, vknotcoeff, (/buf%nknotv/)) call c_f_pointer(buf%vknotpoint, vknotpoint, (/buf%nknotv/)) if (r .gt. buf%cutoff(1)) then ! Argument exceeds cutoff radius phi = 0.0_cd else IF (r>=buf%r2) THEN phi=0.0_cd DO i=1,buf%nknotv IF (r=buf%r2) THEN dphi = 0.0_cd phi = 0.0_cd DO i=1,buf%nknotv IF (r