Skip to content

Commit 65c4622

Browse files
committed
Liam's comments
1 parent 3fbde38 commit 65c4622

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

qstack/io/metatensor.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@ def _tensormap_to_matrix(mol, tensor, fast=False):
300300
mol (pyscf.gto.Mole): pyscf Mole object.
301301
tensor (metatensor.TensorMap): tensor to transform.
302302
fast (bool): Whether to use a faster approach using assumptions
303-
on the internal ordering of the TensorMap. Default is False.
303+
on the internal ordering of the TensorMap. Default is False.
304+
Assumptions:
305+
* tensor keys are ordered as (o3_lambda1, o3_lambda2, center_type1, center_type2),
306+
* for each element, the basis functions are ordered wrt L,
307+
* the individual samples are ordered as nested itemizations of atom_i1,atom_i2,
308+
the components as that of m1,m2, the properties as that of n1,n2 in this order.
309+
This structure correstonds to `_matrix_to_tensormap()` output.
304310
305311
Returns:
306312
numpy.ndarray: 2D array (matrix) representation.
@@ -404,7 +410,8 @@ def tensormap_to_array(mol, tensor, dest='pyscf', fast=False):
404410
tensor (metatensor.TensorMap): Tensor to transform.
405411
dest (str): Destination AO ordering of the output array. Default is 'pyscf'.
406412
fast (bool): Whether to use a faster approach for matrix conversion
407-
using assumptions on the internal ordering of the TensorMap. Default is False.
413+
using assumptions on the internal ordering of the TensorMap
414+
(see `_tensormap_to_matrix()`). Default is False.
408415
409416
Returns:
410417
numpy.ndarray: Array representation (1D vector or 2D matrix).

qstack/io/turbomole.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def read_mos(mol, fname, reorder_dest='pyscf'):
2424
Returns:
2525
c (ndarray): AO coefficients, shape (nao, nmo).
2626
e (ndarray): Orbital energies, shape (nmo,).
27-
title (str): Title of the MOs set, e.g. '$scfmo', '$uhfmo_alpha', '$uhfmo_beta'.
27+
title (str): Title of the MOs set ('$scfmo', '$uhfmo_alpha', or '$uhfmo_beta').
2828
2929
Raises:
3030
RuntimeError: If the file format is invalid or unsupported.
@@ -34,7 +34,7 @@ def read_mos(mol, fname, reorder_dest='pyscf'):
3434

3535
title, _, fmt = lines[0].split()
3636
if title not in ['$scfmo', '$uhfmo_alpha', '$uhfmo_beta']:
37-
raise RuntimeError('Not a valid Turbomole MOs file')
37+
raise RuntimeError(f'Not a valid Turbomole MOs file or unsupported MO set ({title}). You can contribute!')
3838

3939
re_int = r'(\d+)'
4040
re_flt = r'([0-].\d+[Ee][+-]\d+)'

qstack/reorder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ def _get_idx(l, m, shell_start, convention):
141141
signs: Sign multipliers to convert from given convention to SA-GPR.
142142
143143
Raises:
144-
NotImplementedError: If the specified convention is not implemented or if l>4 for Turbomole convention.
144+
NotImplementedError: If the specified convention is not implemented
145+
or if Turbomole convention is used and functions with L>4 are present.
145146
"""
146147
convention = convention.lower()
147148
l_shells = l[shell_start]
@@ -164,7 +165,7 @@ def _get_idx(l, m, shell_start, convention):
164165
(https://en.wikipedia.org/wiki/Table_of_spherical_harmonics#Real_spherical_harmonics).
165166
"""
166167
if max(l)>_TURBOMOLE_MAX_L:
167-
raise NotImplementedError(f"Phase convention differences orbitals with l>{_TURBOMOLE_MAX_L} are not implemented yet. You can contribute!")
168+
raise NotImplementedError(f"Phase convention for orbitals with l>{_TURBOMOLE_MAX_L} are not implemented for {convention} yet. You can contribute!")
168169
signs[(l==3) & (m==-3)] = -1 # in pyscf order
169170
signs[(l==4) & (m==-3)] = -1 # in pyscf order
170171
signs[(l==4) & (m== 2)] = -1 # in pyscf order

0 commit comments

Comments
 (0)