https://github.com/benmaier/ljhouses

C++-based Python package to efficiently simulate 2D Lennard-Jones spheres in an external potential

https://github.com/benmaier/ljhouses

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.4%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

C++-based Python package to efficiently simulate 2D Lennard-Jones spheres in an external potential

Basic Info
  • Host: GitHub
  • Owner: benmaier
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Size: 2.79 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 3 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

ljhouses

Simulate Lennard-Jones spheres and similar systems in the context of location of buildings.

Install

git clone https://github.com/benmaier/ljhouses/
pip install ./ljhouses

ljhouses was developed and tested for

  • Python 3.10
  • Python 3.11

So far, the package's functionality was tested on macOS X and Ubuntu only.

Dependencies

ljhouses directly depends on the following packages which will be installed by pip during the installation process

  • numpy>=1.17

Examples

Thermalized LJ simulation

```python import numpy as np import matplotlib.pyplot as pl

from ljhouses.pythonsims import getclosetoequilibriuminitialconditions, simulate, StochasticBerendsenThermostat from ljhouses.drawing import plotconfiguration

define system parameters

N = 1000 # number of particles LJr = 10 # potential minimum for interaction energy LJe = 20 # potential depth LJRmax = 3*LJr # maximum distance to which to compute interaction forces g = 0.2 # gravitational pull to the center v0 = 6 # root mean squared velocity of the particles (~root temperature) dt = 0.01 # length of time step

create display figure

fig, ax = pl.subplots(1, 3, figsize=(10,4)) ax[0].sharex(ax[1]) ax[0].sharey(ax[1])

create initial conditions that should lie close to an equilibrium

configuration and display the configuration

x, v, a = getclosetoequilibriuminitialconditions(N, v0, LJr, g, dt) plotconfiguration(x, LJr/2, ax[0]) ax[0].set_title('initial configuration')

Define a thermostat that keeps the configuration at roughly the

same temperature

thermostat = StochasticBerendsenThermostat(v0, N)

define more simulation parameters

Nsamplingrounds = 10 Nstepspersample = 1000 maxsamples = 10

run the simulation

samples, t, K, V, Vij = simulate(dt, Nsamplingrounds, Nstepspersample, maxsamples, LJr, LJe, LJ_Rmax, g, x, v, a, thermostat)

obtain the final configuration and display it

x1, v1, a1 = samples[-1] plotconfiguration(x1, LJr/2, ax[1]) ax[1].set_title(f'after {int(np.round(t[-1]/dt)):d} steps')

plot the temporal evolution of the energies

ax[2].plot(t, K, label='K') ax[2].plot(t, V, label='V') ax[2].plot(t, Vij, label='Vij') ax[2].plot(t, np.sum((K, V, Vij),axis=0), label='E') ```

Example simulation

Collision simulation

```python import numpy as np import matplotlib.pyplot as pl

from ljhouses.pythonsims import simulatecollisionsuntilnocollisions from ljhouses.drawing import plot_configuration

N = 300 L = 1 R = L/np.sqrt(N)/np.pi D = 2*R x = np.random.rand(N,2) * L

fig, ax = pl.subplots(1,2,figsize=(10,5),sharex=True,sharey=True) ax[0].set_title('initial configuration')

plotconfiguration(x, R, ax[0]) xnew = simulatecollisionsuntilnocollisions(x, D) plotconfiguration(xnew, R, ax[1]) ax[1].set_title('after running collision detection') ```

Collision simulation

Changelog

Changes are logged in a separate file.

License

Most of this project is licensed under the BSD-3 License. Note that this excludes any images/pictures/figures shown here or in the documentation.

Contributing

If you want to contribute to this project, please make sure to read the code of conduct and the contributing guidelines. In case you're wondering about what to contribute, we're always collecting ideas of what we want to implement next in the outlook notes.

Contributor Covenant

Dev notes

Fork this repository, clone it, and install it in dev mode.

bash git clone git@github.com:YOURUSERNAME/ljhouses.git make

If you want to upload to PyPI, first convert the new README.md to README.rst

bash make readme

It will give you warnings about bad .rst-syntax. Fix those errors in README.rst. Then wrap the whole thing

bash make pypi

It will probably give you more warnings about .rst-syntax. Fix those until the warnings disappear. Then do

bash make upload

Owner

  • Name: Benjamin F. Maier
  • Login: benmaier
  • Kind: user
  • Location: Copenhagen
  • Company: Technical University of Denmark

Postdoc @suneman 's, generative art, electronic music. DTU Compute & SODAS.

GitHub Events

Total
Last Year

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 31
  • Total Committers: 1
  • Avg Commits per committer: 31.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ben F. Maier b****r@g****m 31

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • numpy >=1.17
setup.py pypi
  • numba *
  • numpy *
  • pybind11 >=2.0.0
  • scipy *