occ
Loading...
Searching...
No Matches
occ::solvent::cosmors Namespace Reference

The openCOSMO-RS solvation free energy expression. More...

Classes

struct  ActivityOptions
 Controls for the segment activity fixed point. More...
 
struct  Component
 One component reduced to what the kernel needs: its segment descriptors, areas, and the cavity volume the combinatorial term uses. More...
 
struct  ComponentFile
 A solvent's segment ensemble as stored on disk. More...
 
struct  Parameters
 Every parameter of the openCOSMO-RS model. More...
 
struct  Segments
 Per-segment COSMO data. More...
 
class  SegmentStore
 Resolves a solvent name to its segment ensemble, read from <name>.json or <name>.rsseg under the search paths, preferring the former within a directory. More...
 
struct  SolvationEnergy
 The terms of the openCOSMO-RS solvation free energy, each in Hartree. More...
 
class  SolventModel
 A solvent held as its converged segment activities, ready to accept any solute at infinite dilution. More...
 

Functions

int ring_count (const core::Molecule &molecule)
 Number of rings, for the ring correction: the cycle rank of the bond graph, bonds - atoms + 1 for a connected molecule.
 
Vec segment_vdw_energies (const Component &component, const Parameters &params)
 Per-segment van der Waals contribution −τ_Z(i) a_i, in Hartree.
 
std::vector< int > unparameterised_elements (const Component &component, const Parameters &params)
 Atomic numbers in component that params.tau does not cover, sorted and deduplicated.
 
Component mix_components (const std::vector< Component > &components, const Vec &mole_fractions)
 Mole-fraction-weighted mixture of solvent components, as the pooled segment ensemble the kernel sees.
 
Mat interaction_energies (const Component &a, const Component &b, const Parameters &params, double temperature)
 Pairwise interaction free energy between every segment of a and every segment of b, in J/mol.
 
Vec residual_ln_gamma (const std::vector< Component > &components, const Vec &mole_fractions, const Parameters &params, const ActivityOptions &options={})
 Residual ln γ per component, with the ideal conductor as reference.
 
Vec combinatorial_ln_gamma (const std::vector< Component > &components, const Vec &mole_fractions, const Parameters &params)
 Staverman–Guggenheim combinatorial ln γ, in the volume/area form openCOSMO-RS uses.
 
SolvationEnergy solvation_free_energy (const SolventModel &solvent, const Component &solute, double dielectric, int num_rings, double volume_liquid)
 Assemble the solvation free energy of a solute at infinite dilution.
 
ankerl::unordered_dense::map< int, double > area_per_element (const Component &component)
 Cavity area per element, Ų, keyed by atomic number.
 
ComponentFile read_segments (const std::string &path)
 Read an ensemble, picking the layout from the file extension.
 
void write_segments (const std::string &path, const std::string &name, const Component &component, const Parameters &params, const std::string &method={}, const std::string &basis={})
 Write an ensemble.
 
ComponentFile load_solvent (const SegmentStore &store, const std::string &name, const Parameters &params, const std::string &method={}, const std::string &basis={})
 Load name's ensemble and check it against the parameters in use.
 
Segments segments_from_cavity (const surface::Surface &cavity, const Vec &charges, const IVec &atomic_numbers)
 Build segments from a COSMO cavity and the apparent surface charges.
 
void average_sigma (Segments &segments, double r_av_angs, double f_decay=1.0)
 Segment averaging onto the effective contact scale:
 
Vec averaged_sigma (const Segments &segments, double r_av_angs, double f_decay=1.0)
 The same average returned rather than stored, so a second descriptor can be built on a different radius without disturbing sigma_averaged.
 
void average_sigma_orth (Segments &segments, double r_av_angs, double r_corr_angs, double factor=0.816)
 Fill sigma_orth, the correlation screening charge density COSMO-RS misfit uses:
 

Detailed Description

The openCOSMO-RS solvation free energy expression.

