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


Python Vasp.get_elapsed_time方法代码示例

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


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

示例1: db_update

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_elapsed_time [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

示例2: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_elapsed_time [as 别名]
from vasp import Vasp
calc = Vasp('molecules/CO-vacuum')
calc.clone('molecules/CO-solvated')
calc.set(istart=1,  #
         lsol=True)
print(calc.get_atoms().get_potential_energy())
print(calc.get_atoms().get_forces())
print('Calculation time: {} seconds'.format(calc.get_elapsed_time()))
开发者ID:beeruyue,项目名称:dft-book,代码行数:10,代码来源:script-239.py

示例3: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_elapsed_time [as 别名]
from vasp import Vasp
L = [4, 5, 6, 8, 10]
for a in L:
    calc = Vasp('molecules/co-L-{0}'.format(a))
    print('{0} {1} seconds'.format(a, calc.get_elapsed_time()))
开发者ID:beeruyue,项目名称:dft-book,代码行数:7,代码来源:script-23.py

示例4: Vasp

# 需要导入模块: from vasp import Vasp [as 别名]
# 或者: from vasp.Vasp import get_elapsed_time [as 别名]
from vasp import Vasp
calc = Vasp('surfaces/Pt-slab-O-fcc')
calc.clone('surfaces/Pt-slab-O-fcc-vib')
calc.set(ibrion=5,     # finite differences with selective dynamics
         nfree=2,      # central differences (default)
         potim=0.015,  # default as well
         ediff=1e-8,
         nsw=1)
atoms = calc.get_atoms()
f, v = calc.get_vibrational_modes(0)
print 'Elapsed time = {0} seconds'.format(calc.get_elapsed_time())
allfreq = calc.get_vibrational_modes()[0]
from ase.units import meV
c = 3e10  # cm/s
h = 4.135667516e-15  # eV*s
print 'vibrational energy = {0} eV'.format(f)
print 'vibrational energy = {0} meV'.format(f/meV)
print 'vibrational freq   = {0} 1/s'.format(f/h)
print 'vibrational freq   = {0} cm^{{-1}}'.format(f/(h*c))
print
print 'All energies = ', allfreq
开发者ID:beeruyue,项目名称:dft-book,代码行数:23,代码来源:script-202.py


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