π¨βπ»π€ΈββοΈ
Software +
Physics + UX
vhchavez / moly Goto Github PK
View Code? Open in Web Editor NEWMolecular Visualization powered by Plotly
License: BSD 3-Clause "New" or "Revised" License
Molecular Visualization powered by Plotly
License: BSD 3-Clause "New" or "Revised" License
π¨βπ»π€ΈββοΈ
Software +
Physics + UX
Adding rendered images to the repo is irreversible and can bloat the size if changed a lot. Consider adding Jupyter notebook that are auto rendered in nbsphinx for the docs.
Have we tried go.Surface?
Given n molecules of considerable different size.
Layering them by decreasing size keeps the range of the latest molecule added instead of the larger.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of moly.
(optional) I have confirmed this bug exists on the master branch of moly.
import os
import psi4
import moly
os.mkdir('test')
psi4.set_options({'CUBEPROP_FILEPATH': 'test', 'CUBEPROP_TASKS': ['density']})
psi4.cubeprop(wfn)
fig = moly.Figure()
fig.add_cubes(directory='test')
fig.show()
Error:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-2-5fc546037018> in <module>
3 # fig.add_molecule("Li", molecule)
4 # fig.add_density(wfn=wfn, densities=['Da'], iso=0.1)
----> 5 fig.add_cubes(directory='test')
6 # fig.add_density(wfn=wfn, densities='Da', iso=0.1)
7 fig.show()
~/.local/lib/python3.6/site-packages/moly/figure/figure.py in add_cubes(self, directory, iso, style, colorscale, opacity)
131 def add_cubes(self, directory=".", iso=0.03, style="ball_and_stick", colorscale="Portland_r", opacity=0.3):
132 cubes, details = get_cubes(directory)
--> 133 geometry, symbols, atomic_numbers, spacing, origin = cube_to_molecule(details[0]["name"]+".cube")
134 bonds = qcel.molutil.guess_connectivity(symbols, geometry)
135 add_bonds(geometry, symbols, bonds, self.fig, style, self.surface)
~/.local/lib/python3.6/site-packages/moly/layers/cube.py in cube_to_molecule(cube_file)
139 def cube_to_molecule(cube_file):
140
--> 141 _ , meta = cube_to_array(cube_file)
142 origin = meta["origin"]
143 atoms = meta["geometry"]
~/.local/lib/python3.6/site-packages/moly/layers/cube.py in cube_to_array(file)
171 """
172 cube_details = {}
--> 173 with open(file, 'r') as cube:
174 cube.readline()
175 cube.readline() # ignore comments
FileNotFoundError: [Errno 2] No such file or directory: 'st/Psi_a_1_1-Ag.cube'
In moly/layers/cube.py, line 64 has details.update({"name":cube_file[2:-5]})
and thus it is chopping off the first two characters of the directory. It should be details.update({"name":cube_file[0:-5]})
. I have tested this locally and it works as expected.
An API like the following can be awkward:
fig.add_molecule("QC", molecule=ammonia_dimer)
fig.add_molecule("xyz", file='bucky.xyz')
It is a bit overloaded in general and doesn't follow any common python pattern.
Consider always using the pattern add_x(name, object)
where we would have:
fig.add_molecule("mol1", Molecule)
fig.add_molecule("mol2", Molecule.from_file('Bucky.xyz"))
fig.add_orbital("Orbital1", Wavefunction)
It bring in an interesting question if we have two contexts:
fig.add_measurement("measure1", "mol1", [0, 1, 2])
Or Moly?
The Molecule adapter pattern in this case is overkill and adds additional overhead. I would highly recommend using QCElemental as the base molecule and relying on its readers.
Currently no tests are implemented.
[] Importing molecules
[] Adding layers
[] Showing plot (One needs to be creative on how to test this :))
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of moly.
(optional) I have confirmed this bug exists on the master branch of moly.
fig = moly.Figure()
fig.add_cube('Psi_a_9_5-A1.cube', iso=[0.03, 0.04, 0.05], plot_geometry=True)
fig.show()
Error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-29b34361b222> in <module>
1 fig = moly.Figure()
----> 2 fig.add_cube('Psi_a_9_5-A1.cube', iso=[0.03, 0.04, 0.05], plot_geometry=True)
3 fig.show()
~/Python_stuff/psi4labs/moly/moly/figure/figure.py in add_cube(self, file, iso, plot_geometry, colorscale, opacity, style)
127 self.fig.add_trace(trace)
128
--> 129 slider = get_slider(iso, geometry_traces)
130 self.fig.update_layout(sliders=slider)
131
~/Python_stuff/psi4labs/moly/moly/figure/widgets.py in get_slider(iso, geometry_traces)
44 one_step = {'method': "restyle",
45 'label': str(iso_i),
---> 46 'args': [{"visible": [True] * geometry_traces + [False] * len(iso)}]}
47 one_step["args"][0]['visible'][geometry_traces + i] = True
48 steps.append(one_step)
TypeError: can't multiply sequence by non-int of type 'tuple'
In moly/figure/figure.py, line 120 should have the len removed.
In moly/figure/widgets.py, lines 46 and 47 do not include the len for the geometry_traces parameter.
I have tested this locally and it works as expected.
See PR #15
Hello,
Your Launch Binder feature is not working but it is working on google colab. Can we switch the demo to there?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.