Giter Site home page Giter Site logo

moly's Introduction

πŸ‘¨β€πŸ’»πŸ€Έβ€β™‚οΈ
Software + Physics + UX

moly's People

Contributors

billy-doyle avatar vhchavez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

moly's Issues

Don't add images to repo

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.

moly/layers/cube.py negelecting first two characters of a directory

  • 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.


Code Sample, a copy-pastable example

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'

Problem description

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.

OO API

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])

Molecule Adapter Pattern

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.

Tests

Currently no tests are implemented.

[] Importing molecules
[] Adding layers
[] Showing plot (One needs to be creative on how to test this :))

Slider Bug

  • 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.


Code Sample, a copy-pastable example

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'

Problem description

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

Launch Binder Not working

Hello,

Your Launch Binder feature is not working but it is working on google colab. Can we switch the demo to there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.