-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
678160e
commit 5f3719e
Showing
3 changed files
with
102 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""GibbsModel module.""" | ||
|
||
from typing import Union | ||
|
||
import pandas as pd | ||
|
||
from ugropy.fragmentation_models.fragmentation_model import FragmentationModel | ||
|
||
|
||
class GibbsModel(FragmentationModel): | ||
"""GibbsModel it's a fragmentation model dedicated to Gibbs excess models. | ||
unifac, psrk, dortmund are instances of this class. | ||
Parameters | ||
---------- | ||
subgroups : pd.DataFrame | ||
Model's subgroups. Index: 'group' (subgroups names). Mandatory columns: | ||
'smarts' (SMARTS representations of the group to detect its precense in | ||
the molecule), 'molecular_weight' (molecular weight of the subgroups | ||
used to check that the result is correct) | ||
subgroups_info : Union[pd.DataFrame, None], optional | ||
Information of the model's subgroups (R, Q, subgroup_number, | ||
main_group), by default None | ||
Attributes | ||
---------- | ||
subgroups : pd.DataFrame | ||
Model's subgroups. Index: 'group' (subgroups names). Mandatory columns: | ||
'smarts' (SMARTS representations of the group to detect its precense in | ||
the molecule), 'molecular_weight' (molecular weight of the subgroups | ||
used to check that the result is correct) | ||
detection_mols : dict | ||
Dictionary cotaining all the rdkit Mol object from the detection_smarts | ||
subgroups column | ||
subgroups_info : pd.DataFrame | ||
Information of the model's subgroups. Columns: R, Q, subgroup_number, | ||
main_group. Index: 'group' (subgroups names) | ||
""" | ||
|
||
def __init__( | ||
self, | ||
subgroups: pd.DataFrame, | ||
subgroups_info: Union[pd.DataFrame, None] = None, | ||
) -> None: | ||
super().__init__(subgroups) | ||
|
||
# subgroups info | ||
if subgroups_info is None: | ||
self.subgroups_info = pd.DataFrame( | ||
[], | ||
columns=["group", "subgroup_number", "main_group", "R", "Q"], | ||
).set_index("group") | ||
else: | ||
self.subgroups_info = subgroups_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.