Skip to main content

Precisely define and calculate measurements across multiple crystal structures

Project description

picometer

codecov CodeFactor Documentation Status

This is a little Python 3.10+ suite which aims to precisely define and calculate measurements across multiple crystal structures. This is a software for you if you have ever:

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

Instead of relying on a graphical interface and evaluating a single structure at a time, picometer uses an input yaml file with individual settings and consecutive instructions to probe multiple 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

In order to use picometer:

  1. Clone (download) the git repository to your computer;
  2. Make sure you have Python version 3.10+ installed;
  3. Create a virtual environment using i.e. venv: python -m venv /path/to/virtual_environment
  4. Activate your virtual environment: use /path/to/virtual_environment on Windows or source /path/to/virtual_environment on Linux/MacOS;
  5. Install required python packages: pip install -r requirements.txt
  6. Test your installation by running python -m unittest

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 picometer_process.py
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

In order to know what to do, picometer requires an input file with (settings and) instructions. This file should follow yaml format and the list of instructions, called "routine", must include only single-element maps in the instruction: details format. An example of instruction file is available in tests directory. The easiest way to generate your file is to manually write 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.

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.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

picometer-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: picometer-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for picometer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b666eaecfbd3f9d40ec84f34e1eff05b7b9c87c5287b221aa66ccd4847481605
MD5 f5bd4fdeee8efd43050a9af6d056fbf7
BLAKE2b-256 a4cd93b177cc258d265cf86feb1396e1e598fceae1405ae034d4f7ed8d6d6b3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: picometer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for picometer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0130e7c15670e4626eb91507c2538c54cfaf29b59212211fc9fbc5df219a399a
MD5 13d4c3dc8f610d1f2479a2535e545c40
BLAKE2b-256 a2d2cac9261129800287572aab97f76f0109cb58dc34d8eab876bcc37be1775c

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