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


#include "random_tree_dll.h"


/**** DLL entry point ****/

/*
 * Define T2C_DLLMAIN to enable this code
 */

#ifdef T2C_DLLMAIN
#  ifdef __BORLANDC__
int WINAPI DllEntryPoint(HINSTANCE hDllHandle, unsigned long Reason, void *lpReserved)
#  else
int WINAPI DllMain(HINSTANCE hDllHandle, DWORD Reason, LPVOID lpReserved)
#  endif
{
  return 1;
}
#endif


/**** Classification code ****/

/*
 * Return the class code
 */

T2C_EXTERN int T2C_EXPORT T2C_RANDOM_TREE_Classify(T2C_RANDOM_TREE_INPUT *Input)
{
  int     Res;

  if (Input -> HbDon < 0.5000f) {
    if (Input -> Sas < 756.1100f) {
      if (Input -> FG_COOR == T2C_RANDOM_TREE_FG_COOR_YES) {
        if (Input -> Angles < 106.5000f) {
          if (Input -> Atoms < 48.0000f) {
            Res = T2C_RANDOM_TREE_TRUE;
          } else {
            if (Input -> Atoms < 51.0000f) {
              Res = T2C_RANDOM_TREE_FALSE;
            } else {
              Res = T2C_RANDOM_TREE_TRUE;
            }
          }
        } else {
          Res = T2C_RANDOM_TREE_FALSE;
        }
      } else {
        if (Input -> HeavyAtoms < 13.5000f) {
          if (Input -> Gyrrad < 2.8500f) {
            Res = T2C_RANDOM_TREE_TRUE;
          } else {
            Res = T2C_RANDOM_TREE_FALSE;
          }
        } else {
          Res = T2C_RANDOM_TREE_TRUE;
        }
      }
    } else {
      Res = T2C_RANDOM_TREE_FALSE;
    }
  } else {
    if (Input -> Angles < 92.5000f) {
      if (Input -> Gyrrad < 3.6800f) {
        if (Input -> Torsions < 17.5000f) {
          if (Input -> Sas < 283.4200f) {
            Res = T2C_RANDOM_TREE_TRUE;
          } else {
            if (Input -> FlexTorsions < 0.5000f) {
              if (Input -> Sas < 301.9000f) {
                Res = T2C_RANDOM_TREE_FALSE;
              } else {
                Res = T2C_RANDOM_TREE_TRUE;
              }
            } else {
              if (Input -> FG_CON2 == T2C_RANDOM_TREE_FG_CON2_YES) {
                if (Input -> Lipole < 2.1200f) {
                  Res = T2C_RANDOM_TREE_TRUE;
                } else {
                  Res = T2C_RANDOM_TREE_FALSE;
                }
              } else {
                if (Input -> HbAcc < 2.5000f) {
                  if (Input -> Rings < 1.5000f) {
                    if (Input -> Sav < 575.0000f) {
                      Res = T2C_RANDOM_TREE_TRUE;
                    } else {
                      if (Input -> Sdiam < 8.5700f) {
                        Res = T2C_RANDOM_TREE_FALSE;
                      } else {
                        Res = T2C_RANDOM_TREE_TRUE;
                      }
                    }
                  } else {
                    if (Input -> Torsions < 15.5000f) {
                      Res = T2C_RANDOM_TREE_FALSE;
                    } else {
                      if (Input -> HeavyAtoms < 15.5000f) {
                        Res = T2C_RANDOM_TREE_TRUE;
                      } else {
                        Res = T2C_RANDOM_TREE_FALSE;
                      }
                    }
                  }
                } else {
                  if (Input -> HeavyAtoms < 12.5000f) {
                    Res = T2C_RANDOM_TREE_FALSE;
                  } else {
                    if (Input -> Angles < 39.5000f) {
                      Res = T2C_RANDOM_TREE_TRUE;
                    } else {
                      if (Input -> Torsions < 14.5000f) {
                        Res = T2C_RANDOM_TREE_FALSE;
                      } else {
                        if (Input -> HeavyAtoms < 16.5000f) {
                          if (Input -> ChiralAtms < 1.5000f) {
                            Res = T2C_RANDOM_TREE_FALSE;
                          } else {
                            Res = T2C_RANDOM_TREE_TRUE;
                          }
                        } else {
                          Res = T2C_RANDOM_TREE_TRUE;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        } else {
          if (Input -> Vdiam < 7.3000f) {
            Res = T2C_RANDOM_TREE_FALSE;
          } else {
            if (Input -> Sas < 561.9500f) {
              if (Input -> HeavyAtoms < 19.5000f) {
                if (Input -> Torsions < 19.5000f) {
                  if (Input -> FG_COOH == T2C_RANDOM_TREE_FG_COOH_YES) {
                    Res = T2C_RANDOM_TREE_FALSE;
                  } else {
                    Res = T2C_RANDOM_TREE_TRUE;
                  }
                } else {
                  Res = T2C_RANDOM_TREE_TRUE;
                }
              } else {
                Res = T2C_RANDOM_TREE_TRUE;
              }
            } else {
              Res = T2C_RANDOM_TREE_FALSE;
            }
          }
        }
      } else {
        if (Input -> Ovality < 1.6900f) {
          if (Input -> HbAcc < 3.5000f) {
            if (Input -> Rings < 1.5000f) {
              Res = T2C_RANDOM_TREE_FALSE;
            } else {
              if (Input -> Mass < 303.4100f) {
                if (Input -> Ovality < 1.5900f) {
                  Res = T2C_RANDOM_TREE_FALSE;
                } else {
                  Res = T2C_RANDOM_TREE_TRUE;
                }
              } else {
                Res = T2C_RANDOM_TREE_FALSE;
              }
            }
          } else {
            if (Input -> Mass < 356.3800f) {
              Res = T2C_RANDOM_TREE_FALSE;
            } else {
              if (Input -> EzBnds < 0.5000f) {
                Res = T2C_RANDOM_TREE_FALSE;
              } else {
                if (Input -> Mass < 362.3900f) {
                  Res = T2C_RANDOM_TREE_TRUE;
                } else {
                  Res = T2C_RANDOM_TREE_FALSE;
                }
              }
            }
          }
        } else {
          if (Input -> Sdiam < 10.9700f) {
            if (Input -> Lipole < 2.3800f) {
              if (Input -> HbAcc < 3.5000f) {
                Res = T2C_RANDOM_TREE_TRUE;
              } else {
                Res = T2C_RANDOM_TREE_FALSE;
              }
            } else {
              Res = T2C_RANDOM_TREE_FALSE;
            }
          } else {
            if (Input -> VirtualLogP < 3.4100f) {
              if (Input -> Dipole < 2.8300f) {
                Res = T2C_RANDOM_TREE_FALSE;
              } else {
                Res = T2C_RANDOM_TREE_TRUE;
              }
            } else {
              Res = T2C_RANDOM_TREE_TRUE;
            }
          }
        }
      }
    } else {
      if (Input -> FlexTorsions < 1.0000f) {
        Res = T2C_RANDOM_TREE_TRUE;
      } else {
        if (Input -> Ovality < 1.7300f) {
          Res = T2C_RANDOM_TREE_FALSE;
        } else {
          if (Input -> Psa < 59.6600f) {
            if (Input -> HeavyAtoms < 31.0000f) {
              if (Input -> Bonds < 51.5000f) {
                Res = T2C_RANDOM_TREE_FALSE;
              } else {
                Res = T2C_RANDOM_TREE_TRUE;
              }
            } else {
              if (Input -> FlexTorsions < 9.0000f) {
                Res = T2C_RANDOM_TREE_FALSE;
              } else {
                Res = T2C_RANDOM_TREE_TRUE;
              }
            }
          } else {
            if (Input -> FG_PhOH == T2C_RANDOM_TREE_FG_PHOH_YES) {
              if (Input -> Angles < 119.5000f) {
                Res = T2C_RANDOM_TREE_TRUE;
              } else {
                if (Input -> Angles < 230.0000f) {
                  Res = T2C_RANDOM_TREE_FALSE;
                } else {
                  if (Input -> ChiralAtms < 21.5000f) {
                    Res = T2C_RANDOM_TREE_FALSE;
                  } else {
                    Res = T2C_RANDOM_TREE_TRUE;
                  }
                }
              }
            } else {
              if (Input -> FG_F == T2C_RANDOM_TREE_FG_F_YES) {
                if (Input -> ChiralAtms < 1.5000f) {
                  Res = T2C_RANDOM_TREE_TRUE;
                } else {
                  if (Input -> Vdiam < 9.0700f) {
                    Res = T2C_RANDOM_TREE_FALSE;
                  } else {
                    Res = T2C_RANDOM_TREE_TRUE;
                  }
                }
              } else {
                if (Input -> Lipole < 2.3100f) {
                  if (Input -> FlexTorsions < 8.5000f) {
                    if (Input -> Sas < 977.1200f) {
                      if (Input -> EzBnds < 0.5000f) {
                        if (Input -> ChiralAtms < 0.5000f) {
                          if (Input -> Mass < 441.2400f) {
                            Res = T2C_RANDOM_TREE_TRUE;
                          } else {
                            Res = T2C_RANDOM_TREE_FALSE;
                          }
                        } else {
                          Res = T2C_RANDOM_TREE_FALSE;
                        }
                      } else {
                        if (Input -> Bonds < 59.0000f) {
                          Res = T2C_RANDOM_TREE_FALSE;
                        } else {
                          Res = T2C_RANDOM_TREE_TRUE;
                        }
                      }
                    } else {
                      Res = T2C_RANDOM_TREE_TRUE;
                    }
                  } else {
                    Res = T2C_RANDOM_TREE_FALSE;
                  }
                } else {
                  Res = T2C_RANDOM_TREE_FALSE;
                }
              }
            }
          }
        }
      }
    }
  }

  return Res;
}


/**** Domain check code ****/

/*
 * Return the number of domain violations
 */

T2C_EXTERN int T2C_EXPORT T2C_RANDOM_TREE_DomCheck(T2C_RANDOM_TREE_INPUT *Input)
{
  int     Violations = 0;

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

  return Violations;
}
