# stacking_2d_systems
**stacking_2d_systems** is a Python package designed to create different stacking configurations of 2D systems. It allows users to easily generate various configurations of 2D materials, such as AA and AB stacking, and custom translations along the x, y, or xy directions. This package is particularly useful for researchers working with Powder X-ray Diffraction (PXRD) data, helping to match structures and explore different stacking patterns.
## Features
- **AB and AA Stacking**:
Generate AB- and AA-stacked bilayer structures from a monolayer input file.
- **Custom Translations**:
Create slip-stacked configurations by translating the second layer along the x, y, or xy directions.
- **Batch Generation**:
Automatically generate all possible stacking configurations with a single command.
- **User-Friendly CLI**:
Easily generate stacking configurations without needing to write any Python code.
- **Flexible Library**:
Use `CreateStack` in Python scripts for more control and custom workflows.
## Installation
### From PyPI
The package can be installed from PYPI as follows:
```bash
pip install stacking_2d_systems
```
### From GitHub
To get the latest version or contribute to the development, you can install directly from GitHub:
```bash
git clone https://github.com/bafgreat/stacking_2d_systems.git
cd stack_2d_systems
pip install .
```
## Usage
### Command-Line Interface (CLI)
The stacking_2d_systems package provides a user-friendly command-line tool called create-stack for generating stacking configurations without needing to write Python code.
```bash
create-stack path/to/monolayer.cif --stacking <type> [options]
```
#### Available Options
**filename:**
Path to the input monolayer structure file (e.g., .cif).
**--interlayer-dist:**
Distance between the layers in the bilayer structure. Default is 3.2.
**--output-dir:**
The folder, which specifies where the generated files should be saved. The default is the current working directory where the code is run.
**--stacking:**
Type of stacking configuration to generate. Options include:
- ab: Generates an AB-stacked bilayer.
- aa: Generates an AA-stacked bilayer.
- x: Translates the second layer along the x-axis.
- y: Translates the second layer along the y-axis.
- xy: Translates the second layer along both x and y directions.
- all: Generates all stacking configurations (AB, AA, x, y, xy).
**--max-length:**
Maximum translation length along the specified axis (x, y, or xy). If not specified, defaults to half of the corresponding cell dimension
#### Examples
1. Generate AB Stacking
```bash
create-stack path/to/monolayer.cif --stacking ab
```
if you wish to that the stack files should written in a particular directory
```bash
create-stack path/to/monolayer.cif --stacking ab --output-dir path/to/output
```
2. Generate AA Stacking
```bash
create-stack path/to/monolayer.cif --stacking aa
```
3. Custom Stacking Along the x-axis
To translate the second layer along the x-axis with a maximum translation length of 5.0 Angstroms:
```bash
create-stack path/to/monolayer.cif --stacking x --max-length 5.0
```
This code will generate a series of files like monolayer_x_0.5.cif, monolayer_x_1.0.cif, etc.
4. Generate All Stacking Configurations
To automatically create AB, AA, and all custom translations along x, y, and xy
```bash
create-stack path/to/monolayer.cif --stacking all
```
This code will generate all stacking configurations. At the maximum length for the custom translations will be half the size of the lattice length. i.e for translation along x, the maximum length is a/2.0 and b/2.0 along y and a+b/2.0 for xy.
## Library Usage
To have full control over the stacking process, the CreateStack class can be used directly in Python scripts.
```python
from stacking_2d_systems.slip_layers import CreateStack
# Initialize the stack with a monolayer structure and interlayer distance
stack = CreateStack('path/to/monolayer.cif', interlayer_dist=3.2)
# Create an AB-stacked structure
stack.create_ab_stacking()
# Create an AA-stacked structure
stack.create_aa_stacking()
# Create custom stacking along the x-axis with a max length of 5.0 units
stack.stack_along_x(max_length=5.0)
# Create custom stacking along the y-axis
stack.stack_along_y()
# Create custom stacking along the xy-axis
stack.stack_along_xy()
```
### Methods in CreateStack
- create_ab_stacking():
Generates an AB-stacked structure and saves it as *_ab.cif.
- create_aa_stacking():
Generates an AA-stacked structure and saves it as *_aa.cif.
- stack_along_x(max_length):
Generates a series of x-axis translated structures.
- stack_along_y(max_length):
Generates a series of y-axis translated structures.
- stack_along_xy(max_length):
Generates a series of xy-diagonal translated structures.
## Contact
If you have any questions or need further help, feel free to contact the project maintainer at `bafgreat@gmail.com`.
## License
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "stacking-2d-systems",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "2D materials, stacking, AA stacking, AB stacking, slip stacking, COFs, crystal structures, Graphene",
"author": "Dinga Wonanke",
"author_email": "bafgreat@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9f/f8/efe69b81dd9cd76f44fabd4e7ec72151bd1cd7be177b94c5ac11327ab97d/stacking_2d_systems-0.1.0.tar.gz",
"platform": null,
"description": "# stacking_2d_systems\n**stacking_2d_systems** is a Python package designed to create different stacking configurations of 2D systems. It allows users to easily generate various configurations of 2D materials, such as AA and AB stacking, and custom translations along the x, y, or xy directions. This package is particularly useful for researchers working with Powder X-ray Diffraction (PXRD) data, helping to match structures and explore different stacking patterns.\n\n## Features\n\n- **AB and AA Stacking**:\n Generate AB- and AA-stacked bilayer structures from a monolayer input file.\n- **Custom Translations**:\n Create slip-stacked configurations by translating the second layer along the x, y, or xy directions.\n- **Batch Generation**:\n Automatically generate all possible stacking configurations with a single command.\n- **User-Friendly CLI**:\n Easily generate stacking configurations without needing to write any Python code.\n- **Flexible Library**:\n Use `CreateStack` in Python scripts for more control and custom workflows.\n\n## Installation\n\n### From PyPI\n\nThe package can be installed from PYPI as follows:\n\n```bash\npip install stacking_2d_systems\n```\n\n### From GitHub\n\nTo get the latest version or contribute to the development, you can install directly from GitHub:\n\n```bash\ngit clone https://github.com/bafgreat/stacking_2d_systems.git\ncd stack_2d_systems\npip install .\n```\n\n## Usage\n\n### Command-Line Interface (CLI)\n\nThe stacking_2d_systems package provides a user-friendly command-line tool called create-stack for generating stacking configurations without needing to write Python code.\n\n```bash\ncreate-stack path/to/monolayer.cif --stacking <type> [options]\n```\n\n#### Available Options\n\n**filename:**\n Path to the input monolayer structure file (e.g., .cif).\n\n**--interlayer-dist:**\n Distance between the layers in the bilayer structure. Default is 3.2.\n\n**--output-dir:**\n The folder, which specifies where the generated files should be saved. The default is the current working directory where the code is run.\n\n**--stacking:**\n Type of stacking configuration to generate. Options include:\n - ab: Generates an AB-stacked bilayer.\n - aa: Generates an AA-stacked bilayer.\n - x: Translates the second layer along the x-axis.\n - y: Translates the second layer along the y-axis.\n - xy: Translates the second layer along both x and y directions.\n - all: Generates all stacking configurations (AB, AA, x, y, xy).\n**--max-length:**\n Maximum translation length along the specified axis (x, y, or xy). If not specified, defaults to half of the corresponding cell dimension\n\n#### Examples\n\n1. Generate AB Stacking\n\n ```bash\n create-stack path/to/monolayer.cif --stacking ab\n ```\nif you wish to that the stack files should written in a particular directory\n\n ```bash\n create-stack path/to/monolayer.cif --stacking ab --output-dir path/to/output\n ```\n\n2. Generate AA Stacking\n\n ```bash\n create-stack path/to/monolayer.cif --stacking aa\n ```\n\n3. Custom Stacking Along the x-axis\nTo translate the second layer along the x-axis with a maximum translation length of 5.0 Angstroms:\n\n ```bash\n create-stack path/to/monolayer.cif --stacking x --max-length 5.0\n ```\n\nThis code will generate a series of files like monolayer_x_0.5.cif, monolayer_x_1.0.cif, etc.\n\n4. Generate All Stacking Configurations\nTo automatically create AB, AA, and all custom translations along x, y, and xy\n\n ```bash\n create-stack path/to/monolayer.cif --stacking all\n ```\n\nThis code will generate all stacking configurations. At the maximum length for the custom translations will be half the size of the lattice length. i.e for translation along x, the maximum length is a/2.0 and b/2.0 along y and a+b/2.0 for xy.\n\n## Library Usage\n\nTo have full control over the stacking process, the CreateStack class can be used directly in Python scripts.\n\n ```python\n from stacking_2d_systems.slip_layers import CreateStack\n\n # Initialize the stack with a monolayer structure and interlayer distance\n stack = CreateStack('path/to/monolayer.cif', interlayer_dist=3.2)\n\n # Create an AB-stacked structure\n stack.create_ab_stacking()\n\n # Create an AA-stacked structure\n stack.create_aa_stacking()\n\n # Create custom stacking along the x-axis with a max length of 5.0 units\n stack.stack_along_x(max_length=5.0)\n # Create custom stacking along the y-axis\n stack.stack_along_y()\n # Create custom stacking along the xy-axis\n stack.stack_along_xy()\n ```\n\n### Methods in CreateStack\n\n- create_ab_stacking():\n Generates an AB-stacked structure and saves it as *_ab.cif.\n- create_aa_stacking():\n Generates an AA-stacked structure and saves it as *_aa.cif.\n- stack_along_x(max_length):\n Generates a series of x-axis translated structures.\n- stack_along_y(max_length):\n Generates a series of y-axis translated structures.\n- stack_along_xy(max_length):\n Generates a series of xy-diagonal translated structures.\n\n\n## Contact\n\nIf you have any questions or need further help, feel free to contact the project maintainer at `bafgreat@gmail.com`.\n\n## License\nMIT License",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python package for creating stack layers of 2D systems.",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [
"2d materials",
" stacking",
" aa stacking",
" ab stacking",
" slip stacking",
" cofs",
" crystal structures",
" graphene"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d705918a0cae24c7483e597a23230591fe1917fb24b8a000742af3cf9a4b7f0e",
"md5": "9d7582dc66c8bdd80244e6603305987d",
"sha256": "8f9330e2083d7e2de213bab6fcdfaf31794153a1cbb7c9859ace0c4c0ce64608"
},
"downloads": -1,
"filename": "stacking_2d_systems-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d7582dc66c8bdd80244e6603305987d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 5877,
"upload_time": "2024-10-21T19:31:47",
"upload_time_iso_8601": "2024-10-21T19:31:47.767955Z",
"url": "https://files.pythonhosted.org/packages/d7/05/918a0cae24c7483e597a23230591fe1917fb24b8a000742af3cf9a4b7f0e/stacking_2d_systems-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9ff8efe69b81dd9cd76f44fabd4e7ec72151bd1cd7be177b94c5ac11327ab97d",
"md5": "88b7062252cb9abb6fd2cc63f541a0dc",
"sha256": "594fd307af247a03ec39e6783edf253acdc21b3003ac8d5a93d94dfcddae8b73"
},
"downloads": -1,
"filename": "stacking_2d_systems-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "88b7062252cb9abb6fd2cc63f541a0dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4592,
"upload_time": "2024-10-21T19:31:48",
"upload_time_iso_8601": "2024-10-21T19:31:48.884500Z",
"url": "https://files.pythonhosted.org/packages/9f/f8/efe69b81dd9cd76f44fabd4e7ec72151bd1cd7be177b94c5ac11327ab97d/stacking_2d_systems-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-21 19:31:48",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "stacking-2d-systems"
}