1
1
import warnings
2
2
import struct
3
3
import numpy as np
4
+ import pyscf
4
5
from qstack .mathutils .matrix import from_tril
5
6
from qstack .tools import reorder_ao
6
7
@@ -41,6 +42,16 @@ def read_density(mol, basename, directory='./', version=500, openshell=False, re
41
42
else :
42
43
dm = np .fromfile (path [0 ], offset = 8 , count = mol .nao * mol .nao * nspin ).reshape ((nspin ,mol .nao ,mol .nao ))
43
44
45
+
46
+ is_def2 = 'def2' in pyscf .gto .basis ._format_basis_name (mol .basis )
47
+ has_3d = np .any ([21 <= pyscf .data .elements .charge (q ) <= 30 for q in mol .elements ])
48
+ if is_def2 and has_3d :
49
+ msg = f'\n { path } :\n Basis set is not sorted wrt angular momenta for 3d elements.\n Better use a gbw file.'
50
+ warnings .warn (msg )
51
+ if reorder_dest is not None :
52
+ msg = f'\n Density matrix reordering for ORCA to { reorder_dest } may be compromised.'
53
+ warnings .warn (msg )
54
+
44
55
if reorder_dest is not None :
45
56
dm = np .array ([reorder_ao (mol , i , src = 'orca' , dest = reorder_dest ) for i in dm ])
46
57
@@ -126,7 +137,6 @@ def _reorder_coeff(c):
126
137
for i in range (len (c )):
127
138
c [:,i ] = c [indices_full ,i ]
128
139
129
-
130
140
for i in range (len (c )):
131
141
c [:,i ] = reorder_ao (mol , c [:,i ], src = 'orca' , dest = reorder_dest )
132
142
[_reorder_coeff (c_full [i ]) for i in range (c_full .shape [0 ])]
@@ -137,7 +147,7 @@ def read_gbw(mol, fname, reorder_dest='pyscf', sort_l=True):
137
147
138
148
ls = {iat : lsiat for iat , lsiat in ls .items () if np .any (lsiat != sorted (lsiat ))}
139
149
if ls and not sort_l :
140
- msg = f'{ fname } : basis set is not sorted wrt angular momenta for atoms # { list (ls .keys ())} and is kept as is'
150
+ msg = f'\n { fname } : basis set is not sorted wrt angular momenta for atoms # { list (ls .keys ())} and is kept as is'
141
151
warnings .warn (msg )
142
152
143
153
if reorder_dest is not None :
0 commit comments