Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
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.
CreateStack
in Python scripts for more control and custom workflows.The package can be installed from PYPI as follows:
pip install stacking_2d_systems
To get the latest version or contribute to the development, you can install directly from GitHub:
git clone https://github.com/bafgreat/stacking_2d_systems.git
cd stack_2d_systems
pip install .
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.
create-stack path/to/monolayer.cif --stacking <type> [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
Generate AB Stacking
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.
Generate All Stacking Configurations To automatically create AB, AA, and all custom translations along x, y, and xy
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.
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()
```
If you have any questions or need further help, feel free to contact the project maintainer at bafgreat@gmail.com
.
MIT License
FAQs
A python package for creating stack layers of 2D systems.
We found that stacking-2d-systems demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.