Python bindings for molrs molecular simulation library
Project description
molcrafts-molrs
Python bindings for the molrs molecular modeling toolkit.
This package is the first public preview of the Python API. Install with
pip install molcrafts-molrs and import it as molrs.
Install
pip install molcrafts-molrs
Quick start
import numpy as np
import molrs
# Parse SMILES and generate 3D coordinates
ir = molrs.parse_smiles("CCO")
frame = ir.to_frame()
result = molrs.generate_3d(frame)
# Build a system from scratch
frame = molrs.Frame()
atoms = molrs.Block()
atoms.insert("x", np.array([0.0, 0.96, -0.24], dtype=np.float32))
atoms.insert("y", np.array([0.0, 0.0, 0.93], dtype=np.float32))
atoms.insert("z", np.zeros(3, dtype=np.float32))
atoms.insert("element", ["O", "H", "H"])
frame["atoms"] = atoms
Support
- Python 3.9+
pip install molcrafts-molrsimport molrs- Packing users should prefer explicit
seed=for reproducible placements
API
Data model
Frame— dict-like container of namedBlocks + optionalBoxBlock— column store backed by numpy arraysBox— simulation box with periodic boundaries
I/O
molrs.read_pdb(path)/molrs.read_xyz(path)→Framemolrs.parse_smiles(smiles)→SmilesIR→.to_frame()
Neighbor search (freud-style)
nq = molrs.AABBQuery(box, positions, cutoff=5.0)
nlist = nq.query_self() # self-query (unique pairs)
nlist = nq.query(query_positions) # cross-query
nlist.query_point_indices # np.array, uint32
nlist.point_indices # np.array, uint32
nlist.distances # np.array, float
Analysis
rdf = molrs.RDF(bins=100, r_max=5.0)
result = rdf.compute(nlist, box) # auto self/cross normalization
msd = molrs.MSD.from_reference(ref_frame)
result = msd.compute(frame)
cluster = molrs.Cluster(min_size=5)
result = cluster.compute(frame, nlist)
Molecular packing
target = (
molrs.Target(frame, count=100)
.with_name("water")
.with_constraint(molrs.InsideBox([0.0, 0.0, 0.0], [40.0, 40.0, 40.0]))
.with_constraint_for_atoms([1], molrs.AbovePlane([0.0, 0.0, 1.0], 5.0))
.constrain_rotation_z(0.0, 20.0)
)
packer = (
molrs.Packer(tolerance=2.0, precision=0.01)
.with_nloop0(40)
.with_pbc_box([40.0, 40.0, 40.0])
.with_progress(False)
)
result = packer.pack([target], max_loops=200, seed=42)
print(result.natoms, result.converged)
Force field
typifier = molrs.MMFFTypifier()
potentials = typifier.build(atomistic)
Development
maturin build
pip install target/wheels/*.whl
pytest -q
License
BSD-3-Clause
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file molcrafts_molrs-0.0.7-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b392e455691ec45890a49749202591d995db7e5bba2a18e5a9681767910ed0b
|
|
| MD5 |
114a8f46be9ba24b6a65c1a0a2ecbc6e
|
|
| BLAKE2b-256 |
34fc268ac72c8d730c3c1aad9d45148404810c46970591e24471ef1120b48a8f
|
File details
Details for the file molcrafts_molrs-0.0.7-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45d019a00347b31f368e2801b34e74a4b76ee6e20ed95ae8579701bd1edc1073
|
|
| MD5 |
c3d0fca5f720cb1ae2d470ff51a3df3a
|
|
| BLAKE2b-256 |
fa1f1375ecdb96700b81e94dcc8408082405f8233e8311b7757630554d5102d7
|
File details
Details for the file molcrafts_molrs-0.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c7e806bbc3db9f522e9e531436244c3471aa1992567445abbb0b23472f717ce
|
|
| MD5 |
6d801176f4db220a670247808014ea15
|
|
| BLAKE2b-256 |
ac9767238e318eeebea1ee4383718213485a703dcbfe36ccec04e87396e0eaeb
|
File details
Details for the file molcrafts_molrs-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a889e723d7ecef6a84348cc7eee0611734fb4a186bb354457754c8d7171ed544
|
|
| MD5 |
f513d88b9e94c584021fe6fe560dbb13
|
|
| BLAKE2b-256 |
61a15d00ca37440ad0c0f4bb5ecafaa4765c2869a8525399572da6abba3ebc24
|
File details
Details for the file molcrafts_molrs-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2579b87bafac6e356ebc0895b63fc19567304451c42eadd8f2daa4f079f7489a
|
|
| MD5 |
d58992f061d408fe236b0b98b5558741
|
|
| BLAKE2b-256 |
982ab46a67798e4c62401901750035cc6e314d1cdb2b63fb08161b79f01fcad5
|
File details
Details for the file molcrafts_molrs-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2af5675be78d3bb3a4fa00be0cc694b46ce59a31342c5babfff1e3f1fa4e900a
|
|
| MD5 |
dcefb87339c75af3dc812bf449007265
|
|
| BLAKE2b-256 |
dfcdb73c74109e3e3dcbd97a7a753529931231e433775283aeb6c0f640db6785
|
File details
Details for the file molcrafts_molrs-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: molcrafts_molrs-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a4e1561dba3467dd299e112643bee9b1abf1b205c68a9de1863d4337cba41f0
|
|
| MD5 |
d68ef3900c29c13125bb5102cd8dffd7
|
|
| BLAKE2b-256 |
b57e27e0d17a120cff6c831f6f2f42b00354bce16cda9c64186269c57588c135
|