openCOSMO-RS 24a: segment descriptors, the interaction kernel and the solvation free energy assembled from them

Screening-charge-density (σ) machinery underlying the COSMO-RS solvation model.

openCOSMO-RS assembles a solvation free energy as

dG_solv = E_diel + RT ln(gamma_inf) - sum_a tau_a A_a
          - omega_ring n_ring - RT ln(v_gas/v_liquid) - eta

(Grigorash et al., Chem. Eng. Sci., 2025, eq. 16), term by term:

  • E_diel, the gas-to-ideal-conductor energy. The caller supplies it, since it comes from the conductor SCF rather than from this model.
  • RT ln(gamma_inf), the activity coefficient at infinite dilution, split here into its residual (segment misfit and hydrogen bonding) and combinatorial (Staverman-Guggenheim size and shape) parts.
  • -sum_a tau_a A_a, the van der Waals term: a per-element surface tension times that element's cavity area. It is a sum over atoms, so it is additive over surface segments and partitions over contacts exactly as the residual does.
  • -omega_ring n_ring, an empirical correction for ring strain.
  • -RT ln(v_gas/v_liquid), moving from a 1 bar ideal gas reference to the pure liquid.
  • -eta, the fitted intercept of the regression.

There is deliberately no cavity-formation term: the work of opening the cavity was not modelled separately in the regression, and whatever part of it is not already in the van der Waals term is absorbed into eta. Without the last four terms the total is not a solvation free energy on any absolute scale.

Units follow the published parameter tables and are converted at the boundary: σ in e/Ų, segment areas in Ų, distances in Å (positions are stored in Bohr to match surface::Surface).

The entry point for a single molecule is occ::driver::cosmors_solvation_free_energy; occ cg --solvation-model cosmo-rs uses the same model with the surface-additive terms partitioned over crystal contacts.

Function Documentation

◆ area_per_element()

ankerl::unordered_dense::map< int, double > occ::solvent::cosmors::area_per_element ( const Component component)

Cavity area per element, Ų, keyed by atomic number.

◆ average_sigma()

void occ::solvent::cosmors::average_sigma ( Segments segments,
double  r_av_angs,
double  f_decay = 1.0 
)

Segment averaging onto the effective contact scale:

σ̄_i = Σ_j σ_j w_ij / Σ_j w_ij
w_ij = (r_j² r_av²)/(r_j² + r_av²) · exp[ −f_decay d_ij²/(r_j² + r_av²)
]

with r_j = √(a_j/π) the radius of an equal-area disc. Fills sigma_averaged. The Gaussian is truncated where it falls below ~1e-12.

openCOSMO-RS averages on r_av = 0.5 Å with f_decay = 1.

◆ average_sigma_orth()

void occ::solvent::cosmors::average_sigma_orth ( Segments segments,
double  r_av_angs,
double  r_corr_angs,
double  factor = 0.816 
)

Fill sigma_orth, the correlation screening charge density COSMO-RS misfit uses:

σ⊥ = avg(r_corr) − factor · avg(r_av)

openCOSMO-RS takes r_av = 0.5 Å, r_corr = 1.0 Å and factor = 0.816. Requires sigma_averaged to have been filled on the same r_av.

◆ averaged_sigma()

Vec occ::solvent::cosmors::averaged_sigma ( const Segments segments,
double  r_av_angs,
double  f_decay = 1.0 
)

The same average returned rather than stored, so a second descriptor can be built on a different radius without disturbing sigma_averaged.

◆ combinatorial_ln_gamma()

Vec occ::solvent::cosmors::combinatorial_ln_gamma ( const std::vector< Component > &  components,
const Vec &  mole_fractions,
const Parameters params 
)

Staverman–Guggenheim combinatorial ln γ, in the volume/area form openCOSMO-RS uses.

Zero for a pure component, so it needs no reference state subtraction.

◆ interaction_energies()

Mat occ::solvent::cosmors::interaction_energies ( const Component a,
const Component b,
const Parameters params,
double  temperature 
)

