Beispiel #1
0
def read_HS(filename, symboli, symbolj, format=None):
    """
    Read Slater-Koster tables from files.

    Parameters:
    -----------
    fileobj:   filename of file-object to read from
    symboli:   chemical symbol of the first element
    symbolj:   chemical symbol of the second element
    """

    if format is None:
        format = filetype(filename)

    if format == 'par':
        from hotbit.io.native import read_HS_from_par
        return read_HS_from_par(filename, symboli, symbolj)

    if format == 'skf':
        from hotbit.io.dftb import read_HS_from_skf
        return read_HS_from_skf(filename, symboli, symbolj)

    raise RuntimeError('File format "'+format+'" not recognized!')
Beispiel #2
0
    parf = open(argv[1] + '_' + argv[2] + '.par')
    elmf = open(argv[1] + '.elm')
except:
    parf = open(argv[2] + '_' + argv[1] + '.par')

# Read line-by-line (needed for repulsive term)
tmp = parf.readlines()

for carousel in [(argv[1], argv[2]), (argv[2], argv[1])]:

    # Open Outfile
    skff = open(carousel[0] + '-' + carousel[1] + '.skf', 'w')

    # Read relevant data (A-B and B-A is different!)
    elmdat = native.read_element_from_elm(elmf, argv[1])
    pardat = native.read_HS_from_par(parf, carousel[0], carousel[1])

    # Generate DFTBplus format string
    print 'Reading in Hotbit Metadata and repulsive potential'
    header = generate_DFTBplus_header(elmdat,
                                      pardat,
                                      argv[1] == argv[2]) + \
        generate_DFTBplus_repulsion(tmp,
                                    DEBUG=False)

    skff.write(header)
    skff.close()

# Close files
parf.close()
elmf.close()
Beispiel #3
0
except:
    parf = open(argv[2] + '_' + argv[1] + '.par')


# Read line-by-line (needed for repulsive term)
tmp = parf.readlines()


for carousel in [(argv[1], argv[2]), (argv[2], argv[1])]:

    # Open Outfile
    skff = open(carousel[0] + '-' + carousel[1] + '.skf', 'w')

    # Read relevant data (A-B and B-A is different!)
    elmdat = native.read_element_from_elm(elmf, argv[1])
    pardat = native.read_HS_from_par(parf, carousel[0], carousel[1])

    # Generate DFTBplus format string
    print 'Reading in Hotbit Metadata and repulsive potential'
    header = generate_DFTBplus_header(elmdat,
                                      pardat,
                                      argv[1] == argv[2]) + \
        generate_DFTBplus_repulsion(tmp,
                                    DEBUG=False)

    skff.write(header)
    skff.close()

# Close files
parf.close()
elmf.close()