Skip to main content

The dompap simulation package

The dompap package focuses on simulations of point-like particles in any dimension with any pair potential. The package uses NumPy and Numba for efficient calculations and SymPy to implement any pair potentials. The user is not expected to be familiar with these packages but only basic Python syntax.

Installation

Use the Python package index (PyPI)

The package can be installed from the Python package index (PyPI) using pip.

pip install dompap

Download source from GitHub

Clone the repository from github at https://github.com/urpedersen/dompap.git (into a working directory of your choice), and add the package to your python path.

# Clone repository into some directory (replace [dir])
cd [dir]
git clone https://github.com/urpedersen/dompap.git

# Add to python path
export PYTHONPATH=$PYTHONPATH:$PWD/dompap

# Install requirements
pip install -r ./dompap/requirements.txt

Usage example

Python script

Below is an example of a 3D system of harmonic repulsive particles with the pair potential $$v(r) = (1 - r)^2$$ for $r<1$ and zero otherwise. The initial positions are set to a face-centered cubic (fcc) lattice, with five unit cells in each direction. The simulation is run for 100 steps (constant $NVT$ with Langevin thermostat), and the potential energy is printed every 10 steps.

from dompap import Simulation

# Initialize simulation object
sim = Simulation()

# Setup simulation
fcc_unit_cell = ([0.0, 0.0, 0.0], 
                 [0.5, 0.5, 0.0], 
                 [0.5, 0.0, 0.5], 
                 [0.0, 0.5, 0.5])
sim.set_positions(unit_cell_coordinates=fcc_unit_cell,
                  cells=(5, 5, 5), 
                  lattice_constants=(1.0, 1.0, 1.0))
sim.set_density(density=1.0)
sim.set_masses(masses=1.0)
sim.set_random_velocities(temperature=1.0)
sim.set_pair_potential(pair_potential_str='(1-r)**2', 
                       r_cut=1.0,
                       force_method='neighbor list', 
                       energy_method='neighbor list')
sim.set_pair_potential_parameters(sigma=1.0, epsilon=1.0)
sim.set_neighbor_list(skin=0.7, 
                      max_number_of_neighbors=128, 
                      method_str='double loop')
sim.set_integrator(time_step=0.01, 
                   target_temperature=1.0, 
                   temperature_damping_time=0.1)

# Run simulation
steps = 100
for step in range(steps):
    sim.step()
    if step % 10 == 0:
        print(f'Energy after {step} steps: {sim.get_potential_energy()}')

This simulation produces the output

Energy after 0 steps: 0.0
Energy after 10 steps: 3.1573922419447613
Energy after 20 steps: 16.330136084973663
Energy after 30 steps: 31.47341041787513
Energy after 40 steps: 43.913179017390576
Energy after 50 steps: 52.04197939534787
Energy after 60 steps: 57.968309542867964
Energy after 70 steps: 61.752276744879524
Energy after 80 steps: 67.33278804505039
Energy after 90 steps: 72.00507120397305

See examples for more examples of the capabilities of the dompap package.

Use dompap from the command line

The dompap package can also be used from the command line limited functionality. Type dompap --help for more information and to see the available options:

python3 -m dompap --help

Metadata

Release files for dompap 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dompap 0.0.5
File Size Uploaded
dompap-0.0.5.tar.gz 855.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dompap 0.0.5
File Interpreter ABI Platform
dompap-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 888.6 kB

Release files / dompap-0.0.5.tar.gz

Download URL dompap-0.0.5.tar.gz
Size 855.9 kB
Tags Source
SHA-256 checksum
How to use checksums
24579526864c9cf27e7aabd0f31a41b07dcd02603523f24e878002cc515e36b9
BLAKE2b-256 checksum
How to use checksums
341c0d61ba0f323be1473c0464388c73fc772d7b9a45a474ba5511e665812789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / dompap-0.0.5-py3-none-any.whl

Download URL dompap-0.0.5-py3-none-any.whl
Size 32.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a28e0152075d8160a0a48d909f29e26fb07e51b25a0e0a2a618a8bbc78ef496
BLAKE2b-256 checksum
How to use checksums
896de1eb649a61e2666e8f0545c33198daa26e8af15f4e7a2c91bc2ee0ac2750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page