예제 #1
0
def create_randomized_configurations(mapfile,
                                     infile,
                                     random_seed,
                                     numconf,
                                     is_sorted):
    """

    Parameters
    ----------
    mapfile : String
        Input file including mapping information.
    infile : String
        POSCAR filename.
    """
    import json
    from vasp.poscar import Poscar
    from collections import OrderedDict

    atoms = Poscar(infile).get_atoms()

    with open(mapfile, "r") as f:
        map_s2s = json.load(f, object_pairs_hook=OrderedDict)

    order = create_order_of_symbols(map_s2s)

    configuration_randomizer = ConfigurationRandomizer(
        atoms=atoms,
        map_s2s=map_s2s,
        random_seed=random_seed,
    )

    for i in range(numconf):
        atoms = configuration_randomizer.create_randomized_configuration()
        filename = "RPOSCAR-{}".format(i + 1)
        poscar = Poscar().set_atoms(atoms)
        if is_sorted:
            poscar.sort_by_symbols(order=order)
        poscar.write(filename)
예제 #2
0
 def write_cell_enlarged_ideal(self, filename):
     poscar = Poscar()
     poscar.set_atoms(self._enlarged_cell_average)
     poscar.write(filename)
예제 #3
0
 def write_cell_enlarged(self, filename):
     poscar = Poscar()
     poscar.set_atoms(self._enlarged_cell)
     poscar.write(filename)