Ejemplo n.º 1
0
from scipy import interpolate
from scipy.spatial import ConvexHull

parser = argparse.ArgumentParser(
    description="Prepare the directories for the new ground states to run VASP."
)
parser.add_argument('--genstr',
                    default='genstr.out',
                    help="the genstr.out file")
parser.add_argument('-x',
                    action='store_true',
                    help="actually create the directories.")
args = parser.parse_args()

strcorrenergy = pd.read_csv('strcorrenergy.csv', index_col='str_id')
gs = atat_module.get_df('gs', 'gs.out')
interp_func = interpolate.interp1d(gs['c'], gs['E_fit'])
strcorrenergy['E_gs'] = interp_func(strcorrenergy['c'])
strcorrenergy['E_diff'] = strcorrenergy['E_per_site'] - strcorrenergy['E_gs']
str_below_hull = strcorrenergy[(strcorrenergy['E_diff'] < -0.0001)]

str_id_list = []
for c in sorted(list(set(str_below_hull['c']))):
    str_below_hull_c = str_below_hull[np.isclose(str_below_hull['c'], c)]
    str_id_list.append(str_below_hull_c['E_diff'].idxmin())

if len(str_id_list) >= 3:
    str_lowest_hanging = strcorrenergy.loc[str_id_list]
    str_gs = gs[['c']].copy()
    str_gs['E_diff'] = 0
    concat_df = pd.concat([str_lowest_hanging, str_gs])
Ejemplo n.º 2
0
                    help="the range of y-axis")
parser.add_argument('-s',
                    metavar='savefig_name',
                    help="if specified, save to file but not display")
args = parser.parse_args()

if args.s:
    mpl.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('research')

colors = plt.rcParams['axes.color_cycle']
n_colors = len(colors)

for idx, i in enumerate(args.file):
    df = atat_module.get_df('phb', i)
    color = colors[idx % n_colors]
    plt.plot(df['x1'], df.index.values, 'x-', ms=3, color=color, label=i)
    plt.plot(df['x2'], df.index.values, 'x-', ms=3, color=color)

plt.xlabel(r'Concentration (-1 ~ 1)')
plt.ylabel('Temperature (K)')
if args.xlim:
    plt.xlim(*args.xlim)
if args.ylim:
    plt.ylim(*args.ylim)
plt.legend(loc=0, fontsize='x-small', handlelength=1, labelspacing=0.1)
plt.tight_layout()

if args.s:
    plt.savefig(args.s)
Ejemplo n.º 3
0
    "Check if the energy discrepancy is too large (measured by multiples of std), or lies too much above the hull (measured by quantile)."
)
parser.add_argument(
    '-q',
    required=True,
    type=float,
    help=
    "the quantile of the energy at a certain concentration, above which to remove."
)
parser.add_argument('-d',
                    required=True,
                    type=float,
                    help="the multiple of std, above which to remove.")
args = parser.parse_args()

quantile = float(args.q)
std_multi = float(args.d)

fit = atat_module.get_df('fit', 'fit.out')

above_limit_list = []
for c in sorted(list(set(fit['c']))):
    fit_c = fit[np.isclose(fit['c'], c)]
    fit_c_above_limit = fit_c[fit_c['E'] > fit_c['E'].quantile(quantile)]
    above_limit_list.append(fit_c_above_limit)

above_limit = pd.concat(above_limit_list)
to_be_gone = above_limit[above_limit['E_diff'] > std_multi *
                         fit['E_diff'].std()]
print(to_be_gone)
Ejemplo n.º 4
0
                    metavar='savefig_name',
                    help="if specified, save to file but not display")
args = parser.parse_args()

if args.s:
    mpl.use('Agg')
import matplotlib.pyplot as plt

plt.style.use('research')

#plt.rcParams['axes.prop_cycle'] = plt.rcParamsDefault['axes.prop_cycle']
colors = plt.rcParams['axes.color_cycle']

if args.gs:
    strcorrenergy = pd.read_csv('strcorrenergy.csv', index_col='str_id')
predstr = atat_module.get_df('predstr', 'predstr.out')
fit = atat_module.get_df('fit', 'fit.out')
gs = atat_module.get_df('gs', 'gs.out')

if args.gsline_vasp:
    gsline_E = '-'
    gsline_E_fit = ''
    interp_func = interpolate.interp1d(gs['c'], gs['E'])
else:
    gsline_E = ''
    gsline_E_fit = '-'
    interp_func = interpolate.interp1d(gs['c'], gs['E_fit'])

if args.gslim:
    x1 = args.gslim[0]
    x2 = args.gslim[1]
Ejemplo n.º 5
0
    '--return_single',
    action='store_true',
    help="return single peak, rather than however many it detects")

args = parser.parse_args()

if args.s and not args.p:
    mpl.use('Agg')
import matplotlib.pyplot as plt

plt.style.use('research')
plot = True if args.p or args.s else None

if args.filetype == 'emc2':
    df = pd.concat([
        atat_module.get_df('emc2', filename, special=args.special)
        for filename in args.filename
    ])
    cm = True if args.special == 'cm' else False
    df = df.sort_index()
    idxsls = pd.IndexSlice
    if not cm:
        if args.special == 'innerT':
            df = df.loc[idxsls[args.mu[0]:args.mu[1], args.T[0]:args.T[1]], :]
        else:
            df = df.loc[idxsls[args.T[0]:args.T[1], args.mu[0]:args.mu[1]], :]
    else:
        df = df.loc[idxsls[:, args.T[0]:args.T[1]], :]

    if args.trans:
        df_trans = atat_module.get_emc2_transition(
Ejemplo n.º 6
0
                    help="if specified, save to file but not display")
args = parser.parse_args()

if args.s:
    mpl.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('research')

if args.file:
    f = args.file
else:
    f = StringIO(
        check_output("getclus -e | grep -v '^0' | grep -v '^1'",
                     shell=True).decode())

clusinfo = atat_module.get_df('clusinfo', f)
clusinfo['eci'] *= 1e3
pair = clusinfo[clusinfo['n_pts'] == 2]
trip = clusinfo[clusinfo['n_pts'] == 3]
quad = clusinfo[clusinfo['n_pts'] == 4]

is_trip = None
is_quad = None

if trip.values.any():
    is_trip = True
    orig_for_trip = np.ceil(pair['d'].iloc[-1]) + 1
if quad.values.any():
    is_quad = True
    orig_for_quad = orig_for_trip + np.ceil(trip['d'].iloc[-1]) + 1