Skip to content

Commit 5dfdf1a

Browse files
committed
fix errors in master
1 parent da36ff7 commit 5dfdf1a

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
lines changed

src/models/Electrolytes/base.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ end
1919
neutralmodel::EoSModel = pharmaPCSAFT,
2020
ionmodel::IonModel = DH,
2121
RSPmodel::RSPModel = ConstRSP,
22-
charges = String[],
22+
charge::Vector{Int} = Int[],
2323
ideal_userlocations = String[],
2424
neutralmodel_userlocations = String[],
2525
ionmodel_userlocations = String[],
@@ -42,7 +42,7 @@ function ESElectrolyte(solvents,ions;
4242
neutralmodel = pharmaPCSAFT,
4343
ionmodel = DH,
4444
RSPmodel = ConstRSP,
45-
charge = String[],
45+
charge = nothing,
4646
ideal_userlocations = String[],
4747
neutralmodel_userlocations = String[],
4848
ionmodel_userlocations = String[],
@@ -54,11 +54,18 @@ function ESElectrolyte(solvents,ions;
5454
components = deepcopy(ions)
5555
prepend!(components,solvents)
5656

57-
58-
5957

60-
params = getparams(components, ["Electrolytes/properties/charges.csv"]; userlocations=charge, verbose=verbose)
61-
charge = params["charge"].values
58+
if isnothing(charge)
59+
charge_params = getparams(components, ["Electrolytes/properties/charges.csv"]; verbose=verbose)
60+
init_charge = charge_params["charge"].values
61+
62+
elseif charge isa Vector{String}
63+
charge_params = getparams(components, ["Electrolytes/properties/charges.csv"]; userlocations=charge, verbose=verbose)
64+
init_charge = charge_params["charge"].values
65+
else
66+
init_charge = charge
67+
end
68+
6269
#path0 = default_locations(neutralmodel)
6370
#remove unused datapaths
6471
#neutral_path = joinpath.(DB_PATH,filter(∉(("properties/molarmass.csv","properties/molarmass_groups.csv,properties/critical_csv")),path0))
@@ -75,7 +82,7 @@ function ESElectrolyte(solvents,ions;
7582
components = init_neutralmodel.components
7683

7784
references = String[]
78-
model = ESElectrolyte(components,charge,init_idealmodel,init_neutralmodel,init_ionmodel,references)
85+
model = ESElectrolyte(components,init_charge,init_idealmodel,init_neutralmodel,init_ionmodel,references)
7986
set_reference_state!(model,reference_state;verbose)
8087
return model
8188
end

src/models/SAFT/PCSAFT/variants/ePCSAFT.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end
1616
neutralmodel::EoSModel = pharmaPCSAFT,
1717
ionmodel::IonModel = DH,
1818
RSPmodel::RSPModel = ConstRSP,
19-
charges = String[],
19+
charge = String[],
2020
ideal_userlocations = String[],
2121
neutralmodel_userlocations = String[],
2222
ionmodel_userlocations = String[],
@@ -54,7 +54,7 @@ function ePCSAFT(solvents,ions;
5454
neutralmodel = pharmaPCSAFT,
5555
ionmodel = hsdDH,
5656
RSPmodel = ConstRSP,
57-
charges = String[],
57+
charge = String[],
5858
ideal_userlocations = String[],
5959
neutralmodel_userlocations = String[],
6060
ionmodel_userlocations = String[],
@@ -68,9 +68,16 @@ function ePCSAFT(solvents,ions;
6868
components = deepcopy(ions)
6969
prepend!(components,solvents)
7070

71-
params = getparams(components, ["Electrolytes/properties/charges.csv"]; userlocations=charges, verbose=verbose)
72-
_charge = params["charge"]
73-
charge = _charge.values
71+
if isnothing(charge)
72+
charge_params = getparams(components, ["Electrolytes/properties/charges.csv"]; verbose=verbose)
73+
init_charge = charge_params["charge"].values
74+
75+
elseif charge isa Vector{String}
76+
charge_params = getparams(components, ["Electrolytes/properties/charges.csv"]; userlocations=charge, verbose=verbose)
77+
init_charge = charge_params["charge"].values
78+
else
79+
init_charge = charge
80+
end
7481

7582
neutral_path = DB_PATH.*["/SAFT/PCSAFT","/SAFT/PCSAFT/ePCSAFT","/SAFT/PCSAFT/pharmaPCSAFT"]
7683

@@ -82,15 +89,15 @@ function ePCSAFT(solvents,ions;
8289
for i in ions
8390
init_neutralmodel.params.epsilon[i] = 0. #pure ion has ϵi
8491
for j in ions
85-
if sign(_charge[i]) == sign(_charge[j]) #cation-cation and anion-anion interactions are neglected.
92+
if sign(init_charge[i]) == sign(init_charge[j]) #cation-cation and anion-anion interactions are neglected.
8693
init_neutralmodel.params.epsilon[i,j] = 0.
8794
end
8895
end
8996
end
9097

9198
references = ["10.1016/j.cherd.2014.05.017"]
9299
components = format_components(components)
93-
model = ePCSAFT(components,charge,init_idealmodel,init_neutralmodel,init_ionmodel,references)
100+
model = ePCSAFT(components,init_charge,init_idealmodel,init_neutralmodel,init_ionmodel,references)
94101
set_reference_state!(model,reference_state;verbose)
95102
return model
96103
end

src/models/SAFT/SAFTVRMie/variants/SAFTVREMie.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
neutralmodel::EoSModel = SAFTVRMie,
66
ionmodel::IonModel = MSABorn,
77
RSPmodel::RSPModel = Schreckenberg,
8-
charges = String[],
8+
charge = String[],
99
ideal_userlocations = String[],
1010
neutralmodel_userlocations = String[],
1111
ionmodel_userlocations = String[],
@@ -48,7 +48,7 @@ function SAFTVREMie(solvents,ions;
4848
neutralmodel = SAFTVRMie,
4949
ionmodel = MSABorn,
5050
RSPmodel = Schreckenberg,
51-
charges = String[],
51+
charge = String[],
5252
ideal_userlocations = String[],
5353
neutralmodel_userlocations = String[],
5454
ionmodel_userlocations = String[],
@@ -59,7 +59,7 @@ function SAFTVREMie(solvents,ions;
5959

6060
return ESElectrolyte(solvents,ions;
6161
idealmodel,neutralmodel,ionmodel,RSPmodel,
62-
charges,ideal_userlocations,neutralmodel_userlocations,ionmodel_userlocations,RSPmodel_userlocations,assoc_options,reference_state,verbose)
62+
charge,ideal_userlocations,neutralmodel_userlocations,ionmodel_userlocations,RSPmodel_userlocations,assoc_options,reference_state,verbose)
6363
end
6464

6565
export SAFTVREMie

src/models/SAFT/SAFTVRMie/variants/eSAFTVRMie.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end
1717
neutralmodel::EoSModel = SAFTVRMie15,
1818
ionmodel::IonModel = DHBorn,
1919
RSPmodel::RSPModel = ZuoFurst,
20-
charges = String[],
20+
charge = String[],
2121
ideal_userlocations = String[],
2222
neutralmodel_userlocations = String[],
2323
ionmodel_userlocations = String[],
@@ -60,7 +60,7 @@ function eSAFTVRMie(solvents,ions;
6060
neutralmodel = SAFTVRMie15,
6161
ionmodel = DHBorn,
6262
RSPmodel = ZuoFurst,
63-
charges = String[],
63+
charge = String[],
6464
ideal_userlocations = String[],
6565
neutralmodel_userlocations = String[],
6666
ionmodel_userlocations = String[],
@@ -71,7 +71,7 @@ function eSAFTVRMie(solvents,ions;
7171

7272
return ESElectrolyte(solvents,ions;
7373
idealmodel,neutralmodel,ionmodel,RSPmodel,
74-
charges,ideal_userlocations,neutralmodel_userlocations,ionmodel_userlocations,RSPmodel_userlocations,assoc_options,reference_state,verbose)
74+
charge,ideal_userlocations,neutralmodel_userlocations,ionmodel_userlocations,RSPmodel_userlocations,assoc_options,reference_state,verbose)
7575
end
7676

7777
export eSAFTVRMie

0 commit comments

Comments
 (0)