used. If that is set to a list of directory names, the volumes and
    structures will be concatenated and sorted according to the volume value.

    If you set a 'slice' tag in the under the tag 'phonopy', like

        phonopy:
          volumes_and_structures:
            slice: [null, -4]

    The slice is applied to the volume and structure list.

    """

    run_specs, filename = rmd.get_run_specs_and_filename()
    cwd = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)

    phonopy_specs = run_specs['phonopy']
    phonopy_specs['dim'] = ' '.join(map(str, phonopy_specs['dim']))
    incar = rmd.read_incar(run_specs)
    if os.path.isfile('../properties.json'):
        properties = rmd.fileload('../properties.json')
        if 'ISPIN' not in incar:
            if rmd.detect_is_mag(properties['mag']):
                incar.update({'ISPIN': 2})
            else:
                incar.update({'ISPIN': 1})

    # higher priority for run_specs
    if 'poscar' in run_specs:
Esempio n. 2
0
        ISMEAR: -5
        LORBIT: 10
        NEDOS: 4000
        ISYM: -1
        LWAVE: True
        ISTART: 0

    It will cause the INCAR and/or KPOINTS to change before starting the static
    run.

    """

    # pre-config
    run_specs, filename = rmd.get_run_specs_and_filename()
    start_dir = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)
    rmd.init_stdout()

    # read settings

    # POSCAR
    if 'poscar' in run_specs:
        structure = rmd.get_structure(run_specs)
    elif os.path.isfile('../POSCAR'):
        structure = mg.Structure.from_file('../POSCAR')
        rmd.insert_elem_types(run_specs, structure)

    # INCAR
    incar = rmd.read_incar(run_specs)
    if os.path.isfile('../properties.json'):
Esempio n. 3
0
    Run convergence test with changing kpoints subdivision values, and plot
    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'])
    arguments of pymatgen.analysis.elasticity.strain.DeformedStructureSet(),
    like

        elastic:
          num_norm: 2
          num_shear: 2

    After the set of VASP runs, you need to use the process script
    process_elastic_stress_strain to solve for the elastic constants.

    """

    # pre-config
    run_specs, filename = rmd.get_run_specs_and_filename()
    cwd = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)

    # read settings
    incar = rmd.read_incar(run_specs)
    structure = rmd.get_structure(run_specs)
    kpoints = rmd.read_kpoints(run_specs, structure)

    # elastic
    if 'elastic' in run_specs and ('num_norm' in run_specs['elastic'] or 'num_shear' in run_specs['elastic']):
        dss = elasticity.strain.DeformedStructureSet(structure, num_norm=run_specs['elastic']['num_norm'], num_shear=run_specs['elastic']['num_shear'])
    else:
        dss = elasticity.strain.DeformedStructureSet(structure)
    strain_list = [i.green_lagrange_strain for i in dss.deformations]
    rmd.filedump([i.tolist() for i in strain_list], 'strain_list.json')
    for idx, defo in enumerate(dss.deformations):
Esempio n. 5
0
    would use to actually run the routine script run_phonopy_qha-para.py before
    this.

    You should set a 'phonopy' tag in the specs file in the format documented in
    the script run_phonopy_qha-para.py.

    Optionally, you can set a tag 'qha_only' to be True to skip the per volume
    phonopy evaluation, and just run phonopy_qha,

        phonopy:
          qha_only: True

    """

    run_specs, filename = rmd.get_run_specs_and_filename()
    rmd.chdir(rmd.get_run_dir(run_specs))
    phonopy_specs = run_specs['phonopy']
    phonopy_specs['dim'] = ' '.join(map(str, phonopy_specs['dim']))
    phonopy_specs['mp'] = ' '.join(map(str, phonopy_specs['mp']))
    phonopy_specs['tmax'] = str(phonopy_specs['tmax'])
    phonopy_specs['tstep'] = str(phonopy_specs['tstep'])

    run_volume_dirname = phonopy_specs['volumes_and_structures']['from']\
        if 'volumes_and_structures' in phonopy_specs and \
           'from' in phonopy_specs['volumes_and_structures'] and \
           phonopy_specs['volumes_and_structures']['from'] else 'run_volume'

    if isinstance(run_volume_dirname, str):
        fitting_results = rmd.fileload(os.path.join('..',
            run_volume_dirname, 'fitting_results.json'))[-1]
        volume = fitting_results['volume']
    Run the full independent strain sets with changing delta values, fit the
    energy values from each strain set to a polynomial, extract the parameters
    and plot figures, and then linearly solve for the elastic constants.

    The strain sets used to solve the elastic constants are detailed in
    run_module_elastic.py.

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

        elastic:
          cryst_sys: cubic

    """

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

    cryst_sys = run_specs['elastic']['cryst_sys']

    rmd.infer_from_json(run_specs)
    structure = rmd.get_structure(run_specs)
    incar = rmd.read_incar(run_specs)
    kpoints = rmd.read_kpoints(run_specs, structure)

    is_mag = incar['ISPIN'] == 2 if 'ISPIN' in incar else False

    fitting_results_summary = {}

    rmd.chdir('nostrain')
    rmd.init_stdout()
    Run the phonopy force set calculation for a constant volume.

    You should set a 'phonopy' tag in the specs file like

        phonopy:
          mode: force_set (or force_constant)
          dim: [2, 2, 2]
          mp: [31, 31, 31]
          tmax: 1400
          tstep: 5

    """

    run_specs, filename = rmd.get_run_specs_and_filename()
    cwd = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)

    phonopy_dim = ' '.join(map(str, run_specs['phonopy']['dim']))
    phonopy_mp = ' '.join(map(str, run_specs['phonopy']['mp']))
    phonopy_tmax = str(run_specs['phonopy']['tmax'])
    phonopy_tstep = str(run_specs['phonopy']['tstep'])
    incar = rmd.read_incar(run_specs)
    if os.path.isfile('../properties.json'):
        properties = rmd.fileload('../properties.json')
        if 'ISPIN' not in incar:
            if rmd.detect_is_mag(properties['mag']):
                incar.update({'ISPIN': 2})
            else:
                incar.update({'ISPIN': 1})
