Python bindings and ASE adapters for potlib
Project description
pypotlib
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pypotlib-0.0.13-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31427128a4a05aedcf4275696aebdfa0853ba93b4c5ec9bd0aa5daa505547a61 |
|
MD5 | 8a66a7a95ec7801993b9a9e08fe2240a |
|
BLAKE2b-256 | 7e98db914042c9d6187ee70d57a00f218c13c059fe7f39043d56ba77a3c41f5c |
Hashes for pypotlib-0.0.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dfca6236916d5c9a9e65931705822d7e56b5117071eb9a4c4174062203f6e80 |
|
MD5 | 9c0085d388650b63116e497fe0e9ffb2 |
|
BLAKE2b-256 | 0313a2c12d4b43e747178709adb1f080f1cb184b99594cd533e3907811d1ecc5 |
Hashes for pypotlib-0.0.13-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57cf11c47f866606f20e16bf3a225e1bb54094215980aea19e2591de689fe6a1 |
|
MD5 | 761ab67b5fdeffc2678afed48efe7f3f |
|
BLAKE2b-256 | c9d5237d3cfeb051e79ddd4e61784a8c3d7ea56513a6951a8c390a98c4f33ce0 |
Hashes for pypotlib-0.0.13-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52863036928f364449577147fd55d18f354b5895f34578222b08714c4b99d3ec |
|
MD5 | 83aa4946f302d3ef699af4a10f5108f2 |
|
BLAKE2b-256 | 7d191aa306973c3a45521c6f099f4e5b130cc9357c7233c64c314f17dc0860bf |
Hashes for pypotlib-0.0.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ae67abc91a20f22c9dd1f9f807da552c7509bf8fcf9ac9d69695805db8c3a35 |
|
MD5 | 2ed186460dfd4b05850ab150873dacba |
|
BLAKE2b-256 | cdd803c9c69438f2e7db3bb2e8cb662d0ab0728e68ddd27886a51d83a8d3482a |
Hashes for pypotlib-0.0.13-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5a1d1f5cb49efd6a8d3c6de7388da12d12f1b497e35210614669adc3286b0b |
|
MD5 | 13cf14af00417a02d25f4b5eee0cc7b6 |
|
BLAKE2b-256 | 9a0a05876dbb3b63f8913c849ded9d2562aa2cbaea2302244e2ba07271920b62 |
Hashes for pypotlib-0.0.13-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86e8539d58617d9e53a995b43226bdafe0d10a1b9f1a128e186c19355449ba87 |
|
MD5 | 89673834e3dacdf70b39ab5b33693970 |
|
BLAKE2b-256 | 43da336d4be39eced7ff765ec31bcfcc88316270fb66b460bd8806087c3c82a1 |
Hashes for pypotlib-0.0.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c858c9af172707ef8403a4605911a76c0c036633bce5fa0b8d4aa910686dd3 |
|
MD5 | 1e819d35979ac04cbdb28c623f79024d |
|
BLAKE2b-256 | f8a610a3edae3ec6039781c979b156edaae0c8384feb7dc74897e687cfc47c1a |
Hashes for pypotlib-0.0.13-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9daf5ed07df9064f9e669f69edfaa860e9f5c3ca1bccd523fc458372b247accb |
|
MD5 | a6689ca1955605df46a8008ecf32189d |
|
BLAKE2b-256 | d9b1b2ff3cb8bd49952826ba4a2f0c1b88c66962436582954d3eefa84268b515 |
Hashes for pypotlib-0.0.13-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3608b37d5bdf07a290bf5b12a7ab80221e9a25a6eca8e0f900c899a4a05e361b |
|
MD5 | 152bb21a20d5bccf9afb01c9621e6789 |
|
BLAKE2b-256 | 4ced69ff66402a3e88d6a7ad247b1c77225d2a4bc177437cf07bde38f3f1d3e4 |
Hashes for pypotlib-0.0.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de80211e3a6bcb33f69fcd64fae61f67633f88e8c0c7302849db1ce5327bf1e4 |
|
MD5 | efbb40e2ea6557db86d5da2f3be12951 |
|
BLAKE2b-256 | 93ba0d6bd5e035957eedb0e6c36f9b6dbc1008055f03d58d7a2083f0792c43c8 |
Hashes for pypotlib-0.0.13-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbc571b431100420e239b00d590bed3166fd3e882cc15dbe125bf0479793f492 |
|
MD5 | 680e805875fe1b93c6d02aa2f2f93141 |
|
BLAKE2b-256 | e9bf516bdc2a5ef7885efec5160f9eb1f0a2b5e5511ad555c72bfc301bbd6d63 |