Pairwise interaction free energy between every segment of a and every segment of b, in J/mol.

Misfit plus hydrogen bonding; the sign convention is that hydrogen bonding is negative.

◆ load_solvent()

ComponentFile occ::solvent::cosmors::load_solvent ( const SegmentStore store,
const std::string &  name,
const Parameters params,
const std::string &  method = {},
const std::string &  basis = {} 
)

Load name's ensemble and check it against the parameters in use.

The descriptors are meaningless across averaging radii and only comparable at one level of theory, so both are checked here rather than left to each caller: a mismatched radius throws, a mismatched basis warns.

◆ mix_components()

Component occ::solvent::cosmors::mix_components ( const std::vector< Component > &  components,
const Vec &  mole_fractions 
)

Mole-fraction-weighted mixture of solvent components, as the pooled segment ensemble the kernel sees.

Segment areas are scaled by mole fraction so the pooled ensemble carries the mixture's segment fractions; volume and cavity area become the mole-fraction averages the combinatorial term expects. Fractions are normalised.

◆ read_segments()

ComponentFile occ::solvent::cosmors::read_segments ( const std::string &  path)

Read an ensemble, picking the layout from the file extension.

◆ residual_ln_gamma()

Vec occ::solvent::cosmors::residual_ln_gamma ( const std::vector< Component > &  components,
const Vec &  mole_fractions,
const Parameters params,
const ActivityOptions options = {} 
)

Residual ln γ per component, with the ideal conductor as reference.

Solves the pooled-segment fixed point Γ_i = 1/Σ_j X_j Γ_j exp(−A_ij/RT) in log space, then sums (a_i/a_eff) ln Γ_i over each component's own segments. Subtract the pure-component values for a pure-component reference state.

◆ ring_count()

int occ::solvent::cosmors::ring_count ( const core::Molecule molecule)

Number of rings, for the ring correction: the cycle rank of the bond graph, bonds - atoms + 1 for a connected molecule.

Zero without bonds, which is also the right answer for an acyclic solute.

◆ segment_vdw_energies()

Vec occ::solvent::cosmors::segment_vdw_energies ( const Component component,
const Parameters params 
)

Per-segment van der Waals contribution −τ_Z(i) a_i, in Hartree.

Negative, so it stabilises. Additive over segments by construction, which is what lets occ cg attribute it to contacts without further modelling. Segments on an element outside the parameter set contribute zero.

◆ segments_from_cavity()

Segments occ::solvent::cosmors::segments_from_cavity ( const surface::Surface cavity,
const Vec &  charges,
const IVec atomic_numbers 
)

Build segments from a COSMO cavity and the apparent surface charges.

charges are segment charges in e, not densities — the COSMO A matrix carries units of inverse length, so σ = A⁻¹(−f φ) is a charge.

◆ solvation_free_energy()

SolvationEnergy occ::solvent::cosmors::solvation_free_energy ( const SolventModel solvent,
const Component solute,
double  dielectric,
int  num_rings,
double  volume_liquid 
)

Assemble the solvation free energy of a solute at infinite dilution.

dielectric is the gas-to-conductor energy in Hartree, which the caller already has from the conductor SCF. volume_liquid is the volume of one solute molecule in the liquid, ų; pass a non-positive value to drop the reference-state term. The parameters are the solvent model's own, so the kernel and the assembly cannot disagree.

◆ unparameterised_elements()

std::vector< int > occ::solvent::cosmors::unparameterised_elements ( const Component component,
const Parameters params 
)

Atomic numbers in component that params.tau does not cover, sorted and deduplicated.

Empty when every element is covered.

◆ write_segments()

void occ::solvent::cosmors::write_segments ( const std::string &  path,
const std::string &  name,
const Component component,
const Parameters params,
const std::string &  method = {},
const std::string &  basis = {} 
)

Write an ensemble.

A .json path gets occ's JSON layout, anything else the .rsseg text one.