Skip to main content

Python bindings and ASE adapters for potlib

Project description

pypotlib Contributor Covenant Builds Wheels

Python bindings and ASE adapters for potlib.

Details

The library consists of thin wrappers to potlib under cpot and a PyPotLibCalc class which is an ase calculator under ase_adapters.

Installation

This is on PyPI, with wheels, so usage is simply:

pip install pypotlib

Users are advised to not try to build from source, since the underlying potlib code includes fortran and cpp dependencies which can be slightly tricky to work with.

Local Development

The easiest way is to use the environment file, compatible with conda, mamba, micromamba etc.

mamba env create -f environment.yml
mamba activate rgpotpy
pdm install

Production

As such, due to the compiled extensions and what not, cibuildwheel is used to generate macos and linux wheels. Locally this may be emulated (on linux) by:

cibuildwheel --output-dir wheelhouse --platform linux

Usage examples

The simplest usage is just:

import pypotlib as ppl
import numpy as np
ljpot = ppl.cpot.LJPot()
pos = np.array([1, 2, 3, 1.2, 2.3, 3.6]).reshape(-1, 3)
atm_types = [0, 0]
cell_dim = np.eye(3)*50
print(ljpot(pos, atm_types, cell_dim))

For using the ASE calculator we need an instantiated class.

from ase import Atoms
from pypotlib import cpot
from pypotlib.ase_adapters import PyPotLibCalc
atoms = Atoms(symbols=['Cu', 'H'], positions=[[0, 0, 0], [0.5, 0.5, 0.5]])
calc = PyPotLibCalc(cpot.CuH2Pot())
atoms.set_calculator(calc)
print(atoms.get_potential_energy())
print(atoms.get_forces())

To run an NEB with this, consider the following toy example:

from ase import Atoms
from ase.neb import NEB
from ase.optimize import BFGS

from pypotlib import cpot
from pypotlib.ase_adapters import PyPotLibCalc

atoms_initial = Atoms(symbols=['H', 'H'], positions=[(0, 0, 0), (0, 0, 1)])
atoms_final = Atoms(symbols=['H', 'H'], positions=[(0, 0, 2), (0, 0, 3)])

images = [atoms_initial]
images += [atoms_initial.copy() for idx in range(3)]
images += [atoms_final]

for image in images:
    image.calc = PyPotLibCalc(cpot.LJPot())

neb = NEB(images)
neb.interpolate(method = 'idpp')
optimizer = BFGS(neb)
optimizer.run(fmax=0.04)

Contributions

All contributions are welcome, this includes code and documentation contributions but also questions or other clarifications. Note that we expect all contributors to follow our Code of Conduct.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypotlib-0.0.12.tar.gz (18.5 kB view details)

Uploaded Source

Built Distributions

pypotlib-0.0.12-cp311-cp311-musllinux_1_1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pypotlib-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pypotlib-0.0.12-cp311-cp311-macosx_10_9_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pypotlib-0.0.12-cp310-cp310-musllinux_1_1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pypotlib-0.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pypotlib-0.0.12-cp310-cp310-macosx_10_9_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pypotlib-0.0.12-cp39-cp39-musllinux_1_1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pypotlib-0.0.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pypotlib-0.0.12-cp39-cp39-macosx_10_9_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pypotlib-0.0.12-cp38-cp38-musllinux_1_1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pypotlib-0.0.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pypotlib-0.0.12-cp38-cp38-macosx_10_9_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pypotlib-0.0.12.tar.gz.

File metadata

  • Download URL: pypotlib-0.0.12.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypotlib-0.0.12.tar.gz
Algorithm Hash digest
SHA256 7f6936c6c63c689989be9480d4857228e03f63fa5e78fd72d0d69de86f0a5f98
MD5 a932213a918fb9a9ec28839892c3ead0
BLAKE2b-256 ce80c542138576ef98d9668cc84a78aadf57d30201caf8bc4f02a1aefd495c0a

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 01fb907068e9aa0a347070f551cb243d3b4c3171ac3e71ce35cd972098163e13
MD5 8a255a2c33fed770b3846230ccc4f455
BLAKE2b-256 98f56195599057367afc02c06b86d8fdde9aef807895b7db4442c981cd5e63f4

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae4120e589197bd49376dc891be63f6774f442faf83f5baab41b73620a9d76f5
MD5 a758596ab0d9e80982308a6355470abf
BLAKE2b-256 65aff68d43f6e9e60afc8dc0fcd2a5fa1c52a95e723c4260153a5e7286f8b159

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 86783b5411f5571bce70ca3e73b3c0b2a85895fce376fc5cf276f08a2bf28dd3
MD5 ed964141506d8a57340ff1045f736ac6
BLAKE2b-256 d2342ba31ca6491f3f670e6f6ec440abcc83e9327a0074161d4071551f65a14e

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 daf770f7937b7c86674b9ec4e12c145baf4ef7d2bd5e76456a5457245bd9a017
MD5 9fd20e2bd2769b0eeca14af6bd5410a4
BLAKE2b-256 640603ed465d727e3ba05e938032069fa500f98babadf8c69e537847d364feb5

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19dbea1d333da8d21387ae25b30635274e4672770dc76107c14d1953e87bf006
MD5 80577d9b60b9af6e5f518e9372ef722d
BLAKE2b-256 839258a6b9474364b82b4a4eeaacf1d0cbdec182d8cb291ea29716ab3b35c119

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c9836dbe07cf401078e9d7f79f5d1aad111e323151ba22764cb6931b9e4923e
MD5 8603829ca0ab131b85c5f005f2d2fb2f
BLAKE2b-256 f69b41b75132e52f7ccd52b7f2c06154707db472f66d5cac9b800cba41624b49

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 2b9a99d15d4eb1d02f57bf6ddd0fa8aa1f8031a08712ea4c3dcefec241f7170c
MD5 fe71fc215913d602b51a0634d83b1b97
BLAKE2b-256 3b4bae9236a49bb42e4e8d8fb1bf058d5d84a5c9e7b63d280c8a5d3e41bb4ed7

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc6ec1146c7616d4246b5d6d5b0f261f2848a0436376e479d8d4fc7664a9f99b
MD5 e36626c738632793c546d3fbfd7a889c
BLAKE2b-256 86d964b4f2047414cee185e4fa5708e7aa63b5f46d04a6945c5308681ee9286c

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07cda9d0024529b5f3a38d69858f97a852978975f72438064150cc0026c810ad
MD5 4f7e3f29a1790685e625b60d88036773
BLAKE2b-256 38fed505c171f5cafe7a79016408ca580938d94afe77230b8e26882634349bb5

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3ff0b26e94749da7d28cdfb761c772c215e1992efd0c9a15292907230a8bb883
MD5 b1a363911b11c20ff53e6f087987fb61
BLAKE2b-256 d1558e557407a0a29aed704f0b451e4a132f264be1fb481b4b476b28d66b9fd1

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c8520912d7524664729189a59ce78cfe24daf0758cb3bfd416621d368e78326b
MD5 8ca27bf10ccf8f4d93512ae104b18a88
BLAKE2b-256 45fbd837f8242f86c233065db6390c93d408e9407f2d90c9a148a5e9db7ab1a4

See more details on using hashes here.

File details

Details for the file pypotlib-0.0.12-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pypotlib-0.0.12-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 71233444e061892d7f1b7a69a7ead7acdf276c19d7f1f90d5b226eeac43a1d34
MD5 7b66f8e2f781c06c1f45ab893f2a057a
BLAKE2b-256 199dbddd63c45a9f6150a324064747522b3ae9af8b7a92525538449c0ffc6cab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page