get_coordination_number Subroutine

public subroutine get_coordination_number(mol, trans, cutoff, rcov, en, cn, dcndr, dcndL, error)

Geometric fractional coordination number, supports error function counting.

Arguments

Type IntentOptional Attributes Name
type(structure_type), intent(in) :: mol

Molecular structure data

real(kind=wp), intent(in) :: trans(:,:)

Lattice points

real(kind=wp), intent(in) :: cutoff

Real space cutoff

real(kind=wp), intent(in) :: rcov(:)

Covalent radius

real(kind=wp), intent(in) :: en(:)

Electronegativity

real(kind=wp), intent(out) :: cn(:)

Error function coordination number.

real(kind=wp), intent(out), optional :: dcndr(:,:,:)

Derivative of the CN with respect to the Cartesian coordinates.

real(kind=wp), intent(out), optional :: dcndL(:,:,:)

Derivative of the CN with respect to strain deformations.

type(error_type), intent(out), optional, allocatable :: error

Error on failure; results are NaN if initialization fails.


Source Code

subroutine get_coordination_number(mol, trans, cutoff, rcov, en, cn, dcndr, dcndL, error)
   !DEC$ ATTRIBUTES DLLEXPORT :: get_coordination_number

   !> Molecular structure data
   type(structure_type), intent(in) :: mol

   !> Lattice points
   real(wp), intent(in) :: trans(:, :)

   !> Real space cutoff
   real(wp), intent(in) :: cutoff

   !> Covalent radius
   real(wp), intent(in) :: rcov(:)

   !> Electronegativity
   real(wp), intent(in) :: en(:)

   !> Error function coordination number.
   real(wp), intent(out) :: cn(:)

   !> Derivative of the CN with respect to the Cartesian coordinates.
   real(wp), intent(out), optional :: dcndr(:, :, :)

   !> Derivative of the CN with respect to strain deformations.
   real(wp), intent(out), optional :: dcndL(:, :, :)

   !> Error on failure; results are NaN if initialization fails.
   type(error_type), allocatable, intent(out), optional :: error

   class(ncoord_type), allocatable :: ncoord
   type(error_type), allocatable :: local_error

   call new_ncoord(ncoord, mol, cn_count%dftd4, &
      & kcn=default_kcn, cutoff=cutoff, rcov=rcov, en=en, error=local_error)
   if (allocated(local_error)) then
      cn = ieee_value(0.0_wp, ieee_quiet_nan)
      if (present(dcndr)) dcndr = ieee_value(0.0_wp, ieee_quiet_nan)
      if (present(dcndL)) dcndL = ieee_value(0.0_wp, ieee_quiet_nan)
      if (present(error)) call move_alloc(local_error, error)
      return
   end if

   call ncoord%get_coordination_number(mol, trans, cn, dcndr, dcndL)

end subroutine get_coordination_number