本文整理汇总了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)