Esempio n. 1
0
        createFolder('%02d_%s' % (idx + 1.0, formula))

        struc_ini.replace(0, TM_list[idx])
        struc_ini.replace(1, TM_list[idx])
        struc_ini.replace(2, TM_list[idx])
        struc_ini.replace(3, TM_list[idx])

        # getting conventional unit cell
        sga = SpacegroupAnalyzer(struc_ini)
        conv_struc = sga.get_conventional_standard_structure()

        poscar = Poscar(conv_struc)
        poscar.write_file('%02d_%s/POSCAR' % (idx + 1.0, formula))

        poscar_ase = read_vasp('%02d_%s/POSCAR' % (idx + 1.0, formula))
        write_xsd('models/poscar_%02d_%s.xsd' % (idx + 1.0, formula),
                  poscar_ase)

        for k in range(len(df)):
            if formula == df['pretty_formula'][k]:

                struc = df['structure'][k]
                sga = SpacegroupAnalyzer(struc)
                # print(idx+1.0," ",formula," ",len(sga.get_conventional_standard_structure()))

                if len(sga.get_conventional_standard_structure()) != 30:
                    print('Error for conv. struc. of %s' % formula)
                    f.writelines('Error for conv. struc. of %s\n' % formula)
                    break
                conv_struc = sga.get_conventional_standard_structure()
                poscar = Poscar(conv_struc)
                poscar.write_file('%02d_%s/POSCAR' % (idx + 1.0, formula))
c1 = zwitter_AA.cell[2][0] / cell_params[2]
c2 = zwitter_AA.cell[2][1] / cell_params[2]
c3 = zwitter_AA.cell[2][2] / cell_params[2]
print('cell vector C: %4.5f %4.5f %4.5f ' % (c1,c2,c3))


for a_int in range(0,11):
    for c_int in range(0,11):
        
        createFolder('%02d_%02d_shift' % (a_int, c_int))
        createFolder('xsd')

        for i in range(tot_num):
            if i in idx_list:
#               count = count + 1
#               print(i," ",zwitter_temp[i]," ",count)
                zwitter_temp[i].x = x_data[i] + a_int*cell_params[0]*a1*0.1 - c_int*cell_params[2]*c1*0.1
                zwitter_temp[i].z = z_data[i] + a_int*cell_params[0]*a3*0.1 - c_int*cell_params[2]*c3*0.1
                
        INCAR.write_file('%02d_%02d_shift/INCAR' % (a_int, c_int))
        KPOINTS.write_file('%02d_%02d_shift/KPOINTS' % (a_int, c_int))    
        write_vasp('%02d_%02d_shift/POSCAR' % (a_int, c_int), zwitter_temp)
        
        write_xsd('xsd/%02d_%02d.xsd' % (a_int, c_int), zwitter_temp)
        
        # jobscript copy
        destination = '%02d_%02d_shift' % (a_int, c_int)
        job_file = os.getcwd() + '/jobscript_vasp.sh'
        shutil.copy(job_file, destination)
       
Esempio n. 3
0
from ase.io.vasp import read_vasp
from ase.io.xsd import write_xsd

contcar = read_vasp('CONTCAR')
write_xsd('contcar.xsd', contcar)

from pymatgen import Structure
struc = Structure.from_file('CONTCAR')

from pymatgen.io.vasp.inputs import Poscar

poscar = Poscar.from_file('CONTCAR')
poscar.structure

del atoms[atoms.numbers == 6]
del atoms[[atom.index for atom in atoms if atom.symbol == 'C']]
del atoms[[atom.symbol == 'C' for atom in atoms]]

del surf_2x2[[atom.position[2] / z_param < 0.35 for atom in surf_2x2]]

elements = list(set(slab.get_chemical_symbols()))