def run(self): import tempfile working_path = os.getcwd() self.mcell.perturb(self.radius) gcell = self.mcell.to_gcell() out = GeneralIO(gcell) ofname = "{:}_PURB.vasp".format(self.basefname.split('.')[0]) print("PROCESSING: {:}".format(self.infile)) out.write_file(ofname)
def run(self): # Create directory contain POSCARs import random import string rd_suffix = ''.join( random.choices(string.ascii_uppercase + string.digits, k=5)) working_path = os.getcwd() out_dir = os.path.join( working_path, 'STRUCTURES_{0:}_{1:}'.format(self.comment, rd_suffix)) if not os.path.exists(out_dir): os.makedirs(out_dir) else: shutil.rmtree(out_dir) os.makedirs(out_dir) ogg = OccupyGenerator(self.cell) if self.tr is not None: tr = (Specie(self.tr[0]), self.tr[1]) applied_restriction = MinDistanceRestriction(tr) for n1 in range(1, self.n - 1): for n2 in range(1, self.n - n1): g = ogg.gen_nodup_trinary_alloy(Specie(self.s1), n1, Specie(self.s2), n2) for n_count, c in enumerate(g): if self.tr is not None: condition = c.is_primitive( ) and applied_restriction.is_satisfied(c) else: condition = c.is_primitive() if condition: if self.refined: c = c.get_refined_pcell() out = GeneralIO(c) f_suffix = ''.join( random.choices(string.ascii_uppercase + string.digits, k=4)) ofname = "STRUCTURE_{:}_{:}.{:}".format( c.comment, f_suffix, self.outmode) lastpath = os.path.join(out_dir, ofname) out.write_file(lastpath)
def concell(files, outmode, verbose): from ababe.io.io import GeneralIO import os for infile in files: basefname = os.path.basename(infile) gcell = GeneralIO.from_file(infile) pcell = gcell.get_refined_cell() out = GeneralIO(pcell) if outmode == 'stdio': out.write_file(fname=None, fmt='vasp') else: if verbose: print("PROCESSING: {:}".format(infile)) ofname = "{:}_CONC.{:}".format(basefname.split('.')[0], outmode) out.write_file(ofname)
def supcell(file, scale, outmode): from ababe.io.io import GeneralIO import os import numpy as np basefname = os.path.basename(file) gcell = GeneralIO.from_file(file) scale_matrix = np.diag(np.array(scale)) sc = gcell.supercell(scale_matrix) out = GeneralIO(sc) print("PROCESSING: {:}".format(file)) if outmode == 'stdio': out.write_file(fname=None, fmt='vasp') else: ofname = "{:}_SUPC.{:}".format(basefname.split('.')[0], outmode) out.write_file(ofname)
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)
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)