Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename ParametersHetero
  • Loading branch information
prehner committed Jun 20, 2025
commit aee477d5f4ba8ffcbcf54adef214119715ced96f
11 changes: 5 additions & 6 deletions crates/feos-core/src/parameter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<B, C> BinaryParameters<B, C> {
}
}

pub struct ParametersBase<P, B, A, Bo, C> {
pub struct GcParameters<P, B, A, Bo, C> {
pub pure: Vec<PureParameters<P, C>>,
pub binary: Vec<BinaryParameters<B, ()>>,
pub bonds: Vec<BinaryParameters<Bo, C>>,
Expand All @@ -87,11 +87,10 @@ pub struct ParametersBase<P, B, A, Bo, C> {
pub molar_weight: MolarWeight<Array1<f64>>,
}

pub type Parameters<P, B, A> = ParametersBase<P, B, A, (), ()>;
pub type ParametersHetero<P, B, A, Bo, C> = ParametersBase<P, B, A, Bo, C>;
pub type Parameters<P, B, A> = GcParameters<P, B, A, (), ()>;
pub type IdealGasParameters<I> = Parameters<I, (), ()>;

impl<P: Clone, B: Clone, A: Clone, Bo: Clone, C: Clone> ParametersBase<P, B, A, Bo, C> {
impl<P: Clone, B: Clone, A: Clone, Bo: Clone, C: Clone> GcParameters<P, B, A, Bo, C> {
/// Return a parameter set containing the subset of components specified in `component_list`.
///
/// # Panics
Expand Down Expand Up @@ -474,14 +473,14 @@ impl<P: Clone, B: Clone, A: Clone> Parameters<P, B, A> {
}
}

impl<P, B, A, Bo> ParametersHetero<P, B, A, Bo, f64> {
impl<P, B, A, Bo> GcParameters<P, B, A, Bo, f64> {
pub fn segment_counts(&self) -> Array1<f64> {
self.pure.iter().map(|pr| pr.count).collect()
}
}

impl<P: Clone, B: Clone, A: Clone, Bo: Clone, C: GroupCount + Default>
ParametersHetero<P, B, A, Bo, C>
GcParameters<P, B, A, Bo, C>
{
pub fn from_segments_hetero(
chemical_records: Vec<ChemicalRecord>,
Expand Down
2 changes: 1 addition & 1 deletion crates/feos/src/association/dft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct AssociationFunctional<'a, A: AssociationStrength> {
impl<'a, A: AssociationStrength> AssociationFunctional<'a, A> {
pub fn new<P, B, Bo, C>(
model: &'a A,
parameters: &'a ParametersBase<P, B, A::Record, Bo, C>,
parameters: &'a GcParameters<P, B, A::Record, Bo, C>,
association: &'a Option<Association<A>>,
) -> Option<Self> {
association.as_ref().map(|a| Self {
Expand Down
6 changes: 3 additions & 3 deletions crates/feos/src/association/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::collections::HashMap;

use crate::hard_sphere::HardSphereProperties;
use feos_core::parameter::{AssociationParameters, ParametersBase};
use feos_core::parameter::{AssociationParameters, GcParameters};
use feos_core::{FeosError, FeosResult, StateHD};
use ndarray::*;
use num_dual::linalg::{LU, norm};
Expand Down Expand Up @@ -47,7 +47,7 @@ pub struct Association<A: AssociationStrength> {

impl<A: AssociationStrength> Association<A> {
pub fn new<B, Bo, C>(
parameters: &ParametersBase<A::Pure, B, A::Record, Bo, C>,
parameters: &GcParameters<A::Pure, B, A::Record, Bo, C>,
max_iter: usize,
tol: f64,
) -> FeosResult<Option<Self>> {
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<A: AssociationStrength> Association<A> {
}

pub fn new_cross_association<B, Bo, C>(
parameters: &ParametersBase<A::Pure, B, A::Record, Bo, C>,
parameters: &GcParameters<A::Pure, B, A::Record, Bo, C>,
max_iter: usize,
tol: f64,
) -> FeosResult<Option<Self>> {
Expand Down
4 changes: 2 additions & 2 deletions crates/feos/src/gc_pcsaft/record.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use feos_core::parameter::ParametersHetero;
use feos_core::parameter::GcParameters;
use num_traits::Zero;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -51,4 +51,4 @@ impl GcPcSaftAssociationRecord {

/// Parameter set required for the gc-PC-SAFT equation of state.
pub type GcPcSaftParameters<C> =
ParametersHetero<GcPcSaftRecord, f64, GcPcSaftAssociationRecord, (), C>;
GcParameters<GcPcSaftRecord, f64, GcPcSaftAssociationRecord, (), C>;
4 changes: 2 additions & 2 deletions py-feos/src/parameter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl PyGcParameters {

pub fn try_convert_heterosegmented<P, B, A, C: GroupCount + Default>(
self,
) -> PyResult<ParametersHetero<P, B, A, (), C>>
) -> PyResult<GcParameters<P, B, A, (), C>>
where
for<'de> P: Deserialize<'de> + Clone,
for<'de> B: Deserialize<'de> + Clone,
Expand All @@ -559,7 +559,7 @@ impl PyGcParameters {
.collect::<Result<Vec<_>, PyFeosError>>()
})
.transpose()?;
Ok(ParametersBase::<P, B, A, (), C>::from_segments_hetero(
Ok(GcParameters::<P, B, A, (), C>::from_segments_hetero(
self.chemical_records,
&segment_records,
binary_segment_records.as_deref(),
Expand Down