quplots 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quplots-0.0.1/.gitignore +5 -0
- quplots-0.0.1/LICENSE.txt +9 -0
- quplots-0.0.1/PKG-INFO +51 -0
- quplots-0.0.1/README.md +21 -0
- quplots-0.0.1/cosas.zip +0 -0
- quplots-0.0.1/pyproject.toml +66 -0
- quplots-0.0.1/pytest.ini +3 -0
- quplots-0.0.1/src/quplots/__about__.py +5 -0
- quplots-0.0.1/src/quplots/__init__.py +6 -0
- quplots-0.0.1/src/quplots/electron/coordinates.py +10 -0
- quplots-0.0.1/src/quplots/electron/electron.py +46 -0
- quplots-0.0.1/src/quplots/electron/radial.py +10 -0
- quplots-0.0.1/src/quplots/electron/sphericalHarmonics.py +37 -0
- quplots-0.0.1/src/quplots/electron/waveFunction.py +26 -0
- quplots-0.0.1/src/quplots/hibrydization/hybridization.py +32 -0
- quplots-0.0.1/src/quplots/hibrydization/sp.py +8 -0
- quplots-0.0.1/src/quplots/hibrydization/sp2.py +11 -0
- quplots-0.0.1/src/quplots/hibrydization/sp2d.py +12 -0
- quplots-0.0.1/src/quplots/hibrydization/sp3.py +12 -0
- quplots-0.0.1/src/quplots/hibrydization/sp3d.py +14 -0
- quplots-0.0.1/src/quplots/hibrydization/sp3d2.py +16 -0
- quplots-0.0.1/src/quplots/plots/plots.py +421 -0
- quplots-0.0.1/tests/__init__.py +3 -0
- quplots-0.0.1/tests/test.py +37 -0
quplots-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Adrian <kerpador@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
quplots-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quplots
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Allows you to visualize and interact with plots that describes quantum phenoms
|
|
5
|
+
Project-URL: Documentation, https://github.com/JoseAdrianRodriguezGonzalez/quplots#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/JoseAdrianRodriguezGonzalez/quplots/issues
|
|
7
|
+
Project-URL: Source, https://github.com/JoseAdrianRodriguezGonzalez/quplots
|
|
8
|
+
Author-email: Adrian <kerpador@gmail.com>, Isabel <isabelrocha31415@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Keywords: interactive,physics,plots,quantum,visualization
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: matplotlib>=3.6.0
|
|
26
|
+
Requires-Dist: numpy>=1.23.0
|
|
27
|
+
Requires-Dist: plotly>=5.0.0
|
|
28
|
+
Requires-Dist: scipy>=1.9.0
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# QuPlots
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/quplots)
|
|
34
|
+
[](https://pypi.org/project/quplots)
|
|
35
|
+
|
|
36
|
+
-----
|
|
37
|
+
|
|
38
|
+
## Table of Contents
|
|
39
|
+
|
|
40
|
+
- [Installation](#installation)
|
|
41
|
+
- [License](#license)
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```console
|
|
46
|
+
pip install quplots
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
`quplots` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
quplots-0.0.1/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# QuPlots
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/quplots)
|
|
4
|
+
[](https://pypi.org/project/quplots)
|
|
5
|
+
|
|
6
|
+
-----
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
pip install quplots
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
`quplots` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
quplots-0.0.1/cosas.zip
ADDED
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quplots"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = 'Allows you to visualize and interact with plots that describes quantum phenoms'
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["quantum", "plots", "visualization", "interactive", "physics"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Adrian", email = "kerpador@gmail.com" },
|
|
15
|
+
{name="Isabel",email="isabelrocha31415@gmail.com"}
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
26
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
27
|
+
"Intended Audience :: Science/Research",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
30
|
+
]
|
|
31
|
+
dependencies = ['numpy>=1.23.0','matplotlib>=3.6.0','plotly>=5.0.0','scipy>=1.9.0']
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Documentation = "https://github.com/JoseAdrianRodriguezGonzalez/quplots#readme"
|
|
35
|
+
Issues = "https://github.com/JoseAdrianRodriguezGonzalez/quplots/issues"
|
|
36
|
+
Source = "https://github.com/JoseAdrianRodriguezGonzalez/quplots"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
[tool.hatch.version]
|
|
40
|
+
path = "src/quplots/__about__.py"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.envs.types]
|
|
43
|
+
extra-dependencies = [
|
|
44
|
+
"mypy>=1.0.0",
|
|
45
|
+
]
|
|
46
|
+
[tool.hatch.envs.types.scripts]
|
|
47
|
+
check = "mypy --install-types --non-interactive {args:src/quplots tests}"
|
|
48
|
+
|
|
49
|
+
[tool.coverage.run]
|
|
50
|
+
source_pkgs = ["quplots", "tests"]
|
|
51
|
+
branch = true
|
|
52
|
+
parallel = true
|
|
53
|
+
omit = [
|
|
54
|
+
"src/quplots/__about__.py",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.coverage.paths]
|
|
58
|
+
quplots = ["src/quplots", "*/quplots/src/quplots"]
|
|
59
|
+
tests = ["tests", "*/quplots/tests"]
|
|
60
|
+
|
|
61
|
+
[tool.coverage.report]
|
|
62
|
+
exclude_lines = [
|
|
63
|
+
"no cov",
|
|
64
|
+
"if __name__ == .__main__.:",
|
|
65
|
+
"if TYPE_CHECKING:",
|
|
66
|
+
]
|
quplots-0.0.1/pytest.ini
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
def Cartesian_definition():
|
|
3
|
+
xyz = np.linspace(-10, 10, 51)
|
|
4
|
+
x,y,z = np.meshgrid(xyz, xyz, xyz, sparse=False)
|
|
5
|
+
return x,y,z
|
|
6
|
+
def CartesianToSpherical(x,y,z):
|
|
7
|
+
r = np.sqrt(x**2 + y**2 + z**2)
|
|
8
|
+
phi = np.arctan2(y+1e-10, x)
|
|
9
|
+
theta = np.where( np.isclose(r, 0.0), np.zeros_like(r), np.arccos(z/r) )
|
|
10
|
+
return r,phi,theta
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from .coordinates import Cartesian_definition, CartesianToSpherical
|
|
3
|
+
from .radial import radial
|
|
4
|
+
from .sphericalHarmonics import RealSpherical, ImaginarySpherical
|
|
5
|
+
from .waveFunction import normalized_wf, normalized_wf3D, normalized_wf3D_complex
|
|
6
|
+
class electron:
|
|
7
|
+
def __init__(self,n,l,m,radius):
|
|
8
|
+
if n <= 0 or l < 0 or l >= n:
|
|
9
|
+
raise ValueError(f"Valores inválidos para n y l: n={n}, l={l}")
|
|
10
|
+
if abs(m) > l:
|
|
11
|
+
raise ValueError(f"m debe estar entre -l y l: l={l}, m={m}")
|
|
12
|
+
self.n=n
|
|
13
|
+
self.l=l
|
|
14
|
+
self.m=m
|
|
15
|
+
self.radius=radius
|
|
16
|
+
def get_cartesian_grid(self):
|
|
17
|
+
return Cartesian_definition()
|
|
18
|
+
|
|
19
|
+
def get_spherical_grid(self, x, y, z):
|
|
20
|
+
return CartesianToSpherical(x, y, z)
|
|
21
|
+
|
|
22
|
+
def compute_radial(self):
|
|
23
|
+
return radial(self.radius, self.n, self.l)
|
|
24
|
+
|
|
25
|
+
def compute_real_spherical(self):
|
|
26
|
+
return RealSpherical(self.l, self.m)
|
|
27
|
+
|
|
28
|
+
def compute_imaginary_spherical(self):
|
|
29
|
+
return ImaginarySpherical(self.l, self.m)
|
|
30
|
+
|
|
31
|
+
def compute_wavefunction_2D(self, d=2000):
|
|
32
|
+
return normalized_wf(d, self.n, self.l, self.m)
|
|
33
|
+
|
|
34
|
+
def compute_wavefunction_3D(self):
|
|
35
|
+
return normalized_wf3D(self.n, self.l, self.m)
|
|
36
|
+
|
|
37
|
+
def compute_wavefunction_3D_complex(self):
|
|
38
|
+
return normalized_wf3D_complex(self.n, self.l, self.m)
|
|
39
|
+
def getN(self):
|
|
40
|
+
return self.n
|
|
41
|
+
def getL(self):
|
|
42
|
+
return self.l
|
|
43
|
+
def getM(self):
|
|
44
|
+
return self.m
|
|
45
|
+
def getRadius(self):
|
|
46
|
+
return self.radius
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.special import genlaguerre,factorial
|
|
3
|
+
def radial(r,n,l):
|
|
4
|
+
if n <= 0 or l < 0 or l >= n:
|
|
5
|
+
raise ValueError("Values of n and l must be postive or being at the form of n > 0, l >= 0 y l < n",n,l)
|
|
6
|
+
a0_radius = 1
|
|
7
|
+
prefactor = np.sqrt( ((2 / n * a0_radius) ** 3 * (factorial(n - l - 1))) / (2 * n * (factorial(n + l))) )
|
|
8
|
+
laguerre = genlaguerre(n - l - 1, 2 * l + 1)
|
|
9
|
+
p = 2 * r / (n * a0_radius)
|
|
10
|
+
return prefactor * np.exp(-p / 2) * (p ** l) * laguerre(p)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.special import sph_harm
|
|
3
|
+
def RealSpherical(l,m):
|
|
4
|
+
#Creade grid of phi and theta angles for ploting surface mesh
|
|
5
|
+
phi, theta = np.linspace(0, np.pi, 100), np.linspace(0, 2*np.pi, 100)
|
|
6
|
+
phi, theta = np.meshgrid(phi, theta)
|
|
7
|
+
|
|
8
|
+
#Calcualte spherical harmonic with given m and l
|
|
9
|
+
Y = sph_harm(abs(m), l, theta, phi)
|
|
10
|
+
if m<0:
|
|
11
|
+
Y=np.sqrt(2)*(-1)**m*Y.imag
|
|
12
|
+
elif m>0:
|
|
13
|
+
Y=np.sqrt(2)*(-1)**m*Y.real
|
|
14
|
+
R=abs(Y)
|
|
15
|
+
# Let's normalize color scale
|
|
16
|
+
fcolors = Y.real
|
|
17
|
+
fmax, fmin = fcolors.max(), fcolors.min()
|
|
18
|
+
fcolors = (fcolors - fmin)/(fmax - fmin)
|
|
19
|
+
if m>l:
|
|
20
|
+
raise ValueError("l and m must be postive, it means, that l can't be smaller than m")
|
|
21
|
+
return R,phi,theta,fcolors,l,m
|
|
22
|
+
def ImaginarySpherical(l,m):
|
|
23
|
+
#Creade grid of phi and theta angles for ploting surface mesh
|
|
24
|
+
phi, theta = np.linspace(0, np.pi, 100), np.linspace(0, 2*np.pi, 100)
|
|
25
|
+
phi, theta = np.meshgrid(phi, theta)
|
|
26
|
+
|
|
27
|
+
#Calcualte spherical harmonic with given m and l
|
|
28
|
+
Ylm = sph_harm(m, l, theta, phi)
|
|
29
|
+
R=abs(Ylm)
|
|
30
|
+
|
|
31
|
+
# Let's normalize color scale
|
|
32
|
+
fcolors = Ylm.imag
|
|
33
|
+
fmax, fmin = fcolors.max(), fcolors.min()
|
|
34
|
+
fcolors = (fcolors - fmin)/(fmax - fmin)
|
|
35
|
+
if m>l:
|
|
36
|
+
raise ValueError("l and m must be postive, it means, that l can't be smaller than m")
|
|
37
|
+
return R,phi,theta,fcolors,l,m
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.special import sph_harm
|
|
3
|
+
from .radial import radial
|
|
4
|
+
from .coordinates import *
|
|
5
|
+
def normalized_wf(d,n,l,m):
|
|
6
|
+
r = np.linspace(0, d, 10000)
|
|
7
|
+
pr = radial(r, n, l)**2 * r**2 * (r[1]-r[0])
|
|
8
|
+
max_r = r[ np.where(np.cumsum(pr) >0.95)[0][0] ]
|
|
9
|
+
# Set coordinates grid to assign a certain probability to each point (x, y) in the plane
|
|
10
|
+
x = y = np.linspace(-max_r, max_r, 501)
|
|
11
|
+
x, y = np.meshgrid(x, y)
|
|
12
|
+
r = np.sqrt((x ** 2 + y ** 2))
|
|
13
|
+
# Ψnlm(r,θ,φ) = Rnl(r).Ylm(θ,φ)
|
|
14
|
+
psi = radial(r, n, l) * sph_harm(m, l, 0, np.arctan(x / (y + 1e-7)))
|
|
15
|
+
psi_sq = np.abs(psi)**2
|
|
16
|
+
return psi_sq,max_r,n,l,m
|
|
17
|
+
def normalized_wf3D(n,l,m):
|
|
18
|
+
x,y,z = Cartesian_definition()
|
|
19
|
+
r,phi,theta = CartesianToSpherical(x,y,z)
|
|
20
|
+
psi = radial(r, n, l) * np.real(sph_harm(m, l, phi, theta))
|
|
21
|
+
return psi
|
|
22
|
+
def normalized_wf3D_complex(n,l,m):
|
|
23
|
+
x,y,z = Cartesian_definition()
|
|
24
|
+
r,phi,theta = CartesianToSpherical(x,y,z)
|
|
25
|
+
psi = radial(r, n, l) * sph_harm(m, l, phi, theta)*np.real(sph_harm(m, l, phi, theta))
|
|
26
|
+
return psi
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from .sp import sp
|
|
2
|
+
from .sp2 import sp2
|
|
3
|
+
from .sp3 import sp3
|
|
4
|
+
from .sp2d import sp2d
|
|
5
|
+
from .sp3d import sp3d
|
|
6
|
+
from .sp3d2 import sp3d2
|
|
7
|
+
from .sp3d import sp3d
|
|
8
|
+
|
|
9
|
+
class hybridization:
|
|
10
|
+
def __init__(self):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
def generate_sp(self):
|
|
14
|
+
return sp()
|
|
15
|
+
|
|
16
|
+
def generate_sp2(self):
|
|
17
|
+
return sp2()
|
|
18
|
+
|
|
19
|
+
def generate_sp3(self):
|
|
20
|
+
return sp3()
|
|
21
|
+
|
|
22
|
+
def generate_sp2d(self):
|
|
23
|
+
return sp2d()
|
|
24
|
+
|
|
25
|
+
def generate_sp3d(self):
|
|
26
|
+
return sp3d()
|
|
27
|
+
|
|
28
|
+
def generate_sp3d2(self):
|
|
29
|
+
return sp3d2()
|
|
30
|
+
|
|
31
|
+
def generate_sp3d(self):
|
|
32
|
+
return sp3d()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from ..electron.waveFunction import normalized_wf3D
|
|
2
|
+
import numpy as np
|
|
3
|
+
def sp2():
|
|
4
|
+
Spsi = normalized_wf3D(2,0,0)
|
|
5
|
+
Pxpsi= normalized_wf3D(2,1,1)
|
|
6
|
+
Pzpsi= normalized_wf3D(2,1,0)
|
|
7
|
+
Pypsi= normalized_wf3D(2,1,-1)
|
|
8
|
+
PSI2_1=1/np.sqrt(3)*(Spsi+np.sqrt(2)*Pzpsi)
|
|
9
|
+
PSI2_2=1/np.sqrt(3)*(Spsi-np.sqrt(1/2)*Pxpsi-np.sqrt(3/2)*Pzpsi)
|
|
10
|
+
PSI2_3=1/np.sqrt(3)*(Spsi-np.sqrt(1/2)*Pxpsi+np.sqrt(3/2)*Pypsi)
|
|
11
|
+
return PSI2_1,PSI2_2,PSI2_3
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ..electron.waveFunction import *
|
|
3
|
+
def sp2d():
|
|
4
|
+
Spsi = normalized_wf3D(3,0,0)
|
|
5
|
+
Pxpsi= normalized_wf3D(3,1,1)
|
|
6
|
+
Pypsi = normalized_wf3D(3,1,-1)
|
|
7
|
+
Dx2y2psi = normalized_wf3D(3,2,2)
|
|
8
|
+
PSI2D_1=1/2*Spsi+1/np.sqrt(2)*Pxpsi+1/2*Dx2y2psi
|
|
9
|
+
PSI2D_2=1/2*Spsi-1/np.sqrt(2)*Pxpsi+1/2*Dx2y2psi
|
|
10
|
+
PSI2D_3=1/2*Spsi+1/np.sqrt(2)*Pypsi-1/2*Dx2y2psi
|
|
11
|
+
PSI2D_4=1/2*Spsi-1/np.sqrt(2)*Pypsi-1/2*Dx2y2psi
|
|
12
|
+
return PSI2D_1,PSI2D_2,PSI2D_3,PSI2D_4
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ..electron.waveFunction import *
|
|
3
|
+
def sp3():
|
|
4
|
+
Pxpsi= normalized_wf3D_complex(2,1,1)
|
|
5
|
+
Spsi = normalized_wf3D_complex(2,0,0)
|
|
6
|
+
Pypsi = normalized_wf3D_complex(2,1,-1)
|
|
7
|
+
Pzpsi = normalized_wf3D_complex(2,1,0)
|
|
8
|
+
PSI3_1=1/2*(Spsi+Pxpsi+Pypsi+Pzpsi)
|
|
9
|
+
PSI3_2=1/2*(Spsi+Pxpsi-Pypsi-Pzpsi)
|
|
10
|
+
PSI3_3=1/2*(Spsi-Pxpsi-Pypsi+Pzpsi)
|
|
11
|
+
PSI3_4=1/2*(Spsi-Pxpsi+Pypsi-Pzpsi)
|
|
12
|
+
return PSI3_1,PSI3_2,PSI3_3,PSI3_4
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ..electron.waveFunction import *
|
|
3
|
+
def sp3d():
|
|
4
|
+
Spsi = normalized_wf3D(3,0,0)
|
|
5
|
+
Pxpsi= normalized_wf3D(3,1,1)
|
|
6
|
+
Pypsi = normalized_wf3D(3,1,-1)
|
|
7
|
+
Pzpsi = normalized_wf3D(3,1,0)
|
|
8
|
+
Dz2psi = normalized_wf3D(3,2,0)
|
|
9
|
+
PSIP3D_1=np.sqrt(1/3)*(Spsi+np.sqrt(2)*Pzpsi)
|
|
10
|
+
PSIP3D_2=1/np.sqrt(3)*(Spsi-np.sqrt(1/2)*Pxpsi+np.sqrt(3/2)*Pypsi)
|
|
11
|
+
PSIP3D_3=1/np.sqrt(3)*(Spsi-np.sqrt(1/2)*Pxpsi-np.sqrt(3/2)*Pzpsi)
|
|
12
|
+
PSIP3D_4=1/np.sqrt(2)*(Dz2psi+Pzpsi)
|
|
13
|
+
PSIP3D_5=1/np.sqrt(2)*(-Dz2psi+Pzpsi)
|
|
14
|
+
return PSIP3D_1,PSIP3D_2,PSIP3D_3,PSIP3D_4,PSIP3D_5
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ..electron.waveFunction import *
|
|
3
|
+
def sp3d2():
|
|
4
|
+
Spsi = normalized_wf3D(3,0,0)
|
|
5
|
+
Pxpsi= normalized_wf3D(3,1,1)
|
|
6
|
+
Pypsi = normalized_wf3D(3,1,-1)
|
|
7
|
+
Pzpsi = normalized_wf3D(3,1,0)
|
|
8
|
+
Dz2psi = normalized_wf3D(3,2,0)
|
|
9
|
+
Dx2y2psi = normalized_wf3D(3,2,2)
|
|
10
|
+
PSIP3D2_1=np.sqrt(1/6)*(Spsi+np.sqrt(3)*Pzpsi+np.sqrt(2)*Dz2psi)
|
|
11
|
+
PSIP3D2_2=np.sqrt(1/6)*(Spsi+np.sqrt(3)*Pzpsi-np.sqrt(1/2)*Dz2psi+np.sqrt(3/2)*Dx2y2psi)
|
|
12
|
+
PSIP3D2_3=np.sqrt(1/6)*(Spsi+np.sqrt(3)*Pzpsi-np.sqrt(1/2)*Dz2psi-np.sqrt(3/2)*Dx2y2psi)
|
|
13
|
+
PSIP3D2_4=np.sqrt(1/6)*(Spsi+np.sqrt(3)*Pzpsi-np.sqrt(1/2)*Dz2psi+np.sqrt(3/2)*Dx2y2psi)
|
|
14
|
+
PSIP3D2_5=np.sqrt(1/6)*(Spsi+np.sqrt(3)*Pzpsi-np.sqrt(1/2)*Dz2psi-np.sqrt(3/2)*Dx2y2psi)
|
|
15
|
+
PSIP3D2_6=np.sqrt(1/6)*(Spsi-np.sqrt(3)*Pzpsi+np.sqrt(2)*Dz2psi)
|
|
16
|
+
return PSIP3D2_1,PSIP3D2_2,PSIP3D2_3,PSIP3D2_4,PSIP3D2_5,PSIP3D2_6
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import plotly.graph_objects as go
|
|
4
|
+
from ..electron.electron import electron
|
|
5
|
+
from scipy.special import sph_harm, genlaguerre, factorial
|
|
6
|
+
from ..electron.radial import radial
|
|
7
|
+
from ..electron.coordinates import *
|
|
8
|
+
from ..hibrydization.sp import sp
|
|
9
|
+
from ..hibrydization.sp2 import sp2
|
|
10
|
+
from ..hibrydization.sp3 import sp3
|
|
11
|
+
from ..hibrydization.sp2d import sp2d
|
|
12
|
+
from ..hibrydization.sp3d import sp3d
|
|
13
|
+
from ..hibrydization.sp3d2 import sp3d2
|
|
14
|
+
from ..hibrydization.sp3d import sp3d
|
|
15
|
+
class plots:
|
|
16
|
+
def __init__(self, *args):
|
|
17
|
+
super(plots, self).__init__(*args)
|
|
18
|
+
def plot_radial_(self,elect=None,d=None,n=None,l=None,**plot_kwargs):
|
|
19
|
+
if elect is not None and isinstance(elect,electron):
|
|
20
|
+
d=elect.getRadius()
|
|
21
|
+
r=np.linspace(0,d,1000)
|
|
22
|
+
R_function=radial(r,elect.getN(),elect.getL())
|
|
23
|
+
else:
|
|
24
|
+
r = np.linspace(0, d, 1000)
|
|
25
|
+
R_function = radial(r, n, l)
|
|
26
|
+
plt.plot(r, r**2 * R_function**2,**plot_kwargs)
|
|
27
|
+
plt.title(f'$R_{{n, l}}(r)$ distancia = {d}')
|
|
28
|
+
plt.xlabel(r'$r [a_0]$')
|
|
29
|
+
plt.ylabel(r'$R_nl(r) r^2$')
|
|
30
|
+
plt.show()
|
|
31
|
+
def plot_spherical_real(self,elect=None,R=None,theta=None,phi=None,fcolors=None,l=None,m=None,**plots_kwargs):
|
|
32
|
+
if elect is not None and isinstance(elect,electron):
|
|
33
|
+
package=elect.compute_real_spherical()
|
|
34
|
+
x=package[0]*np.sin(package[1]) * np.cos(package[2])
|
|
35
|
+
y=package[0]*np.sin(package[1]) * np.sin(package[2])
|
|
36
|
+
z=package[0]*np.cos(package[1])
|
|
37
|
+
surfacecolor=package[3]
|
|
38
|
+
l_val,m_val=package[4],package[5]
|
|
39
|
+
else:
|
|
40
|
+
x=R*np.sin(theta) * np.cos(phi)
|
|
41
|
+
y=R*np.sin(theta) * np.sin(phi)
|
|
42
|
+
z=R*np.cos(theta)
|
|
43
|
+
surfacecolor=fcolors
|
|
44
|
+
l_val,m_val=l,m
|
|
45
|
+
surface_args = {
|
|
46
|
+
"x": x,
|
|
47
|
+
"y": y,
|
|
48
|
+
"z": z,
|
|
49
|
+
"surfacecolor": surfacecolor,
|
|
50
|
+
"colorscale": plots_kwargs.pop("colorscale", "balance"),
|
|
51
|
+
"showscale": plots_kwargs.pop("showscale", False)
|
|
52
|
+
}
|
|
53
|
+
fig=go.Figure(data=[go.Surface(**surface_args)])
|
|
54
|
+
layout_args = {
|
|
55
|
+
"title": plots_kwargs.pop("title", f"<b>Y<sub>{l_val},{m_val}</sub></b>"),
|
|
56
|
+
"autosize": plots_kwargs.pop("autosize", False),
|
|
57
|
+
"width": plots_kwargs.pop("width", 700),
|
|
58
|
+
"height": plots_kwargs.pop("height", 700),
|
|
59
|
+
"margin": plots_kwargs.pop("margin", dict(l=65, r=50, b=65, t=90)),
|
|
60
|
+
"paper_bgcolor": plots_kwargs.pop("paper_bgcolor", "black"),
|
|
61
|
+
"scene": plots_kwargs.pop("scene", dict(
|
|
62
|
+
xaxis=dict(visible=False),
|
|
63
|
+
yaxis=dict(visible=False),
|
|
64
|
+
zaxis=dict(visible=False))),
|
|
65
|
+
"font": plots_kwargs.pop("font", dict(color="white"))
|
|
66
|
+
}
|
|
67
|
+
fig.update_layout(**layout_args,**plots_kwargs)
|
|
68
|
+
fig.show()
|
|
69
|
+
def plot_spherical_imaginary(self,elect=None,R=None,theta=None,phi=None,fcolors=None,l=None,m=None,**plots_kwargs):
|
|
70
|
+
if elect is not None and isinstance(elect,electron):
|
|
71
|
+
package=elect.compute_imaginary_spherical()
|
|
72
|
+
x=package[0]*np.sin(package[1]) * np.cos(package[2])
|
|
73
|
+
y=package[0]*np.sin(package[1]) * np.sin(package[2])
|
|
74
|
+
z=package[0]*np.cos(package[1])
|
|
75
|
+
surfacecolor=package[3]
|
|
76
|
+
l_val,m_val=package[4],package[5]
|
|
77
|
+
else:
|
|
78
|
+
x=R*np.sin(phi) * np.cos(theta)
|
|
79
|
+
y=R*np.sin(phi) * np.sin(theta)
|
|
80
|
+
z=R*np.cos(phi)
|
|
81
|
+
surfacecolor=fcolors
|
|
82
|
+
l_val,m_val=l,m
|
|
83
|
+
surface_args = {
|
|
84
|
+
"x": x,
|
|
85
|
+
"y": y,
|
|
86
|
+
"z": z,
|
|
87
|
+
"surfacecolor": surfacecolor,
|
|
88
|
+
"colorscale": plots_kwargs.pop("colorscale", "balance"),
|
|
89
|
+
"showscale": plots_kwargs.pop("showscale", False)
|
|
90
|
+
}
|
|
91
|
+
fig=go.Figure(data=[go.Surface(**surface_args)])
|
|
92
|
+
layout_args = {
|
|
93
|
+
"title": plots_kwargs.pop("title", f"<b>Y<sub>{l_val},{m_val}</sub></b>"),
|
|
94
|
+
"autosize": plots_kwargs.pop("autosize", False),
|
|
95
|
+
"width": plots_kwargs.pop("width", 700),
|
|
96
|
+
"height": plots_kwargs.pop("height", 700),
|
|
97
|
+
"margin": plots_kwargs.pop("margin", dict(l=65, r=50, b=65, t=90)),
|
|
98
|
+
"paper_bgcolor": plots_kwargs.pop("paper_bgcolor", "black"),
|
|
99
|
+
"scene": plots_kwargs.pop("scene", dict(
|
|
100
|
+
xaxis=dict(visible=False),
|
|
101
|
+
yaxis=dict(visible=False),
|
|
102
|
+
zaxis=dict(visible=False))),
|
|
103
|
+
"font": plots_kwargs.pop("font", dict(color="white"))
|
|
104
|
+
}
|
|
105
|
+
fig.update_layout(**layout_args,**plots_kwargs)
|
|
106
|
+
fig.show()
|
|
107
|
+
def plot_wf_2d(self,elect=None,psi_sq=None,max_r=None,n=None,l=None,m=None,**plot_kwargs):
|
|
108
|
+
fig, ax = plt.subplots()
|
|
109
|
+
package=elect.compute_wavefunction_2D() if(elect is not None and isinstance(elect,electron)) else (psi_sq,max_r,n,l,m)
|
|
110
|
+
levels = plot_kwargs.pop("levels", 40)
|
|
111
|
+
cmap = plot_kwargs.pop("cmap", "RdBu")
|
|
112
|
+
title_fontsize = plot_kwargs.pop("title_fontsize", 15)
|
|
113
|
+
xlabel = plot_kwargs.pop("xlabel", r"$x$")
|
|
114
|
+
ylabel = plot_kwargs.pop("ylabel", r"$y$")
|
|
115
|
+
title = plot_kwargs.pop("title", r"$|\psi_{{({0}, {1}, {2})}}|^2$".format(package[2], package[3], package[4]))
|
|
116
|
+
ax.contour(package[0], levels=levels, cmap=cmap, extent=[-package[1], package[1], -package[1], package[1]], **plot_kwargs)
|
|
117
|
+
ax.set_title(title, fontsize=title_fontsize)
|
|
118
|
+
ax.set_aspect("equal")
|
|
119
|
+
ax.set_xlabel(xlabel)
|
|
120
|
+
ax.set_ylabel(ylabel)
|
|
121
|
+
ax.set_xlim(-package[1], package[1])
|
|
122
|
+
ax.set_ylim(-package[1], package[1])
|
|
123
|
+
plt.show()
|
|
124
|
+
def plot_wf_3d(self,elect,**kwargs_plot):
|
|
125
|
+
psi= elect.compute_wavefunction_3D() if elect is not None and isinstance(elect,electron) else elect
|
|
126
|
+
x,y,z = Cartesian_definition()
|
|
127
|
+
isosurface_keys = {
|
|
128
|
+
"x", "y", "z", "value", "isomin", "isomax", "opacity", "surface_count",
|
|
129
|
+
"caps", "colorscale", "lighting", "lightposition", "reversescale",
|
|
130
|
+
"showscale", "name", "hoverinfo"
|
|
131
|
+
}
|
|
132
|
+
isosurface_kwargs = {k: v for k, v in kwargs_plot.items() if k in isosurface_keys}
|
|
133
|
+
layout_kwargs = {k: v for k, v in kwargs_plot.items() if k not in isosurface_keys}
|
|
134
|
+
|
|
135
|
+
fig = go.Figure(data=go.Isosurface(
|
|
136
|
+
x=x.flatten(),
|
|
137
|
+
y=y.flatten(),
|
|
138
|
+
z=z.flatten(),
|
|
139
|
+
value=abs(psi).flatten(),
|
|
140
|
+
isomin=isosurface_kwargs.pop('isomin', -0.75 * abs(psi).min()),
|
|
141
|
+
isomax=isosurface_kwargs.pop('isomax', 0.75 * abs(psi).max()),
|
|
142
|
+
opacity=isosurface_kwargs.pop('opacity', 0.5),
|
|
143
|
+
surface_count=isosurface_kwargs.pop('surface_count', 6),
|
|
144
|
+
caps=isosurface_kwargs.pop('caps', dict(x_show=False, y_show=False, z_show=False)),
|
|
145
|
+
colorscale=isosurface_kwargs.pop('colorscale', 'RdBu'),
|
|
146
|
+
**isosurface_kwargs
|
|
147
|
+
))
|
|
148
|
+
|
|
149
|
+
n_val,l_val,m_val=elect.getN(),elect.getL(),elect.getM()
|
|
150
|
+
fig.update_layout(
|
|
151
|
+
title = f"<b>|ψ<sub>{n_val},{l_val},{m_val}</sub>(x,y,z)|</b>",
|
|
152
|
+
paper_bgcolor="black",
|
|
153
|
+
scene=dict(
|
|
154
|
+
xaxis=dict(visible=False),
|
|
155
|
+
yaxis=dict(visible=False),
|
|
156
|
+
zaxis=dict(visible=False)
|
|
157
|
+
),
|
|
158
|
+
font=dict(color="white"),
|
|
159
|
+
**layout_kwargs
|
|
160
|
+
)
|
|
161
|
+
fig.show()
|
|
162
|
+
def plot_sp(self, **kwargs):
|
|
163
|
+
PSI1, PSI2 = sp()
|
|
164
|
+
x, y, z = Cartesian_definition()
|
|
165
|
+
isosurface_keys = {
|
|
166
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
167
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
168
|
+
"showscale", "name", "hoverinfo"
|
|
169
|
+
}
|
|
170
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
171
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
172
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
173
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
174
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
175
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
176
|
+
fig = go.Figure()
|
|
177
|
+
for psi in [PSI1, PSI2]:
|
|
178
|
+
psi_abs = abs(psi)
|
|
179
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
180
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
181
|
+
fig.add_trace(go.Isosurface(
|
|
182
|
+
x=x.flatten(),
|
|
183
|
+
y=y.flatten(),
|
|
184
|
+
z=z.flatten(),
|
|
185
|
+
value=psi_abs.flatten(),
|
|
186
|
+
isomin=isomin,
|
|
187
|
+
isomax=isomax,
|
|
188
|
+
surface_count=surface_count,
|
|
189
|
+
opacity=opacity,
|
|
190
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
191
|
+
**isosurface_kwargs
|
|
192
|
+
))
|
|
193
|
+
|
|
194
|
+
fig.update_layout(
|
|
195
|
+
title=layout_kwargs.get("title", "<b>sp: Lineal</b>"),
|
|
196
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
197
|
+
scene=layout_kwargs.get('scene', dict(
|
|
198
|
+
xaxis=dict(visible=False),
|
|
199
|
+
yaxis=dict(visible=False),
|
|
200
|
+
zaxis=dict(visible=False)
|
|
201
|
+
)),
|
|
202
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
203
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
fig.show()
|
|
207
|
+
def plot_sp2(self, **kwargs):
|
|
208
|
+
PSI2_1, PSI2_2, PSI2_3 = sp2()
|
|
209
|
+
x, y, z = Cartesian_definition()
|
|
210
|
+
isosurface_keys = {
|
|
211
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
212
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
213
|
+
"showscale", "name", "hoverinfo"
|
|
214
|
+
}
|
|
215
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
216
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
217
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
218
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
219
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
220
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
221
|
+
fig = go.Figure()
|
|
222
|
+
for psi in [PSI2_1, PSI2_2, PSI2_3]:
|
|
223
|
+
psi_abs = abs(psi)
|
|
224
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
225
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
226
|
+
fig.add_trace(go.Isosurface(
|
|
227
|
+
x=x.flatten(),
|
|
228
|
+
y=y.flatten(),
|
|
229
|
+
z=z.flatten(),
|
|
230
|
+
value=psi_abs.flatten(),
|
|
231
|
+
isomin=isomin,
|
|
232
|
+
isomax=isomax,
|
|
233
|
+
surface_count=surface_count,
|
|
234
|
+
opacity=opacity,
|
|
235
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
236
|
+
**isosurface_kwargs
|
|
237
|
+
))
|
|
238
|
+
fig.update_layout(
|
|
239
|
+
title=layout_kwargs.get("title", "<b>sp<sup>2</sup>: Trigonal Planar</b>"),
|
|
240
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
241
|
+
scene=layout_kwargs.get('scene', dict(
|
|
242
|
+
xaxis=dict(visible=False),
|
|
243
|
+
yaxis=dict(visible=False),
|
|
244
|
+
zaxis=dict(visible=False)
|
|
245
|
+
)),
|
|
246
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
247
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
248
|
+
)
|
|
249
|
+
fig.show()
|
|
250
|
+
def plot_sp3(self, **kwargs):
|
|
251
|
+
PSI3_1, PSI3_2, PSI3_3, PSI3_4 = sp3()
|
|
252
|
+
x, y, z = Cartesian_definition()
|
|
253
|
+
isosurface_keys = {
|
|
254
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
255
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
256
|
+
"showscale", "name", "hoverinfo"
|
|
257
|
+
}
|
|
258
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
259
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
260
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
261
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
262
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
263
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
264
|
+
fig = go.Figure()
|
|
265
|
+
for psi in [PSI3_1, PSI3_2, PSI3_3, PSI3_4]:
|
|
266
|
+
psi_abs = abs(psi)
|
|
267
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
268
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
269
|
+
fig.add_trace(go.Isosurface(
|
|
270
|
+
x=x.flatten(),
|
|
271
|
+
y=y.flatten(),
|
|
272
|
+
z=z.flatten(),
|
|
273
|
+
value=psi_abs.flatten(),
|
|
274
|
+
isomin=isomin,
|
|
275
|
+
isomax=isomax,
|
|
276
|
+
surface_count=surface_count,
|
|
277
|
+
opacity=opacity,
|
|
278
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
279
|
+
**isosurface_kwargs
|
|
280
|
+
))
|
|
281
|
+
fig.update_layout(
|
|
282
|
+
title=layout_kwargs.get("title", "<b>sp<sup>3</sup>: Tetrahedral</b>"),
|
|
283
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
284
|
+
scene=layout_kwargs.get('scene', dict(
|
|
285
|
+
xaxis=dict(visible=False),
|
|
286
|
+
yaxis=dict(visible=False),
|
|
287
|
+
zaxis=dict(visible=False)
|
|
288
|
+
)),
|
|
289
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
290
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
291
|
+
)
|
|
292
|
+
fig.show()
|
|
293
|
+
def plot_sp2d(self, **kwargs):
|
|
294
|
+
PSI2D_1, PSI2D_2, PSI2D_3, PSI2D_4 = sp2d()
|
|
295
|
+
x, y, z = Cartesian_definition()
|
|
296
|
+
isosurface_keys = {
|
|
297
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
298
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
299
|
+
"showscale", "name", "hoverinfo"
|
|
300
|
+
}
|
|
301
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
302
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
303
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
304
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
305
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
306
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
307
|
+
fig = go.Figure()
|
|
308
|
+
for psi in [PSI2D_1, PSI2D_2, PSI2D_3, PSI2D_4]:
|
|
309
|
+
psi_abs = abs(psi)
|
|
310
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
311
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
312
|
+
fig.add_trace(go.Isosurface(
|
|
313
|
+
x=x.flatten(),
|
|
314
|
+
y=y.flatten(),
|
|
315
|
+
z=z.flatten(),
|
|
316
|
+
value=psi_abs.flatten(),
|
|
317
|
+
isomin=isomin,
|
|
318
|
+
isomax=isomax,
|
|
319
|
+
surface_count=surface_count,
|
|
320
|
+
opacity=opacity,
|
|
321
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
322
|
+
**isosurface_kwargs
|
|
323
|
+
))
|
|
324
|
+
fig.update_layout(
|
|
325
|
+
title=layout_kwargs.get("title", "<b>sp<sup>2</sup>d: Square Planar</b>"),
|
|
326
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
327
|
+
scene=layout_kwargs.get('scene', dict(
|
|
328
|
+
xaxis=dict(visible=False),
|
|
329
|
+
yaxis=dict(visible=False),
|
|
330
|
+
zaxis=dict(visible=False)
|
|
331
|
+
)),
|
|
332
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
333
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
334
|
+
)
|
|
335
|
+
fig.show()
|
|
336
|
+
def plot_sp3d(self, **kwargs):
|
|
337
|
+
PSIP3D_1, PSIP3D_2, PSIP3D_3, PSIP3D_4, PSIP3D_5 = sp3d()
|
|
338
|
+
x, y, z = Cartesian_definition()
|
|
339
|
+
isosurface_keys = {
|
|
340
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
341
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
342
|
+
"showscale", "name", "hoverinfo"
|
|
343
|
+
}
|
|
344
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
345
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
346
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
347
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
348
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
349
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
350
|
+
fig = go.Figure()
|
|
351
|
+
for psi in [PSIP3D_1, PSIP3D_2, PSIP3D_3, PSIP3D_4, PSIP3D_5]:
|
|
352
|
+
psi_abs = abs(psi)
|
|
353
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
354
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
355
|
+
fig.add_trace(go.Isosurface(
|
|
356
|
+
x=x.flatten(),
|
|
357
|
+
y=y.flatten(),
|
|
358
|
+
z=z.flatten(),
|
|
359
|
+
value=psi_abs.flatten(),
|
|
360
|
+
isomin=isomin,
|
|
361
|
+
isomax=isomax,
|
|
362
|
+
surface_count=surface_count,
|
|
363
|
+
opacity=opacity,
|
|
364
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
365
|
+
**isosurface_kwargs
|
|
366
|
+
))
|
|
367
|
+
fig.update_layout(
|
|
368
|
+
title=layout_kwargs.get("title", "<b>sp<sup>3</sup>d: Trigonal Bipyramidal</b>"),
|
|
369
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
370
|
+
scene=layout_kwargs.get('scene', dict(
|
|
371
|
+
xaxis=dict(visible=False),
|
|
372
|
+
yaxis=dict(visible=False),
|
|
373
|
+
zaxis=dict(visible=False)
|
|
374
|
+
)),
|
|
375
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
376
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
377
|
+
)
|
|
378
|
+
fig.show()
|
|
379
|
+
def plot_sp3d2(self, **kwargs):
|
|
380
|
+
PSIP3D2_1, PSIP3D2_2, PSIP3D2_3, PSIP3D2_4, PSIP3D2_5, PSIP3D2_6 = sp3d2()
|
|
381
|
+
x, y, z = Cartesian_definition()
|
|
382
|
+
isosurface_keys = {
|
|
383
|
+
"colorscale", "isomin", "isomax", "opacity", "surface_count",
|
|
384
|
+
"caps", "lighting", "lightposition", "reversescale",
|
|
385
|
+
"showscale", "name", "hoverinfo"
|
|
386
|
+
}
|
|
387
|
+
isosurface_kwargs = {k: v for k, v in kwargs.items() if k in isosurface_keys}
|
|
388
|
+
layout_kwargs = {k: v for k, v in kwargs.items() if k not in isosurface_keys}
|
|
389
|
+
opacity = isosurface_kwargs.pop("opacity", 0.5)
|
|
390
|
+
surface_count = isosurface_kwargs.pop("surface_count", 6)
|
|
391
|
+
isomin_user = isosurface_kwargs.pop("isomin", None)
|
|
392
|
+
isomax_user = isosurface_kwargs.pop("isomax", None)
|
|
393
|
+
fig = go.Figure()
|
|
394
|
+
for psi in [PSIP3D2_1, PSIP3D2_2, PSIP3D2_3, PSIP3D2_4, PSIP3D2_5, PSIP3D2_6]:
|
|
395
|
+
psi_abs = abs(psi)
|
|
396
|
+
isomin = isomin_user if isomin_user is not None else -0.75 * psi_abs.min()
|
|
397
|
+
isomax = isomax_user if isomax_user is not None else 0.75 * psi_abs.max()
|
|
398
|
+
fig.add_trace(go.Isosurface(
|
|
399
|
+
x=x.flatten(),
|
|
400
|
+
y=y.flatten(),
|
|
401
|
+
z=z.flatten(),
|
|
402
|
+
value=psi_abs.flatten(),
|
|
403
|
+
isomin=isomin,
|
|
404
|
+
isomax=isomax,
|
|
405
|
+
surface_count=surface_count,
|
|
406
|
+
opacity=opacity,
|
|
407
|
+
caps=dict(x_show=False, y_show=False, z_show=False),
|
|
408
|
+
**isosurface_kwargs
|
|
409
|
+
))
|
|
410
|
+
fig.update_layout(
|
|
411
|
+
title=layout_kwargs.get("title", "<b>sp<sup>3</sup>d<sup>2</sup>: Octahedral</b>"),
|
|
412
|
+
paper_bgcolor=layout_kwargs.get('paper_bgcolor', "black"),
|
|
413
|
+
scene=layout_kwargs.get('scene', dict(
|
|
414
|
+
xaxis=dict(visible=False),
|
|
415
|
+
yaxis=dict(visible=False),
|
|
416
|
+
zaxis=dict(visible=False)
|
|
417
|
+
)),
|
|
418
|
+
font=layout_kwargs.get('font', dict(color="white")),
|
|
419
|
+
**{k: v for k, v in layout_kwargs.items() if k not in ['title', 'paper_bgcolor', 'scene', 'font']}
|
|
420
|
+
)
|
|
421
|
+
fig.show()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from quplots import plots
|
|
2
|
+
p = plots()
|
|
3
|
+
p.plot_sp(
|
|
4
|
+
colorscale='Viridis',
|
|
5
|
+
reversescale=True,
|
|
6
|
+
opacity=0.6,
|
|
7
|
+
surface_count=5,
|
|
8
|
+
lighting=dict(ambient=0.4, diffuse=0.9, specular=0.5, roughness=0.9, fresnel=0.1),
|
|
9
|
+
lightposition=dict(x=100, y=200, z=0),
|
|
10
|
+
showscale=False,
|
|
11
|
+
name="Orbital"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
p.plot_sp2(colorscale='Plasma',
|
|
15
|
+
reversescale=False,
|
|
16
|
+
opacity=0.7,
|
|
17
|
+
surface_count=5)
|
|
18
|
+
|
|
19
|
+
p.plot_sp3(colorscale='Cividis',
|
|
20
|
+
reversescale=False,
|
|
21
|
+
opacity=0.7,
|
|
22
|
+
surface_count=5)
|
|
23
|
+
|
|
24
|
+
p.plot_sp2d(colorscale='Inferno',
|
|
25
|
+
reversescale=False,
|
|
26
|
+
opacity=0.7,
|
|
27
|
+
surface_count=5)
|
|
28
|
+
|
|
29
|
+
p.plot_sp3d(colorscale='Magma',
|
|
30
|
+
reversescale=False,
|
|
31
|
+
opacity=0.7,
|
|
32
|
+
surface_count=5)
|
|
33
|
+
|
|
34
|
+
p.plot_sp3d2(colorscale='Turbo',
|
|
35
|
+
reversescale=False,
|
|
36
|
+
opacity=0.7,
|
|
37
|
+
surface_count=5)
|