Skip to content

Commit 99f8585

Browse files
missing: tutorial, fix clapeyron writer
1 parent 8dcca5a commit 99f8585

22 files changed

+155
-41
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Class
2+
====================
3+
4+
.. automodule:: ugropy.core.frag_classes.abdulelah_gani.abdulelah_gani
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani PST Class
2+
========================
3+
4+
.. automodule:: ugropy.core.frag_classes.abdulelah_gani.abdulelah_gani_pst
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani PST Result
2+
=========================
3+
4+
.. automodule:: ugropy.core.frag_classes.abdulelah_gani.abdulelah_gani_pst_result
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Result Class
2+
===========================
3+
4+
.. automodule:: ugropy.core.frag_classes.abdulelah_gani.abdulelah_gani_result
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Abdulelah-Gani fragmentation Classes
2+
====================================
3+
4+
.. automodule:: ugropy.core.frag_classes.abdulelah_gani
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. toctree::
10+
:maxdepth: 1
11+
12+
abdulelah_gani_pst_result
13+
abdulelah_gani_pst
14+
abdulelah_gani_result
15+
abdulelah_gani

docs/source/core/frag_classes/init.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Fragmentation Classes
1212
base/init
1313
gibbs_model/init
1414
joback_model/init
15+
abdulelah_gani/init
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Model
2+
====================
3+
4+
.. automodule:: ugropy.models.abdulelah_gani_mod
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Primary Model
2+
============================
3+
4+
.. automodule:: ugropy.models.abdulelah_gani_pmod
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Secondary Model
2+
==============================
3+
4+
.. automodule:: ugropy.models.abdulelah_gani_smod
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Abdulelah-Gani Tertiary Model
2+
=============================
3+
4+
.. automodule:: ugropy.models.abdulelah_gani_tmod
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/models/init.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Models
99
.. toctree::
1010
:maxdepth: 1
1111

12+
abdulelah_gani_mod
13+
abdulelah_gani_pmod
14+
abdulelah_gani_smod
15+
abdulelah_gani_tmod
1216
jobackmod
1317
psrkmod
1418
unifacmod
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Clapeyron Database File,,,,,
22
Critical Single Parameters,,,,,
33
species,CAS,Tc,Pc,Vc,acentricfactor
4-
limonene,,657.4486692170663,2755561.066677689,0.0004965,0.3219127551737521
5-
adrenaline,,953.7486693594541,5569169.079973267,0.0004115,1.6071531017924205
6-
Trinitrotoluene,,1146.7095578060987,4067315.701790919,0.0005654999999999999,1.0796561474496789
4+
limonene,,657.4486692170663 kelvin,2755561.066677689 bar,0.0004965 centimeter ** 3 / mole,0.3219127551737521 dimensionless
5+
adrenaline,,953.7486693594541 kelvin,5569169.079973267 bar,0.0004115 centimeter ** 3 / mole,1.6071531017924205 dimensionless
6+
Trinitrotoluene,,1146.7095578060987 kelvin,4067315.701790919 bar,0.0005654999999999999 centimeter ** 3 / mole,1.0796561474496789 dimensionless
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Clapeyron Database File,,
22
Molar Mases Single Params,,
33
species,CAS,Mw
4-
limonene,,136.238
5-
adrenaline,,183.207
6-
Trinitrotoluene,,227.13199999999998
4+
limonene,,136.238 gram / mole
5+
adrenaline,,183.207 gram / mole
6+
Trinitrotoluene,,227.13199999999998 gram / mole

ugropy/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
----------
55
R : float
66
Gas constant [J/mol/K]
7+
ureg : pint.UnitRegistry
8+
Unit registry of Pint library
79
"""
810

911
from pathlib import Path

ugropy/core/frag_classes/abdulelah_gani/abdulelah_gani_pst.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818

1919
class AbdulelahGaniPSTModel(FragmentationModel):
20-
"""Abdulelah-Gani model dedicated to properties estimation models.
20+
"""Abdulelah-Gani model dedicated to properties estimation.
2121
22-
Class to construct the primary structures detector for the Abdulelah-Gani
23-
properties estimation model :cite:p:`gani`.
22+
Class to construct the primary, secondary and tertiary structures detector
23+
for the Abdulelah-Gani properties estimation model :cite:p:`gani`.
2424
2525
Parameters
2626
----------
@@ -112,8 +112,7 @@ def mol_preprocess(self, mol: Chem.rdchem.Mol) -> Chem.rdchem.Mol:
112112
1. Kekulize the molecule.
113113
2. Identify the aromatic rings.
114114
3. Check the aromaticity of the rings.
115-
4. Make the rings aromatic or non-aromatic based on the aromaticity
116-
check.
115+
4. Make the rings aromatic or non-aromatic based on the setp 3 check.
117116
118117
The criteria to check the aromaticity of the rings are based on the
119118
criteria proposed by Abdulelah-Gani in the original paper datase

ugropy/core/frag_classes/abdulelah_gani/abdulelah_gani_pst_result.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111

1212
class AGaniPSTFragmentationResult(FragmentationResult):
13-
"""Abdulelah-Gani primary group contribution properties estimator.
13+
"""Abdulelah-Gani group contribution properties estimator.
14+
15+
This class is to instantiate the Abdulelah-Gani primary, secondary and
16+
tertiary models.
1417
1518
Parameters
1619
----------
@@ -26,11 +29,11 @@ class AGaniPSTFragmentationResult(FragmentationResult):
2629
Attributes
2730
----------
2831
subgroups : dict
29-
Abdulelah-Gani primary functional groups of the molecule.
32+
Abdulelah-Gani groups of the molecule.
3033
subgroups_atoms_indexes : dict
31-
Abdulelah-Gani primary functional groups atoms indexes.
34+
Abdulelah-Gani groups atoms indexes.
3235
subgroups_numbers : dict
33-
Abdulelah-Gani primary functional groups numbers.
36+
Abdulelah-Gani groups numbers.
3437
"""
3538

