Skip to content

Commit

Permalink
removing py3dmol
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRalli committed Oct 8, 2024
1 parent dc8cf6f commit 6eef95a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 49 deletions.
16 changes: 1 addition & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ray = "2.10"
sphinx-design = "^0.5.0"
myst-nb = "^0.17.2"
sphinx-copybutton = "^0.5.2"
py3dmol = "^2.0.4"
scipy = "1.9.3"
urllib3 = "1.26.6"

Expand Down
33 changes: 0 additions & 33 deletions symmer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import scipy as sp
from typing import List, Tuple, Union
from functools import reduce
import py3Dmol
from scipy.sparse import csr_matrix
from scipy.sparse import kron as sparse_kron
from symmer.operators.utils import _rref_binary
Expand Down Expand Up @@ -226,38 +225,6 @@ def gram_schmidt_from_quantum_state(state:Union[np.array, list, QuantumState]) -
return M


def Draw_molecule(
xyz_string: str, width: int = 400, height: int = 400, style: str = "sphere"
) -> py3Dmol.view:
"""Draw molecule from xyz string.
Note if molecule has unrealistic bonds, then style should be sphere. Otherwise stick style can be used
which shows bonds.
TODO: more styles at http://3dmol.csb.pitt.edu/doc/$3Dmol.GLViewer.html
Args:
xyz_string (str): xyz string of molecule
width (int): width of image
height (int): Height of image
style (str): py3Dmol style ('sphere' or 'stick')
Returns:
view (py3dmol.view object). Run view.show() method to print molecule.
"""
view = py3Dmol.view(width=width, height=height)
view.addModel(xyz_string, "xyz")
if style == "sphere":
view.setStyle({'sphere': {"radius": 0.2}})
elif style == "stick":
view.setStyle({'stick': {}})
else:
raise ValueError(f"unknown py3dmol style: {style}")

view.zoomTo()
return view


def get_sparse_matrix_large_pauliwordop(P_op: PauliwordOp) -> csr_matrix:
"""
In order to build the sparse matrix (e.g. above 18 qubits), this function goes through each pauli term
Expand Down

0 comments on commit 6eef95a

Please sign in to comment.