Skip to main content

Precisely define and calculate measurements across multiple crystal structures

Project description

picometer

PyPI version Python version codecov CodeFactor Documentation Status Gitmoji tests

Picometer is a Python 3.10+ package which allows to define and calculate various metrics across multiple crystal structures in a clear and reproducible fashion. It is supposed to be used in tandem with a GUI program such as Mercury or Olex2 and applied on a series of cif files with consistent labelling.

This is a software for you if you have ever:

  • Misclicked and lost your 250-atom selection,
  • Tried to fit or calculate metrics for any plane or line,
  • Spent a day measuring distances and angles in tens of similar structures,
  • Had to redo measurements because of an offensively minor change,

Instead of relying on a graphical interface, picometer reads settings and instructions from an input .yaml file to probe one or many consistently-named structures concurrently. The results are output in a form of a .csv file, which can be then opened in a spreadsheet editor for further analysis. Because of that, picometer is a handy tool to save time on dumb repeatable labor and focus on what really matters.

Installation

If you are installing python solely to run picometer or are not concerned about introducing additional dependencies, installing picometer is as simple as running:

pip install picometer

However, it is advised to install picometer in a designated virtual environment. This is best achieved by following the linked instructions, but can be otherwise summarised as follows:

  1. Make sure you have Python 3.10+ installed: python --version
  2. Create a virtual environment using i.e. venv: python -m venv /path/to/virtual_environment
  3. Activate your virtual environment:
    • Windows: \path\to\virtual_environment\Scripts\activate
    • Unix/macOS: source /path/to/virtual_environment/bin/activate
  4. Install picometer and its dependencies: pip install picometer

The code is currently updated with an intention to be available for download directly from pip:

$ pip install picometer

Usage

Whenever you want to use picometer, first re-activate the virtual environment created during installation following instructions therein. Running the program with no arguments produces the help string.

python -m picometer
usage: picometer [-h] filename

Precisely define and measure across multiple crystal structures

positional arguments:
  filename    Path to yaml file with routine settings and instructions

options:
  -h, --help  show this help message and exit

Author: Daniel Tchoń, baharis @ GitHub

Picometer inputs its settings and instructions from an input .yaml file. The file can contain a dictionary of settings, as well as a list of instructions. The list of instructions, called also a "routine", must include only single-element maps in the - instruction: detail or - instruction: {details} format. Examples of instruction files are available in the tests directory. The easiest way to generate your file is to prepare it based on the example provided.

Instructions

The following instructions are currently supported by picometer:

  • Input/output instructions
    • load model from a cif file, given filename or mapping syntax: {path: filename.cif, block: cif_block}.
    • write table with all evaluations to a csv file.
  • Selection instructions
    • select atoms, groups, or shapes to be used; use raw element names or provide symmetry relation / recenter using mapping syntax, for example: {label: C(11), symm: x;-y;z+1/2, at: Fe(1)}. By default, selection is cleared after calling select with no arguments or calling an aggregating or evaluating instruction.
    • recenter selection around a new centroid; this action is applied to every selected item individually, so to recenter fixed group of atoms, group them first and recenter this group - otherwise you will recenter individual atoms instead.
  • Aggregation instructions
    • group current selection into a new object with fixed elements.
    • fit centroid to the current atom / centroid selection;
    • fit line to the current atom / centroid selection;
    • fit plane to the currect atom / centroid selection;
  • Evaluation instructions
    • measure distance between 2 selected objects; if the selection includes groups of atoms, measure closes distance to the group of atoms.
    • measure angle between 2–6 selected objects; if the selection includes (ordered) atoms, calculate direct or dihedral angle between presumed bonds.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

picometer was created by Daniel Tchoń. It is licensed under the terms of the MIT license.

Credits

This software has been written as a hobby project of Daniel Tchoń (email: dtchon at lbl dot gov, or other address currectly available on https://dtools.pl/about/). All contributions and suggestions are heartily welcome!

picometer was created with the help of cookiecutter and the py-pkgs-cookiecutter template. It is published with the help of poetry, Python Semantic Versioning, and Gitmoji.

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

picometer-0.1.3.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

picometer-0.1.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file picometer-0.1.3.tar.gz.

File metadata

  • Download URL: picometer-0.1.3.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for picometer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 44394c3816114984d220b1f539906856fb37f71292038f874a0c490d8bfbf691
MD5 5f1686ef6de0065473386fa669466c95
BLAKE2b-256 0ca0259e14ada6d12c2426221078b7d25e4544de05f5b2c76b40ef386b572bda

See more details on using hashes here.

File details

Details for the file picometer-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: picometer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for picometer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 809b0cb2c73ac56e960903be12a2538356287818f5ba764893c9b22af8c3f260
MD5 62986440719fff4c8896f224b389d277
BLAKE2b-256 2f26531a8677743b06741df16b8edc2619713550b77f92a96acf90dc3a244da9

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