Merge branch 'master' of github.com:rasmusthog/nafuma
This commit is contained in:
commit
3d493a69f8
3 changed files with 39 additions and 15 deletions
|
|
@ -786,12 +786,10 @@ def prettify_dos_plot(fig, ax, options):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def plot_coop(plot_data, options):
|
def plot_coop(data, options):
|
||||||
''' interactions = list with number of interaction (index + 1 of interactions list from read_coop)'''
|
''' interactions = list with number of interaction (index + 1 of interactions list from read_coop)'''
|
||||||
|
|
||||||
|
|
||||||
required_options = ['plot_kind', 'mode', 'up', 'down', 'collapse', 'interactions', 'flip_xy', 'fill', 'colours', 'palettes']
|
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
'plot_kind': 'COOP',
|
'plot_kind': 'COOP',
|
||||||
'mode': 'individual',
|
'mode': 'individual',
|
||||||
|
|
@ -806,17 +804,17 @@ def plot_coop(plot_data, options):
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options = update_options(options=options, required_options=required_options, default_options=default_options)
|
options = aux.update_options(options=options, default_options=default_options)
|
||||||
|
|
||||||
|
|
||||||
fig, ax = prepare_plot(options=options)
|
fig, ax = btp.prepare_plot(options=options)
|
||||||
|
|
||||||
coopcar, coop_interactions = dft.io.read_coop(plot_data=plot_data, options=options)
|
coopcar, coop_interactions = dft.io.read_coop(data=data, options=options)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not options['colours']:
|
if not options['colours']:
|
||||||
colour_cycle = generate_colours(palettes=options['palettes'])
|
colour_cycle = btp.generate_colours(palettes=options['palettes'])
|
||||||
|
|
||||||
colours = []
|
colours = []
|
||||||
for interaction in range(len(coop_interactions)):
|
for interaction in range(len(coop_interactions)):
|
||||||
|
|
@ -894,6 +892,8 @@ def plot_coop(plot_data, options):
|
||||||
to_plot = ['mean_down']
|
to_plot = ['mean_down']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Plot all columns as decided above
|
# Plot all columns as decided above
|
||||||
for j, column in enumerate(to_plot):
|
for j, column in enumerate(to_plot):
|
||||||
if options['fill']:
|
if options['fill']:
|
||||||
|
|
@ -912,9 +912,9 @@ def plot_coop(plot_data, options):
|
||||||
else:
|
else:
|
||||||
coopcar.plot(x='Energy', y=column, ax=ax, color=colour)
|
coopcar.plot(x='Energy', y=column, ax=ax, color=colour)
|
||||||
|
|
||||||
prettify_dos_plot(fig=fig, ax=ax, options=options)
|
fig, ax = btp.adjust_plot(fig=fig, ax=ax, options=options)
|
||||||
|
|
||||||
return coopcar
|
return coopcar, fig, ax
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@ def read_coop(data={}, options={}):
|
||||||
required_options = ['collapse']
|
required_options = ['collapse']
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
'collapse': False
|
'collapse': False,
|
||||||
|
'adjust': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -128,6 +129,9 @@ def read_coop(data={}, options={}):
|
||||||
|
|
||||||
coopcar.columns = columns
|
coopcar.columns = columns
|
||||||
|
|
||||||
|
if options['adjust']:
|
||||||
|
coopcar['Energy'] = coopcar['Energy'] - options['adjust']
|
||||||
|
|
||||||
|
|
||||||
if options['collapse']:
|
if options['collapse']:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -926,10 +926,18 @@ def refine(data: dict, options={}):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def read_results(path):
|
def read_results(path, options={}):
|
||||||
|
|
||||||
|
|
||||||
|
default_options = {
|
||||||
|
'errors': True
|
||||||
|
}
|
||||||
|
|
||||||
|
options = aux.update_options(options=options, default_options=default_options)
|
||||||
|
|
||||||
results = pd.read_csv(path, delim_whitespace=True, index_col=0, header=None)
|
results = pd.read_csv(path, delim_whitespace=True, index_col=0, header=None)
|
||||||
|
|
||||||
|
if options['errors']:
|
||||||
atoms = int((results.shape[1] - 24) / 10)
|
atoms = int((results.shape[1] - 24) / 10)
|
||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
|
|
@ -938,13 +946,25 @@ def read_results(path):
|
||||||
'a', 'a_err', 'b', 'b_err', 'c', 'c_err', 'alpha', 'alpha_err', 'beta', 'beta_err', 'gamma', 'gamma_err',
|
'a', 'a_err', 'b', 'b_err', 'c', 'c_err', 'alpha', 'alpha_err', 'beta', 'beta_err', 'gamma', 'gamma_err',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
else:
|
||||||
|
atoms = int((results.shape[1] - 15) / 5)
|
||||||
|
|
||||||
|
headers = [
|
||||||
|
'r_wp', 'r_exp', 'r_p', 'r_p_dash', 'r_exp_dash', 'gof',
|
||||||
|
'vol', 'mass', 'wp',
|
||||||
|
'a', 'b', 'c', 'alpha', 'beta', 'gamma',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
labels = ['x', 'y', 'z', 'occ', 'beq']
|
labels = ['x', 'y', 'z', 'occ', 'beq']
|
||||||
for i in range(atoms):
|
for i in range(atoms):
|
||||||
for label in labels:
|
for label in labels:
|
||||||
headers.append(f'atom_{i+1}_{label}')
|
headers.append(f'atom_{i+1}_{label}')
|
||||||
|
|
||||||
|
if options['errors']:
|
||||||
headers.append(f'atom_{i+1}_{label}_err')
|
headers.append(f'atom_{i+1}_{label}_err')
|
||||||
|
|
||||||
|
|
||||||
results.columns = headers
|
results.columns = headers
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue