Ejemplo n.º 1
0
    def __init__(self, infile, radius):
        gcell = GeneralIO.from_file(infile)
        self.infile = infile
        self.basefname = os.path.basename(infile)
        self.mcell = ModifiedCell.from_gcell(gcell)

        self.radius = radius
Ejemplo n.º 2
0
    def __init__(self, infile, cenele, radius, ele, refined):
        gcell = GeneralIO.from_file(infile)
        self.infile = infile
        self.basefname = os.path.basename(infile)

        self.mcell = ModifiedCell.from_gcell(gcell)

        self.clarifier = VerboseAtomRemoveClarifier(Specie(cenele), radius,
                                                    Specie(ele))
        self.refined = refined
Ejemplo n.º 3
0
    def run(self):
        import tempfile
        working_path = os.getcwd()

        for infile in self.files:
            basefname = os.path.basename(infile)

            # read
            gcell = GeneralIO.from_file(infile)

            mcell = ModifiedCell.from_gcell(gcell)
            new_mcell = self.clarifier.clarify(mcell)
            gcell = new_mcell.to_gcell()
            # todo: add feature- to convcell.
            if self.refined:
                gcell = gcell.get_refined_pcell()

            out = GeneralIO(gcell)
            ofname = "{:}_ACLR.vasp".format(basefname.split('.')[0])

            print("PROCESSING: {:}".format(infile))
            out.write_file(ofname)
Ejemplo n.º 4
0
def perturb(files, radius, outmode, verbose):
    from ababe.io.io import GeneralIO
    from ababe.stru.scaffold import ModifiedCell
    from ababe.stru.element import Specie
    import os
    for infile in files:
        basefname = os.path.basename(infile)

        # read
        gcell = GeneralIO.from_file(infile)
        # process
        mcell = ModifiedCell.from_gcell(gcell)
        mcell.perturb(radius)

        # write
        out = GeneralIO(mcell.to_gcell())

        if outmode == 'stdio':
            out.write_file(fname=None, fmt='vasp')
        else:
            if verbose: print("PROCESSING: {:}".format(infile))
            ofname = "{:}_PURB.{:}".format(basefname.split('.')[0], outmode)
            out.write_file(ofname)
Ejemplo n.º 5
0
 def test_from_to_gcell(self):
     gcell = GeneralCell(self.latt, self.pos, self.numbers)
     modcell = ModifiedCell.from_gcell(gcell)
     new_gcell = modcell.to_gcell()
     self.assertTrue(np.allclose(new_gcell.positions, gcell.positions))