Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3e326c7
Delete arrow-down.png
tilaskabengele Jul 20, 2020
a02537f
Delete bg_hr.png
tilaskabengele Jul 20, 2020
c0b193c
Delete blacktocat.png
tilaskabengele Jul 20, 2020
8908558
Delete icon_download.png
tilaskabengele Jul 20, 2020
f8e07d1
Delete octocat-small.png
tilaskabengele Jul 20, 2020
22ff45c
Delete sprite_download.png
tilaskabengele Jul 20, 2020
da964eb
Delete github-light.css
tilaskabengele Jul 20, 2020
6984838
Delete styles.css
tilaskabengele Jul 20, 2020
ab3485f
Delete stylesheet.css
tilaskabengele Jul 20, 2020
9b5ed16
Delete main.js
tilaskabengele Jul 20, 2020
578d97a
Delete scale.fix.js
tilaskabengele Jul 20, 2020
3389491
Delete _config.yml
tilaskabengele Jul 20, 2020
aa72f55
Delete index.html
tilaskabengele Jul 20, 2020
85fda7e
Delete params.json
tilaskabengele Jul 20, 2020
d19cc17
Create master branch via GitHub
tilaskabengele Jul 20, 2020
db7614b
Update README.md
tilaskabengele Jul 20, 2020
0f075e1
Create master branch via GitHub
tilaskabengele Jul 20, 2020
41f204b
Create master branch via GitHub
tilaskabengele Jul 20, 2020
0d3125a
Create CNAME
tilaskabengele Jul 20, 2020
298a020
Create master branch via GitHub
tilaskabengele Jul 20, 2020
540241a
Delete CNAME
tilaskabengele Jul 20, 2020
c109bbc
Create master branch via GitHub
tilaskabengele Jul 20, 2020
b268b39
Create master branch via GitHub
tilaskabengele Jul 20, 2020
4cbb92a
Create master branch via GitHub
tilaskabengele Jul 20, 2020
41ad2d9
Create master branch via GitHub
tilaskabengele Jul 20, 2020
01b4e98
Create master branch via GitHub
tilaskabengele Jul 20, 2020
9048d91
Create master branch via GitHub
tilaskabengele Jul 20, 2020
c093988
Set theme jekyll-theme-slate and migrate Page Generator content
tilaskabengele Jul 26, 2020
446bd6c
Update index.md
tilaskabengele Jul 26, 2020
ca6781e
Set theme jekyll-theme-slate
tilaskabengele Jul 26, 2020
45a176a
Set theme jekyll-theme-slate
tilaskabengele Jul 26, 2020
b520bb1
Set theme jekyll-theme-slate
tilaskabengele Jul 26, 2020
d34a141
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
8d5278d
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
9b6a9d7
Update README.md
tilaskabengele Jul 26, 2020
2921c28
Update README.md
tilaskabengele Jul 26, 2020
939b1f2
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
5bea967
Delete _config.yml
tilaskabengele Jul 26, 2020
0d989ee
Delete index.md
tilaskabengele Jul 26, 2020
d4de72e
Delete github-light.css
tilaskabengele Jul 26, 2020
6a7408c
Delete normalize.css
tilaskabengele Jul 26, 2020
47d2299
Delete stylesheet.css
tilaskabengele Jul 26, 2020
69e598b
Update README.md
tilaskabengele Jul 26, 2020
b847978
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
61faa65
Update README.md
tilaskabengele Jul 26, 2020
1e9c25b
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
57a0c5a
Update README.md
tilaskabengele Jul 26, 2020
933a77c
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
fa115cd
Update README.md
tilaskabengele Jul 26, 2020
9365406
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
7be51a3
Update README.md
tilaskabengele Jul 26, 2020
2ac02cb
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
e8ace00
Update README.md
tilaskabengele Jul 26, 2020
587151c
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
29faa6c
Update README.md
tilaskabengele Jul 26, 2020
cb3da10
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
d15c33b
Set theme jekyll-theme-slate
tilaskabengele Jul 26, 2020
7c3e936
Set theme jekyll-theme-dinky
tilaskabengele Jul 26, 2020
b92a6f3
Update program.py
tilaskabengele Aug 6, 2020
a8dc72b
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
76f4be0
Delete _config.yml
tilaskabengele Aug 6, 2020
ef19b90
Update README.md
tilaskabengele Aug 6, 2020
94b7a89
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
f77c094
Update README.md
tilaskabengele Aug 6, 2020
28a7b3f
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
a6585c3
Update README.md
tilaskabengele Aug 6, 2020
8502043
Update README.md
tilaskabengele Aug 6, 2020
dc638f1
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
6931ca9
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
aec0b32
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
6bce8f7
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
80f9557
Update README.md
tilaskabengele Aug 6, 2020
b9cdec9
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
449800c
Update README.md
tilaskabengele Aug 6, 2020
6ac2612
Set theme jekyll-theme-dinky
tilaskabengele Aug 6, 2020
391149f
Update program.py
tilaskabengele Feb 17, 2021
abd3a63
add poetry package management
Oct 18, 2022
fd50301
add lockfile
Oct 18, 2022
2892cbd
Merge pull request #9 from abidart/poetry
tilaskabengele Oct 18, 2022
f2fd9a9
Update README.md
tilaskabengele Oct 24, 2022
e0d6c57
Update README.md
tilaskabengele Oct 24, 2022
124ed73
Update README.md
tilaskabengele Oct 24, 2022
4fb2913
Update README.md
tilaskabengele Oct 24, 2022
b41c667
Update README.md
tilaskabengele Oct 25, 2022
472fba1
Update README.md
tilaskabengele Oct 25, 2022
e81122b
Update README.md
tilaskabengele Oct 25, 2022
7283232
removed path requirement to program.py, periodic_table.csv
tilaskabengele Jun 2, 2023
7eb3827
modified README.md, added more package dependencies; ase, pymatgen, p…
tilaskabengele Jun 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bicrystal/outfile

