当前位置: 首页>>代码示例>>Python>>正文


Python Vasp.in_queue方法代码示例

本文整理汇总了Python中vasp.Vasp.in_queue方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.in_queue方法的具体用法?Python Vasp.in_queue怎么用?Python Vasp.in_queue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vasp.Vasp的用法示例。


在下文中一共展示了Vasp.in_queue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: db_update

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import in_queue [as 别名]
def db_update(db_path, dft_path, delete=False, silent=False):
    """Update the database to include Vasp() calculations nested in dft_path."""
    VASPRC['mode'] = None
    db = connect(db_path)
    old_size = sum(1 for _ in db.select())

    db_paths = []
    for d in db.select():
        try:
            db_paths.append(d.data.path)
        except:
            pass

    for path in utils.calc_paths(dft_path):
        if os.path.abspath(path) in db_paths:
            continue
        calc = Vasp(path)

        if not calc.in_queue() and calc.potential_energy is None:
            for output_file in utils.calc_output_files(path):
                dead_file = os.path.join(path, output_file)
                if delete:
                    os.remove(dead_file)
                if not silent:
                    print("Dead output file: {}. Deleted: {}".format(dead_file, delete))
        else:
            ctime = calc.get_elapsed_time()

            # The write_db method throws an AttributeError for new calcs. Remove this to debug.
            old_stdout = sys.stdout
            sys.stdout = open(os.devnull, "w")
            calc.write_db(db_path, parser='=',
                        overwrite=False,
                        data={'ctime': ctime})
            sys.stdout.close()
            sys.stdout = old_stdout

            if not silent:
                print("Added calc to DB: {}".format(path))

    new_size = sum(1 for _ in db.select())
    added = new_size - old_size
    if not silent:
        print("{} total entries. {} new entries added.".format(new_size, added))
开发者ID:devonwa,项目名称:twodee,代码行数:46,代码来源:ase_utils.py


注:本文中的vasp.Vasp.in_queue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。