Posted onInChemistryWaline: Views: Word count in article: 521Reading time ≈2 mins.
上回说到,去年夏天,导师收到了JCP Special Topic: Modern Semiempirical Electronic Structure Methods的邀稿,但是迟迟没决定写什么。到了10月下旬,JCP把deadline延长到了11月30日,这时他的想法是,写一篇Perspective来总结过去的工作,并把我上一篇文章的一些数据拆了出来,放到这篇文章里。但是到了11月下旬,我把上一篇文章投出去以后,导师又决定,改成一篇benchmark的文章,在QDπ已经benchmark的一大堆机器学习和半经验方法数据的基础上,再benchmark两个方法的数据,最后再得出结论,半经验+机器学习联用的精度最好,QDπ的精度最好。
defgenerate_totp(secret: str, period: int=30, token_length: int=6) -> int: """Generate time-based one time password (TOTP) from the secret. Some HPCs use TOTP for two-factor authentication for safety. Parameters ---------- secret: str The encoded secret provided by the HPC. It's usually extracted from a 2D code and base32 encoded. period: int, default=30 Time period where the code is valid in seconds. token_length: int, default=6 The token length. Returns ------- token: int The generated token. """ timestamp = time.time() counter = int(timestamp) // period msg = struct.pack('>Q', counter) digest = hmac.new(base64.b32decode(secret), msg, hashlib.sha1).digest() ob = digest[19] pos = ob & 15 base = struct.unpack('>I', digest[pos:pos + 4])[0] & 0x7fffffff token = base % (10**token_length) returnstr(token).zfill(token_length)