/bicrystal/workspace
80 changes: 30 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,49 @@
# BiCrystal
``BiCrystal`` is a Python program that builds commensurate and incommensurate crystal structures of layered materials. The current version reads CIF files and writes the new structure to a QUANTUM ESPRESSO input file. The program also provides additional information such as the bond distance between atoms, lattice vectors in Bohr and Angstrom, and a simple 3D plot of each layer.
``BiCrystal`` is a **Python 3** program that builds incommensurate crystal structures of layered materials. The current version reads CIF files and writes the new structure to a QUANTUM ESPRESSO input file. The program also provides additional information such as the bond distance between atoms, lattice vectors in Bohr and Angstrom, and a simple 3D plot of each layer.

Contents
==========
**Overview** \
**Download** \
**Packages** \
**Files** \
**Installation** \
**Usage** \
**Examples** \
**Summary Table** \
**References** \
**License**

# Overview
Building unit cells of arbitrary size is often an inevitable task when studying the physical and mechanical properties of layered materials such as graphene, hexagonal Boron Nitride, transition metal dichalcogenides. Although most visualzation software such as Xcrysden, VESTA or Avogadro provide very powerful tools for analysing and manipulating periodic crystal structures, constructing large unit cells in bilayers with one of the layers perturbed can be very daunting. ``BiCrystal`` provides a convinient and easy way of creating new crystal structures of arbitrary size from CIF files.
Building unit cells of arbitrary size is often an inevitable task when studying the physical and mechanical properties of layered materials such as graphene, hexagonal Boron Nitride, transition metal dichalcogenides. Although most visualzation software such as Xcrysden, VESTA or Avogadro provide very powerful tools for analysing and manipulating periodic crystal structures, constructing large unit cells in bilayers with one of the layers perturbed can be very daunting. ``BiCrystal`` provides a convenient and easy way of creating new crystal structures of arbitrary size from CIF files.

# Download
# Download and Installation
The latest version of ``BiCrystal`` can be found on github:

https://github.com/tilaskabengele/BiCrystal

**Contact**: Tilas Kabengele [email protected]

