
!********************************************
!****    File generated by Tree2C V1.0   ****
!**** (c) 2017-2019, Alessandro Pedretti ****
!********************************************


!**** Classification module ****/

module random_tree
  implicit none

  !**** Output values ****

  integer, parameter :: T2F90_RANDOM_TREE_FALSE = 0
  integer, parameter :: T2F90_RANDOM_TREE_TRUE = 1

  !**** Values of the attributes ****

  integer, parameter :: T2F90_RANDOM_TREE_FG_CON2_NO = 0
  integer, parameter :: T2F90_RANDOM_TREE_FG_CON2_YES = 1
  integer, parameter :: T2F90_RANDOM_TREE_FG_COOH_NO = 0
  integer, parameter :: T2F90_RANDOM_TREE_FG_COOH_YES = 1
  integer, parameter :: T2F90_RANDOM_TREE_FG_COOR_NO = 0
  integer, parameter :: T2F90_RANDOM_TREE_FG_COOR_YES = 1
  integer, parameter :: T2F90_RANDOM_TREE_FG_F_NO = 0
  integer, parameter :: T2F90_RANDOM_TREE_FG_F_YES = 1
  integer, parameter :: T2F90_RANDOM_TREE_FG_PHOH_NO = 0
  integer, parameter :: T2F90_RANDOM_TREE_FG_PHOH_YES = 1

  type :: T2F90_RANDOM_TREE_Input

    !**** Properties ****

    real :: Angles
    real :: Atoms
    real :: Bonds
    real :: ChiralAtms
    real :: Dipole
    real :: EzBnds
    integer :: FG_CON2
    integer :: FG_COOH
    integer :: FG_COOR
    integer :: FG_F
    integer :: FG_PhOH
    real :: FlexTorsions
    real :: Gyrrad
    real :: HbAcc
    real :: HbDon
    real :: HeavyAtoms
    real :: Lipole
    real :: Mass
    real :: Ovality
    real :: Psa
    real :: Rings
    real :: Sas
    real :: Sav
    real :: Sdiam
    real :: Torsions
    real :: Vdiam
    real :: VirtualLogP

  contains
    procedure, pass(this) :: Classify
    procedure, pass(this) :: DomCheck
  end type T2F90_RANDOM_TREE_Input

