[ase-users] A short script for making a periodic table
Michael Joseph Waters
michael.j.waters at northwestern.edu
Mon Jan 13 16:54:47 CET 2020
Hi all,
I made a short script that creates the row and column positions for each element in the periodic table. I think it's handy if you are picking a color set.
############### generates column, row positions for each element
x, y = 1, 1 # column, row , initial coordinates for Hydrogen
position_list = [(0,0,0)]
zmax = 118
for z in range(1,zmax+1):
if z==2: x += 16
if z==5: x += 10
if z==13: x += 10
if z==57 or z==89: y+=3
if z==72 or z==104:
y-=3
x-=14
position_list.append((x,y,0))
x += 1
if x > 18:
x=1
y+=1
################### now for viewing
from ase.data import chemical_symbols, colors
from ase import Atoms, Atom, io
import numpy as np
spacing = 2.5
atoms = Atoms()
for z in range(1,zmax+1):
symbol = chemical_symbols[z]
position = spacing *np.array(position_list[z])
position[1] = -position[1]
atoms.append(Atom(symbol, position=position))
io.write('ptable.xyz',atoms)
from ase.visualize import view
view(atoms)
I hope someone finds it useful.
Cheers,
-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200113/fbcf12cc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ptable_cells.py
Type: text/x-python-script
Size: 849 bytes
Desc: ptable_cells.py
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200113/fbcf12cc/attachment.bin>
More information about the ase-users
mailing list