-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_atom.py
More file actions
executable file
·58 lines (44 loc) · 1.5 KB
/
plot_atom.py
File metadata and controls
executable file
·58 lines (44 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# AtomPy - atomic calcalations in python
# Copyright (C) 2010 Davide Ceresoli <dceresoli@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from Atomic import *
# parse command line
from optparse import OptionParser
parser = OptionParser("usage: %prog atom.data")
(options, args) = parser.parse_args()
if len(args) == 0:
parser.print_help()
exit(1)
# read data
import cPickle as pickle
atom = pickle.load(file(args[0]))
# plot
import pylab
pylab.figure(1)
pylab.plot(atom.grid.r, atom.rho*atom.grid.r2, label='charge density')
pylab.xlim(0.0, 3.0)
pylab.legend()
pylab.figure(2)
pylab.plot(atom.grid.r, atom.v_pot, label='SCF potential')
pylab.plot(atom.grid.r, atom.v_ion, label='ionic potential')
pylab.xlim(0.0, 3.0)
pylab.ylim(-20.0, 0.0)
pylab.legend()
pylab.figure(3)
for orb in atom.orbitals:
pylab.plot(atom.grid.r, orb.psi, label="n=%i, l=%i, ene=%f" % (orb.n, orb.l, orb.ene))
pylab.xlim(0.0, 3.0)
pylab.legend()
pylab.show()