contains

  !**** Classification function ****

  function Classify(this) result(Res)
    class(T2F90_RANDOM_TREE_Input) , intent(in) :: this
    integer :: Res

    if (this%HbDon < 0.5000) then
      if (this%Sas < 756.1100) then
        if (this%FG_COOR == T2F90_RANDOM_TREE_FG_COOR_YES) then
          if (this%Angles < 106.5000) then
            if (this%Atoms < 48.0000) then
              Res = T2F90_RANDOM_TREE_TRUE;
            else
              if (this%Atoms < 51.0000) then
                Res = T2F90_RANDOM_TREE_FALSE;
              else
                Res = T2F90_RANDOM_TREE_TRUE;
              end if
            end if
          else
            Res = T2F90_RANDOM_TREE_FALSE;
          end if
        else
          if (this%HeavyAtoms < 13.5000) then
            if (this%Gyrrad < 2.8500) then
              Res = T2F90_RANDOM_TREE_TRUE;
            else
              Res = T2F90_RANDOM_TREE_FALSE;
            end if
          else
            Res = T2F90_RANDOM_TREE_TRUE;
          end if
        end if
      else
        Res = T2F90_RANDOM_TREE_FALSE;
      end if
    else
      if (this%Angles < 92.5000) then
        if (this%Gyrrad < 3.6800) then
          if (this%Torsions < 17.5000) then
            if (this%Sas < 283.4200) then
              Res = T2F90_RANDOM_TREE_TRUE;
            else
              if (this%FlexTorsions < 0.5000) then
                if (this%Sas < 301.9000) then
                  Res = T2F90_RANDOM_TREE_FALSE;
                else
                  Res = T2F90_RANDOM_TREE_TRUE;
                end if
              else
                if (this%FG_CON2 == T2F90_RANDOM_TREE_FG_CON2_YES) then
                  if (this%Lipole < 2.1200) then
                    Res = T2F90_RANDOM_TREE_TRUE;
                  else
                    Res = T2F90_RANDOM_TREE_FALSE;
                  end if
                else
                  if (this%HbAcc < 2.5000) then
                    if (this%Rings < 1.5000) then
                      if (this%Sav < 575.0000) then
                        Res = T2F90_RANDOM_TREE_TRUE;
                      else
                        if (this%Sdiam < 8.5700) then
                          Res = T2F90_RANDOM_TREE_FALSE;
                        else
                          Res = T2F90_RANDOM_TREE_TRUE;
                        end if
                      end if
                    else
                      if (this%Torsions < 15.5000) then
                        Res = T2F90_RANDOM_TREE_FALSE;
                      else
                        if (this%HeavyAtoms < 15.5000) then
                          Res = T2F90_RANDOM_TREE_TRUE;
                        else
                          Res = T2F90_RANDOM_TREE_FALSE;
                        end if
                      end if
                    end if
                  else
                    if (this%HeavyAtoms < 12.5000) then
                      Res = T2F90_RANDOM_TREE_FALSE;
                    else
                      if (this%Angles < 39.5000) then
                        Res = T2F90_RANDOM_TREE_TRUE;
                      else
                        if (this%Torsions < 14.5000) then
                          Res = T2F90_RANDOM_TREE_FALSE;
                        else
                          if (this%HeavyAtoms < 16.5000) then
                            if (this%ChiralAtms < 1.5000) then
                              Res = T2F90_RANDOM_TREE_FALSE;
                            else
                              Res = T2F90_RANDOM_TREE_TRUE;
                            end if
                          else
                            Res = T2F90_RANDOM_TREE_TRUE;
                          end if
                        end if
                      end if
                    end if
                  end if
                end if
              end if
            end if
          else
            if (this%Vdiam < 7.3000) then
              Res = T2F90_RANDOM_TREE_FALSE;
            else
              if (this%Sas < 561.9500) then
                if (this%HeavyAtoms < 19.5000) then
                  if (this%Torsions < 19.5000) then
                    if (this%FG_COOH == T2F90_RANDOM_TREE_FG_COOH_YES) then
                      Res = T2F90_RANDOM_TREE_FALSE;
                    else
                      Res = T2F90_RANDOM_TREE_TRUE;
                    end if
                  else
                    Res = T2F90_RANDOM_TREE_TRUE;
                  end if
                else
                  Res = T2F90_RANDOM_TREE_TRUE;
                end if
              else
                Res = T2F90_RANDOM_TREE_FALSE;
              end if
            end if
          end if
        else
          if (this%Ovality < 1.6900) then
            if (this%HbAcc < 3.5000) then
              if (this%Rings < 1.5000) then
                Res = T2F90_RANDOM_TREE_FALSE;
              else
                if (this%Mass < 303.4100) then
                  if (this%Ovality < 1.5900) then
                    Res = T2F90_RANDOM_TREE_FALSE;
                  else
                    Res = T2F90_RANDOM_TREE_TRUE;
                  end if
                else
                  Res = T2F90_RANDOM_TREE_FALSE;
                end if
              end if
            else
              if (this%Mass < 356.3800) then
                Res = T2F90_RANDOM_TREE_FALSE;
              else
                if (this%EzBnds < 0.5000) then
                  Res = T2F90_RANDOM_TREE_FALSE;
                else
                  if (this%Mass < 362.3900) then
                    Res = T2F90_RANDOM_TREE_TRUE;
                  else
                    Res = T2F90_RANDOM_TREE_FALSE;
                  end if
                end if
              end if
            end if
          else
            if (this%Sdiam < 10.9700) then
              if (this%Lipole < 2.3800) then
                if (this%HbAcc < 3.5000) then
                  Res = T2F90_RANDOM_TREE_TRUE;
                else
                  Res = T2F90_RANDOM_TREE_FALSE;
                end if
              else
                Res = T2F90_RANDOM_TREE_FALSE;
              end if
            else
              if (this%VirtualLogP < 3.4100) then
                if (this%Dipole < 2.8300) then
                  Res = T2F90_RANDOM_TREE_FALSE;
                else
                  Res = T2F90_RANDOM_TREE_TRUE;
                end if
              else
                Res = T2F90_RANDOM_TREE_TRUE;
              end if
            end if
          end if
        end if
      else
        if (this%FlexTorsions < 1.0000) then
          Res = T2F90_RANDOM_TREE_TRUE;
        else
          if (this%Ovality < 1.7300) then
            Res = T2F90_RANDOM_TREE_FALSE;
          else
            if (this%Psa < 59.6600) then
              if (this%HeavyAtoms < 31.0000) then
                if (this%Bonds < 51.5000) then
                  Res = T2F90_RANDOM_TREE_FALSE;
                else
                  Res = T2F90_RANDOM_TREE_TRUE;
                end if
              else
                if (this%FlexTorsions < 9.0000) then
                  Res = T2F90_RANDOM_TREE_FALSE;
                else
                  Res = T2F90_RANDOM_TREE_TRUE;
                end if
              end if
            else
              if (this%FG_PhOH == T2F90_RANDOM_TREE_FG_PHOH_YES) then
                if (this%Angles < 119.5000) then
                  Res = T2F90_RANDOM_TREE_TRUE;
                else
                  if (this%Angles < 230.0000) then
                    Res = T2F90_RANDOM_TREE_FALSE;
                  else
                    if (this%ChiralAtms < 21.5000) then
                      Res = T2F90_RANDOM_TREE_FALSE;
                    else
                      Res = T2F90_RANDOM_TREE_TRUE;
                    end if
                  end if
                end if
              else
                if (this%FG_F == T2F90_RANDOM_TREE_FG_F_YES) then
                  if (this%ChiralAtms < 1.5000) then
                    Res = T2F90_RANDOM_TREE_TRUE;
                  else
                    if (this%Vdiam < 9.0700) then
                      Res = T2F90_RANDOM_TREE_FALSE;
                    else
                      Res = T2F90_RANDOM_TREE_TRUE;
                    end if
                  end if
                else
                  if (this%Lipole < 2.3100) then
                    if (this%FlexTorsions < 8.5000) then
                      if (this%Sas < 977.1200) then
                        if (this%EzBnds < 0.5000) then
                          if (this%ChiralAtms < 0.5000) then
                            if (this%Mass < 441.2400) then
                              Res = T2F90_RANDOM_TREE_TRUE;
                            else
                              Res = T2F90_RANDOM_TREE_FALSE;
                            end if
                          else
                            Res = T2F90_RANDOM_TREE_FALSE;
                          end if
                        else
                          if (this%Bonds < 59.0000) then
                            Res = T2F90_RANDOM_TREE_FALSE;
                          else
                            Res = T2F90_RANDOM_TREE_TRUE;
                          end if
                        end if
                      else
                        Res = T2F90_RANDOM_TREE_TRUE;
                      end if
                    else
                      Res = T2F90_RANDOM_TREE_FALSE;
                    end if
                  else
                    Res = T2F90_RANDOM_TREE_FALSE;
                  end if
                end if
              end if
            end if
          end if
        end if
      end if
    end if

  end function Classify


  !**** Domain check function ****

  !*
  !* Return the number of domain violations
  !*

  function DomCheck(this) result(Violations)
    class(T2F90_RANDOM_TREE_Input) , intent(in) :: this
    integer :: Violations

    Violations = 0

    if (this%Angles < 6.00000000 .or. this%Angles > 374.00000000) Violations = Violations + 1
    if (this%Atoms < 5.00000000 .or. this%Atoms > 203.00000000) Violations = Violations + 1
    if (this%Bonds < 4.00000000 .or. this%Bonds > 206.00000000) Violations = Violations + 1
    if (this%ChiralAtms < 0.00000000 .or. this%ChiralAtms > 25.00000000) Violations = Violations + 1
    if (this%Dipole < 0.00001200 .or. this%Dipole > 22.36607000) Violations = Violations + 1
    if (this%EzBnds < 0.00000000 .or. this%EzBnds > 7.00000000) Violations = Violations + 1
    if (this%FlexTorsions < 0.00000000 .or. this%FlexTorsions > 28.00000000) Violations = Violations + 1
    if (this%Gyrrad < 1.41856400 .or. this%Gyrrad > 10.56297000) Violations = Violations + 1
    if (this%HbAcc < 0.00000000 .or. this%HbAcc > 26.00000000) Violations = Violations + 1
    if (this%HbDon < 0.00000000 .or. this%HbDon > 21.00000000) Violations = Violations + 1
    if (this%HeavyAtoms < 3.00000000 .or. this%HeavyAtoms > 101.00000000) Violations = Violations + 1
    if (this%Lipole < 0.00000300 .or. this%Lipole > 6.34667600) Violations = Violations + 1
    if (this%Mass < 70.08984000 .or. this%Mass > 1449.25400000) Violations = Violations + 1
    if (this%Ovality < 1.16274900 .or. this%Ovality > 2.74024100) Violations = Violations + 1
    if (this%Psa < 0.00000000 .or. this%Psa > 544.81690000) Violations = Violations + 1
    if (this%Rings < 0.00000000 .or. this%Rings > 10.00000000) Violations = Violations + 1
    if (this%Sas < 203.40610000 .or. this%Sas > 2006.11400000) Violations = Violations + 1
    if (this%Sav < 252.97150000 .or. this%Sav > 3811.29900000) Violations = Violations + 1
    if (this%Sdiam < 5.14906200 .or. this%Sdiam > 22.48208000) Violations = Violations + 1
    if (this%Torsions < 0.00000000 .or. this%Torsions > 94.00000000) Violations = Violations + 1
    if (this%Vdiam < 4.77512900 .or. this%Vdiam > 13.58132000) Violations = Violations + 1
    if (this%VirtualLogP < -7.13032600 .or. this%VirtualLogP > 9.48374900) Violations = Violations + 1

  end function DomCheck

end module
