CRSManager¶
This submodule facilitate the creation, execution, and output processes for mutiple crsJob
and is intended to be used in conjunction with the pyCRS.database module.
- class pyCRS.CRSManager.CRSSystem¶
This class is designed to manage multiple instances of the
CRSMixture
class, facilitating the creation, execution, and output processes.A
CRSSsytem
instance can create mutipleCRSMixute
instance associated with its mixture attribute by add_compound method. The resulting mutipleCRSResults
will be stored in its outputs attribute. This functionality requires the concurrent use of the pyCRS.database module.- num_mix¶
The numbers of mixture
- Type:
int
- mixture¶
List of
CRSMixture
class- Type:
list[CRSMixture]
- outputs¶
Results for each
CRSMixture
in mixture.- Type:
list[CRSResults]
Example
db = COSKFDatabase("my_coskf_db.db") crs = CRSSystem() crs.add_Mixture(mixture={"water":1.0}, database=db) crs.runCRSJob() res = crs.outputs[0].get_results() print(f"{res['temperature']} : {res['gamma']}")
- add_Mixture(mixture: dict, temperature: float | str = 298.15, problem_type: str = 'activitycoef', database: str | COSKFDatabase = 'my_coskf_db.db', method: str = 'COSMORS', pressure: float | str = 1.01325, jobname: str | None = None, conformer: bool = False, massfraction: bool = False, density_corr: bool = False, vp_corr: bool = False, solute: str = 'solid', iso: str = 'isotherm', additional_sett: Settings | None = None, multi_species: dict | None = None)¶
Adds a new
CRSMixture
to the mixture attribute of theCRSSystem
.- Parameters:
mixture (
dict
) – Composition as {Identifier : mole/mass fraction}- Keyword Arguments:
temperature (
float or str
) – Temp in Kelvin (default 298.15). If str, format can be “T1” or “T1 T2 ntemp”. Where T1 is the starting temperature, T2 is the ending temperature, and ntemp is the number of intervals between T1 and T2.problem_type (
str
) – Calculation type (default “activitycoef”).database (
str or COSKFDatabase
) – Path or instance of COSKFDatabase (default “my_coskf_db.db”).method (
str
) – Version of COSMORS or COSMOSAC (default “COSMORS”).pressure (
float or str
) – Pressure in bar (default 1.01325). If str, format can be “P1” or “P1 P2 npress”. Where P1 is the starting pressure, P2 is the ending pressure, and npress is the number of intervals between P1 and P2.jobname (
str
) – Job name in plam_workdir (defaults “crsJob_n”).conformer (
bool
) – Use multiple conformers in COSMO-RS (default False).massfraction (
bool
) – Input fraction as mass (default False).density_corr (
bool
) – Use pure compound density for volume. Default to False (uses COSMO volume).vp_corr (
bool
) – Correct gas phase chemical potential with vapor pressure (default False).solute (
str
) – Solute state (“solid”, “gas”, “liquid”) in SOLUBILITY and PURESOLUBILITY. Default is “solid”.iso (
str
) – Condition (“isotherm”, “isobar”, “flashpoint”) for BINMIXCOEF, TERNARYMIX, and COMPOSITIONLINE. Default is “isotherm”.additional_sett (
Settings
) – Optional custom settings (default None).multi_species (
dict
) – Multi-species settings as {Identifier: Settings} (default None).
Note
The identifiers for a compound can be the name, CAS number, or identifier in the pyCRS.database. When searching in the database, the input string will be converted to lowercase, except when it starts with ‘InChI’.
The available problem types is listed below.
problem_type
valueProblem type
ACTIVITYCOEF
Activity Coefficient
BINMIXCOEF
Binary mixture LLE/VLE
TERNARYMIX
Ternary mixture LLE/VLE
COMPOSITIONLINE
Solvent composition line interpolation
SOLUBILITY
Solubility calculation in a mixed solvent
PURESOLUBILITY
Solubility calculation in a pure solvent
LOGP
Partition coefficient calculation
VAPORPRESSURE
Vapor pressure calculation for a mixed solvent
PUREVAPORPRESSURE
Vapor pressure calculation for a pure solvent
BOILINGPOINT
Boiling point calculation for a mixture
PUREBOILINGPOINT
Boiling point calculation for a pure solvent(s)
FLASHPOINT
Flashpoint calculation for a mixture
SIGMAPROFILE
Sigma profile calculation for a mixture
PURESIGMAPROFILE
Sigma profile calculation for a pure component(s)
SIGMAPOTENTIAL
Sigma potential calculation for a mixture
PURESIGMAPOTENTIAL
Sigma potential calculation for a pure component(s)
- get_activity_coefficients(idx: int | List[int] | None = None) List[ndarray] ¶
Returns activity coefficients for all
CRSMixture
or the specified ones.- Keyword Arguments:
idx (
int or List[int], optional
) – Index or list of indices ofCRSMixture
to return. If None, returns for all mixtures. Default is None.- Returns:
Activity coefficients as a list of numpy arrays.
- Return type:
List[np.ndarray])
- runCRSJob()¶
Run all
CRSJob``_ in each ``CRSMixture
- class pyCRS.CRSManager.CRSMixture(**kwargs)¶
This class is used to auto-generate a
CRSJob
instance- crs_job¶
The generated
CRSJob
instance.- Type:
CRSJob
- mixture¶
Composition as {Identifier : mole/mass fraction}
- Type:
dict
- temperature¶
Temp in Kelvin (default 298.15). If str, format can be “T1” or “T1 T2 ntemp”. Where T1 is the starting temperature, T2 is the ending temperature, and ntemp is the number of intervals between T1 and T2.
- Type:
float or str
- problem_type¶
Calculation type (default “activitycoef”).
- Type:
str
- database¶
Path or instance of COSKFDatabase (default “my_coskf_db.db”).
- Type:
str or COSKFDatabase
- method¶
Version of COSMORS or COSMOSAC (default “COSMORS”).
- Type:
str
- pressure¶
Pressure in bar (default 1.01325). If str, format can be “P1” or “P1 P2 npress”. Where P1 is the starting pressure, P2 is the ending pressure, and npress is the number of intervals between P1 and P2.
- Type:
float or str
- jobname¶
Job name in plam_workdir (defaults “crsJob_n”).
- Type:
str
- conformer¶
Use multiple conformers in COSMO-RS (default False).
- Type:
bool
- massfraction¶
Input fraction as mass (default False).
- Type:
bool
- density_corr¶
Use pure compound density for volume. Default to False (uses COSMO volume).
- Type:
bool
- vp_corr¶
Correct gas phase chemical potential with vapor pressure (default False).
- Type:
bool
- solute¶
Solute state (“solid”, “gas”, “liquid”) in SOLUBILITY and PURESOLUBILITY. Default is “solid”.
- Type:
str
- iso¶
Condition (“isotherm”, “isobar”, “flashpoint”) for BINMIXCOEF, TERNARYMIX, and COMPOSITIONLINE. Default is “isotherm”.
- Type:
str
- additional_sett¶
Optional custom settings (default None).
- Type:
Settings
- multi_species¶
Multi-species settings as {Identifier: Settings} (default None).
- Type:
dict
Reference