lineshape_tools 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
@@ -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"
lineshape_tools/cli.py CHANGED
@@ -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]
@@ -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 -->
@@ -0,0 +1,20 @@
1
+ lineshape_tools-0.1.2.dist-info/METADATA,sha256=BXG4V2PE1x4bPk2pa7fWRbO7wFYFM0vxrgytGqlznVU,3677
2
+ lineshape_tools-0.1.2.dist-info/WHEEL,sha256=Wb0ASbVj8JvWHpOiIpPi7ucfIgJeCi__PzivviEAQFc,90
3
+ lineshape_tools-0.1.2.dist-info/entry_points.txt,sha256=UXygiyrvvwic-jiUrHINzx3lUR27qjyd1BJRY6S1Mdg,86
4
+ lineshape_tools-0.1.2.dist-info/licenses/LICENSE,sha256=2AJLb-6XbTVThSycPkXkvDVAf697F5rbWWY8SicUdf4,1074
5
+ lineshape_tools/__init__.py,sha256=aQaLQQHq0Nyf1_4NNTGKXls23J9qpETklvJXyN6GRpw,213
6
+ lineshape_tools/__main__.py,sha256=X3QJ708vxRsHQhZkYDIDZlwQC0HuBO2bzZmN41KXutM,1250
7
+ lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func-128.py311.1.nbc,sha256=_3BI5pjGXDDN1HAB8ZaShO60thkupbe5qfuKJTRXFZM,258854
8
+ lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func-128.py311.nbi,sha256=999q880zQH3rZcqOToQ94g1sevjIIQrXRniHGcG88Ck,1752
9
+ lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func_zeroT-92.py311.1.nbc,sha256=CmqIjKX5WxjnFpm26F2JhUpA1U9lyxZY-rt5uvpxlZs,151685
10
+ lineshape_tools/__pycache__/lineshape._do_compute_phonon_spec_func_zeroT-92.py311.nbi,sha256=6GW6popeklgbeGmlIaW396LZyeXKQOZV-mAwApirKzo,1755
11
+ lineshape_tools/__pycache__/lineshape.gaussian-26.py311.1.nbc,sha256=mKBwgnhBXFRLHJYh2VRPY9mt6txhH4eNo0B63_0PCX4,30231
12
+ lineshape_tools/__pycache__/lineshape.gaussian-26.py311.nbi,sha256=4i8Jmz968WrJshLUQGQFU0CMn2biEQoxXvsmgGnvN1M,1317
13
+ lineshape_tools/__pycache__/lineshape.lorentzian-32.py311.1.nbc,sha256=PHMHumjybDinzvEgW_045EFobJRldbJhvSbBzZNexfI,28028
14
+ lineshape_tools/__pycache__/lineshape.lorentzian-32.py311.nbi,sha256=VDnI92WrDEOuhT_9dlqIahDhdDOKpAnweuiPHWko8UI,1319
15
+ lineshape_tools/cli.py,sha256=342cwe19_7Aa3nYvU20OHH-LlIAlcjsZFoDBsvXdZjU,39218
16
+ lineshape_tools/constants.py,sha256=fNcTHWHajyIYbTnEM4sHHygL7MqEuULjZl_Pf2ojrE0,122
17
+ lineshape_tools/lineshape.py,sha256=bkdOi2pt_EiKVkpoMdWvVlYLfvp1AgWOFRVQyR2lBUY,9704
18
+ lineshape_tools/phonon.py,sha256=Lk8zVB_02Vzr-rvrVxqn3Bpj2PhxZSwThWuNSFCfl0c,2350
19
+ lineshape_tools/plot.py,sha256=YEeLWjQSSvid9BCcj0jfl654WGQn0FdNUDY9smCHI3Q,9932
20
+ lineshape_tools-0.1.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.5)
2
+ Generator: pdm-backend (2.4.7)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,12 +0,0 @@
1
- lineshape_tools-0.1.0.dist-info/METADATA,sha256=UYMiULDQVB3Qxs8iyegVM7P_GqIeqA-zj20aJkbSUY0,3144
2
- lineshape_tools-0.1.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- lineshape_tools-0.1.0.dist-info/entry_points.txt,sha256=UXygiyrvvwic-jiUrHINzx3lUR27qjyd1BJRY6S1Mdg,86
4
- lineshape_tools-0.1.0.dist-info/licenses/LICENSE,sha256=2AJLb-6XbTVThSycPkXkvDVAf697F5rbWWY8SicUdf4,1074
5
- lineshape_tools/__init__.py,sha256=53s3VgTNA50ob3hx8kxlAkQG4LYqyeyabd8ELC1jVxQ,213
6
- lineshape_tools/__main__.py,sha256=X3QJ708vxRsHQhZkYDIDZlwQC0HuBO2bzZmN41KXutM,1250
7
- lineshape_tools/cli.py,sha256=w2R216EP626ZHkOUneATSV8-nMtt6XrxIqYERhakqOM,38574
8
- lineshape_tools/constants.py,sha256=fNcTHWHajyIYbTnEM4sHHygL7MqEuULjZl_Pf2ojrE0,122
9
- lineshape_tools/lineshape.py,sha256=bkdOi2pt_EiKVkpoMdWvVlYLfvp1AgWOFRVQyR2lBUY,9704
10
- lineshape_tools/phonon.py,sha256=Lk8zVB_02Vzr-rvrVxqn3Bpj2PhxZSwThWuNSFCfl0c,2350
11
- lineshape_tools/plot.py,sha256=YEeLWjQSSvid9BCcj0jfl654WGQn0FdNUDY9smCHI3Q,9932
12
- lineshape_tools-0.1.0.dist-info/RECORD,,