# Load the COSMO species
database = CosmoRSSpeciesDatabase()
water = database.exportSpecies('water')
octanol = database.exportSpecies('1-octanol')
acetonitrile = database.exportSpecies('acetonitrile')

# Saturated octanol contains ~24mol% water.
octanol_phase = CosmoRSMixture([(octanol, 0.76), (water, 0.24)])

# Determine the partition coefficient.
partition_coefficient = PartitionCoefficient(
    acetonitrile,
    octanol_phase,
    water,
    temperature=298*Kelvin,
    parameters=CosmoRSParameters(),
)

# Retrieve the logP.
logp = partition_coefficient.partitionCoefficient()[0]
nlprint(f'The partition coefficient for acetonitrile is {logp}')
