Dplot output charge density, total number of electron incorrect

From NWChem

You are viewing a single post from the thread title above
Jump to: navigation, search

Click here for full thread
Just Got Here
Threads 1
Posts 3
Dear NwChem Users,

I want to calculate the total charge density in a cube file by mp2 method. While, after I have this done, I integrate all the charge density, but it is not the total number of electron in the system. Is there something wrong with my input file?

Here is my input file and sum charge script.

Yi Yao

mp2.nw

=

start nacl

geometry
 na 0 0 0
cl 2.0 0 0
end

basis
 * library 6-311G**
end

mp2
 freeze core
end

task mp2

dplot
 TITLE CHARGE_DENSITY
vectors nacl.movecs
LimitXYZ
-7.5 7.5 100
-7.5 7.5 100
-7.5 7.5 100
spin total
gaussian
output nacl.cube
end

task dplot


sum_charge.py

=

import sys,math

cube_file_name = sys.argv[1]

cube_file = file(cube_file_name)

init =[0,0,0]
npix =[0,0,0]
dpix =[0,0,0]
sumcharge = 0

          1. READ THE HEAD INFORMATION
cube_file.readline()
cube_file.readline()
line = cube_file.readline()
words = line.split()
natoms = int(words[0])
for i in range(3):
   init[i] = float(words[i+1])
for i in range(3):
   line = cube_file.readline()
words = line.split()
npix[i] = int(words[0])
dpix[i] = float(words[i+1])
  1. print init, npix, dpix,
for i in range(natoms):
   cube_file.readline(),

for i in range(npix[0]):
   #print i
for j in range(npix[1]):
for k in range(int(math.ceil(npix[2]/6.0))):
line = cube_file.readline()
words = line.split()
for word in words:
sumcharge += float(word)
total_charge = sumcharge*dpix[0]*dpix[1]*dpix[2]
print total_charge
cube_file.close()


Who's here now Members 0 Guests 0 Bots/Crawler 0


AWC's: 2.5.10 MediaWiki - Stand Alone Forum Extension
Forum theme style by: AWC