本文整理匯總了Python中commopy.Bash.copy_dir方法的典型用法代碼示例。如果您正苦於以下問題:Python Bash.copy_dir方法的具體用法?Python Bash.copy_dir怎麽用?Python Bash.copy_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類commopy.Bash
的用法示例。
在下文中一共展示了Bash.copy_dir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_condition
# 需要導入模塊: from commopy import Bash [as 別名]
# 或者: from commopy.Bash import copy_dir [as 別名]
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))
示例2: all
# 需要導入模塊: from commopy import Bash [as 別名]
# 或者: from commopy.Bash import copy_dir [as 別名]
def all(cls, path, incar_obj=None, kp_rx=0.15, kp_soc=0.11):
"""
All pattern of INCAR files are prepared.
それぞれのパラメータの変更は
class method "cls_add_fixedtag"や"cls_add_extratag"を使うか
incar_objに書き替えたincarを入力
省略した場合、path中のPOSCARをbaseに作成
"""
if not incar_obj:
incar_obj = IncarReadPoscar(os.path.join(path, 'POSCAR'))
cls.make_potcar_kpoints(path, kp_rx, kp_soc)
methods = ['relax', 'cell', 'volume', 'volumeE', 'presoc', 'presoc_nc',
'ibzkp', 'soc',
'dos', 'band', 'static']
for method in methods:
getattr(cls, method)(path, incar_obj)
src_dir = os.path.join(MODULE_DIR, '../sorce/originalsVASP', 'Calc')
dst_dir = os.path.join(path, 'Calc')
Bash.copy_dir(src_dir, dst_dir)