In [1]:
%matplotlib inline

绘制TiO2 (110) 面


In [2]:
from catplot.grid_components.nodes import Node2D
from catplot.grid_components.edges import Edge2D
nodes, edges = [], []

In [3]:
ti = Node2D([0.0, 0.0], size=800, color="#6D6E70", alpha=0.8, zorder=1)
o = Node2D([0.0, 0.0], size=800, color="#E35858", alpha=0.8, zorder=1)

Ti nodes


In [4]:
t1 = ti.clone()
t2 = ti.clone([0.5, 1.0])

In [5]:
nodes.extend([t1, t2])

O nodes


In [6]:
from math import sqrt
o1 = o.clone([0.0, 1.0])
o2 = o.clone([0.5, 0.5/sqrt(3)])
o3 = o.clone([0.5, 2.-0.5/sqrt(3)])

In [7]:
nodes.extend([o1, o2, o3])

辅助nodes


In [8]:
n1 = Node2D([0.0, 2.0])
n2 = Node2D([1.0, 2.0])
n3 = Node2D([1.0, 1.0])
n4 = Node2D([1.0, 0.0])

Edges


In [9]:
e1 = Edge2D(t1, n4, width=5)
e2 = Edge2D(o2, t1, width=5)
e3 = Edge2D(o2, n4, width=5)
e4 = Edge2D(t2, n3, width=5)
e5 = Edge2D(t2, o1, width=5)
e6 = Edge2D(o3, t2, width=5)
e9 = Edge2D(o2, t2, width=5)
e7 = Edge2D(o3, n1, width=5)
e8 = Edge2D(o3, n2, width=5)

In [10]:
edges.extend([e1, e2, e3, e4, e5, e6, e7, e8, e9])

绘制


In [11]:
from catplot.grid_components.supercell import SuperCell2D

In [12]:
supercell = SuperCell2D(nodes, edges)

In [13]:
from catplot.grid_components.grid_canvas import Grid2DCanvas

In [14]:
canvas = Grid2DCanvas()



In [15]:
canvas.add_supercell(supercell)

In [16]:
canvas.draw()
canvas.figure


Out[16]:

扩展


In [17]:
expanded_supercell = supercell.expand(5, 3, cell_vectors=[[1.0, 0.0], [0.0, 2.0]])

In [18]:
canvas_big = Grid2DCanvas(figsize=(30, 20), dpi=60)
canvas_big.add_supercell(expanded_supercell)



In [19]:
canvas_big.draw()
canvas_big.figure


Out[19]: