[ase-users] A short script for making a periodic table

Jens Jørgen Mortensen jjmo at dtu.dk
Wed Jan 22 11:16:13 CET 2020


Den 13.01.2020 kl. 16.54 skrev Michael Joseph Waters via ase-users:
> 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.

Thanks! I've added it to our gallery:

     https://wiki.fysik.dtu.dk/ase/dev/gallery/gallery.html#periodic-table

Jens Jørgen

> 
> 
> ############### 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
> 
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
> 


More information about the ase-users mailing list