Skip to content

Commit

Permalink
Use rdkit from Rust to fragment SMILES
Browse files Browse the repository at this point in the history
  • Loading branch information
prehner committed Sep 15, 2023
1 parent 5c18ef0 commit 8673507
Show file tree
Hide file tree
Showing 6 changed files with 483 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ indexmap = "1.8"
rayon = { version = "1.5", optional = true }
itertools = "0.10"
typenum = "1.16"
once_cell = "1.13"

[dependencies.pyo3]
version = "0.18"
Expand Down
6 changes: 3 additions & 3 deletions feos-core/src/parameter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ where
/// and the ideal gas record.
fn from_segments<C: SegmentCount>(
chemical_records: Vec<C>,
segment_records: Vec<SegmentRecord<Self::Pure>>,
segment_records: &[SegmentRecord<Self::Pure>],
binary_segment_records: Option<Vec<BinaryRecord<String, Self::Binary>>>,
) -> Result<Self, ParameterError>
where
Expand All @@ -221,7 +221,7 @@ where
let pure_records = chemical_records
.iter()
.map(|cr| {
cr.segment_map(&segment_records).and_then(|segments| {
cr.segment_map(segment_records).and_then(|segments| {
PureRecord::from_segments(cr.identifier().into_owned(), segments)
})
})
Expand Down Expand Up @@ -335,7 +335,7 @@ where
})
.transpose()?;

Self::from_segments(chemical_records, segment_records, binary_records)
Self::from_segments(chemical_records, &segment_records, binary_records)
}

/// Return a parameter set containing the subset of components specified in `component_list`.
Expand Down
2 changes: 1 addition & 1 deletion feos-core/src/python/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ macro_rules! impl_parameter_from_segments {
) -> Result<Self, ParameterError> {
Ok(Self(Arc::new(<$parameter>::from_segments(
chemical_records.into_iter().map(|cr| cr.0).collect(),
segment_records.into_iter().map(|sr| sr.0).collect(),
&segment_records.into_iter().map(|sr| sr.0).collect::<Vec<_>>(),
binary_segment_records.map(|r| r.into_iter().map(|r| BinaryRecord{id1:r.0.id1,id2:r.0.id2,model_record:r.0.model_record.into()}).collect()),
)?)))
}
Expand Down
Loading

0 comments on commit 8673507

Please sign in to comment.