CosmoRSParameterSets

class CosmoRSParameterSets
deleteParameterSet(name)

Delete the the given named entry from the available parameter sets. This can only be done for user added entries.

Parameters:

name (str) – The name of the parameter set to delete.

loadParameterSet(name)

Return the parameter set for the given named entry.

Parameters:

name (str) – The name of the parameter set to return.

Returns:

The parameter set.

Return type:

CosmoRSParameters

parameterSets()
Returns:

A list of the names of the available parameter sets.

Return type:

list of str

saveParameterSet(name, parameter_set, reference=None, description=None)

Save a parameter set into the set of available parameter sets.

Parameters:
  • name (str) – The name to be given to the parameter set.

  • parameter_set (CosmoRSParameters) – The data for the parameter set.

  • reference (str) – An optional reference for where the parameters were obtained.

  • description (str) – An optional description of the parameter set.

Usage Examples

List the available parameter sets and load a parameter set to calculate the chemical potential of water.

# Load the parameters database
param_database = CosmoRSParameterSets()

# Print the names of the available parameter sets
parameter_names = param_database.parameterSets()
nlprint('Available parameter set names:')
for name in parameter_names:
    nlprint(name)
nlprint('')

# Load a specific parameter set
parameters = param_database.loadParameterSet('klamt_1998')

# Calculate the chemical potential of water with the new parameter set
molecule_database = CosmoRSSpeciesDatabase()
water = molecule_database.exportSpecies('water')
solvent = CosmoRealSolvent(298*Kelvin, water, parameters)
chemical_potential = solvent.chemicalPotential(water)
nlprint(f'The estimated chemical potential of water is {chemical_potential}')

load_parameters_example.py

Save a parameter set into the database and then delete it again.

# Create the custom CosmoRSParameters object
parameters = CosmoRSParameters(
    hydrogen_bond_donors=Hydrogen,
    hydrogen_bond_acceptors=(Nitrogen, Oxygen, Fluorine),
    r_average=0.334*Ang,
    alpha_prime=1428.3*kiloCaloriePerMol*Ang**2/elementary_charge**2,
    f_correlation=2.784,
    c_hydrogen_bonding=8800*kiloCaloriePerMol*Ang**2/elementary_charge**2,
    sigma_hydrogen_bonding=0.869*elementary_charge/nm**2,
    hydrogen_bond_temperature=False,
    a_effective=7.79*Ang**2,
    lambda_comb=0.13,
    omega_ring=-0.216*kiloCaloriePerMol,
    eta_gas=-10.05,
    lambda_reg=0.611,
    lambda_ortho=0.820,
    pka_scale=1.0,
    pka_offset=0.0,
    dispersion={
        Hydrogen: -3.59*kiloCaloriePerMol/nm**2,
        Carbon: -3.47*kiloCaloriePerMol/nm**2,
        Nitrogen: -2.26*kiloCaloriePerMol/nm**2,
        Oxygen: -3.17*kiloCaloriePerMol/nm**2,
        Chlorine: -5.00*kiloCaloriePerMol/nm**2,
    },
)

# Save the parameters to the database
database = CosmoRSParameterSets()
database.saveParameterSet(
    'custom_parameter_set',
    parameters,
    reference='DOI: 10.1139/V09-008',
    description=(
        'Taken from "C. C. Pye, T. Zeigler, E. van Lenthe and J. L. Louwen. '
        'Can. J. Chem., 87, 790-797 (2009).'
    )
)

# Print the names of the available parameter sets
parameter_names = database.parameterSets()
nlprint('Available parameter set names:')
for name in parameter_names:
    nlprint(name)
nlprint('')

# Remove the entry from the database again
database.deleteParameterSet('custom_parameter_set')

save_delete_parameters_example.py

Notes

The CosmoRSParameterSets object functions as an interface to a local database of COSMO-RS parameter sets. This database can also be accessed by the COSMO-RS Parameters dialog in the COSMO-RS Analyzer. Parameter sets added to the CosmoRSParameterSets object also become available in the COSMO-RS Analyzer.

Parameter sets can be stored or retrieved with a simple save and load interface. The method parameterSets lists the available parameter sets. A parameter set is obtained from the database using the loadParameterSet method. This returns a CosmoRSParameters object which can be used directly in COSMO-RS calculations. Likewise, a parameter set can be saved using the saveParameterSet method, which takes along with it a a CosmoRSParameters object that defines the parameter set. Optional text information about the parameter set can also be provided. Once saved, a parameter set can be removed with the deleteParameterSet method. Only parameter sets added by the user can be deleted.