Coder Social home page Coder Social logo

lammps / lammps-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andeplane/lammps-web

5.0 4.0 4.0 138.94 MB

A web version of LAMMPS.

License: GNU General Public License v3.0

C++ 10.71% CoffeeScript 3.29% CSS 2.71% HTML 7.21% JavaScript 73.10% Dockerfile 0.75% Shell 0.71% CMake 1.52%

lammps-web's Introduction

Atomify LAMMPS Online

A web version of Atomify LAMMPS powered by Emscripten, Codemirror and three.js. You can try it here or here.

What is LAMMPS?

LAMMPS (lammps.sandia.gov, github.com/lammps/lammps) is a high performance molecular dynamics code written in C++. It is an acronym for Large-scale Atomic/Molecular Massively Parallel Simulator. With Emscripten, an LLVM-to-JavaScript Compiler, it isn't too hard to compile LAMMPS into asm.js (a subset of Javascript) so it can run in any browser.

What is Atomify LAMMPS?

Atomify LAMMPS (ovilab.net/atomify, github.com/computationalphysics/atomify-lammps) is an editor for LAMMPS with realtime visualization of atom positions and live plotting of physical quantities.

Requirements

To run the precompiled version, you only need a simple web server. An example is i.e. Node.js and the server.js file in the web directory. See instructions below.

How to run using Node.js

A precompiled version is already in the web directory.

  • Install Node.js and npm

  • Install bower

    npm install -g bower
  • Open the web directory in a terminal and install build prerequisites

cd web/
npm install

Build instructions

You will need the Emscripten compiler (instructions in the link). Once you have that, just open the directory containing this README.md file and run

./build.sh

This will clone LAMMPS from github.com/lammps/lammps, compile it and copy the new version of LAMMPS into the web directory.

Build instructions with Docker

# build the container
./build_container.sh

# compile in container
./build_in_container.sh

To view the generated site, you can use any simple webserver to host the web/_site folder.

cd web/_site
python3 -m http.server

lammps-web's People

Contributors

andeplane avatar rbberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lammps-web's Issues

Enable exception handling

Currently, the web version doesn't handle if an exception is thrown by LAMMPS (script error etc). We should handle this.

Use Web Workers for running LAMMPS

We want to use fix atomify all atomify that will do a callback function to JS whenever a timestep/minimization step is finished so we can synchronize rendering.

But LAMMPS freezes the GUI (naturally), so we want to move the LAMMPS work to another thread. This has (at least) two benefits:

  • Faster code (since we actually use two threads)
  • naturally solves the GUI hanging problem

See example of web workers. Shouldn't be very hard. Synchronization is performed with post events where we can send a JSON object.

Do webGL data synchronization in c++

If VBO's are created with threejs and javascript, we can pass identifiers to c++ and do data synchronization there. It is probably much faster.

Add lj/webgl pair style

We don't have cuda or anything like that, but we do have webgl. It is possible to do all computations in a simple pair style like LJ just to be able to run big simulations in the browser.

Maybe compute shaders are available on WebGL? If not, we can send all atom positions/types etc as textures into the fragment shader kernels and write forces and energies as output maybe. Problem is that we'd like one fragment shader kernel per atom i, not per Fx, Fy, Fz, E per atom. So maybe we can write to multiple textures, one for Fx, one for Fy etc.

https://gist.github.com/adrianseeley/f768fd7a3aab2370eafc
https://github.com/gnonio/gl-compute
http://www.khronos.org/webcl/
https://kripken.github.io/emscripten-site/docs/api_reference/module.html

Add console

Users should be able to see console output during a simulation (thermo output and simulation summary). This isn't so easy to do right now because stdout is only printed to console, and we can't hook into this yet in LAMMPS.

I think once lammps/lammps/issues/120 is fixed, this might be a simple fix.

Add phong shading

Current shading is very simple and not so pretty, so we should add phong shading.

If we want to enable bond rendering between atoms, we will need the ray traced shading like we have in Atomify. The only problem is that three.js doesn't let us override vertexPosition in the fragment shader for shading, so we need to add an issue / create a PR so this is supported.

For version 1.0 we can simply just use the lighting three.js has and interpolate vertexPosition the regular way.

Add LAMMPS wrapper classes

As in Atomify, the system, groups, regions, fixes, variables and computes should have a mirror object that can be visualized and handled.

Prevent any main function to run

Right now, we have -s NO_EXIT_RUNTIME=1 so that everything runs after some main function has been executed. We don't want any such function.

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.