Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: MissingException: Missing values exist ∈ single parameter Tc: ["CC(CO)O"]. with get_groups_from_smiles function #327

Closed
Tiger2Wings opened this issue Dec 30, 2024 · 2 comments

Comments

@Tiger2Wings
Copy link

I have updated GCIdentifier.jl to latest version. GCIdentifier.jl
BUT, still ERROR, please, thanks.

julia> (component,groups) = get_groups_from_smiles("CC(Cc1ccc(cc1)C(C(=O)O)C)C", UNIFACGroups)
("CC(Cc1ccc(cc1)C(C(=O)O)C)C", ["COOH" => 1, "CH3" => 3, "CH" => 1, "ACH" => 4, "ACCH2" => 1, "ACCH" => 1])

julia> model = UNIFAC(["water",(component,groups)])

ERROR: MissingException: Missing values exist ∈ single parameter Tc: ["CC(Cc1ccc(cc1)C(C(=O)O)C)C"].
Stacktrace:
  [1] SingleMissingError(param::Clapeyron.SingleParameter; all::Any)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:324
  [2] SingleMissingError(param::Clapeyron.SingleParameter)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:317
  [3] is_valid_param(param::Clapeyron.SingleParameter, options::Any)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:304
  [4] getparams(components::Vector{String}, locations::Vector{String}, options::ParamOptions{Vector{String}, Vector{String}})
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:223
  [5] #getparams#126
    @ ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:211 [inlined]
  [6] getparams
    @ ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:179 [inlined]
  [7] PR(components::Vector{…}; idealmodel::Type, alpha::Type, mixing::Type, activity::Nothing, translation::Type, userlocations::Vector{…}, ideal_userlocations::Vector{…}, alpha_userlocations::Vector{…}, mixing_userlocations::Vector{…}, activity_userlocations::Vector{…}, translation_userlocations::Vector{…}, reference_state::Nothing, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/cubic/PR/PR.jl:109
  [8] init_model(::Type{PR}, components::Vector{String}, userlocations::Vector{String}, verbose::Bool, reference_state::Nothing)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/utils/macros.jl:511
  [9] init_model(::Type{PR}, components::Vector{String}, userlocations::Vector{String}, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/utils/macros.jl:505
 [10] init_puremodel(model::Type, components::Vector{String}, userlocations::Vector{String}, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/utility/EoSVectorParam.jl:34
 [11] UNIFAC(components::Vector{…}; puremodel::Type, userlocations::Vector{…}, group_userlocations::Vector{…}, pure_userlocations::Vector{…}, verbose::Bool, reference_state::Nothing)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/Activity/UNIFAC/UNIFAC.jl:189
 [12] UNIFAC(components::Vector{Any})
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/Activity/UNIFAC/UNIFAC.jl:169
 [13] top-level scope
    @ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.

AND i try my own example,
julia> (component,groups) = get_groups_from_smiles("CC(CO)O",UNIFACGroups)
("CC(CO)O", ["CH3" => 1, "CH2" => 1, "CH" => 1, "OH (P)" => 1, "OH (S)" => 1])

julia> model = UNIFAC(["Ethanol",(component,groups)])

ERROR: MissingException: Missing values exist ∈ single parameter Tc: ["CC(CO)O"].
Stacktrace:
  [1] SingleMissingError(param::Clapeyron.SingleParameter; all::Any)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:324
  [2] SingleMissingError(param::Clapeyron.SingleParameter)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:317
  [3] is_valid_param(param::Clapeyron.SingleParameter, options::Any)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database_rawparam.jl:304
  [4] getparams(components::Vector{String}, locations::Vector{String}, options::ParamOptions{Vector{String}, Vector{String}})
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:223
  [5] #getparams#126
    @ ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:211 [inlined]
  [6] getparams
    @ ~/.julia/packages/Clapeyron/pUKt5/src/database/database.jl:179 [inlined]
  [7] PR(components::Vector{…}; idealmodel::Type, alpha::Type, mixing::Type, activity::Nothing, translation::Type, userlocations::Vector{…}, ideal_userlocations::Vector{…}, alpha_userlocations::Vector{…}, mixing_userlocations::Vector{…}, activity_userlocations::Vector{…}, translation_userlocations::Vector{…}, reference_state::Nothing, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/cubic/PR/PR.jl:109
  [8] init_model(::Type{PR}, components::Vector{String}, userlocations::Vector{String}, verbose::Bool, reference_state::Nothing)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/utils/macros.jl:511
  [9] init_model(::Type{PR}, components::Vector{String}, userlocations::Vector{String}, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/utils/macros.jl:505
 [10] init_puremodel(model::Type, components::Vector{String}, userlocations::Vector{String}, verbose::Bool)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/utility/EoSVectorParam.jl:34
 [11] UNIFAC(components::Vector{…}; puremodel::Type, userlocations::Vector{…}, group_userlocations::Vector{…}, pure_userlocations::Vector{…}, verbose::Bool, reference_state::Nothing)
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/Activity/UNIFAC/UNIFAC.jl:189
 [12] UNIFAC(components::Vector{Any})
    @ Clapeyron ~/.julia/packages/Clapeyron/pUKt5/src/models/Activity/UNIFAC/UNIFAC.jl:169
 [13] top-level scope
    @ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types.
@Tiger2Wings
Copy link
Author

julia> (component2,groups) = get_groups_from_name("Phenylethanol",UNIFACGroups)
("Phenylethanol", ["CH2" => 1, "OH (P)" => 1, "ACH" => 5, "ACCH2" => 1])

julia> model = UNIFAC(["Ethanol",(component2,groups)])
ERROR: MissingException: Missing values exist ∈ single parameter Tc: ["Phenylethanol"].

Another ERROR, "Phenylethanol", could it be parameter Tc database related? Smiles and names that not in the database lead to ERROR: MissingException: Missing values exist ∈ single parameter Tc

@longemen3000
Copy link
Member

hello,

For the first error (ERROR: MissingException: Missing values exist ∈ single parameter Tc: ["CC(Cc1ccc(cc1)C(C(=O)O)C)C"].), it means that there is no component in the critical database with name "CC(Cc1ccc(cc1)C(C(=O)O)C)C. the critical database is called because we use the Peng-Robinson equation of state as the default pure model for UNIFAC. if you are only modeling in low pressures and moderate temps, you can just use an ideal gas model instead:

julia> component,groups = ("CC(Cc1ccc(cc1)C(C(=O)O)C)C", ["COOH" => 1, "CH3" => 3, "CH" => 1, "ACH" => 4, "ACCH2" => 1, "ACCH" => 1])
("CC(Cc1ccc(cc1)C(C(=O)O)C)C", ["COOH" => 1, "CH3" => 3, "CH" => 1, "ACH" => 4, "ACCH2" => 1, "ACCH" => 1])

julia> model = UNIFAC(["water",(component,groups)],puremodel = BasicIdeal)
UNIFAC{BasicIdeal} with 2 components:
 "water": "H2O" => 1
 "CC(Cc1ccc(cc1)C(C(=O)O)C)C": "COOH" => 1, "CH3" => 3, "CH" => 1, "ACH" => 4, "ACCH2" => 1, "ACCH" => 1
Group Type: UNIFACDortmund
Contains parameters: A, B, C, R, Q

julia> c2,g2 = ("CC(CO)O", ["CH3" => 1, "CH2" => 1, "CH" => 1, "OH (P)" => 1, "OH (S)" => 1])
("CC(CO)O", ["CH3" => 1, "CH2" => 1, "CH" => 1, "OH (P)" => 1, "OH (S)" => 1])

julia> model = UNIFAC(["Ethanol",(c2,g2)],puremodel = BasicIdeal)
UNIFAC{BasicIdeal} with 2 components:
 "Ethanol": "CH2" => 1, "CH3" => 1, "OH (P)" => 1
 "CC(CO)O": "CH3" => 1, "CH2" => 1, "CH" => 1, "OH (P)" => 1, "OH (S)" => 1
Group Type: UNIFACDortmund
Contains parameters: A, B, C, R, Q

on the error with phenylethanol, you can try with 1-phenylethanol, that name is in the database

julia> c1 = Clapeyron.cas("1-phenylethanol") #gets a cas from a name
1-element Vector{String}:
 "98-85-1"

julia> Clapeyron.by_cas(c1) #gets a name from a cas.
1-element Vector{String}:
 "1-phenylethanol"

julia> PR("1-phenylethanol")
PR{BasicIdeal, PRAlpha, NoTranslation, vdW1fRule} with 1 component:
 "1-phenylethanol"
Contains parameters: a, b, Tc, Pc, Mw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants