lineshape_tools 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/PKG-INFO +17 -12
  2. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/README.md +16 -11
  3. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/pyproject.toml +1 -1
  4. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/__init__.py +1 -1
  5. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func-128.py311.1.nbc +0 -0
  6. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func-128.py311.nbi +0 -0
  7. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func_zeroT-92.py311.1.nbc +0 -0
  8. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func_zeroT-92.py311.nbi +0 -0
  9. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape.gaussian-26.py311.1.nbc +0 -0
  10. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape.gaussian-26.py311.nbi +0 -0
  11. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape.lorentzian-32.py311.1.nbc +0 -0
  12. lineshape_tools-0.1.2/src/lineshape_tools/__pycache__/lineshape.lorentzian-32.py311.nbi +0 -0
  13. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/cli.py +15 -2
  14. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/LICENSE +0 -0
  15. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/__main__.py +0 -0
  16. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/constants.py +0 -0
  17. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/lineshape.py +0 -0
  18. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/phonon.py +0 -0
  19. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/src/lineshape_tools/plot.py +0 -0
  20. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/__init__.py +0 -0
  21. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/conftest.py +0 -0
  22. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/C_N-GaN.exc.extxyz.gz +0 -0
  23. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/C_N-GaN.gnd.extxyz.gz +0 -0
  24. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/FORCE_CONSTANTS +0 -0
  25. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/NV-diamond.exc.extxyz.gz +0 -0
  26. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/NV-diamond.gnd.extxyz.gz +0 -0
  27. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/dimer-hBN.exc.extxyz.gz +0 -0
  28. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/files/dimer-hBN.gnd.extxyz.gz +0 -0
  29. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/test_main.py +0 -0
  30. {lineshape_tools-0.1.0 → lineshape_tools-0.1.2}/tests/test_plot.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lineshape_tools
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Software to evaluate the optical lineshape function of a defect.
5
5
  Keywords: defect,luminescence,absorption,electron-phonon coupling,density functional theory
6
6
  Author-Email: "Mark E. Turiansky" <mark.e.turiansky.ctr@us.navy.mil>
