mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 18:16:03 +01:00
[py3] Be sure to properly use floor division in various places
This commit is contained in:
parent
2b673f7926
commit
484e10ef1f
@ -266,7 +266,7 @@ class ConfigParameters:
|
||||
mat = np.array(rows)
|
||||
else:
|
||||
err_mess = "Complex matrix must contain 2*M values:\n%s"%(par_str)
|
||||
assert 2 * (nm / 2) == nm, err_mess
|
||||
assert 2 * (nm // 2) == nm, err_mess
|
||||
|
||||
tmp = np.array(rows, dtype=np.complex128)
|
||||
mat = tmp[:, 0::2] + 1.0j * tmp[:, 1::2]
|
||||
|
@ -135,8 +135,8 @@ class ProjectorShell:
|
||||
assert nrow%nion == 0, "Number of rows in TRANSFILE must be divisible by the number of ions"
|
||||
assert ncol%nm == 0, "Number of columns in TRANSFILE must be divisible by the number of orbitals 2*l + 1"
|
||||
|
||||
nr = nrow / nion
|
||||
nsize = ncol / nm
|
||||
nr = nrow // nion
|
||||
nsize = ncol // nm
|
||||
assert nsize in (1, 2, 4), "Number of columns in TRANSFILE must be divisible by either 1, 2, or 4"
|
||||
#
|
||||
# Determine the spin-dimension and whether the matrices are real or complex
|
||||
@ -154,11 +154,11 @@ class ProjectorShell:
|
||||
# is_complex = True
|
||||
#
|
||||
is_complex = nsize > 1
|
||||
ns_dim = max(1, nsize / 2)
|
||||
ns_dim = max(1, nsize // 2)
|
||||
|
||||
# Dimension of the orbital subspace
|
||||
assert nr%ns_dim == 0, "Number of rows in TRANSFILE is not compatible with the spin dimension"
|
||||
ndim = nr / ns_dim
|
||||
ndim = nr // ns_dim
|
||||
|
||||
self.tmatrices = np.zeros((nion, nr, nm * ns_dim), dtype=np.complex128)
|
||||
|
||||
@ -181,7 +181,7 @@ class ProjectorShell:
|
||||
assert ncol%nm == 0, "Number of columns in TRANSFORM must be divisible by the number of orbitals 2*l + 1"
|
||||
|
||||
# Only spin-independent matrices are expected here
|
||||
nsize = ncol / nm
|
||||
nsize = ncol // nm
|
||||
assert nsize in (1, 2), "Number of columns in TRANSFORM must be divisible by either 1 or 2"
|
||||
|
||||
is_complex = nsize > 1
|
||||
|
@ -701,7 +701,7 @@ def read_symmcar(vasp_dir, symm_filename='SYMMCAR'):
|
||||
line = next(sym_file)
|
||||
# Permutations (in chunks of 20 indices per line)
|
||||
for it in range(ntrans):
|
||||
for ibl in range((nion - 1) / 20 + 1):
|
||||
for ibl in range((nion - 1) // 20 + 1):
|
||||
i1 = ibl * 20
|
||||
i2 = (ibl + 1) * 20
|
||||
line = next(sym_file)
|
||||
|
@ -60,7 +60,7 @@ for i in range(5):
|
||||
assert 'ud_{}'.format(i) in SK.gf_struct_solver[0], "missing block"
|
||||
assert SK.gf_struct_solver[0]['ud_{}'.format(i)] == list(range(2)), "wrong block size"
|
||||
for i in range(10):
|
||||
assert SK.sumk_to_solver[0]['ud',i] == ('ud_{}'.format(i/2), i%2), "wrong mapping"
|
||||
assert SK.sumk_to_solver[0]['ud',i] == ('ud_{}'.format(i//2), i%2), "wrong mapping"
|
||||
|
||||
assert len(SK.deg_shells[0]) == 2, "wrong number of equivalent groups found"
|
||||
assert sorted([len(d) for d in SK.deg_shells[0]]) == [2,3], "wrong number of members in the equivalent groups found"
|
||||
@ -103,7 +103,7 @@ for i in range(5):
|
||||
assert 'ud_{}'.format(i) in SK.gf_struct_solver[0], "missing block"
|
||||
assert SK.gf_struct_solver[0]['ud_{}'.format(i)] == list(range(2)), "wrong block size"
|
||||
for i in range(10):
|
||||
assert SK.sumk_to_solver[0]['ud',i] == ('ud_{}'.format(i/2), i%2), "wrong mapping"
|
||||
assert SK.sumk_to_solver[0]['ud',i] == ('ud_{}'.format(i//2), i%2), "wrong mapping"
|
||||
|
||||
assert len(SK.deg_shells[0]) == 2, "wrong number of equivalent groups found"
|
||||
assert sorted([len(d) for d in SK.deg_shells[0]]) == [2,3], "wrong number of members in the equivalent groups found"
|
||||
|
Loading…
Reference in New Issue
Block a user