# Crystallite Size Calculator
**crystallite-size-calculator** is a Python module designed to estimate
the average crystallite sizes and microstrain from powder X-ray diffraction (PXRD) data.
It provides methods based on the envelope function, Williamson-Hall method, Warren-Averbach method,
and Scherrer equation to accurately compute crystallite sizes and microstrains.
## Features
- Compute the radial distribution function (RDF) from PXRD data.
- Estimate average crystallite size using the envelope function approach.
- Calculate crystallite size and microstrain using the Williamson-Hall method.
- Compute crystallite size using the Scherrer and modified Scherrer equations.
- Support for advanced strain and crystallite size analysis using the Warren-Averbach method.
## Installation
To install the **crystallite-size-calculator** module, use `pip`:
```bash
pip install crystallite_size_calculator
```
## Eaxamples
# Crystallite Size Calculator - CIF File Examples
Below are examples demonstrating how to use the **crystallite-size-calculator** module to load CIF files, compute crystallite sizes, and analyze microstrain.
### 1. Loading a CIF File and Computing Crystallite Size
You can load a crystal structure from a CIF file and compute the crystallite size using the envelope function approach.
```python
from crystallite_size_calculator.crystallite_size import ComputeCrystalSizes
# Provide the path to your CIF file
cif_file = "example_structure.cif"
# Initialize the ComputeCrystalSizes class with the CIF file
calculator = ComputeCrystalSizes(cif_file=cif_file)
# Compute the crystallite size using the envelope function approach
d_crys = calculator.compute_crystallite_size_from_envelope_function()
print(f"Crystallite size from CIF file: {d_crys:.2f} nm")
# Compute crystallite size and strain using the Williamson-Hall method
strain, d_crys = calculator.size_strain_from_williamson_hall_method()
print(f"Crystallite size: {d_crys:.2f} nm, Microstrain: {strain:.4f}")
# Compute crystallite size using the Scherrer equation
d_crys = calculator.size_from_scherrer_eq()
print(f"Crystallite size using Scherrer equation: {d_crys:.2f} nm")
# Compute crystallite size and strain using the Warren-Averbach method
strain, d_crys = calculator.size_and_strain_from_warren_averbach_method()
print(f"Crystallite size: {d_crys:.2f} nm, Microstrain: {strain:.4f}")
# Compute the radial distribution function (RDF) from the CIF file
r, g_r = calculator.compute_rdf_from_diffraction_pattern()
# Print the first few r and g(r) values
print("r values:", r[:5])
print("g(r) values:", g_r[:5])
```
Raw data
{
"_id": null,
"home_page": null,
"name": "crystallite-size-calculator",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Dinga Wonanke",
"author_email": "bafgreat@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3f/a3/ac52dabcc1462d089450848c825eda4decf180795e3c27326f26d9fe363c/crystallite_size_calculator-0.1.0.tar.gz",
"platform": null,
"description": "# Crystallite Size Calculator\n\n**crystallite-size-calculator** is a Python module designed to estimate\nthe average crystallite sizes and microstrain from powder X-ray diffraction (PXRD) data.\nIt provides methods based on the envelope function, Williamson-Hall method, Warren-Averbach method,\n and Scherrer equation to accurately compute crystallite sizes and microstrains.\n\n## Features\n\n- Compute the radial distribution function (RDF) from PXRD data.\n- Estimate average crystallite size using the envelope function approach.\n- Calculate crystallite size and microstrain using the Williamson-Hall method.\n- Compute crystallite size using the Scherrer and modified Scherrer equations.\n- Support for advanced strain and crystallite size analysis using the Warren-Averbach method.\n\n## Installation\n\nTo install the **crystallite-size-calculator** module, use `pip`:\n\n```bash\npip install crystallite_size_calculator\n```\n\n## Eaxamples\n# Crystallite Size Calculator - CIF File Examples\n\nBelow are examples demonstrating how to use the **crystallite-size-calculator** module to load CIF files, compute crystallite sizes, and analyze microstrain.\n\n### 1. Loading a CIF File and Computing Crystallite Size\n\nYou can load a crystal structure from a CIF file and compute the crystallite size using the envelope function approach.\n\n```python\nfrom crystallite_size_calculator.crystallite_size import ComputeCrystalSizes\n\n# Provide the path to your CIF file\ncif_file = \"example_structure.cif\"\n\n# Initialize the ComputeCrystalSizes class with the CIF file\ncalculator = ComputeCrystalSizes(cif_file=cif_file)\n\n# Compute the crystallite size using the envelope function approach\nd_crys = calculator.compute_crystallite_size_from_envelope_function()\nprint(f\"Crystallite size from CIF file: {d_crys:.2f} nm\")\n\n# Compute crystallite size and strain using the Williamson-Hall method\nstrain, d_crys = calculator.size_strain_from_williamson_hall_method()\nprint(f\"Crystallite size: {d_crys:.2f} nm, Microstrain: {strain:.4f}\")\n\n# Compute crystallite size using the Scherrer equation\nd_crys = calculator.size_from_scherrer_eq()\nprint(f\"Crystallite size using Scherrer equation: {d_crys:.2f} nm\")\n\n# Compute crystallite size and strain using the Warren-Averbach method\nstrain, d_crys = calculator.size_and_strain_from_warren_averbach_method()\nprint(f\"Crystallite size: {d_crys:.2f} nm, Microstrain: {strain:.4f}\")\n\n\n# Compute the radial distribution function (RDF) from the CIF file\nr, g_r = calculator.compute_rdf_from_diffraction_pattern()\n# Print the first few r and g(r) values\nprint(\"r values:\", r[:5])\nprint(\"g(r) values:\", g_r[:5])\n```",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.1.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "447b81bd1ba23da0a979443e80e4dc8e28efedb19dab7e525b5931fb4f7d60a6",
"md5": "d90cb438b439617c6d02230320f8b177",
"sha256": "980d40ce9a398d8e9efb9faf95e218a5a341546beb68f3e024a80bd1bc27a030"
},
"downloads": -1,
"filename": "crystallite_size_calculator-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d90cb438b439617c6d02230320f8b177",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 18096,
"upload_time": "2024-10-16T15:52:44",
"upload_time_iso_8601": "2024-10-16T15:52:44.875566Z",
"url": "https://files.pythonhosted.org/packages/44/7b/81bd1ba23da0a979443e80e4dc8e28efedb19dab7e525b5931fb4f7d60a6/crystallite_size_calculator-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fa3ac52dabcc1462d089450848c825eda4decf180795e3c27326f26d9fe363c",
"md5": "19f0cbb8ee4df7988354defe9fbd5209",
"sha256": "579a4c435fabaa72abdba27e4f840822dd8b96f99bb5936c5f51b4889acca778"
},
"downloads": -1,
"filename": "crystallite_size_calculator-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "19f0cbb8ee4df7988354defe9fbd5209",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 15947,
"upload_time": "2024-10-16T15:52:46",
"upload_time_iso_8601": "2024-10-16T15:52:46.491974Z",
"url": "https://files.pythonhosted.org/packages/3f/a3/ac52dabcc1462d089450848c825eda4decf180795e3c27326f26d9fe363c/crystallite_size_calculator-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-16 15:52:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "crystallite-size-calculator"
}