This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
periodic_table = ('H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', | |
'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', | |
'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', | |
'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', | |
'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', | |
'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', | |
'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', | |
'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', | |
'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th', 'Pa', | |
'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This program transfrom vasp, cif etc, structure file | |
# to castep profess file | |
# Usage: | |
# python 2profess *.vasp *.cif *.CHGCAR ... | |
# output: *.cell | |
# requirement: pymatgen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing as mp | |
from tqdm import tqdm | |
class MyProcessPool(): | |
def __init__(self, processes, timeout=None, error_callback=None): | |
self.pool = mp.Pool(processes=processes) | |
self.timeout = timeout | |
self.error_callback = error_callback | |
def work(self, job, args_list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
rcconfig = { | |
'figure.titlesize': 30, | |
'figure.titleweight': 'bold', | |
'xtick.direction': 'in', | |
'ytick.direction': 'in', | |
'xtick.major.width': 3, | |
'ytick.major.width': 3, | |
'xtick.major.size': 9, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
d = {'a1': [1, 2, 3, 4], 'a2': ['a', 'cxzs', 'as', 123]} | |
tmp = [list(map(lambda i: str(i), [k] + v)) for k, v in d.items()] | |
# print(tmp) | |
# [['a1', '1', ...], ['a2', ...]] | |
max_len = [max(map(lambda i: len(i), v)) for v in tmp] | |
for i in zip(*tmp): | |
fmt = tuple(chain.from_iterable((zip(max_len, i)))) |