Esempio n. 8
0
    Run the phonopy force set calculation for a constant volume.

    You should set a 'phonopy' tag in the specs file like

        phonopy:
          mode: force_set (or force_constant)
          dim: [2, 2, 2]
          mp: [31, 31, 31]
          tmax: 1400
          tstep: 5

    """

    run_specs, filename = rmd.get_run_specs_and_filename()
    cwd = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)

    phonopy_dim = ' '.join(map(str, run_specs['phonopy']['dim']))
    phonopy_mp = ' '.join(map(str, run_specs['phonopy']['mp']))
    phonopy_tmax = str(run_specs['phonopy']['tmax'])
    phonopy_tstep = str(run_specs['phonopy']['tstep'])

    rmd.infer_from_json(run_specs)
    structure = rmd.get_structure(run_specs)
    incar = rmd.read_incar(run_specs)
    kpoints = rmd.read_kpoints(run_specs, structure)

    if run_specs['phonopy']['mode'] == 'force_set':
        structure.to(filename='POSCAR')
        call('phonopy -d --dim="' + phonopy_dim + '" > /dev/null', shell=True)
Esempio n. 9
0
    Run the full independent strain sets with changing delta values, fit the
    energy values from each strain set to a polynomial, extract the parameters
    and plot figures, and then linearly solve for the elastic constants.

    The strain sets used to solve the elastic constants are detailed in
    run_module_elastic.py.

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

        elastic:
          cryst_sys: cubic

    """

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

    cryst_sys = run_specs['elastic']['cryst_sys']

    rmd.infer_from_json(run_specs)
    structure = rmd.get_structure(run_specs)
    incar = rmd.read_incar(run_specs)
    kpoints = rmd.read_kpoints(run_specs, structure)

    is_mag = incar['ISPIN'] == 2 if 'ISPIN' in incar else False

    fitting_results_summary = {}

    rmd.chdir('nostrain')
    rmd.init_stdout()
    arguments of pymatgen.analysis.elasticity.strain.DeformedStructureSet(),
    like

        elastic:
          num_norm: 2
          num_shear: 2

    After the set of VASP runs, you need to use the process script
    process_elastic_stress_strain to solve for the elastic constants.

    """

    # pre-config
    run_specs, filename = rmd.get_run_specs_and_filename()
    cwd = os.getcwd()
    rmd.chdir(rmd.get_run_dir(run_specs))
    rmd.filedump(run_specs, filename)

    # read settings
    rmd.infer_from_json(run_specs)
    structure = rmd.get_structure(run_specs)
    incar = rmd.read_incar(run_specs)
    kpoints = rmd.read_kpoints(run_specs, structure)

    # elastic
    if 'elastic' in run_specs and ('num_norm' in run_specs['elastic']
                                   or 'num_shear' in run_specs['elastic']):
        dss = elasticity.strain.DeformedStructureSet(
            structure,
            num_norm=run_specs['elastic']['num_norm'],
            num_shear=run_specs['elastic']['num_shear'])