phonopy_specs['volumes_and_structures']['slice'] else [None] * 2

    volume, energy, structures = np.array(sorted(zip(volume, energy, structures)))[idx_slice[0]:idx_slice[1]].T

    for V, st in zip(volume, structures):
        rmd.chdir(str(np.round(V, 2)))
        if run_specs['phonopy']['mode'] == 'force_set':
            structure = mg.Structure.from_dict(st)
            structure.to(filename='POSCAR')
            call('phonopy -d --dim="' + phonopy_specs['dim'] + '" > /dev/null', shell=True)
            os.remove('SPOSCAR')
            disp_structures = sorted(glob.glob('POSCAR-*'))
            disp_dirs = ['disp-' + i.split('POSCAR-')[1] for i in disp_structures]
            for disp_d, disp_p in zip(disp_dirs, disp_structures):
                rmd.chdir(disp_d)
                rmd.init_stdout()
                shutil.move('../' + disp_p, 'POSCAR')
                incar.write_file('INCAR')
                kpoints.write_file('KPOINTS')
                rmd.write_potcar(run_specs)
                job = str(V) + '-' + disp_d
                shutil.copy(cwd + '/INPUT/deploy.job', job)
                call('sed -i "/python/c time ' + rmd.VASP_EXEC + ' 2>&1 | tee -a stdout" ' + job, shell=True)
                call('M ' + job, shell=True)
                os.remove(job)
                os.chdir('..')
        elif run_specs['phonopy']['mode'] == 'force_constant':
            rmd.init_stdout()
            incar.write_file('INCAR')
            kpoints.write_file('KPOINTS')
            structure = mg.Structure.from_dict(st)
Пример #2
0
    figures.

    You should set a 'kpoints_test' tag in the specs file, like

        kpoints_test:
          density_change: [1000, 2000, 4000]
          force_gamma: True

    Obviously, 'kpoints' tag should be omitted.

    """

    run_specs, filename = rmd.get_run_specs_and_filename()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)
    rmd.init_stdout()

    rmd.infer_from_json(run_specs)
    structure = rmd.get_structure(run_specs)
    incar = rmd.read_incar(run_specs)

    kpoints_specs = run_specs['kpoints_test']
    if 'force_gamma' in kpoints_specs:
        force_gamma = kpoints_specs['force_gamma']
    else:
        force_gamma = False

    if 'density_change' in kpoints_specs:
        density_change = np.array(kpoints_specs['density_change'])
    else:
        density_change = np.array(range(kpoints_specs['begin'], kpoints_specs['end'], kpoints_specs['step']))