Giter Club home page Giter Club logo

pylj's Introduction

Hi there ๐Ÿ‘‹

I am Andrew R. McCluskey, a scientist, educator, and programmer. I lead the SCAMs@bristol research group in the School of Chemistry at the University of Bristol.

  • Where: Bristol, GB
  • Work: Centre for Computational Chemistry, School of Chemistry, University of Bristol
  • Contact: Email
  • Pronouns: (he/him)

pylj's People

Contributors

arm61 avatar sansona avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

pylj's Issues

Buckingham energy/force don't work for arrays

In writing tests, I discovered that the Buckingham forcefield functions run into a TypeError if the dr input is not a single float (i.e [dr] or for an array of different values).

Here's the error that comes up:
TypeError: can't multiply sequence by non-int of type 'float'

Add square-well potential

Now that there is support for other forcefields, it would be nice to have a Square-well potential

msd not accurate

using the msd plot in the scattering class there is some inconsistency due to the pbc

Animations not working?

Describe the bug
I'm working through the ideal_gas_law example. I have a feeling the plot of atoms should animate them moving around the box, but there's no display until the calculation is over, then it just shows what I think is the last frame.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'ideal_gas_law example notebook'
  2. Click on 'simulation1 = md_simulation(4, 100., 100, 10000, sample.JustCell)'
  3. Scroll down to 'plot'
  4. Nothing displays until the calculation is over, then it's just a static plot.

Expected behavior
From the instructions it seems like it should be animated?.

Screenshots
image

Desktop (please complete the following information):

  • OS: CentOS
  • Browser chrome
  • Version 97

Additional context

Scaling of the particles

Currently the marker size for the particles in the mpl plots is deteremined based on the size of the simulation cell. However, with the release 1.1, it is now possible to change the forcefield and the values of A and B, therefore requiring the particle marker size to scale with both the simulation cell size and the nature of the potential model.

I reckon it is best to have the marker size be dependent on the position of the minima on the potential well. e.g. the sigma for a (sigma-epsilon) Lennard Jones.

This would involve working on the mk variable in the sample.setup_cellview function. Since it might be forcefield dependent, it might be necessary to define something in the forcefields.py module.

Ideas welcome.

Installation manual

  1. I really like the idea of running a demo through Jupyter, as it is convenient to test the code directly. I tried the cloud version for molecular_dynamics but not successful. Please correct me if I did it wrong. http://35.230.133.1/notebook/notebooks/examples/molecular_dynamics.ipynb#
    The error message is here:
TypeError                                 Traceback (most recent call last)
 in ()
----> 1 system = md_simulation(100, 273.15, 100, 5000, 50)
 in md_simulation(number_of_particles, temperature, box_length, number_of_steps, sample_frequency)
     16                                                                                                  system.cut_off)
     17         # Run the equations of motion integrator algorithm
---> 18         system.particles = md.velocity_verlet(system.particles, system.timestep_length, system.box_length)
     19         # Sample the thermodynamic and structural parameters of the system
     20         system = md.sample(system.particles, system.box_length, system.initial_particles, system)
TypeError: velocity_verlet() missing 1 required positional argument: 'cut_off' 
  1. I tried to run it on a linux computer through a terminal, it was not successful either. I followed exactly all the steps shown in README.md. I suspected I missed installing some libraries. I think it will be beneficial if a detailed installation manual can be provided.

Add sigma epsilon LJ potential

Now that there is support for other forcefields, it would be nice to have a sigma epsilon LJ potential in addition to the A B one there is currently.

How this is done for a Lennard-Jones potential can be found in pylj/forcefields.py

Example notebooks

I liked the additional notebooks. I had a few simple fixes; nothing too difficult. Pending these changes I agree that it is ready for publication. Great job!

ideal_gas_law/first_principles.ipynb:

When rearranging ln(Q) add some helpful hints for students:
Between eq 1 and 2: "Using Stirling's approximation"
Between eq 2 and 3: "Substituting the de Broglie thermal wavelength"

ideal_gas_law/intro_to_monte_carlo.ipynb:

typos:
"approxmations" -> "approximations"
"intantenous" -> "instantaneous"
"accoprding" -> "according"
"enivornment" -> "environment"
"neglible" -> "negligible"
"implimented" -> "implemented"

ideal_gas_law/intro_to_molecular_dynamics.ipynb:

typos:
"approxmations" -> "approximations"
"intantenous" -> "instantaneous"
"accoprding" -> "according"
"enivornment" -> "environment"
"deriviative" -> "derivative"

ideal_gas_law/ideal_gas_law.ipynb:

typos:
"approxmations" -> "approximations"
"intantenous" -> "instantaneous"
"accoprding" -> "according"
"showen" -> "shown"
"presssure" -> "pressure"
"disucss" -> "discuss"

In all of the "Atomistic Simulation" cells:

The sentence: "The use of computers in chemistry is becoming more and more commonplace with increases computational resource and more efficient and effective algorithms." sounds a bit awkward.
Consider: "The use of computers in chemistry is becoming more common as computers are increasing in power and the algorithms are becoming more accurate and efficient."

Widget to control variables

Include ipywidgets (or similar) to control variables of the simulation such as temperature, number of particles etc.

Broken characters in examples

In the examples, there are several fields/code boxes which are not running, since they contain broken special characters.

Steps to reproduce the behavior:

  1. Go to 'pylj/examples/molecular_dynamics/intro_to_molecular_dynamics.ipynb'
  2. Check code box 2 and 3, for example
    or
  3. pylj/examples/ideal_gas_law/ideal_gas_law.ipynb
  4. Check code box 2 and 3, for example

Screenshot from the "raw" notebook:
image

Checked on Ubuntu 20.04.2 LTS with

  • Firefox (87.0+build3-0ubuntu0.20.04.2)
  • Chromium (89.0.4389.114)

Users seeking support

The readme says all development discussion will take place on gitter. The docs say there is a slack channel. I couldn't sign in to the slack channel because it says I need to "Contact the workspace administrator for an invitation".

Is all communication going to occur via gitter? If so can the read me be changed to make this clearer?

Magic Numbers

Can these please be replaced with named constants? Preferably with the formula/units in a comment? I think this code has educational utility beyond what is intended. The project is structured well and the code is written well so it is readable. I could imagine more advanced students reading the source and learning something.
E.g.

// four_ep_sigma (UNITS) = 4 * \epsilon * \sigma**6 
four_ep_sigma = 9.273e-78

Instances that I saw:

Minor efficiency improvement

Since this is pedagogical code, I don't think the focus should be on making things faster if it becomes unreadable. However I had one change that could make things quicker and if someone is reading the code to learn, it could start them thinking about these things when programming.

In comp.cpp, change from

f = (1.635e-133 * pow(dr, -13.) - 5.834e-77 * pow(dr, -7.));
force_arr[k] = f;
e = (1.363e-134 * pow(dr, -12.) - 9.273e-78 * pow(dr, -6.));
energy_arr[k] = e;

to

inv_dr_1 = 1.0 / dr;
inv_dr_6 = pow(inv_dr_1, 6);

f = (1.635e-133 * (inv_dr_1*inv_dr_6*inv_dr_6) - 5.834e-77 * (inv_dr_1*inv_dr_6*));
force_arr[k] = f;
e = (1.363e-134 * (inv_dr_6*inv_dr_6)) - 9.273e-78 * (inv_dr_6));
energy_arr[k] = e;

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.