Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 3 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fcc_ge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
eigs_k.append(eigs)

eigs_k = np.array(eigs_k).T
print eigs_k[:,-1]
print(eigs_k[:,-1])
draw_band(kpts_len, eigs_k)


Expand Down
8 changes: 5 additions & 3 deletions hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def calc_g(self, kpt):
phase = np.exp(2.*np.pi*1j * np.dot(kpt_cart, dist_vec))
g_mat[image_ind, ind_1, ind_2] = phase
# non-translated image_ind is self.system.structure.max_image/2
g_mat[self.system.structure.max_image/2, :, :] += np.eye(self.n_orbitals, dtype=complex)
g_mat[self.system.structure.max_image//2, :, :] += np.eye(self.n_orbitals, dtype=complex)
return g_mat

def calc_ham_wo_k(self):
Expand Down Expand Up @@ -109,8 +109,10 @@ def get_ind(atom_1_i, orbit_1_i, element_1, orbit_1):

onsite_i = self.system.get_onsite_term(atom_i)

self.H_wo_g[self.system.structure.max_image/2,
H_ind: H_ind+len_orbitals, H_ind: H_ind+len_orbitals] = onsite_i
#print(self.system.structure.max_image//2, H_ind, (H_ind+len_orbitals), H_ind,(H_ind+len_orbitals) )
#exit()
self.H_wo_g[self.system.structure.max_image//2,
(H_ind):(H_ind+len_orbitals), (H_ind):(H_ind+len_orbitals)] = onsite_i
H_ind += len_orbitals


Expand Down
2 changes: 1 addition & 1 deletion sys_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ def get_kpts(self):
sys_input = Sys_input('./input_Jancu_PRB_76_115202_2007.yaml')
sys = sys_input.system

print sys.get_soc_mat()
print(sys.get_soc_mat())
# struct = sys.structure
4 changes: 2 additions & 2 deletions system.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def calc_volume(self, atom_i):
assert len(d_mat) == 4, 'tetrahedron required! # of bond = {}'.format(len(d_mat))
a, b, c, d = d_mat
vol = 1/6. * np.linalg.det([a-d, b-d, c-d])
print vol
print(vol)

def get_onsite_term(self, atom_i):
""" calc onsite term
Expand Down Expand Up @@ -225,7 +225,7 @@ def get_onsite_sd(beta, dir_cos):
if self.scale_params is None or \
(not atoms[atom_i].element in self.scale_params or \
self.scale_params[atoms[atom_i].element] is None):
print 'a'
print('a')
e_s = params['e_s']
if 'px' in atoms[atom_i].orbitals:
e_p = params['e_p']
Expand Down
2 changes: 1 addition & 1 deletion tb_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def get_hop_int(V_sss=0, V_sps=0, V_pps=0, V_ppp=0,
V_SSs=0, V_sSs=0, V_Sps=0, V_Sds=0,
l=0, m=0, n=0):

hop_int = [[None for _ in xrange(10)] for __ in xrange(10)]
hop_int = [[None for _ in range(10)] for __ in range(10)]

hop_int[0][0] = V_sss
hop_int[0][1] = l * V_sps
Expand Down
20 changes: 10 additions & 10 deletions vasp_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def _parse_kpt(line):
energy_list = np.array(energy_list).reshape(shape_e)
K_list = np.array(K_list).reshape(shape_K)
return kpt_list_prim, k_wt_list_prim, energy_list, K_list, kpt_list
except Exception, e:
print e
except e:
print(e)
raise e


Expand Down Expand Up @@ -208,7 +208,7 @@ def _parse_proj_phase(line, n_orbits):
n_kpts, n_bands, n_ions, n_orbits, orbit_names = \
_parse_procar_metadata(procar)

print n_orbits
print(n_orbits)

Proj = np.zeros((n_kpts, n_bands, n_ions, n_orbits), float)
Proj_cmplx = np.zeros((n_kpts, n_bands, n_ions, n_orbits), complex)
Expand Down Expand Up @@ -265,10 +265,10 @@ def _parse_proj_phase(line, n_orbits):
return Kpts, k_wt, Eigs, Proj, Proj_cmplx, Occs
else:
return Kpts, k_wt, Eigs, Proj, Occs
except Exception, e:
print e
print line
print 'fail to read {}'.format(file_name)
except e:
print (e)
print (line)
print ('fail to read {}'.format(file_name))


def readPROCAR(fileName='PROCAR', orbital=-1):
Expand Down Expand Up @@ -379,7 +379,7 @@ def readCONTCAR(fileName='CONTCAR', rtspecies=False, rt_comment=False):
if DorC[0]=='D' or DorC[0]=='d' : # Direct
coord = latticeVecs[0]*coord[0]+latticeVecs[1]*coord[1]+latticeVecs[2]*coord[2]
else:
print "check coord! it's not direct form"
print ("check coord! it's not direct form")

atomSet.append([symbol,coord])
k += 1
Expand Down Expand Up @@ -706,7 +706,7 @@ def get_eps(OUTCAR='./OUTCAR'):
eps = [item for idx, item in enumerate(eps) if idx % 2 == 0]
return eps
except IOError as e:
print "I/O error({0}): {1}".format(e.errno, e.strerror)
print ("I/O error({0}): {1}".format(e.errno, e.strerror))
return None

def readTRANCAR(dir_name, file_name='TRANCAR'):
Expand Down Expand Up @@ -833,4 +833,4 @@ def read_stress(dir_name, filre_name='OUTCAR'):
# readPROCAR_phase(procar_12 + '/PROCAR')
# readPRJCAR('/home/users/nwan/cj01/00_NW/R3/00_pristine/unfold/bulk/00_222/PRJCAR')
stress = read_stress('./')
print stress
print (stress)