Пример #1
0
    if len(elems) != len(rwigsMinRadii):
        sys.exit('Error: elems and rwigsMinRadii are not the same length!\n' \
                 'Check that you POSCAR and POTCAR match.')

    for i in range(len(elems)):
        rwigs[elems[i]] = rwigsMinRadii[i]

    return rwigs


def sphereVolume(r):
    return 4.0 / 3.0 * math.pi * (r**3)


crystal = readPOSCAR.readPOSCAR("POSCAR")

volume = crystal.getVolume()

print('==============================================================')
print('Volume of the crystal:', volume)

rwigs = readRWIGSFromPOTCAR("POTCAR")

print('RWIGS read from POTCAR:')
for key in rwigs:
    print(' ', key, ':', rwigs[key])

atoms = crystal.getAtoms()

totalAtomVolume = 0.0
Пример #2
0
filename = "charges.txt"
with open(filename, "r") as f:
  lines = f.readlines()
  for line in lines:
    if line.strip() == '': continue
    symbol = line.split()[0]
    charge = line.split()[1]
    charges[symbol] = charge

for root, dirs, files in os.walk('.'):
  for d in dirs:
    energy = vu.getOszicarFreeEnergy(d + "/OSZICAR")
    coords = '#Begin: ' + d + '\n'

    # c is of type Crystal
    c = rp.readPOSCAR(d + "/CONTCAR")
    if c.cartesian: c.convertAtomsToFractional()

    coords += 'cell\n'
    coords += (str(c.getA()) + '  ')
    coords += (str(c.getB()) + '  ')
    coords += (str(c.getC()) + '  ')
    coords += (str(c.rad2Deg(c.getAlpha())) + '  ')
    coords += (str(c.rad2Deg(c.getBeta())) + '  ')
    coords += (str(c.rad2Deg(c.getGamma())) + '\n')

    numAtoms = c.numAtoms()
    coords += ('fractional  ' + str(numAtoms) + '\n')

    atoms = c.atoms
Пример #3
0
filename = "charges.txt"
with open(filename, "r") as f:
  lines = f.readlines()
  for line in lines:
    if line.strip() == '': continue
    symbol = line.split()[0]
    charge = line.split()[1]
    charges[symbol] = charge

for root, dirs, files in os.walk('.'):
  for d in dirs:
    energy = vu.getOszicarFreeEnergy(d + "/OSZICAR")
    coords = '#Begin: ' + d + '\n'

    # c is of type Crystal
    c = rp.readPOSCAR(d + "/CONTCAR")
    if c.cartesian: c.convertAtomsToFractional()

    coords += 'cell\n'
    coords += (str(c.getA()) + '  ')
    coords += (str(c.getB()) + '  ')
    coords += (str(c.getC()) + '  ')
    coords += (str(c.rad2Deg(c.getAlpha())) + '  ')
    coords += (str(c.rad2Deg(c.getBeta())) + '  ')
    coords += (str(c.rad2Deg(c.getGamma())) + '\n')

    numAtoms = c.numAtoms()
    coords += ('fractional  ' + str(numAtoms) + '\n')

    atoms = c.atoms
Пример #4
0
#!/usr/bin/env python3

# Author -- Patrick S. Avery -- 2016

import sys
import readPOSCAR

if len(sys.argv) != 2:
    print("Error: Please put one argument after the executable:" + \
          " the name of the POSCAR to be read")
    sys.exit()

crystal = readPOSCAR.readPOSCAR(sys.argv[1])

crystal.display()

crystal.displayLatticeInfo()

crystal.displayDistances()
Пример #5
0
#!/usr/bin/env python3

from crystal import Crystal
from readPOSCAR import readPOSCAR

import sys

if len(sys.argv) != 2:
    sys.exit("Usage: <script> <poscarFile>")

c = readPOSCAR(sys.argv[1])

poscar = c.writePoscar()
print(poscar)