# Load the COSMO species
database = CosmoRSSpeciesDatabase()
water = database.exportSpecies('water')
aspirin = database.exportSpecies('acetylsalicylic acid')

# Set the melting temperature and enthalpy of fusion.
aspirin.setMeltingPoint(409*Kelvin)
aspirin.setEnthalpyOfFusion(29.17*kiloJoulePerMol)

# Determine the solid solubility.
solid_solubility = SolidSolubility(
    aspirin,
    water,
    temperature=298*Kelvin,
    parameters=CosmoRSParameters()
)

# Retrieve solute concentration in different forms.
molar_concentration = solid_solubility.soluteConcentration()[0]
nlprint(f'The molar concentration of aspirin in water is {molar_concentration}')
mole_fraction = solid_solubility.soluteMoleFraction()[0]
nlprint(f'The mole fraction of aspirin in water is {mole_fraction}')
weight_percent = solid_solubility.soluteWeightPercent()[0]
nlprint(f'The weight percent of aspirin in water is {weight_percent}')
