[ase-users] Superimpose a structural model onto slices through a CHGCAR file

fabian Fabian.T89 at web.de
Wed May 17 17:38:58 CEST 2017


Dear all,

I want to superimpose a structural model onto slices through a CHGCAR 
file or differences of CHGCAR files.
Theses slices are displayed with the contour plot from matplotlib.
My first question is, if there is a script in existence that does this 
which somebody would be willing to share?

At the moment i am trying to plot circles based on the atoms object i 
get from my data. I do want to limit the
amount of atoms from the structure to only include those which are 
necessary and roughly of the same hightas the slice in question. This is 
were i currently am
wicht my code:

import  numpyas  np
from  matplotlibimport  pyplot
from  aseimport  Atom
from  ase.atomsimport  Atoms
from  ase.dataimport  covalent_radiias  radii
from  ase.data.colorsimport  jmol_colors
from  matplotlib.patchesimport  Circle
from  ase.ioimport  read,  write
fig,  ax=  pyplot.subplots()


atoms=  read('CHGDIFF',  format="vasp")
Z_POS=25.5
maxi=  max(a.zfor  ain  atoms)
mini=  min(a.zfor  ain  atoms)
percent=40
add=  ((maxi-mini)/100)*percent


if  min(a.zfor  ain  atoms)  <  Z_POS<  max(a.zfor  ain  atoms):
	filter  =  [a.indexfor  ain  atomsif  Z_POS-add<  a.z<=  Z_POS+add]
	atoms_filtered=  Atoms([afor  ain  atomsif  a.indexin  filter])
	
	
	
for  atomin  atoms_filtered:
	color=  jmol_colors[atom.number]
	#color = "None"
	radius=  radii[atom.number]
	circle=  Circle((atom.x,  atom.y),  (radius/2.5),  facecolor=color,edgecolor='k',  linewidth=0.4)#alpha=10)
	ax.add_patch(circle)
	


ax.axis('equal')
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')

fig.savefig('out.png',dpi=300)








There are a few problems, however.

a) Some atoms are not in the unit cell any more but appear as mirrors on 
the other side  after the calculation? Can i shift them back somehow?
b) if i limit with the "percent" variable the amount of atoms i display 
to not include the slab any more, the plotted picture does not have the 
size of the unicell any more? Can i somehow force it to this size anyways?
How do i make sure, that i can to a superposition in a way that the 
atoms are always at the corect position with in the slice thru the 
CHGCAR file?
c) i use jmol_colors to color my structure i would however want to 
change only the colour of the atoms in my slab ( Cu) to be transparent. 
Can i change the corresponding entry in the array
color = jmol_colors[atom.number] somehow?
d) Can i somehow connect only the centres of those circles from a 
certain specie such that the molecular structure becomes visible?
e) I suppose there are much better ways to do this? Could somebody point 
my in the right direction should this be the case?

All the best and thank you in advance

Fabian





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170517/02a44fe3/attachment.html>


More information about the ase-users mailing list