예제 #1
0
 def loop(self):
     if not os.path.exists(f'conf{self.n}'):
         os.mkdir(f'conf{self.n}')
         shutil.copy('INCAR', f'conf{self.n}')
         shutil.copy('KPOINTS', f'conf{self.n}')
         shutil.copy('POTCAR', f'conf{self.n}')
         self.s.to('POSCAR', f'conf{self.n}/POSCAR')
         self.move()
         if self.n > 0:
             shutil.copy2(f'conf{self.n - 1}/CHGCAR', f'conf{self.n}')
             shutil.copy2(f'conf{self.n - 1}/WAVECAR', f'conf{self.n}')
         pathlib.Path(f'conf{self.n}/wait').touch()
     else:
         self.s = Structure.from_file(f'conf{self.n}/POSCAR')
         self.move()
     os.chdir(f'conf{self.n}')
     self.calculate()
     os.chdir('..')
예제 #2
0
from pymatgen.io.vasp.outputs import Structure
import os

os.chdir('/home/jinho93/new/oxides/perobskite/lanthanum-aluminate/bulk/hse/polaron')
s = Structure.from_file('POSCAR')

s.translate_sites(range(len(s.sites)), [0.5, 0.5, 0], frac_coords=True)
s.to('POSCAR', 'POSCAR')
예제 #3
0
from pymatgen.io.vasp.outputs import Structure, Element
import os
import numpy as np


def aver(arr:np.ndarray):
    return arr.sum() / len(arr)


if __name__ == '__main__':
    os.chdir('/home/jinho93/oxides/cluster/zno/vasp/3.slab/2.80')
    os.chdir('/home/jinho93/oxides/cluster/zno/vasp/3.slab/1.zn_vac/3.LDIPOL_from_ini')
    os.chdir('/home/jinho93/oxides/cluster/zno/cp2k/3.slab/2.wann')
    os.chdir('/home/jinho93/oxides/cluster/zno/vasp/4.supc/1.fix/two')
    s = Structure.from_file('CONTCAR')
    z_coords = []
    p = []
    for i in s.sites:
        if i.specie == Element.Zn:
            if len(s.get_neighbors(i, 2.5)) is 4:
                z = [_[0].z for _ in s.get_neighbors(i, 2.5)]
                z_coords.append(i.z)
                p.append(i.z - sum(z) / 4)

    arr = np.array([z_coords, p]).transpose()
    arr = arr[arr[:, 0].argsort()]
    n = 2
    for i in range(len(arr) // n):
        print(arr[n*i][0], aver(arr[n * i: n * (i + 1), 1]))
예제 #4
0
 def __init__(self):
     self.s = Structure.from_file('POSCAR')
     self.n = 0
     self.output = []
     self.displacement = -0.1
예제 #5
0
from pymatgen.io.vasp.outputs import Element, Structure
import os
import numpy as np

os.chdir('/home/ksrc5/FTJ/bfo')

s = Structure.from_file('r3c_gaf_relaxed.vasp')
output2 = np.zeros(3)
for i in s.sites:
    if i.specie == Element.Fe or i.specie == Element.Bi:
        output = np.zeros(3)
        n = 0
        for j in s.get_neighbors(i, 2.7):
            output += j[0].coords
            n += 1
        output2 += (output / n - i.coords)
print(output2)