def test_celldm_cryst_const(): cc = np.array([3, 4, 5, 30, 50, 123.0]) assrt(cc, celldm2cc(cc2celldm(cc))) cc = np.array([3, 4, 5, 30, 50, 123.0]) assrt(cc, celldm2cc(cc2celldm(cc, fac=10), fac=0.1)) cc = [3, 3, 3, 90, 90, 90] assrt(cc2celldm(cc), np.array([3, 1, 1, 0, 0, 0])) cc = [3, 4, 5, 90, 90, 120] assrt(cc2celldm(cc), np.array([3, 4 / 3., 5 / 3., 0, 0, -0.5])) cc = [3, 4, 5, 90, 90, 120] assrt(cc2celldm(cc, fac=10), np.array([30, 4 / 3., 5 / 3., 0, 0, -0.5]))
def test_celldm_cryst_const(): cc = np.array([3,4,5, 30, 50, 123.0]) assrt(cc, celldm2cc(cc2celldm(cc))) cc = np.array([3,4,5, 30, 50, 123.0]) assrt(cc, celldm2cc(cc2celldm(cc, fac=10), fac=0.1)) cc = [3,3,3,90,90,90] assrt(cc2celldm(cc), np.array([3,1,1,0,0,0])) cc = [3,4,5, 90, 90, 120] assrt(cc2celldm(cc), np.array([3, 4/3., 5/3., 0,0, -0.5])) cc = [3,4,5, 90, 90, 120] assrt(cc2celldm(cc, fac=10), np.array([30, 4/3., 5/3., 0,0, -0.5]))
def indent(txt, num=4): """Indent text block by `num` white spaces.""" space = " "*num return '\n'.join(space + line for line in txt.splitlines()) # All lengths in Bohr struct = io.read_cif(sys.argv[1], units={'length': Angstrom/Bohr}) rcell = crys.recip_cell(struct.cell) norms = np.sqrt((rcell**2.0).sum(axis=1)) bar = '-'*78 mass_unique = [atomic_data.pt[sym]['mass'] for sym in struct.symbols_unique] atspec = pwscf.atspec_str(struct.symbols_unique, mass_unique, [sym + '.UPF' for sym in struct.symbols_unique]) celldm = crys.cc2celldm(struct.cryst_const) atpos_frac = pwscf.atpos_str(struct.symbols, struct.coords_frac) print("""\ Notes ----- The .cif file is assumed to contain NO symmetry information: _symmetry_space_group_name_H-M 'P 1' _symmetry_Int_Tables_number 1 loop_ _symmetry_equiv_pos_as_xyz x,y,z Only a,b,c,alpha,beta,gamma and the fractional coords as found in the file are used. CPMD
def indent(txt, num=4): """Indent text block by `num` white spaces.""" space = " " * num return '\n'.join(space + line for line in txt.splitlines()) # All lengths in Bohr struct = io.read_cif(sys.argv[1], units={'length': Angstrom / Bohr}) rcell = crys.recip_cell(struct.cell) norms = np.sqrt((rcell**2.0).sum(axis=1)) bar = '-' * 78 mass_unique = [atomic_data.pt[sym]['mass'] for sym in struct.symbols_unique] atspec = pwscf.atspec_str(struct.symbols_unique, mass_unique, [sym + '.UPF' for sym in struct.symbols_unique]) celldm = crys.cc2celldm(struct.cryst_const) atpos_frac = pwscf.atpos_str(struct.symbols, struct.coords_frac) print("""\ Notes ----- The .cif file is assumed to contain NO symmetry information: _symmetry_space_group_name_H-M 'P 1' _symmetry_Int_Tables_number 1 loop_ _symmetry_equiv_pos_as_xyz x,y,z Only a,b,c,alpha,beta,gamma and the fractional coords as found in the file are used. CPMD