1
General Questions and Answers / Re: export CUBE files
« on: April 1, 2013, 22:00 »
Hi Anders,
Thanks for the awesome script! This is very helpful!
I had to make some minor tweaks --
Here I changed the number format from %13.6 to %18.6e to prevent numbers from running together.
The second tweak was to add a column to the atom section. There are a total five columns:
atomic number, charge, x, y, and z. Here I just added the fifth column and set the charge to zero as
I am using the electron density to get Bader charges anyways.
But that was really minor stuff that I could figure out This is really useful, thanks again
for your help!
Best,
John
Thanks for the awesome script! This is very helpful!
I had to make some minor tweaks --
Code
header = """CUBE FILE. DATA VALUES IN UNITS OF %s, LENGTHS IN BOHR
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
"""
The second tweak was to add a column to the atom section. There are a total five columns:
atomic number, charge, x, y, and z. Here I just added the fifth column and set the charge to zero as
I am using the electron density to get Bader charges anyways.
Code
if number_of_atoms:
coordinates = gridvalues._configuration().cartesianCoordinates().inUnitsOf(Bohr)
elements = gridvalues._configuration().elements()
zero = 0.0
for e,c in zip(elements,coordinates):
stream.write("%5i%4.1f%18.6e%18.6e%18.6e\n" % (e.atomicNumber(),zero,c[0],c[1],c[2]))
else:
stream.write("\n")
But that was really minor stuff that I could figure out This is really useful, thanks again
for your help!
Best,
John