function fromFormationEnergies input Real MM = 1 "Molar mass of the substance"; input Real z = 0 "Charge number of the substance (e.g., 0..uncharged, -1..electron, +2..Ca^(2+))"; input Real DfG = 0 "Gibbs energy of formation of the substance at SATP conditions (298.15, 1bar)"; input Real DfH = 0 "Enthalpy of formation of the substance at SATP conditions (298.15, 1bar)"; input Real S0 = 0 "Standart molar entropy of the substance at SATP conditions (298.15, 1bar)"; input Real Cp = 1 "Molar heat capacity of the substance at SATP conditions (298.15, 1bar)"; input PhaseType phase = PhaseType.Incompressible "State of matter"; input Real Vm = if (phase == PhaseType.Gas) then ((1.380649e-23*6.02214076e23)*298.15)/100000 else 0.001*MM "Molar volume of the pure substance at SATP conditions (298.15, 1bar) (default fron non-gaseous is to reach density 1kg/L)"; input Real gamma = 1 "Activity coefficient of the substance"; input Boolean SelfClustering = false; input Real SelfClustering_dH = 0; input Real SelfClustering_dS = 0; output Definition result(data = DataRecord(MM = MM, Hf = DfH, H0 = DfH - 298.15*Cp, alow = {0, 0, Cp/(1.380649e-23*6.02214076e23), 0, 0, 0, 0}, blow = {(DfH - Cp*298.15)/(1.380649e-23*6.02214076e23), (S0 - Cp*log(298.15))/(1.380649e-23*6.02214076e23), (((DfH - DfG)/298.15) - Cp*log(298.15))/(1.380649e-23*6.02214076e23)}, ahigh = {0, 0, Cp/(1.380649e-23*6.02214076e23), 0, 0, 0, 0}, bhigh = {(DfH - Cp*298.15)/(1.380649e-23*6.02214076e23), (S0 - Cp*log(298.15))/(1.380649e-23*6.02214076e23), (((DfH - DfG)/298.15) - Cp*log(298.15))/(1.380649e-23*6.02214076e23)}, z = z, phase = phase, VmBase = Vm/(1 + log(gamma)), VmExcess = Vm*log(gamma)/(1 + log(gamma))), SelfClustering = SelfClustering, SelfClustering_dH = SelfClustering_dH, SelfClustering_dS = SelfClustering_dS); end fromFormationEnergies;