csslib 1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
csslib-1.2/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Research
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
csslib-1.2/PKG-INFO ADDED
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: csslib
3
+ Version: 1.2
4
+ Summary: CSSlib is an open-source code for building configuration search space (CSS) of disordered crystals, loading of the CSS dataset obtained, local/remote MPI or SLURM calculations and data visualization.
5
+ Author: A.V. Krautsou, A.A. Solovykh
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: <3.14,>=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENCE
11
+ Requires-Dist: jupyter<=1.1.1,>=1.0.0
12
+ Requires-Dist: matplotlib<=3.10.8,>=3.10.7
13
+ Requires-Dist: numpy<=2.4.2,>=1.26.4
14
+ Requires-Dist: pandas<3.0,>=2.3.2
15
+ Requires-Dist: paramiko>=4.0.0
16
+ Requires-Dist: plotly<=6.5.2,>=6.3.1
17
+ Requires-Dist: pydantic>=2.12.5
18
+ Requires-Dist: pymatgen==2025.6.14
19
+ Requires-Dist: pymatgen-analysis-defects==2025.1.18
20
+ Requires-Dist: scipy<1.17.1,>=1.15.3
21
+ Requires-Dist: scp>=0.15.0
22
+ Requires-Dist: tqdm<=4.67.3,>=4.67.1
23
+ Requires-Dist: networkx<=3.6.1,>=3.4.2
24
+ Dynamic: license-file
25
+
26
+ # Welcome to CSSlib 👋
27
+ ![License](https://img.shields.io/github/license/AIRI-Institute/CSSlib?style=flat&logo=opensourceinitiative&logoColor=white&color=blue) ![Version](https://img.shields.io/badge/version-1.2-orange.svg?cacheSeconds=2592000)
28
+
29
+ <p align="center">
30
+ <img src="./logo.jpg" width="30%" title="CSSlib" alt="CSSlib"/>
31
+ </p>
32
+
33
+ CSSlib is an open-source code for building configuration search space (CSS) of disordered crystals, loading of the CSS dataset obtained, local/remote MPI or SLURM calculations and data visualization.
34
+
35
+ ## Table of content
36
+ - [Installation](#installation)
37
+ - [Contributors](#contributors)
38
+ - [Tutorial](#tutorial)
39
+ - [References & Citing](#references--citing)
40
+
41
+ ## Installation
42
+ **CSSlib** can be installed through
43
+ 1) the **pip** package manager (in the virtual environment):
44
+ ```sh
45
+ pip install csslib
46
+ ```
47
+ 2) the **git clone** command:
48
+ ```sh
49
+ git clone https://github.com/AIRI-Institute/CSSlib.git CSSlib
50
+ cd CSSlib
51
+ pip install .
52
+ ```
53
+ 3) the **uv** package manager:
54
+ ```sh
55
+ uv venv .venv
56
+ source .venv/bin/activate
57
+ uv pip install csslib
58
+ ```
59
+
60
+ **CSSlib** by default requires **Supercell** program. Details on **Supercell** installation can be found at the corresponding [website](https://orex.github.io/supercell/download/).
61
+
62
+ As a calculator for quantum mechanical calculations, **CSSlib** assumes the use of the [VASP](https://www.vasp.at/) (Vienna Ab initio Simulation Package) software package. Also there is an optional dependency for the [QuantumEspresso](http://www.quantum-espresso.org) simulation package which can be installed after the normal installation as:
63
+ ```sh
64
+ pip install --group espresso .
65
+ ```
66
+ or
67
+ ```sh
68
+ uv sync --group espresso
69
+ ```
70
+
71
+ ## Contributors
72
+ - Aleksey Krautsou
73
+ - Aleksandr Solovykh
74
+
75
+ ## Tutorial
76
+ The best way to learn how to use **CSSlib** is through the tutorial notebook located at the [tests directory](tests/csslib_example.ipynb) or at the [google collab](https://colab.research.google.com/drive/1OzYe7QXuL-BYXROnEh7hvuIW08xGlZO2?usp=sharing).
77
+
78
+ ## References & Citing
79
+ If you use this code, please consider citing works that actively used the CSS approach, which resulted in the creation of this library:
80
+
81
+ 1. A.V. Krautsou, I.S. Humonen, V.D. Lazarev, R.A. Eremin, S.A. Budennyy<br/>
82
+ "Impact of crystal structure symmetry in training datasets on GNN-based energy assessments for chemically disordered CsPbI<sub>3</sub>"<br/>
83
+ https://doi.org/10.1038/s41598-025-92669-3
84
+ 2. N.A. Matsokin, R.A. Eremin, A.A. Kuznetsova, I.S. Humonen, A.V. Krautsou, V.D. Lazarev, Y.Z. Vassilyeva, A.Y. Pak, S.A. Budennyy, A.G. Kvashnin, A.A. Osiptsov<br/>
85
+ "Discovery of chemically modified higher tungsten boride by means of hybrid GNN/DFT approach"<br/>
86
+ https://doi.org/10.1038/s41524-025-01628-z
87
+ 3. R.A. Zaripov, R.A. Eremin, I.S. Humonen, A.V. Krautsou, V.V. Kuznetsov, K.E. GermanS, S.A. Budennyy, S.V. Levchenko</br>
88
+ "First-principles data-driven approach for assessment of stability of Tc-C systems"</br>
89
+ https://doi.org/10.1016/j.actamat.2025.121704
csslib-1.2/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Welcome to CSSlib 👋
2
+ ![License](https://img.shields.io/github/license/AIRI-Institute/CSSlib?style=flat&logo=opensourceinitiative&logoColor=white&color=blue) ![Version](https://img.shields.io/badge/version-1.2-orange.svg?cacheSeconds=2592000)
3
+
4
+ <p align="center">
5
+ <img src="./logo.jpg" width="30%" title="CSSlib" alt="CSSlib"/>
6
+ </p>
7
+
8
+ CSSlib is an open-source code for building configuration search space (CSS) of disordered crystals, loading of the CSS dataset obtained, local/remote MPI or SLURM calculations and data visualization.
9
+
10
+ ## Table of content
11
+ - [Installation](#installation)
12
+ - [Contributors](#contributors)
13
+ - [Tutorial](#tutorial)
14
+ - [References & Citing](#references--citing)
15
+
16
+ ## Installation
17
+ **CSSlib** can be installed through
18
+ 1) the **pip** package manager (in the virtual environment):
19
+ ```sh
20
+ pip install csslib
21
+ ```
22
+ 2) the **git clone** command:
23
+ ```sh
24
+ git clone https://github.com/AIRI-Institute/CSSlib.git CSSlib
25
+ cd CSSlib
26
+ pip install .
27
+ ```
28
+ 3) the **uv** package manager:
29
+ ```sh
30
+ uv venv .venv
31
+ source .venv/bin/activate
32
+ uv pip install csslib
33
+ ```
34
+
35
+ **CSSlib** by default requires **Supercell** program. Details on **Supercell** installation can be found at the corresponding [website](https://orex.github.io/supercell/download/).
36
+
37
+ As a calculator for quantum mechanical calculations, **CSSlib** assumes the use of the [VASP](https://www.vasp.at/) (Vienna Ab initio Simulation Package) software package. Also there is an optional dependency for the [QuantumEspresso](http://www.quantum-espresso.org) simulation package which can be installed after the normal installation as:
38
+ ```sh
39
+ pip install --group espresso .
40
+ ```
41
+ or
42
+ ```sh
43
+ uv sync --group espresso
44
+ ```
45
+
46
+ ## Contributors
47
+ - Aleksey Krautsou
48
+ - Aleksandr Solovykh
49
+
50
+ ## Tutorial
51
+ The best way to learn how to use **CSSlib** is through the tutorial notebook located at the [tests directory](tests/csslib_example.ipynb) or at the [google collab](https://colab.research.google.com/drive/1OzYe7QXuL-BYXROnEh7hvuIW08xGlZO2?usp=sharing).
52
+
53
+ ## References & Citing
54
+ If you use this code, please consider citing works that actively used the CSS approach, which resulted in the creation of this library:
55
+
56
+ 1. A.V. Krautsou, I.S. Humonen, V.D. Lazarev, R.A. Eremin, S.A. Budennyy<br/>
57
+ "Impact of crystal structure symmetry in training datasets on GNN-based energy assessments for chemically disordered CsPbI<sub>3</sub>"<br/>
58
+ https://doi.org/10.1038/s41598-025-92669-3
59
+ 2. N.A. Matsokin, R.A. Eremin, A.A. Kuznetsova, I.S. Humonen, A.V. Krautsou, V.D. Lazarev, Y.Z. Vassilyeva, A.Y. Pak, S.A. Budennyy, A.G. Kvashnin, A.A. Osiptsov<br/>
60
+ "Discovery of chemically modified higher tungsten boride by means of hybrid GNN/DFT approach"<br/>
61
+ https://doi.org/10.1038/s41524-025-01628-z
62
+ 3. R.A. Zaripov, R.A. Eremin, I.S. Humonen, A.V. Krautsou, V.V. Kuznetsov, K.E. GermanS, S.A. Budennyy, S.V. Levchenko</br>
63
+ "First-principles data-driven approach for assessment of stability of Tc-C systems"</br>
64
+ https://doi.org/10.1016/j.actamat.2025.121704
@@ -0,0 +1,41 @@
1
+ [project]
2
+ name = "csslib"
3
+ version = "1.2"
4
+ authors = [
5
+ { name="A.V. Krautsou" },
6
+ { name="A.A. Solovykh" },
7
+ ]
8
+ readme = "README.md"
9
+ description = "CSSlib is an open-source code for building configuration search space (CSS) of disordered crystals, loading of the CSS dataset obtained, local/remote MPI or SLURM calculations and data visualization."
10
+ requires-python = ">=3.10, <3.14"
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "Operating System :: OS Independent",
14
+ ]
15
+ dependencies = [
16
+ "jupyter >=1.0.0, <= 1.1.1",
17
+ "matplotlib >=3.10.7, <= 3.10.8",
18
+ "numpy >=1.26.4, <= 2.4.2",
19
+ "pandas >=2.3.2, < 3.0",
20
+ "paramiko >= 4.0.0",
21
+ "plotly >=6.3.1, <= 6.5.2",
22
+ "pydantic >=2.12.5",
23
+ "pymatgen ==2025.6.14",
24
+ "pymatgen-analysis-defects ==2025.1.18",
25
+ "scipy >=1.15.3, <1.17.1",
26
+ "scp >= 0.15.0",
27
+ "tqdm >=4.67.1, <= 4.67.3",
28
+ "networkx >=3.4.2, <= 3.6.1",
29
+ ]
30
+
31
+ [build-system]
32
+ requires = ["setuptools>=61.0", "wheel"]
33
+ build-backend = "setuptools.build_meta"
34
+
35
+ [dependency-groups]
36
+ espresso = [
37
+ "pymatgen-io-espresso @ git+https://github.com/Griffin-Group/pymatgen-io-espresso",
38
+ ]
39
+ all = [
40
+ {include-group = "espresso"},
41
+ ]
csslib-1.2/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ """Main csslib file."""
2
+
3
+ from csslib.css import *
4
+ from csslib.tools import *
5
+ from csslib.config import *
6
+
7
+ from csslib.css import __all__ as __css_all__
8
+ from csslib.tools import __all__ as __tools_all__
9
+ from csslib.config import __all__ as __config_all__
10
+
11
+ __all__ = __css_all__ + __tools_all__ + __config_all__
@@ -0,0 +1,153 @@
1
+ """Module with pydantic model classes for configs validation (Config, Substitution) and overview functions with information about available
2
+ config fields and the example config."""
3
+
4
+ __all__ = [
5
+ 'get_available_config_fields',
6
+ 'get_example_config'
7
+ ]
8
+
9
+ from csslib.logging_ import get_config_logger
10
+ from pydantic import BaseModel, ConfigDict
11
+
12
+ logger = get_config_logger()
13
+
14
+ class Substitution(BaseModel):
15
+ """
16
+ Substitution field pydantic scheme class of the config.
17
+
18
+ Fields:
19
+ specie_to_substitute (str): the chemical element that must be replaced.
20
+ substitute_with (str): the chemical element that will replace the original chemical element.
21
+ substitution_low_limit (float): lower boundary of the substitution. Restrictions: >= 0 and < 1. Example: 0.05.
22
+ substitution_high_limit (float): higher boundary of the substitution. Restrictions: > 0, <= 1 and > substitution_low_limit. Example: 0.5.
23
+
24
+ Fields that must be empty:
25
+ substitution_low_limit_natoms (int): the minimum number of atoms that must be replaced.
26
+ substitution_high_limit_natoms (int): the maximum number of atoms that must be replaced.
27
+ indices_to_substitute (list[int]): the list of atom indices that must be replaced.
28
+ substitute_with_labels (list[str]): labels of chemical elements that will replace the original chemical elements.
29
+ labels_to_substitute (list[str]): labels of chemical elements that must be replaced.
30
+ """
31
+ model_config = ConfigDict(extra="forbid")
32
+ specie_to_substitute: str
33
+ substitute_with: str
34
+ substitution_low_limit: float
35
+ substitution_high_limit: float
36
+ substitution_low_limit_natoms: int | None = None
37
+ substitution_high_limit_natoms: int | None = None
38
+ indices_to_substitute: list[int] | None = None
39
+ substitute_with_labels: list[str] | None = None
40
+ labels_to_substitute: list[str] | None = None
41
+
42
+ def __repr__(self):
43
+ message = '\n Substitution(\n'
44
+ message += f' specie_to_substitute="{self.specie_to_substitute}",\n'
45
+ message += f' substitute_with="{self.substitute_with}",\n'
46
+ message += f' substitution_low_limit={self.substitution_low_limit},\n'
47
+ message += f' substitution_high_limit={self.substitution_high_limit},\n )'
48
+ return message
49
+
50
+ def __str__(self):
51
+ return self.__repr__()
52
+
53
+
54
+ class Config(BaseModel):
55
+ """
56
+ Config pydantic scheme class.
57
+
58
+ Fields:
59
+ result_dir (str): a full or relative path to the results directory.
60
+ structure_filename (str): a full or relative path to the .cif initial structure file.
61
+ supercell (str, optional): system replication numbers in the following format: "2x1x1", "2x2x1", ... Defaults to "1x1x1".
62
+ num_workers (int, optional): the number of parallel processes. Defaults to 1.
63
+ fictive_atoms (list): list with fictive atom names. Must be filled. If there are no one fictive atom type in the system fictive_atoms should be [].
64
+ substitution (list[Substitutions], optional): list of required substitutions for the system.
65
+ """
66
+ model_config = ConfigDict(extra="forbid")
67
+ result_dir: str
68
+ structure_filename: str
69
+ supercell: str = "1x1x1"
70
+ num_workers: int = 1
71
+ fictive_atoms: list
72
+ substitution: list[Substitution] | None = None
73
+
74
+ @classmethod
75
+ def model_validate_json(cls, json_data: str | bytes | bytearray,):
76
+ model = super().model_validate_json(json_data)
77
+ logger.info(f"The following config is read:\n{model}")
78
+ return model
79
+
80
+ def __repr__(self):
81
+ message = 'Config(\n'
82
+ message += f' result_dir="{self.result_dir}",\n'
83
+ message += f' structure_filename="{self.structure_filename}",\n'
84
+ message += f' supercell="{self.supercell}",\n'
85
+ message += f' num_workers={self.num_workers},\n'
86
+ message += f' fictive_atoms={self.fictive_atoms},\n'
87
+ message += f' substitution=['
88
+ if self.substitution is not None:
89
+ for indx, subst in enumerate(self.substitution):
90
+ message += subst.__repr__()
91
+ if len(self.substitution) > 1 and indx != len(self.substitution) - 1:
92
+ message += ','
93
+ if indx == len(self.substitution) - 1:
94
+ message += '\n '
95
+ message += f']\n)\n'
96
+ return message
97
+
98
+ def __str__(self):
99
+ return self.__repr__()
100
+
101
+
102
+ def get_available_config_fields():
103
+ """
104
+ Prints all possible config field names.
105
+ """
106
+ message = '\nList of available config fields:\n'
107
+ message += ' - "result_dir" - full or relative path to the results directory (mandatory)\n'
108
+ message += ' - "structure_filename" - full or relative path to the .cif initial structure file (mandatory)\n'
109
+ message += ' - "supercell" - system replication numbers in the following format: "2x1x1", "2x2x1", ... (optional, default value - "1x1x1")\n'
110
+ message += ' - "num_workers" - number of parallel processes (optional, default value - 1)\n'
111
+ message += ' - "fictive_atoms" - list with fictive atom names. Must be filled. If there are no one fictive atom type in the system fictive_atoms should be [] (mandatory)\n'
112
+ message += ' - "substitution" - list of required substitutions for the system (optional). The field has the following subfields:\n'
113
+ message += ' - "specie_to_substitute" - string with a chemical element which should be replaced (mandatory)\n'
114
+ message += ' - "substitute_with" - string with with a chemical element that will replace the original chemical element (mandatory)\n'
115
+ message += ' - "substitution_low_limit" - float value containing lower boundary of the substitution (mandatory). Example: 0.05\n'
116
+ message += ' - "substitution_high_limit" - float value containing higher boundary of the substitution (mandatory). Example: 0.5\n'
117
+ message += ' Internal parameters:\n'
118
+ message += ' - "substitution_low_limit_natoms"\n'
119
+ message += ' - "substitution_high_limit_natoms"\n'
120
+ message += ' - "indices_to_substitute"\n'
121
+ message += ' - "substitute_with_labels"\n'
122
+ message += ' - "labels_to_substitute"\n'
123
+ message += 'Example config can be obtained by the `get_example_config` function of `csslib.config`.\n'
124
+ logger.info(message)
125
+
126
+
127
+ def get_example_config():
128
+ """
129
+ Prints example config.
130
+ """
131
+ message = '''
132
+ {
133
+ "result_dir": "path-to-directory-with-results",
134
+ "structure_filename": "path-to-cif-file",
135
+ "supercell": "1x1x1",
136
+ "num_workers": 1,
137
+ "fictive_atoms": ['X', 'N'],
138
+ "substitution": [
139
+ {
140
+ "specie_to_substitute": "X",
141
+ "substitute_with": "Y",
142
+ "substitution_low_limit": 0.0,
143
+ "substitution_high_limit": 0.05
144
+ },
145
+ {
146
+ "specie_to_substitute": "E",
147
+ "substitute_with": "N",
148
+ "substitution_low_limit": 0.0,
149
+ "substitution_high_limit": 0.06
150
+ }
151
+ ]
152
+ }'''
153
+ logger.info(message)