define(`TOHWM4_geometry_subs', `dnl
  subroutine cmlAddLength_$1(xf, id, atomRef1, atomRef2, length, fmt)
    type(xmlf_t), intent(inout) :: xf
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: atomRef1
    character(len=*), intent(in) :: atomRef2
    real(kind=$1), intent(in)    :: length
    character(len=*), intent(in), optional :: fmt

    call xml_NewElement(xf, "length")
    call xml_AddAttribute(xf, "id", id)
    call xml_AddAttribute(xf, "atomRefs2", atomRef1//" "//atomRef2)
    call xml_AddCharacters(xf, length, fmt)
    call xml_EndElement(xf, "length")

  end subroutine cmlAddLength_$1

  subroutine cmlAddAngle_$1(xf, id, atomRef1, atomRef2, atomRef3, angle, fmt)
    type(xmlf_t), intent(inout) :: xf
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: atomRef1
    character(len=*), intent(in) :: atomRef2
    character(len=*), intent(in) :: atomRef3
    real(kind=$1), intent(in)     :: angle
    character(len=*), intent(in), optional :: fmt

    call xml_NewElement(xf, "angle")
    call xml_AddAttribute(xf, "id", id)
    call xml_AddAttribute(xf, "atomRefs3", atomRef1//" "//atomRef2//" "//atomRef3)
    call xml_AddCharacters(xf, angle, fmt)
    call xml_EndElement(xf, "angle")

  end subroutine cmlAddAngle_$1

  subroutine cmlAddTorsion_$1(xf, id, atomRef1, atomRef2, atomRef3, atomRef4, torsion, fmt)
    type(xmlf_t), intent(inout) :: xf
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: atomRef1
    character(len=*), intent(in) :: atomRef2
    character(len=*), intent(in) :: atomRef3        ! ref to third atom
    character(len=*), intent(in) :: atomRef4
    real(kind=$1), intent(in)    :: torsion
    character(len=*), intent(in), optional :: fmt

    call xml_NewElement(xf, "torsion")
    call xml_AddAttribute(xf, "id", id)
    call xml_AddAttribute(xf, "atomRefs4", &
         atomRef1//" "//atomRef2//" "//atomRef3//" "//atomRef4)
    call xml_AddCharacters(xf, torsion, fmt)
    call xml_EndElement(xf, "torsion")

  end subroutine cmlAddTorsion_$1
')dnl
dnl
!
! This file is AUTOGENERATED
! To update, edit m_wcml_geometry.m4 and regenerate

module m_wcml_geometry

  use m_common_realtypes, only: sp, dp
  use FoX_wxml, only: xmlf_t
  use FoX_wxml, only: xml_NewElement, xml_EndElement
  use FoX_wxml, only: xml_AddAttribute, xml_AddCharacters

  implicit none
  private

  interface cmlAddLength
    module procedure cmlAddLength_SP, cmlAddLength_DP
  end interface

  interface cmlAddAngle
    module procedure cmlAddAngle_SP, cmlAddAngle_DP
  end interface

  interface cmlAddTorsion
    module procedure cmlAddTorsion_SP, cmlAddTorsion_DP
  end interface

  public :: cmlAddLength
  public :: cmlAddAngle
  public :: cmlAddTorsion

contains

TOHWM4_geometry_subs(`sp')

TOHWM4_geometry_subs(`dp')

end module m_wcml_geometry
