Git Product home page Git Product logo

Comments (6)

sschoenholz avatar sschoenholz commented on April 28, 2024

Hey! Great question. It was always possible, but because no one had asked we hadn't exposed the functionality. Just pushed a change that makes it possible via the per_particle keyword argument.

For example,

energy_fn = energy.soft_sphere_pair(displacement)
print(energy_fn(R))  # Prints a scalar.

pp_energy_fn = energy.soft_sphere_pair(displacement, per_particle=True)
print(pp_energy_fn(R))  # Prints a vector of shape [N,] 

One case that is not yet implemented is if you have a multispecies system where the species are specified upfront. I'll hopefully get to adding this case soon but in the meantime, you should specify the species dynamically. For example,

pp_energy_fn = energy.soft_sphere_pair(displacement, species=species, sigma=sigma, per_particle=True)
print(pp_energy_fn(R))  # Throws an error.

from jax_md.quantity import Dynamic
pp_energy_fn = energy.soft_sphere_pair(displacement, species=Dynamic, sigma=sigma, per_particle=True)
print(pp_energy_fn(R, species=species))  # Works and prints a vector.

Let me know how it works or if you have any questions!

from jax-md.

SoDantas8452 avatar SoDantas8452 commented on April 28, 2024

Dear sschoeholz, thank you for the beautiful answer. I will try it and let you know. Cheers!

from jax-md.

SoDantas8452 avatar SoDantas8452 commented on April 28, 2024

Dear sschoeholz, I am implementind an EAM explicit potential using jax-md and seems that, until now, all is working fine. The per_particle functionality is very nice and important for my project. As soon as my md approach is working properly I will post here and, maybe, could be an example to others colleagues.

from jax-md.

sschoenholz avatar sschoenholz commented on April 28, 2024

Hey @SoDantas8452 somehow I missed this reply but that sounds awesome! If you were interested, we would also be happy to work with you to commit your EAM potential into jax md properly?

from jax-md.

SoDantas8452 avatar SoDantas8452 commented on April 28, 2024

Dear @sschoenholz I wrote a naive code (somehow zero version of the whole code). Could you take a look to help me with it? Maybe I could send to your e-mail a jupyter notebook code. Thanks!

from jax-md.

sschoenholz avatar sschoenholz commented on April 28, 2024

Hi @SoDantas8452 thanks for your reply again, for some reason I keep missing these. I would love to work iwth you to improve our eam implementation. Definitely send me a jupyter notebook and let's iterate! The best place to reach me is [email protected].

from jax-md.

Related Issues (20)

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.