Esempio n. 1
0
        content = freq_file.readlines()
    index = 2
    while index < len(content):
        line = content[index].strip()
        if line == '':
            break

        line = list(map(float, space.split(line)))
        coordinates.append(np.array([line[0], line[1], line[2]]))
        dcoordinates.append(np.array([line[3], line[4], line[5]]))
        index += 1

    return np.stack(coordinates), np.stack(dcoordinates)


_, _, elements, num_atoms, _, _, _, _ = readVasp(sys.argv[1])
frames = int(sys.argv[-2])
dframe = 1 / float(frames)
scale = float(sys.argv[-1])

print('')
print('################ This script makes animation of vibration ################')
print('')
for freq_file in sys.argv[2:-2]:
    print('                            Processing %s' % freq_file)
    freq_pos, vibration = readFreq(freq_file)

    num_structures = 0
    coordinates = []

    # 0→1
Esempio n. 2
0
    print("")
    print("Usage: %s line1,line2,.... T/F vaspfile" %
          sys.argv[0].split('/')[-1])
    print("the format of line1,line2,... can be either x or x-x")
    print("try again")
    print("")
    exit(1)

flag = sys.argv[-2]
if flag != 'T' and flag != 'F':
    print('')
    print("error: unidentified flag %s" % flag)
    print('')
    exit(1)

lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, coordinates, selective = readVasp(
    sys.argv[-1])

edit_line_number = []
pattern = re.compile(r'-')
if len(sys.argv) == 4:
    line_number = re.split(',', sys.argv[1])
    for num in line_number:
        if pattern.search(num):
            num_list = pattern.split(num)
            num_list[0] = int(num_list[0]) - 1
            num_list[1] = int(num_list[1])
            for i in range(num_list[0], num_list[1]):
                edit_line_number.append(i)
        else:
            edit_line_number.append(int(num) - 1)
Esempio n. 3
0
#!/bin/env python3

import sys
from VASP import readVasp

threshold = 0.001
if len(sys.argv) == 4:
    threshold = float(sys.argv[3])
elif len(sys.argv) != 3:
    print('')
    print("usage: poscar.py POSCAR1 POSCAR2 threshold")
    print("try again!")
    print('')
    exit(1)

lattice1, basis1, elements1, num_atoms1, selectiveflag1, coordinate_type1, coordinates1, selective1 = readVasp(sys.argv[1])
lattice2, basis2, elements2, num_atoms2, selectiveflag2, coordinate_type2, coordinates2, selective2 = readVasp(sys.argv[2])


if abs(lattice1 - lattice2) > threshold:
    print('')
    print("Lattices are different:")
    print("%s: %10.5f" % (sys.argv[1], lattice1))
    print("%s: %10.5f" % (sys.argv[2], lattice2))
    print('')

basis_diff = []
for i in range(0, 3):
    for j in range(0, 3):
        if abs(basis1[i][j] - basis2[i][j]) > threshold:
            basis_diff.append([i, j, basis1[i][j] - basis2[i][j]])
Esempio n. 4
0
#!/bin/env python3

import sys
from VASP import readVasp
from VASP import writeVasp

if len(sys.argv) == 1:
    print('')
    print('Usage: %s vasp_file1 vasp_file2 ...' % sys.argv[0].split('/')[-1])
    print('')
    exit(1)

print('')
print('############ This script converts direct to cartesian ############')
print('          ############ direct -> cartesian ############')
print('')
for vasp_file in sys.argv[1:]:
    print('                      processing %s' % vasp_file)
    lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, coordinates, selective = readVasp(vasp_file)
    if vasp_file.endswith('.vasp'):
        vasp_file = '%s-C.vasp' % vasp_file[:-5]
    else:
        vasp_file = '%s-C.vasp' % vasp_file
    writeVasp(vasp_file, lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, coordinates, selective)

print('')
print('                   ---------- Done ----------')
print('')
Esempio n. 5
0
import sys
from VASP import readGjf, readVasp, writeVasp

if len(sys.argv) == 1:
    print('')
    print('Usage: %s POSCAR gjf_file1 gjf_file2 ...' %
          sys.argv[0].split('/')[-1])
    print('')
    exit(1)

print('')
print(
    '############### This script converts vasp file into gview file ###############'
)
print('')
lattice, basis, _, _, selectiveflag, coordinate_type, _, selective = readVasp(
    sys.argv[1])
for gjf_file in sys.argv[2:]:
    print('                             Processing %s' % gjf_file)
    elements, num_atoms, coordinates = readGjf(gjf_file)
    if gjf_file.endswith('.gjf'):
        gjf_file = '%s.vasp' % gjf_file[:-4]
    else:
        gjf_file = '%s.vasp' % gjf_file
    writeVasp(gjf_file, lattice, basis, elements, num_atoms, selectiveflag,
              coordinate_type, coordinates, selective)

print('')
print('               --------------------  DONE  --------------------')
print('')