# Path: umansysprop/boiling_points.py
# def joback_and_reid(compound):
# def stein_and_brown(compound):
# def nannoolal(compound):
# 
# Path: umansysprop/vapour_pressures.py
# def nannoolal(compound, temperature, boiling_point):
# def myrdal_and_yalkowsky(compound, temperature, boiling_point):
# def evaporation(compound, temperature):
# def evaporation2(compound, temperature):
# def simpol(compound, temperature):
#     C = m[2] + m[4] + m[6]
#     O = m[23] + m[25] + m[29] + m[101] + m[105] + (2 * m[106])
#     N = m[39] + m[41] + m[33] + m[35]
#             A_CL = groups.aggregate_matches(
#                     m, data.EVAPORATION_A,
#                     groups=('5', '6', '7', '13', '16', '17', '18', '12CL')
#                     ) / sqrt(CL_groups)
#             A_CL = 0.0
#             A_HB = groups.aggregate_matches(
#                     m, data.EVAPORATION_A,
#                     groups=('8', '9', '10', '11', '14', '15', '19', '20', '12HB')
#                     ) / sqrt(HB_groups)
#             A_HB = 0.0
#         A = A_lin + (A_CL + A_HB) * diacid_factor
#         B_CL_HB = groups.aggregate_matches(
#                 m, data.EVAPORATION_B,
#                 groups=(
#                     '5', '6', '7', '8', '9', '10', '11', '12',
#                     '13', '14', '15', '16', '17', '18', '19', '20')
#                 )
#         B = B_lin + B_CL_HB * diacid_factor
#         A = groups.aggregate_matches(
#                 m, data.EVAPORATION_A, groups=g)
#         B = groups.aggregate_matches(
#                 m, data.EVAPORATION_B, groups=g)
#             A_CL = groups.aggregate_matches(
#                     m, data.EVAPORATION2_A,
#                     groups=('5', '6', '7', '13', '16', '17', '18', '12CL')
#                     ) / sqrt(CL_groups)
#             A_CL = 0.0
#             A_HB = groups.aggregate_matches(
#                     m, data.EVAPORATION2_A,
#                     groups=('8', '9', '10', '11', '14', '15', '19', '20', '12HB')
#                     ) / sqrt(HB_groups)
#             A_HB = 0.0
#         A = A_lin + (A_CL + A_HB) * diacid_factor
#         B_CL_HB = groups.aggregate_matches(
#                 m, data.EVAPORATION2_B,
#                 groups=(
#                     '5', '6', '7', '8', '9', '10', '11', '12',
#                     '13', '14', '15', '16', '17', '18', '19', '20')
#                 )
#         B = B_lin + B_CL_HB * diacid_factor
#         A = groups.aggregate_matches(
#                 m, data.EVAPORATION2_A, groups=g)
#         B = groups.aggregate_matches(
#                 m, data.EVAPORATION_B, groups=g)
# 
# Path: umansysprop/critical_properties.py
# def joback_and_reid(compound, boiling_point):
# def nannoolal(compound, boiling_point):
# 
# Path: umansysprop/liquid_densities.py
# def girolami(compound):
# def _generic(
#         compound, temperature, molar_volume, critical_properties):
# def schroeder(
#         compound, temperature, critical_properties):
# def le_bas(
#         compound, temperature, critical_properties):
# def tyn_and_calus(
#         compound, temperature, critical_properties):


import glob
import pybel
import collections
import sys
import pdb
from umansysprop import boiling_points
from umansysprop import vapour_pressures
from umansysprop import critical_properties
from umansysprop import liquid_densities
# forms on the current website. The principle is the same, we simply call Pybel directly.
#
# Current properties calculated:
# - Pure component vapour pressure
# - Boiling point
# - Subcooled liquid density
# - Molecular weight and chemical formula
#
# Last modification 21/12/16

# Here you will need to put the relevant path in for your UManSysProp distribution. Mine is
# given as an example  - change this!
sys.path.append('/home/david/Documents/Python/Git_repo_UManSysProp_public/UManSysProp_public/')

##########################################################################################
# 1. Read in the property data, seperating only .prop files from the rest.
# I have defined the .prop files myself, just for ease of use for this project.
# It is just a textfile with compound name/reference as first column, SMILES as second.

onlyfiles = [f for f in glob.glob('*.prop')]

#1) extract the data from each file and start generating a dictionary of Pybel objects

step=0
filenames=[]
Compound_reference=[]
smiles_array=[]
property_array=[]
Pybel_object_dict=dict()


