dompap


Namedompap JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummarySimulations of point-like particles in any dimension with any pair potential
upload_time2024-02-05 14:50:32
maintainer
docs_urlNone
author
requires_python>=3.10
license
keywords lennard-jones harmonic repulsive molecular dynamics particle simulation soft sphere
VCS
bugtrack_url
requirements numpy scipy sympy numba matplotlib pandas toml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.
```bash
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.
```bash
# 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.

```python
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](https://github.com/urpedersen/dompap/tree/master/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:
```bash
python3 -m dompap --help
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dompap",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "\"Ulf R. Pedersen\" <urp@ruc.dk>",
    "keywords": "Lennard-Jones,harmonic repulsive,molecular dynamics,particle simulation,soft sphere",
    "author": "",
    "author_email": "\"Ulf R. Pedersen\" <urp@ruc.dk>",
    "download_url": "https://files.pythonhosted.org/packages/34/1c/0d61ba0f323be1473c0464388c73fc772d7b9a45a474ba5511e665812789/dompap-0.0.5.tar.gz",
    "platform": null,
    "description": "# The dompap simulation package\n\nThe `dompap` package focuses on simulations of point-like particles in any dimension with any pair potential.\nThe package uses NumPy and Numba for efficient calculations and SymPy to implement any pair potentials. \nThe user is not expected to be familiar with these packages but only basic Python syntax.\n\n## Installation\n\n### Use the Python package index (PyPI)\nThe package can be installed from the Python package index (PyPI) using pip.\n```bash\npip install dompap\n```\n\n### Download source from GitHub\nClone the repository from github at https://github.com/urpedersen/dompap.git \n(into a working directory of your choice), and add the package to your python path.\n```bash\n# Clone repository into some directory (replace [dir])\ncd [dir]\ngit clone https://github.com/urpedersen/dompap.git\n\n# Add to python path\nexport PYTHONPATH=$PYTHONPATH:$PWD/dompap\n\n# Install requirements\npip install -r ./dompap/requirements.txt\n```\n\n## Usage example\n### Python script\nBelow is an example of a 3D system of harmonic repulsive particles with the pair potential\n$$v(r) = (1 - r)^2$$\nfor $r<1$ and zero otherwise. The initial positions are set to a face-centered cubic (fcc) lattice,\nwith five unit cells in each direction. \nThe simulation is run for 100 steps (constant $NVT$ with Langevin thermostat), and the potential energy is printed every 10 steps.\n\n```python\nfrom dompap import Simulation\n\n# Initialize simulation object\nsim = Simulation()\n\n# Setup simulation\nfcc_unit_cell = ([0.0, 0.0, 0.0], \n                 [0.5, 0.5, 0.0], \n                 [0.5, 0.0, 0.5], \n                 [0.0, 0.5, 0.5])\nsim.set_positions(unit_cell_coordinates=fcc_unit_cell,\n                  cells=(5, 5, 5), \n                  lattice_constants=(1.0, 1.0, 1.0))\nsim.set_density(density=1.0)\nsim.set_masses(masses=1.0)\nsim.set_random_velocities(temperature=1.0)\nsim.set_pair_potential(pair_potential_str='(1-r)**2', \n                       r_cut=1.0,\n                       force_method='neighbor list', \n                       energy_method='neighbor list')\nsim.set_pair_potential_parameters(sigma=1.0, epsilon=1.0)\nsim.set_neighbor_list(skin=0.7, \n                      max_number_of_neighbors=128, \n                      method_str='double loop')\nsim.set_integrator(time_step=0.01, \n                   target_temperature=1.0, \n                   temperature_damping_time=0.1)\n\n# Run simulation\nsteps = 100\nfor step in range(steps):\n    sim.step()\n    if step % 10 == 0:\n        print(f'Energy after {step} steps: {sim.get_potential_energy()}')\n```\nThis simulation produces the output\n```\nEnergy after 0 steps: 0.0\nEnergy after 10 steps: 3.1573922419447613\nEnergy after 20 steps: 16.330136084973663\nEnergy after 30 steps: 31.47341041787513\nEnergy after 40 steps: 43.913179017390576\nEnergy after 50 steps: 52.04197939534787\nEnergy after 60 steps: 57.968309542867964\nEnergy after 70 steps: 61.752276744879524\nEnergy after 80 steps: 67.33278804505039\nEnergy after 90 steps: 72.00507120397305\n```\nSee [examples](https://github.com/urpedersen/dompap/tree/master/examples) for more examples of the capabilities of the `dompap` package.\n\n### Use dompap from the command line\nThe `dompap` package can also be used from the command line limited functionality.\nType `dompap --help` for more information and to see the available options:\n```bash\npython3 -m dompap --help\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simulations of point-like particles in any dimension with any pair potential",
    "version": "0.0.5",
    "project_urls": {
        "Changelog": "https://github.com/urpedersen/dompap/blob/master/CHANGELOG.md",
        "Homepage": "https://github.com/urpedersen/dompap",
        "Issues": "https://github.com/urpedersen/dompap/issues",
        "Repository": "https://github.com/urpedersen/dompap"
    },
    "split_keywords": [
        "lennard-jones",
        "harmonic repulsive",
        "molecular dynamics",
        "particle simulation",
        "soft sphere"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "896de1eb649a61e2666e8f0545c33198daa26e8af15f4e7a2c91bc2ee0ac2750",
                "md5": "d0af250f37d77daa16036016a8ec147b",
                "sha256": "4a28e0152075d8160a0a48d909f29e26fb07e51b25a0e0a2a618a8bbc78ef496"
            },
            "downloads": -1,
            "filename": "dompap-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d0af250f37d77daa16036016a8ec147b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 32691,
            "upload_time": "2024-02-05T14:50:29",
            "upload_time_iso_8601": "2024-02-05T14:50:29.535023Z",
            "url": "https://files.pythonhosted.org/packages/89/6d/e1eb649a61e2666e8f0545c33198daa26e8af15f4e7a2c91bc2ee0ac2750/dompap-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "341c0d61ba0f323be1473c0464388c73fc772d7b9a45a474ba5511e665812789",
                "md5": "ab954fe35029730dde2668a95339e48b",
                "sha256": "24579526864c9cf27e7aabd0f31a41b07dcd02603523f24e878002cc515e36b9"
            },
            "downloads": -1,
            "filename": "dompap-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ab954fe35029730dde2668a95339e48b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 855894,
            "upload_time": "2024-02-05T14:50:32",
            "upload_time_iso_8601": "2024-02-05T14:50:32.016064Z",
            "url": "https://files.pythonhosted.org/packages/34/1c/0d61ba0f323be1473c0464388c73fc772d7b9a45a474ba5511e665812789/dompap-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-05 14:50:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "urpedersen",
    "github_project": "dompap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.24"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.10"
                ]
            ]
        },
        {
            "name": "sympy",
            "specs": [
                [
                    ">=",
                    "1.12"
                ]
            ]
        },
        {
            "name": "numba",
            "specs": [
                [
                    ">=",
                    "0.58"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.6.3"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.5"
                ]
            ]
        },
        {
            "name": "toml",
            "specs": [
                [
                    ">=",
                    "0.10"
                ]
            ]
        }
    ],
    "lcname": "dompap"
}
        
Elapsed time: 2.43942s