本文整理汇总了Python中commopy.Bash类的典型用法代码示例。如果您正苦于以下问题:Python Bash类的具体用法?Python Bash怎么用?Python Bash使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
Bash.mkdir('cova')
cova_list = Array.frange_stp(1.0, 1.05, 0.05)
series = series_vasp.Produce('POSCAR', 'cova')
series.set_cova(cova_list)
series.make_files()
series.append_list_run('run_cova.sh')
示例2: from_new
def from_new(cls):
"""
seq ディレクトリを作成し originals ディレクトリ中に初期ファイルを保存
実行ディレクトリを記憶
"""
seq_list = glob.glob("seq*/")
i = 0
for seq in seq_list:
try:
j = int(seq.split("seq")[-1].split("/")[0])
if i < j:
i = j
except ValueError:
pass
i += 1
dirc = 'seq{0}/originals/'.format(i)
str_files = glob.glob('*.str')
Bash.mkdir(dirc)
for fname in ['IN.CVM', 'def.txt', 'energies.txt'] + str_files:
copyfile(fname, os.path.join(dirc, fname))
seq_dirc = "seq{0}".format(str(i))
print("New directory of '{}' is created".format(seq_dirc))
clus_name = cls.get_clus_name(".")
results = CEMResults([])
return cls(seq_dirc, None, None, clus_name, results)
示例3: view_osz
def view_osz(self):
path = '.'
if self.value.value == 'EV curve':
path = glob.glob('voldep/volume_*')[0]
print(path)
Bash.execute("emacs {0}/OSZICAR".format(path))
示例4: set_condition
def set_condition(self, r, n):
"""
path 中に originals ファイルをコピーして rmax, nmax を def.txt にセットする
"""
if not self.distances:
self.current_label = "RmaxN2"
rmax = r
else:
self.current_label = "R{0}N{1}".format(r, n)
rmax = self.distances[r-1]+0.005
dst = os.path.join(self.seq_dirc, self.current_label)
Bash.copy_dir(os.path.join(self.seq_dirc, "originals"), dst)
deftxt = os.path.join(dst, "def.txt")
with open(deftxt, 'r') as rfile:
lines = rfile.readlines()
meta = re.compile(r"^{0}\s*.*".format(self.clus_name))
i = 0
# print(self.clus_name)
while not meta.match(lines[i]):
# print(i)
# print(lines[i])
i += 1
lines[i] = "{0} RMAX={1} NSMAX={2} PRNTMAXCL=T NMAX=0\n".format(
self.clus_name, rmax, n)
with open(os.path.join(dst, "def.txt"), 'w') as wfile:
wfile.write("".join(lines))
示例5: alt_incvm
def alt_incvm(src, dst):
"""
CONW, ECLI を書き換えて出力する
"""
call("cat {0}/IN.CVM | sed 's/CONW=T/CONW=F/g' | "
"sed 's/ECLI=T/ECLI=F/g' > tmp".format(src), shell=True)
Bash.move('tmp', os.path.join(dst, "IN.CVM"))
示例6: main
def main():
Bash.mkdir('kp')
kp_list = Array.frange_stp(0.08, 0.24, 0.02)
#kp_list = Array.frange_stp(0.04, 0.07, 0.02)
series = series_vasp.Produce('POSCAR', 'kp')
series.set_kp_relax(kp_list)
series.make_files()
series.make_list_run('run.sh')
示例7: test_plt
def test_plt(self):
clean_prev_dir(self.path, 'output')
Bash.mkdir(os.path.join(self.path, 'output', 'text'))
combi_para = [['Co'], ['Al']]
pathA = os.path.join(self.path, 'typeA')
pathB = os.path.join(self.path, 'typeB')
path_out = os.path.join(self.path, 'output')
self.plt_double(combi_para, pathA, pathB, path_out)
示例8: mkdirs
def mkdirs(self):
"""
pathに記された階層ディレクトリを作成
階層の順番はsetした順番となる
"""
for param in self.series:
dst_path = param['path']
Bash.mkdir(dst_path)
示例9: conv2poscar
def conv2poscar(cif_file, out_path):
"""
A cif file convert to POSCAR
"""
cif_file = os.path.normpath(cif_file)
cmd = 'cif2cell -p vasp -f {0} -o {1}/POSCAR --no-reduce \
--vasp-print-species --vasp-cartesian-lattice-vectors \
--vasp-format=5'.format(cif_file, out_path)
Bash.execute(cmd)
示例10: test_volume
def test_volume(self):
print("SeriesVasp test_volume")
os.chdir(self.path)
clean_prev_dir('.', 'volume')
Bash.mkdir('volume')
volume_list = [5, 6, 7]
series = series_vasp.Produce('POSCAR', 'volume')
series.set_volume(volume_list)
series.make_files()
示例11: stack
def stack(args):
"""
hcp-fcc Mg stacking 構造を作成する
"""
path = args
strs = CVMStrs.from_str_file(path)
for structure in strs:
dirc = str(structure.label).split('*')[0]
Bash.mkdir(dirc)
structure.make_stack_poscar(os.path.join(dirc, "POSCAR"))
示例12: for_ferrite
def for_ferrite():
"""
ferrite系のcombinatorial
"""
Bash.mkdir('combi')
elem_list = ['Ni', 'Mn', 'Cu', 'Zn', 'Cr']
comp_list = [['O', 'Fe', x] for x in elem_list]
series = series_vasp.Produce('POSCAR', 'combi')
series.set_elements(comp_list)
series.make_files()
series.append_list_run('run_combi.sh')
示例13: expand_poscars
def expand_poscars(self, elements):
"""
self.poscarsのPOSCARをディレクトリ(ID名)に展開
elements名も追記する
self.path中に作成
pathを変えたい場合はself.pathを変更
"""
for poscar in self.poscars:
Bash.mkdir(os.path.join(self.path, poscar['ID']))
poscar['object'].elements = elements
poscar['object'].write_poscar(os.path.join(self.path,
poscar['ID'], 'POSCAR'))
示例14: execute
def execute(self):
if self.value == 'EV curve':
Bash.execute("batch_run.sh 100")
else:
Bash.execute("qsub run.sh")
top = tk.Toplevel()
f = tk.Frame(top)
f.pack()
label = tk.Label(f, text="{0} calculation started !".format(self.value))
label.pack()
btn = tk.Button(f, text="OK", command=top.destroy)
btn.pack()
示例15: make_system
def make_system(self, dirname=None):
os.chdir(CWD)
font = ('Helevetica', 12, 'bold')
self.initial.status.configure(text='None', font=font, fg='red')
if not dirname:
dirname = self.e_dir.get()
dirname = "enshu_" + self.e_dir.get()
path = os.path.join(CWD, dirname)
Bash.mkdir(path)
self.initial.listbox.delete(0, tk.END)
SYSTEMS = [x[6:] for x in glob.glob('enshu_*')]
print(SYSTEMS)
self.initial.listbox.insert(tk.END, *SYSTEMS)
self.top.destroy()