-
Notifications
You must be signed in to change notification settings - Fork 1
/
potential_class.py
60 lines (46 loc) · 1.4 KB
/
potential_class.py
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
55
56
57
58
59
import numpy as np
from error import error
class potential:
"""
Describes the potential field that forms part of the quantum system for
which a wavefunction is calculated
"""
def __init__(self,steps,form="SW"):
"""
Initialises potential field and generates potential array
Parameters
----------
steps : int
Number of integration points used in the calculation of wavefunction ψ.
form : str, optional
Describes the shape of the potential. The default is "SW".
Returns
-------
None.
"""
self.form=form
self.steps=steps
if self.form=="SW":
self.V=np.array([1 for i in range(steps)])
else:
error("The form \"{}\" is not currently defined".format(self.form))
def V_depth(self):
"""
Finds the depth of the potential well from the potential array
Returns
-------
depth : float
The depth of the potential well.
"""
depth=-np.max(self.V)
return depth
def nu(self):
"""
Calculates nondimensionalised potential nu
Returns
-------
nu_array : numpy.ndarray
An array of nondimensionalised potential.
"""
nu_array=self.V/self.V_depth()
return nu_array