# Path: umansysprop/boiling_points.py
# def joback_and_reid(compound):
# def stein_and_brown(compound):
# def nannoolal(compound):
# 
# Path: umansysprop/vapour_pressures.py
# def nannoolal(compound, temperature, boiling_point):
# def myrdal_and_yalkowsky(compound, temperature, boiling_point):
# def evaporation(compound, temperature):
# def evaporation2(compound, temperature):
# def simpol(compound, temperature):
#     C = m[2] + m[4] + m[6]
#     O = m[23] + m[25] + m[29] + m[101] + m[105] + (2 * m[106])
#     N = m[39] + m[41] + m[33] + m[35]
#             A_CL = groups.aggregate_matches(
#                     m, data.EVAPORATION_A,
#                     groups=('5', '6', '7', '13', '16', '17', '18', '12CL')
#                     ) / sqrt(CL_groups)
#             A_CL = 0.0
#             A_HB = groups.aggregate_matches(
#                     m, data.EVAPORATION_A,
#                     groups=('8', '9', '10', '11', '14', '15', '19', '20', '12HB')
#                     ) / sqrt(HB_groups)
#             A_HB = 0.0
#         A = A_lin + (A_CL + A_HB) * diacid_factor
#         B_CL_HB = groups.aggregate_matches(
#                 m, data.EVAPORATION_B,
#                 groups=(
#                     '5', '6', '7', '8', '9', '10', '11', '12',
#                     '13', '14', '15', '16', '17', '18', '19', '20')
#                 )
#         B = B_lin + B_CL_HB * diacid_factor
#         A = groups.aggregate_matches(
#                 m, data.EVAPORATION_A, groups=g)
#         B = groups.aggregate_matches(
#                 m, data.EVAPORATION_B, groups=g)
#             A_CL = groups.aggregate_matches(
#                     m, data.EVAPORATION2_A,
#                     groups=('5', '6', '7', '13', '16', '17', '18', '12CL')
#                     ) / sqrt(CL_groups)
#             A_CL = 0.0
#             A_HB = groups.aggregate_matches(
#                     m, data.EVAPORATION2_A,
#                     groups=('8', '9', '10', '11', '14', '15', '19', '20', '12HB')
#                     ) / sqrt(HB_groups)
#             A_HB = 0.0
#         A = A_lin + (A_CL + A_HB) * diacid_factor
#         B_CL_HB = groups.aggregate_matches(
#                 m, data.EVAPORATION2_B,
#                 groups=(
#                     '5', '6', '7', '8', '9', '10', '11', '12',
#                     '13', '14', '15', '16', '17', '18', '19', '20')
#                 )
#         B = B_lin + B_CL_HB * diacid_factor
#         A = groups.aggregate_matches(
#                 m, data.EVAPORATION2_A, groups=g)
#         B = groups.aggregate_matches(
#                 m, data.EVAPORATION_B, groups=g)
# 
# Path: umansysprop/critical_properties.py
# def joback_and_reid(compound, boiling_point):
# def nannoolal(compound, boiling_point):
# 
# Path: umansysprop/liquid_densities.py
# def girolami(compound):
# def _generic(
#         compound, temperature, molar_volume, critical_properties):
# def schroeder(
#         compound, temperature, critical_properties):
# def le_bas(
#         compound, temperature, critical_properties):
# def tyn_and_calus(
#         compound, temperature, critical_properties):


# Path: umansysprop/examples/Pure_component_properties_example.py
import glob
import pybel
import collections
import sys
import pdb
from umansysprop import boiling_points
from umansysprop import vapour_pressures
from umansysprop import critical_properties
from umansysprop import liquid_densities

# forms on the current website. The principle is the same, we simply call Pybel directly.
#
# Current properties calculated:
# - Pure component vapour pressure
# - Boiling point
# - Subcooled liquid density
# - Molecular weight and chemical formula
#
# Last modification 21/12/16

# Here you will need to put the relevant path in for your UManSysProp distribution. Mine is
# given as an example  - change this!
sys.path.append('/home/david/Documents/Python/Git_repo_UManSysProp_public/UManSysProp_public/')

##########################################################################################
# 1. Read in the property data, seperating only .prop files from the rest.
# I have defined the .prop files myself, just for ease of use for this project.
# It is just a textfile with compound name/reference as first column, SMILES as second.

onlyfiles = [f for f in glob.glob('*.prop')]

#1) extract the data from each file and start generating a dictionary of Pybel objects

step=0
filenames=[]
Compound_reference=[]
smiles_array=[]
property_array=[]
Pybel_object_dict=dict()


for filename in onlyfiles: # If you have more than one file, for whatever reason