# Packages
`BiCrystal` is a python-based program that uses Scipy and Shapely libraries. Additionally, the Crystal package, which is not part of the standard Python packages, should be installed. i.e Install via pip or conda:

pip install crystals
or
**Contact**: Tilas Kabengele at [email protected] or [email protected]

conda install -c conda-forge crystals
and
# Packages
We recommend running BiCrystal in python 3.8.x, where it has been thoroughly tested. Aditionally, we recommend installing BiCrystal and all its dependencies via poetry using the .lock and .toml files provided. These files contain all the dependencies of BiCrsytal with the appropriate versions used. You can learn more about poetry from the official website: https://python-poetry.org/. For more information on crystals and shapely, visit: https://pypi.org/project/crystals/ and https://pypi.org/project/Shapely/ respectively.

pip install shapely

For more information on crystals and shapely, visit: https://pypi.org/project/crystals/ and https://pypi.org/project/Shapely/ respectively.

# Files
After you have installed poetry on your machine, cd into the source folder of the cloned repository and run

poetry install

This will create a virtual environment for BiCrystal. To activate the virtual environment and use BiCrystal, run

poetry shell

# BiCrystal files
**bicrystal** - Bash script which runs the python program \
**cifs/** - Directory with sample cif files \
**examples/** - Directory with 33 examples of QUANTUM ESPRESSO input files generated by BiCrystal \
**periodic_table.csv** - Periodic table of elements \
**program.py** - Python program to be called from bicrystal script

# Installation
After downloading the files from the github repository to the directory of your choice (_recommended: /usr/bin/_), make `bicrystal` and `program.py` into executables:

chmod u+x bicrystal program.py

Next, add this directory to your $PATH variable. In Bash, adding the following lines to your `.bashrc file`:

vi ~/.bashrc
**program.py** - Python program to be called from bicrystal script \
**pyproject.toml** - Poetry file which contains summarized list of packages used \
**poetry.lock* - Poetry file which contains detailed description of all packages used and their dependancies

Add:

export PATH="$/path/to/your/directory/with/bicrysal/:$PATH"
export PYTHONPATH="${PYTHONPATH}:/path/to/your/directory/with/bicrysal/"

Save, close then source your `.bashrc` file to activate the changes:

source ~/.bashrc

Restart your terminal window to start using `bicrystal`.

# Usage
BiCrystal is an interactive program that instructs the user every step of the way. To start BiCrystal, in the terminal type:
Expand All @@ -75,13 +55,11 @@ The first thing you will be required to do is input your cif file, e.g. graphite
***Input cif file***
graphite.cif

Next, enter input parameters m and n, and rotation angle in degrees (_zero if you want both layers unperturbed_).
Parameter m and n correspond to the scale of the lattice vectors along the x and y directions, respectively. As an example, let's take m = 2, n = 1 and rotation angle 21.79 degrees.
Next, input scaling parameters m and n, which correspond to the scale of the lattice vectors along the x and y directions, respectively. As an example, let's take m = 2, n = 1. Bicrystal caculates the relative rotation angle for the given m and n. In this case, the rotation angle will be 21.79 degrees.

***Rotation parameters***
Enter m 2
Enter n 1
Enter rotation_angle 0

After that, you will be required to pick a zeroeth atom from the top and bottom layer. If we were picking the atoms by hand using a visualization software such as Xcrysden, this would be the atom we start from when creating the new cell vectors.

Expand All @@ -107,10 +85,13 @@ After that, you will be required to pick a zeroeth atom from the top and bottom

![cc28](https://user-images.githubusercontent.com/62076249/87927879-48795500-ca5a-11ea-98c1-b2949bb672e3.PNG)

Finally, you can save your output as a QUANTUM ESPRESSO file and visualize with Xcrysden for a more sophisticated look.
Finally, you can save your output as a QUANTUM ESPRESSO file and visualize with VESTA or Xcrysden for a more sophisticated look.

********************* SUMMARY REPORT ***********************


Rotation angle (deg) = 19.107
Relative Rotation (deg) = 21.787

Top atoms(rotated) = 14
Bottom atoms = 14

Expand All @@ -121,9 +102,8 @@ After that, you will be required to pick a zeroeth atom from the top and bottom

Would you like to write Espresso file?[Y/n]

# Examples

Let's say we saved our output in the example given above as graphite28.scf.in, we can visualize this with Xcrysden.
# Examples
Let's say we saved our output in the example given above as graphite28.scf.in, we can visualize this with Xcrysden.

xcrysden --pwi graphite28.scf.in

Expand All @@ -134,17 +114,17 @@ Looking from the top view, we can see that for this rotation, a Moire pattern wa
The **examples/** folder has over 30 examples of Moire patterns graphite, Molebdenum Disulfide and blue Phosphorene generated from `bicrystal`. Below are some examples.

# Graphite 364-atom unit cell
The unit cell of graphite with 364 atoms can be generated by using parameters: m = 6, n = 5, and rotation angle of 6.01 degrees. Shown below is the top view.
The unit cell of graphite with 364 atoms can be generated by using parameters: m = 6, n = 5. Shown below is the top view.

![cc364](https://user-images.githubusercontent.com/62076249/87933970-98f5b000-ca64-11ea-906b-15a1036989a1.PNG)

# Blue phosphorene 172-atom unit cell
The unit cell of blue phosphorene with 172 atoms can be generated by using parameters: m = 6, n = 1, and rotation angle of 44.82 degrees. Shown below is the top view.
The unit cell of blue phosphorene with 172 atoms can be generated by using parameters: m = 6, n = 1. Shown below is the top view.

![bluep172](https://user-images.githubusercontent.com/62076249/87934152-e245ff80-ca64-11ea-8f36-b69b5799e3fa.PNG)

# Molybdenun Disulfide 546-atom unit cell
The unit cell of MoS<sub>2</sub> with 546 atoms atoms can be generated by using parameters: m = 6, n = 5, and rotation angle of 6.01 degrees. Shown below is the top view.
The unit cell of MoS<sub>2</sub> with 546 atoms atoms can be generated by using parameters: m = 6, n = 5. Shown below is the top view.

![mos546](https://user-images.githubusercontent.com/62076249/87934312-2fc26c80-ca65-11ea-97a2-c9cdb3068a9d.PNG)

Expand All @@ -153,7 +133,7 @@ All the examples in the examples folder can be summarized in the table below:

![example_table](https://user-images.githubusercontent.com/62076249/87934662-dc045300-ca65-11ea-8f54-818b7183d6e1.PNG)

# References
# References
For a detailed analysis of Moire patterns and angles:

**Density functional calculations on the intricacies of Moiré patterns on graphite**, J. M. Campanera, G. Savini, I. Suarez-Martinez, and M. I. Heggie, _Phys. Rev. B 75, 235449 – Published 28 June 2007_
Expand All @@ -164,7 +144,7 @@ All the examples in the examples folder can be summarized in the table below:

For further reading and related projects, visit **Johnson Group wiki**: http://schooner.chem.dal.ca/wiki/Johnson_Group_Wiki

# License
# License
Copyright (c) 2020 Tilas Kabengele, Johnson Chemistry Group, Dalhousie University.

BiCrystal is a free program: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Expand Down
Binary file added __pycache__/helpers_bicrystal.cpython-38.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-minimal
theme: jekyll-theme-dinky
Binary file added bicrystal/__pycache__/ase.cpython-38.pyc
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions bicrystal/atomic_plotting_data.json

Large diffs are not rendered by default.

63 changes: 31 additions & 32 deletions bicrystal/bicrystal
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
#!/bin/bash

# Remove unnecessary files
rm -f number_of_atoms unitcell body outfile heading heading_nat atoms sorted_atoms k_points

t1=$(whereis program.py | awk '{print $2}')
t2=$(whereis program.py | awk '{print $2}' | sed -r 's/.{10}$//')
echo $t2 > workspace
python $t1 2>&1 | tee outfile
rm -f workspace

echo "Would you like to write Espresso file?[Y/n]"
# Execute python script for bicrystal
python program.py 2>&1 | tee outfile

# Post-process the results and prepare output file
echo -e "\nWould you like to write an Espresso file? [Y/n]"
read reply

if [[ "$reply" == "y" ]]
then
echo "Save as:"
read filename
elif [[ "$reply" == "Y" ]]
then
echo "Save as"
read filename
elif [[ "$reply" == "n" ]]
then
exit
elif [[ "$reply" == "N" ]]
then
exit
else
echo "Invalid"
echo "Stop"
exit
if [[ "$reply" == "y" || "$reply" == "Y" ]]; then
echo "Save as:"
read -r filename
elif [[ "$reply" == "n" || "$reply" == "N" ]]; then
echo -e "\n\n\nGoodbye!\n\n***\n\n"
rm -f outfile
exit
else
echo "Invalid input. Stop."
rm -f outfile
exit
fi
tail -n -4 outfile | head -n 1 > number_of_atoms
uc=$(sed -n '/CELL_PARAMETERS/,+3p' outfile | column -t | tail -n 3 | sed -e "s/^/ /")

# Extract relevant data from the output file
number_of_atoms=$(grep -m 1 -A 1 "Total atoms" outfile | tail -n 1 | awk '{print $NF}')
uc=$(sed -n '/CELL_PARAMETERS/,+3p' outfile)
echo "$uc" > unitcell
sed -n '/control/,/ATOMIC_POSITIONS/p' outfile > heading
sed "s/= atoms/$(cat number_of_atoms)/g" heading > heading_nat
sed "s/nat[[:space:]]*=[[:space:]]*atoms/nat = $number_of_atoms/" heading > heading_nat
sed -n '/ATOMIC_POSITIONS/,/K_POINTS/p' outfile | tail -n +2 | head -n -2 > atoms
sort -k 4n atoms > sorted_atoms
sort -k 4n -o sorted_atoms atoms
echo >> sorted_atoms
sed -n '/K_POINTS/,+1p' outfile > k_points
echo >> k_points
sed -n '/CELL_PARAMETERS/,+0p' outfile > cell_par
cat heading_nat sorted_atoms k_points cell_par unitcell > $filename
sed -n '/CELL_PARAMETERS/,-1p' outfile | tail -n 3 > cell_par

# Combine the extracted data into the final output file
cat heading_nat sorted_atoms k_points cell_par unitcell > "$filename"

# Replace the number of atoms in the output file
sed -i "s/nat = atoms/nat = $number_of_atoms/" "$filename"

# Remove unnecessary files
rm -f number_of_atoms cell_par unitcell body outfile heading heading_nat atoms sorted_atoms k_points

rm -f outfile
echo -e "\n\n\nGoodbye!\n\n***\n\n"

88 changes: 0 additions & 88 deletions bicrystal/cifs/mos.cif

This file was deleted.

37 changes: 37 additions & 0 deletions bicrystal/cifs/mos2.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# generated using pymatgen
data_MoS2
_symmetry_space_group_name_H-M 'P 1'
_cell_length_a 3.19223791
_cell_length_b 3.19223791
_cell_length_c 13.37829400
_cell_angle_alpha 90.00000000
_cell_angle_beta 90.00000000
_cell_angle_gamma 120.00000000
_symmetry_Int_Tables_number 1
_chemical_formula_structural MoS2
_chemical_formula_sum 'Mo2 S4'
_cell_volume 118.06518982
_cell_formula_units_Z 2
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_type_symbol
_atom_type_oxidation_number
Mo4+ 4.0
S2- -2.0
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Mo4+ Mo0 1 0.66666667 0.33333333 0.25000000 1
Mo4+ Mo1 1 0.33333333 0.66666667 0.75000000 1
S2- S2 1 0.66666667 0.33333333 0.63308200 1
S2- S3 1 0.33333333 0.66666667 0.36691800 1
S2- S4 1 0.66666667 0.33333333 0.86691800 1
S2- S5 1 0.33333333 0.66666667 0.13308200 1
Loading