Exemple #1
0
        atoms.cellvec[0][1] = atoms.cellvec[0][1] * bohr2ang
        atoms.cellvec[0][2] = atoms.cellvec[0][2] * bohr2ang
        atoms.cellvec[1][0] = atoms.cellvec[1][0] * bohr2ang
        atoms.cellvec[1][1] = atoms.cellvec[1][1] * bohr2ang
        atoms.cellvec[1][2] = atoms.cellvec[1][2] * bohr2ang
        atoms.cellvec[2][0] = atoms.cellvec[2][0] * bohr2ang
        atoms.cellvec[2][1] = atoms.cellvec[2][1] * bohr2ang
        atoms.cellvec[2][2] = atoms.cellvec[2][2] * bohr2ang
        for iat in range(atoms.nat):
            atoms.rat[iat][0] = atoms.rat[iat][0] * bohr2ang
            atoms.rat[iat][1] = atoms.rat[iat][1] * bohr2ang
            atoms.rat[iat][2] = atoms.rat[iat][2] * bohr2ang

if len(atoms_all) == 1:
    if not atoms_all[0].boundcond == "free":
        atoms_all[0].cellvec, atoms_all[0].rat = latvec2dproj(
            atoms_all[0].cellvec, atoms_all[0].rat, atoms_all[0].nat)
    ascii_write(atoms_all[0], args.fn_out)
else:
    print(
        "\nATTENTION: The are more than one configuration in YAML file. The given name for the output is ignored!"
    )
    prefix = input(
        "Please provide a prefix to generate files enumeratedly: [Default=tt]")
    if prefix == "": prefix = "tt"
    nconf = 0
    for atoms in atoms_all:
        nconf += 1
        fnout = "%s%5.5d.ascii" % (prefix, nconf)
        if not atoms.boundcond == "free":
            atoms.cellvec, atoms.rat = latvec2dproj(atoms.cellvec, atoms.rat,
                                                    atoms.nat)
Exemple #2
0
                    help="Name of the input file in yaml format")
parser.add_argument('dkpt',
                    action='store',
                    type=float,
                    help="Density of k-points")
args = parser.parse_args()

bohr2ang = 0.52917720859
ang2bohr = 1.0 / 0.52917720859

atoms_all = read_yaml(args.fn_inp)
iconf = 0
for atoms in atoms_all:
    iconf += 1
    #rotation
    atoms.cellvec, atoms.rat = latvec2dproj(atoms.cellvec, atoms.rat,
                                            atoms.nat)
    if atoms.units_length_io == "angstrom":
        ax = atoms.cellvec[0][0] * ang2bohr
        bx = atoms.cellvec[1][0] * ang2bohr
        by = atoms.cellvec[1][1] * ang2bohr
        cx = atoms.cellvec[2][0] * ang2bohr
        cy = atoms.cellvec[2][1] * ang2bohr
        cz = atoms.cellvec[2][2] * ang2bohr
    else:
        ax = atoms.cellvec[0][0]
        bx = atoms.cellvec[1][0]
        by = atoms.cellvec[1][1]
        cx = atoms.cellvec[2][0]
        cy = atoms.cellvec[2][1]
        cz = atoms.cellvec[2][2]
    pi = math.acos(-1.0)