@@ -38,6 +38,12 @@ Description-Content-Type: text/markdown
38
38
  In particular, it implements the approach pioneered by [Alkauskas *et al.*](https://doi.org/10.1088/1367-2630/16/7/073026) to compute the lineshape function within Huang-Rhys theory.
39
39
  The code interfaces with [`mace`](https://mace-docs.readthedocs.io/en/latest/) and [`phonopy`](https://phonopy.github.io/phonopy/) to evaluate the dynamical matrix and obtain the phonons of a defect-containing supercell.
40
40
 
41
+ _Key Features_:
42
+ - Compute the temperature-dependent luminescence and absorption spectrum
43
+ - Compatible with phonons computed directly with Phonopy
44
+ - Accelerate evaluation of phonons with `mace` foundation models
45
+ - Convenience tools to fine-tune a `mace` foundation model to your specific system
46
+
41
47
  ### Installation
42
48
  <!-- install start -->
43
49
  To install the latest version of `lineshape_tools`, create a new virtual environment and run
@@ -45,33 +51,32 @@ To install the latest version of `lineshape_tools`, create a new virtual environ
45
51
  pip install lineshape_tools
46
52
  ```
47
53
  <!-- install end -->
48
- For more installation information and some performance considerations, see the [Installation page]().
54
+ For more installation information and some performance considerations, see the [Installation page](https://lineshape-tools.readthedocs.io/en/latest/install.html).
49
55
 
50
56
  ### Usage
51
57
  `lineshape_tools` provides a command-line interface for interacting with the code. See
52
58
  ```
53
59
  lineshape_tools --help
54
60
  ```
55
- Detailed usage information can be found in the [Tutorials page]().
61
+ Detailed usage information can be found in the [Tutorials page](https://lineshape-tools.readthedocs.io/en/latest/tutorials.html).
56
62
 
57
63
  ### How to Cite
58
64
  <!-- cite start -->
59
65
  If you use this code, please consider citing
60
66
  ```bibtex
61
67
  @misc{turiansky_machine_2025,
62
- title = {Machine Learning for Fast and Accurate Optical Lineshapes of Defects},
63
- author = {Turiansky, Mark E. and Lyons, John L., and Bernstein, Noam},
68
+ title = {Machine Learning Phonon Spectra for Fast and Accurate Optical Lineshapes of Defects},
69
+ author = {Mark E. Turiansky and John L. Lyons and Noam Bernstein},
64
70
  year = {2025},
65
- number = {arXiv:XXXX.XXXXX},
66
- eprint = {XXXX.XXXXX},
67
- primaryclass = {cond-mat},
68
- publisher = {arXiv},
69
- doi = {},
70
- urldate = {},
71
+ number = {arXiv:2508.09113},
72
+ eprint = {2508.09113},
71
73
  archiveprefix = {arXiv},
74
+ primaryclass = {cond-mat.mtrl-sci},
75
+ doi = {10.48550/arXiv.2508.09113},
76
+ url = {https://arxiv.org/abs/2508.09113},
72
77
  }
73
78
  ```
74
79
  <!-- cite end -->
75
- Please also consider citing the foundational works that made this code possible on the [Citation page]().
80
+ Please also consider citing the foundational works that made this code possible on the [Citation page](https://lineshape-tools.readthedocs.io/en/latest/cite.html).
76
81
 
77
82
  <!-- index end -->
@@ -5,6 +5,12 @@
5
5
  In particular, it implements the approach pioneered by [Alkauskas *et al.*](https://doi.org/10.1088/1367-2630/16/7/073026) to compute the lineshape function within Huang-Rhys theory.
6
6
  The code interfaces with [`mace`](https://mace-docs.readthedocs.io/en/latest/) and [`phonopy`](https://phonopy.github.io/phonopy/) to evaluate the dynamical matrix and obtain the phonons of a defect-containing supercell.
7
7
 
8
+ _Key Features_:
9
+ - Compute the temperature-dependent luminescence and absorption spectrum
10
+ - Compatible with phonons computed directly with Phonopy
11
+ - Accelerate evaluation of phonons with `mace` foundation models
12
+ - Convenience tools to fine-tune a `mace` foundation model to your specific system
13
+
8
14
  ### Installation
9
15
  <!-- install start -->
10
16
  To install the latest version of `lineshape_tools`, create a new virtual environment and run
@@ -12,33 +18,32 @@ To install the latest version of `lineshape_tools`, create a new virtual environ
12
18
  pip install lineshape_tools
13
19
  ```
14
20
  <!-- install end -->
15
- For more installation information and some performance considerations, see the [Installation page]().
21
+ For more installation information and some performance considerations, see the [Installation page](https://lineshape-tools.readthedocs.io/en/latest/install.html).
16
22
 
17
23
  ### Usage
18
24
  `lineshape_tools` provides a command-line interface for interacting with the code. See
19
25
  ```
20
26
  lineshape_tools --help
21
27
  ```
22
- Detailed usage information can be found in the [Tutorials page]().
28
+ Detailed usage information can be found in the [Tutorials page](https://lineshape-tools.readthedocs.io/en/latest/tutorials.html).
23
29
 
24
30
  ### How to Cite
25
31
  <!-- cite start -->
26
32
  If you use this code, please consider citing
27
33
  ```bibtex
28
34
  @misc{turiansky_machine_2025,
29
- title = {Machine Learning for Fast and Accurate Optical Lineshapes of Defects},
30
- author = {Turiansky, Mark E. and Lyons, John L., and Bernstein, Noam},
35
+ title = {Machine Learning Phonon Spectra for Fast and Accurate Optical Lineshapes of Defects},
36
+ author = {Mark E. Turiansky and John L. Lyons and Noam Bernstein},
31
37
  year = {2025},
32
- number = {arXiv:XXXX.XXXXX},
33
- eprint = {XXXX.XXXXX},
34
- primaryclass = {cond-mat},
35
- publisher = {arXiv},
36
- doi = {},
37
- urldate = {},
38
+ number = {arXiv:2508.09113},
39
+ eprint = {2508.09113},
38
40
  archiveprefix = {arXiv},
41
+ primaryclass = {cond-mat.mtrl-sci},
42
+ doi = {10.48550/arXiv.2508.09113},
43
+ url = {https://arxiv.org/abs/2508.09113},
39
44
  }
40
45
  ```
41
46
  <!-- cite end -->
42
- Please also consider citing the foundational works that made this code possible on the [Citation page]().
47
+ Please also consider citing the foundational works that made this code possible on the [Citation page](https://lineshape-tools.readthedocs.io/en/latest/cite.html).
43
48
 
44
49
  <!-- index end -->
@@ -34,7 +34,7 @@ classifiers = [
34
34
  "Programming Language :: Python :: 3.12",
35
35
  "Programming Language :: Python :: 3.13",
36
36
  ]
37
- version = "0.1.0"
37
+ version = "0.1.2"
38
38
 
39
39
  [project.license]
40
40
  text = "MIT"
@@ -2,6 +2,6 @@
2
2
 
3
3
  __author__ = "Mark E. Turiansky"
4
4
  __email__ = "mark.e.turiansky.ctr@us.navy.mil"
5
- __version__ = "0.1.0"
5
+ __version__ = "0.1.2"
6
6
  __copyright__ = "Copyright (c) 2025 Mark E. Turiansky"
7
7
  __license__ = "MIT"
@@ -15,7 +15,7 @@ from cyclopts import Parameter
15
15
  from tqdm import tqdm
16
16
 
17
17
  from lineshape_tools.constants import omega2eV
18
- from lineshape_tools.lineshape import convert_A_to_L, gaussian, get_phonon_spec_func
18
+ from lineshape_tools.lineshape import convert_A_to_L, gaussian, get_phonon_spec_func, get_Stot
19
19
  from lineshape_tools.phonon import get_disp_vect, get_ipr, get_phonons
20
20
  from lineshape_tools.plot import plot_spec_funcs
21
21
 
@@ -37,6 +37,7 @@ def collect(
37
37
  rtol: float = 1e-5,
38
38
  config_weight: float = 1.0,
39
39
  force_weighting: bool = False,
40
+ allow_constraint: bool = False,
40
41
  ) -> None:
41
42
  """Collect and process data for fine-tuning.
42
43
 
@@ -66,6 +67,8 @@ def collect(
66
67
  force_weighting (bool): store a config_weight that's inversely proportional to the max
67
68
  force that any atom feels in the configuration [min(0.02 / max_fpa, 1)]. Overwrites
68
69
  the value specified by config_weight.
70
+ allow_constraint (bool): allow constraints on atoms (e.g. selective dynamics) to modify the
71
+ forces. This is typically not desirable.
69
72
  """
70
73
  if strategy.lower() not in ("none", "qr", "dx"):
71
74
  raise ValueError("invalid strategy choice")
@@ -79,6 +82,10 @@ def collect(
79
82
  read_atoms = ase.io.read(fname, read_index)
80
83
  total_read += len(read_atoms)
81
84
  for atoms in tqdm(read_atoms, desc="[*] processing atoms", disable=len(read_atoms) < 10):
85
+ if len(atoms.constraints) > 0 and not allow_constraint:
86
+ logger.debug("atoms are constrained, removing prior to extracting forces")
87
+ atoms.set_constraint(None)
88
+
82
89
  forces = atoms.get_forces()
83
90
  if min_force < np.linalg.norm(forces, axis=1).max() < max_force:
84
91
  atoms.info["REF_energy"] = atoms.get_potential_energy()
@@ -878,7 +885,11 @@ def compute_lineshape(
878
885
  fin_atoms: Atoms = ase.io.read(final) # type:ignore[assignment]
879
886
 
880
887
  if dE is None:
881
- dE = np.abs(fin_atoms.get_potential_energy() - ini_atoms.get_potential_energy())
888
+ try:
889
+ dE = np.abs(fin_atoms.get_potential_energy() - ini_atoms.get_potential_energy())
890
+ except RuntimeError:
891
+ logger.critical("input files do not contain total energy, so dE cannot be determined")
892
+ raise
882
893
  logger.info(f"energy difference not provided, found dE = {dE} from input structures")
883
894
 
884
895
  sqrt_mass = np.repeat(np.sqrt(fin_atoms.get_masses()), 3)
@@ -902,6 +913,8 @@ def compute_lineshape(
902
913
  omega, U = get_phonons(H)
903
914
  dq_k = U.T @ dq
904
915
 
916
+ logger.info(f"total Huang-Rhys factor Stot={get_Stot(dq_k, omega):.04f}")
917
+
905
918
  if gamma_psb is not None:
906
919
  logger.info("computing inverse participation ratios")
907
920
  ipr, ipr_cut, gamma_lvm = get_ipr(U), gamma_psb[0], gamma_psb[1]
File without changes