Giter Club home page Giter Club logo

Comments (3)

acappiello avatar acappiello commented on July 2, 2024

I think you're misreading the code. The line you're questioning is actually the force, not the potential. It's just rearranged from the form you've written to pull out constants and rearrange terms to decrease the number of pow calls. The potential itself is not needed at all for the computation.

You're right, units are not as well documented as the should be. If I remember correctly, other than where I use angstroms for distance measurements, everything else should be in standard SI units.

When I run the program with the default values, I see a small number of particles stuck in the corners, but otherwise behaves reasonably. Since I was interested it running with a wide variety of parameters using the command line arguments, I wasn't too concerned with finding perfect "default" parameters. You'll notice if you pause the video around the 7 second mark, it is not being run with default parameters there either. If you're seeing something vastly different than that, I'm not sure what to tell you except maybe you changed something else.

from molecular-dynamics.

pkoutsovasilis avatar pkoutsovasilis commented on July 2, 2024

The code you implement for Force calculation is an approximate version of Lennard-Jones for computational purposes (you should have mentioned it). Also the md.cl file doesnt has a definition for constant SIZE (opencl no compilation). Furthermore if your units are already in angstroms why are you translating them in meter in the force calculation, as you can see here (http://chemwiki.ucdavis.edu/Physical_Chemistry/Physical_Properties_of_Matter/Intermolecular_Forces/Lennard-Jones_Potential) in the solutions section, example 2, (σ/r) must be in the same measure unit and in your calculation σ is angstroms for Xenon but distance is in meters... Last but not least you make the assumption that the velocity of particles is divided in half by elastic collision with box bounds but then its not an elastic collision and the wall must have accumulatively the half kinetic energy of each particle

from molecular-dynamics.

acappiello avatar acappiello commented on July 2, 2024

SIZE is defined at compile time, since I wanted it to be easily adjusted without hardcoding. You'll see this done on line 96-97 of md.cpp. Obviously, you're free to define it elsewhere to suit your needs.

When I precompute sigr = sigma / dist, both values are in angstroms. sigr is now a unitless quantity, so there is no discrepancy. In effect, both are converted to meters, but the conversion factor cancels out. I acknowledge that going back and forth between angstroms and meters is clumsy and ought to have just stayed in meters.

I honestly don't remember why I made the collisions inelastic, but changing that value to 1 will address that. In fairness, I can't find anywhere that I claim the collisions to be elastic.

from molecular-dynamics.

Related Issues (1)

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.