Twisted Graphene Bilayers#

import & prepare#

[1]:
!pip install git+https://github.com/nmdl-mizo/interface_master.git@develop
!mkdir -p cif_files
!curl https://raw.githubusercontent.com/nmdl-mizo/interface_master/develop/test_files/cif_files/C_mp-990448_conventional_standard.cif -o 'cif_files/C_mp-990448_conventional_standard.cif'
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/nmdl-mizo/interface_master.git@develop
  Cloning https://github.com/nmdl-mizo/interface_master.git (to revision develop) to /tmp/pip-req-build-c78tkxc7
  Running command git clone --filter=blob:none --quiet https://github.com/nmdl-mizo/interface_master.git /tmp/pip-req-build-c78tkxc7
  Resolved https://github.com/nmdl-mizo/interface_master.git to commit 2bdf96ed4835b036557ac18de82b4fa2afdabf24
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pymatgen in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (2023.1.30)
Requirement already satisfied: matplotlib in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (3.7.0)
Requirement already satisfied: gb_code in /home/vscode/.local/lib/python3.10/site-packages (from interfacemaster==1.1.1) (1.0.0)
Requirement already satisfied: numpy>=1.14.0 in /home/vscode/.local/lib/python3.10/site-packages (from gb_code->interfacemaster==1.1.1) (1.24.2)
Requirement already satisfied: pillow>=6.2.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (9.4.0)
Requirement already satisfied: fonttools>=4.22.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (4.38.0)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (2.8.2)
Requirement already satisfied: contourpy>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (1.0.7)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (23.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (1.4.4)
Requirement already satisfied: pyparsing>=2.3.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (3.0.9)
Requirement already satisfied: cycler>=0.10 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib->interfacemaster==1.1.1) (0.11.0)
Requirement already satisfied: pybtex in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.24.0)
Requirement already satisfied: pandas in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.5.3)
Requirement already satisfied: sympy in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.11.1)
Requirement already satisfied: uncertainties>=3.1.4 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.1.7)
Requirement already satisfied: tqdm in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (4.64.1)
Requirement already satisfied: requests in /usr/local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2.28.2)
Requirement already satisfied: networkx>=2.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.0)
Requirement already satisfied: mp-api>=0.27.3 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.30.10)
Requirement already satisfied: scipy>=1.5.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (1.10.1)
Requirement already satisfied: monty>=3.0.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2022.9.9)
Requirement already satisfied: tabulate in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.9.0)
Requirement already satisfied: ruamel.yaml>=0.17.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (0.17.21)
Requirement already satisfied: palettable>=3.1.1 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (3.3.0)
Requirement already satisfied: spglib>=2.0.2 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (2.0.2)
Requirement already satisfied: plotly>=4.5.0 in /home/vscode/.local/lib/python3.10/site-packages (from pymatgen->interfacemaster==1.1.1) (5.13.0)
Requirement already satisfied: emmet-core>=0.39.8 in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (0.44.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (65.5.1)
Requirement already satisfied: msgpack in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (1.0.4)
Requirement already satisfied: typing-extensions>=3.7.4.1 in /home/vscode/.local/lib/python3.10/site-packages (from mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (4.5.0)
Requirement already satisfied: tenacity>=6.2.0 in /home/vscode/.local/lib/python3.10/site-packages (from plotly>=4.5.0->pymatgen->interfacemaster==1.1.1) (8.2.1)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->interfacemaster==1.1.1) (1.16.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (1.26.14)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (2022.12.7)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/site-packages (from requests->pymatgen->interfacemaster==1.1.1) (3.4)
Requirement already satisfied: ruamel.yaml.clib>=0.2.6 in /home/vscode/.local/lib/python3.10/site-packages (from ruamel.yaml>=0.17.0->pymatgen->interfacemaster==1.1.1) (0.2.7)
Requirement already satisfied: future in /home/vscode/.local/lib/python3.10/site-packages (from uncertainties>=3.1.4->pymatgen->interfacemaster==1.1.1) (0.18.3)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/site-packages (from pandas->pymatgen->interfacemaster==1.1.1) (2022.7.1)
Requirement already satisfied: PyYAML>=3.01 in /usr/local/lib/python3.10/site-packages (from pybtex->pymatgen->interfacemaster==1.1.1) (6.0)
Requirement already satisfied: latexcodec>=1.0.4 in /home/vscode/.local/lib/python3.10/site-packages (from pybtex->pymatgen->interfacemaster==1.1.1) (2.0.1)
Requirement already satisfied: mpmath>=0.19 in /home/vscode/.local/lib/python3.10/site-packages (from sympy->pymatgen->interfacemaster==1.1.1) (1.2.1)
Requirement already satisfied: pydantic>=1.10.2 in /home/vscode/.local/lib/python3.10/site-packages (from emmet-core>=0.39.8->mp-api>=0.27.3->pymatgen->interfacemaster==1.1.1) (1.10.5)

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   740  100   740    0     0   2605      0 --:--:-- --:--:-- --:--:--  2605
[2]:
from interfacemaster.cellcalc import get_primitive_hkl, get_pri_vec_inplane, get_normal_index, get_normal_from_MI, rot
from interfacemaster.interface_generator import core, convert_vector_index
from interfacemaster.symmetric_tilt import get_csl_twisted_graphenes
from numpy import array, dot, round, cross, eye, pi, ceil, column_stack, arange
from numpy.linalg import inv, det, norm
from gb_code.csl_generator import print_list
import pandas as pd

Define a get_csl_twisted_graphenes class#

[3]:
#sigmas, rotation angles, CNID areas, num of atoms
sigmas, thetas, A_cnid, anum = get_csl_twisted_graphenes(lim = 10, filename = \
                                                         'cif_files/C_mp-990448_conventional_standard.cif',\
                                                        maxsigma = 2500, verbose=False)
/home/vscode/.local/lib/python3.10/site-packages/pymatgen/io/cif.py:1169: UserWarning: Issues encountered while parsing CIF: Some fractional coordinates rounded to ideal values to avoid issues with finite precision.
  warnings.warn("Issues encountered while parsing CIF: " + "\n".join(self.warnings))
[4]:
df = pd.DataFrame(column_stack((sigmas, thetas/pi*180, A_cnid, anum)), index = arange(len(sigmas))+1, \
                  columns = ['sigma','thetas','CNID area','atom number'])
df['sigma'] = df['sigma'].astype('int')
df['atom number'] = df['atom number'].astype('int')
df
[4]:
sigma thetas CNID area atom number
1 7 21.786789 0.753823 28
2 13 32.204228 0.405905 52
3 19 13.173551 0.277724 76
4 31 17.896551 0.170218 124
5 37 9.430008 0.142615 148
6 43 15.178179 0.122715 172
7 49 16.426421 0.107689 196
8 61 7.340993 0.086504 244
9 67 35.567302 0.078758 268
10 73 11.635051 0.072284 292
11 79 26.007824 0.066794 316
12 91 6.008983 0.057986 364
13 97 29.409311 0.054400 388
14 103 19.652860 0.051231 412
15 109 10.992733 0.048411 436
16 127 5.085848 0.041549 508
17 133 8.613238 0.039675 532
18 139 34.538944 0.037962 556
19 151 18.733998 0.034945 604
20 163 36.516938 0.032373 652
21 169 4.408455 0.031223 676
22 181 30.158276 0.029153 724
23 193 8.255621 0.027341 772
24 217 3.890238 0.024317 868
25 223 19.274807 0.023663 892
26 229 26.745652 0.023043 916
27 247 14.622221 0.021363 988
28 259 28.783203 0.020374 1036
29 271 3.481006 0.019471 1084
30 277 17.278244 0.019050 1108
31 283 24.016602 0.018646 1132
32 301 6.608610 0.017531 1204
33 331 3.149657 0.015942 1324
34 337 15.654144 0.015658 1348
35 367 11.985100 0.014378 1468
36 379 23.713582 0.013923 1516
37 403 14.307676 0.013094 1612
38 409 19.932013 0.012902 1636
39 457 27.052418 0.011547 1828
40 481 18.365765 0.010970 1924
41 523 20.146584 0.010089 2092
42 559 17.026049 0.009440 2236
43 613 23.301803 0.008608 2452
[5]:
my_interface = core('cif_files/C_mp-990448_conventional_standard.cif',\
                    'cif_files/C_mp-990448_conventional_standard.cif')
Warning!, this programme will rewrite the POSCAR file in this dir!
/home/vscode/.local/lib/python3.10/site-packages/pymatgen/io/cif.py:1169: UserWarning: Issues encountered while parsing CIF: Some fractional coordinates rounded to ideal values to avoid issues with finite precision.
  warnings.warn("Issues encountered while parsing CIF: " + "\n".join(self.warnings))

Searching two_dimensional CSL#

[6]:
#a known target disorientation giving CSL
R = rot(a=[0,0,1],theta = 1.1/180 * pi)
[7]:
my_interface.parse_limit(du = 1e-3, S = 1e-3, sgm1=10000, sgm2=10000, dd = 1e-3)
#Do searching!
my_interface.search_fixed(R=R, exact=False)
Congrates, we found an appx CSL!

U1 =
[[ 0 58 30]
 [ 0 28 58]
 [ 1  0  0]]; sigma_1 = 2524

U2 =
[[ 0 58 29]
 [ 0 29 58]
 [ 1  0  0]]; sigma_2 = 2524

D =
[[ 1.00019791e+00 -7.07520000e-04  0.00000000e+00]
 [ 7.07520000e-04  1.00019791e+00  0.00000000e+00]
 [ 0.00000000e+00 -0.00000000e+00  1.00000000e+00]]

Get bicrystal#

[8]:
hkl = get_primitive_hkl([0, 0, 1], my_interface.conv_lattice_1, my_interface.lattice_1)
my_interface.compute_bicrystal(hkl = hkl, normal_ortho = False, plane_ortho = False, lim = 50, tol_ortho = 1e-2, tol_integer=1e-3)
hkl in CSL: [-1  0  0]
cell 1:
[[  0  58 -28]
 [  0  28  30]
 [  1   0   0]]
cell 2:
[[  0  58 -29]
 [  0  29  29]
 [  1   0   0]]
[9]:
layer_displacement = 3.4
my_interface.get_bicrystal(xyz_1 = [1,1,1], xyz_2 = [1,1,1], \
                           dp1 = 9.99905800e+00 - layer_displacement, filetype= 'VASP')

Sample CNID#

[10]:
gridsize = 0.3
n1 = int(ceil(norm(my_interface.CNID[:,0])/gridsize))
n2 = int(ceil(norm(my_interface.CNID[:,1])/gridsize))
[11]:
import shutil
try:
    shutil.rmtree('CNID_inputs')
except:
    print('No existing files')
my_interface.sample_CNID([n1,n2], dp1 = 9.99905800e+00 - layer_displacement)
CNID
[[-0.01149425  0.01149425]
 [ 0.01149425  0.02298851]
 [-0.         -0.        ]]
making 1 files...
completed

Please check the POSCAR file