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)
g = ogg.gen_nodup_exch(Specie(self.exch1), Specie(self.exch2), self.n)
if self.tr is not None:
tr = (Specie(self.tr[0]), self.tr[1])
applied_restriction = MinDistanceRestriction(tr)
for n_count, c in enumerate(g):
if self.mpr:
if self.tr is not None:
condition = c.is_primitive() and applied_restriction.is_satisfied(c)
else:
condition = c.is_primitive()
else:
if self.tr is not None:
condition = applied_restriction.is_satisfied(c)
else:
condition = True
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)
评论列表
文章目录