3639
def __init__(

ugropy/groups.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,47 @@
44

55
from rdkit.Chem import Descriptors
66

7+
from .core.frag_classes.abdulelah_gani.abdulelah_gani_result import (
8+
AGaniFragmentationResult,
9+
)
710
from .core.frag_classes.gibbs_model.gibbs_result import (
811
GibbsFragmentationResult,
912
)
1013
from .core.frag_classes.joback.joback_result import JobackFragmentationResult
1114
from .core.get_rdkit_object import instantiate_mol_object
1215
from .core.ilp_solvers.default_solver import DefaultSolver
1316
from .core.ilp_solvers.ilp_solver import ILPSolver
17+
from .models.abdulelah_gani_mod import abdulelah_gani
1418
from .models.jobackmod import joback
1519
from .models.psrkmod import psrk
1620
from .models.unifacmod import unifac
1721

1822

1923
class Groups:
20-
"""Group class.
24+
"""Groups class.
2125
22-
Stores the solved FragmentationModels subgroups of a molecule.
26+
Stores the solved FragmentationModels subgroups of a molecule. This class
27+
was implemented on an early version of the `ugropy` library. Is not really
28+
meant to be used, instead is recommended to use directly the corresponding
29+
FragmentationModel independently since it provides more flexibility and
30+
control over the results. The class is kept since in most cases is very
31+
comfortable to have all the results in a single object.
2332
2433
Parameters
2534
----------
26-
identifier : str or rdkit.Chem.rdchem.Mol
27-
Identifier of a molecule (name, SMILES or Chem.rdchem.Mol). Example:
28-
hexane or CCCCCC.
35+
identifier : Union[str, Chem.rdchem.Mol]
36+
Identifier of the molecule. You can use either the name of the
37+
molecule, the SMILEs of the molecule or a rdkit Mol object.
2938
identifier_type : str, optional
30-
Use 'name' to search a molecule by name, 'smiles' to provide the
31-
molecule SMILES representation or 'mol' to provide a
32-
rdkit.Chem.rdchem.Mol object, by default "name".
39+
Identifier type of the molecule. Use "name" if you are providing
40+
the molecules' name, "smiles" if you are providing the SMILES
41+
or "mol" if you are providing a rdkir mol object, by default "name"
3342
solver : ILPSolver, optional
34-
ILP solver to use, by default DefaultSolver.
43+
ILP solver class, by default DefaultSolver
3544
search_multiple_solutions : bool, optional
36-
If True, the solver will search for multiple solutions. If set to true,
37-
the model's results will be lists of FragmentationResults objects, by
38-
default False.
45+
Weather search for multiple solutions or not, by default False
46+
If False the return will be a FragmentationResult object, if True
47+
the return will be a list of FragmentationResult objects.
3948
normal_boiling_temperature : float, optional
4049
If provided, will be used to estimate critical temperature, acentric
4150
factor, and vapor pressure instead of the estimated normal boiling
@@ -59,6 +68,9 @@ class Groups:
5968
joback : Union[JobackFragmentationResult, List[JobackFragmentationResult]]
6069
JobackFragmentationResult object that contains the Joback subgroups and
6170
the estimated properties of the molecule.
71+
agani : Union[AGaniFragmentationResult, List[AGaniFragmentationResult]]
72+
AGaniFragmentationResult object that contains the Abdulelah-Gani
73+
subgroups and the estimated properties of the molecule.
6274
"""
6375

6476
def __init__(
@@ -104,3 +116,13 @@ def __init__(
104116
search_multiple_solutions=search_multiple_solutions,
105117
normal_boiling_point=normal_boiling_temperature,
106118
)
119+
120+
# Abdulelah-Gani
121+
self.agani: Union[
122+
AGaniFragmentationResult, List[AGaniFragmentationResult]
123+
] = abdulelah_gani.get_groups(
124+
self.identifier,
125+
self.identifier_type,
126+
solver=solver,
127+
search_multiple_solutions=search_multiple_solutions,
128+
)

ugropy/models/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
.. code-block:: python
66
7-
from ugropy import joback, psrk, unifac
7+
from ugropy import joback, psrk, unifac, abdulelah_gani
88
99
You can check the group list and their SMARTS representation with:
1010
@@ -19,6 +19,9 @@
1919
joback.get_groups("n-hexane").subgroups
2020
unifac.get_groups("toluene").subgroups
2121
psrk.get_groups("CCO", "smiles").subgroups
22+
abdulelah_gani.get_groups("CCO", "smiles").primary.subgroups
23+
abdulelah_gani.get_groups("CCO", "smiles").secondary.subgroups
24+
abdulelah_gani.get_groups("CCO", "smiles").tertiary.subgroups
2225
2326
Attributes
2427
----------
@@ -30,8 +33,14 @@
3033
unifac3, unifac4, unifac5, unifac6`
3134
joback: JobackModel
3235
Joback FragmentationModel :cite:p:`joback1, joback2`
33-
abdulelah_gani_p: AbdulelahGaniPrimaryModel
36+
abdulelah_gani_p: AbdulelahGaniPSTModel
3437
Abdulelah-Gani Primary Structures FragmentationModel :cite:p:`gani`
38+
abdulelah_gani_s: AbdulelahGaniPSTModel
39+
Abdulelah-Gani Secondary Structures FragmentationModel :cite:p:`gani`
40+
abdulelah_gani_t: AbdulelahGaniPSTModel
41+
Abdulelah-Gani Tertiary Structures FragmentationModel :cite:p:`gani`
42+
abdulelah_gani: AbdulelahGaniModel
43+
Abdulelah-Gani properties estimation model :cite:p:`gani`
3544
"""
3645

3746
from . import (

ugropy/models/abdulelah_gani_mod.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
tol = abdulelah_gani.get_groups("toluene")
1111
1212
print(tol.critical_temperature)
13+
print(tol.primary.subgroups)
14+
print(tol.secondary.subgroups)
15+
print(tol.tertiary.subgroups)
1316
1417
# Get groups from molecule's SMILES
1518
eth = abdulelah_gani.get_groups("CCO", "smiles")

ugropy/models/abdulelah_gani_pmod.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
1919
Attributes
2020
----------
21-
abdulelah_gani_p: AbdulelahGaniPrimaryModel
22-
AbdulelahGaniPrimaryModel FragmentationModel :cite:p:`gani`
21+
abdulelah_gani_p: AbdulelahGaniPSTModel
22+
AbdulelahGaniPSTModel FragmentationModel :cite:p:`gani`
2323
"""
2424

2525
from ugropy.constants import _csvs

ugropy/models/abdulelah_gani_smod.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
55
.. code-block:: python
66
7-
from ugropy import abdulelah_gani_p
7+
from ugropy import abdulelah_gani_s
88
99
# Get groups from molecule's name
10-
tol = abdulelah_gani_p.get_groups("toluene")
10+
tol = abdulelah_gani_s.get_groups("toluene")
1111
1212
print(tol.subgroups)
1313
1414
# Get groups from molecule's SMILES
15-
eth = abdulelah_gani_p.get_groups("CCO", "smiles")
15+
eth = abdulelah_gani_s.get_groups("CCO", "smiles")
1616
1717
print(eth.subgroups)
1818
1919
Attributes
2020
----------
21-
abdulelah_gani_p: AbdulelahGaniPrimaryModel
22-
AbdulelahGaniPrimaryModel FragmentationModel :cite:p:`gani`
21+
abdulelah_gani_s: AbdulelahGaniPSTModel
22+
AbdulelahGaniPSTModel FragmentationModel :cite:p:`gani`
2323
"""
2424

2525
from ugropy.constants import _csvs

ugropy/models/abdulelah_gani_tmod.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
55
.. code-block:: python
66
7-
from ugropy import abdulelah_gani_p
7+
from ugropy import abdulelah_gani_t
88
99
# Get groups from molecule's name
10-
tol = abdulelah_gani_p.get_groups("toluene")
10+
tol = abdulelah_gani_t.get_groups("toluene")
1111
1212
print(tol.subgroups)
1313
1414
# Get groups from molecule's SMILES
15-
eth = abdulelah_gani_p.get_groups("CCO", "smiles")
15+
eth = abdulelah_gani_t.get_groups("CCO", "smiles")
1616
1717
print(eth.subgroups)
1818
1919
Attributes
2020
----------
21-
abdulelah_gani_p: AbdulelahGaniPrimaryModel
22-
AbdulelahGaniPrimaryModel FragmentationModel :cite:p:`gani`
21+
abdulelah_gani_t: AbdulelahGaniPSTModel
22+
AbdulelahGaniPSTModel FragmentationModel :cite:p:`gani`
2323
"""
2424

2525
from ugropy.constants import _csvs

0 commit comments

Comments
 (0)