PageRenderTime 34ms CodeModel.GetById 23ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/ase/structure.py

https://gitlab.com/vote539/ase
Python | 35 lines | 29 code | 5 blank | 1 comment | 6 complexity | bce88daa4c865b6bacd1ad8e7264fbf1 MD5 | raw file
 1# creates: a1.png a2.png a3.png cnt1.png cnt2.png gnr1.png gnr2.png
 2from ase.io import write
 3from ase.lattice import bulk
 4from ase.structure import nanotube, graphene_nanoribbon
 5import numpy as np
 6
 7for i, a in enumerate([
 8    bulk('Cu', 'fcc', a=3.6),
 9    bulk('Cu', 'fcc', a=3.6, orthorhombic=True),
10    bulk('Cu', 'fcc', a=3.6, cubic=True)]):
11    write('a%d.pov' % (i + 1), a,
12          show_unit_cell=2, display=False, run_povray=True)
13
14cnt1 = nanotube(6, 0, length=4)
15cnt1.rotate('x', 'z', rotate_cell=True)
16cnt2 = nanotube(3, 3, length=6, bond=1.4, symbol='Si')
17cnt2.rotate('x', 'z', rotate_cell=True)
18
19for i, a in enumerate([cnt1, cnt2]):
20    write('cnt%d.pov' % (i + 1), a,
21          show_unit_cell=2, display=False, run_povray=True)
22
23ind = [2, 0, 1]
24gnr1 = graphene_nanoribbon(3, 4, type='armchair', saturated=True)
25gnr1.set_cell(np.diag(gnr1.cell)[ind])
26gnr1.positions = gnr1.positions[:, ind]
27gnr2 = graphene_nanoribbon(2, 6, type='zigzag', saturated=True,
28                           C_H=1.1, C_C=1.4, vacuum=3.0, 
29                           magnetic=True, initial_mag=1.12)
30gnr2.set_cell(np.diag(gnr2.cell)[ind])
31gnr2.positions = gnr2.positions[:, ind]
32
33for i, a in enumerate([gnr1, gnr2]):
34    write('gnr%d.pov' % (i + 1), a,
35          show_unit_cell=2, display=False, run_povray=True)