<commit_before>import os

from pymatgen.phasediagram.pdanalyzer import PDAnalyzer
from pymatgen.phasediagram.pdmaker import PhaseDiagram
from pymatgen.core.structure import Structure
from pymatgen.io.vasp.outputs import Vasprun
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.matproj.rest import MPRester

from monty.serialization import loadfn

import twod_materials.standard as st

import matplotlib.pyplot as plt


MPR = MPRester(
    loadfn(os.path.join(os.path.expanduser('~'), 'dbauth.yaml'))['mp_api']
    )


def get_competing_species(directories):

    total_competing_species = []
    hull_distances = {}
    finished_competitors = {}

    # Determine which competing species have been relaxed in the current
    # framework and store them in a dictionary ({formula: entry}).
    if os.path.isdir('all_competitors'):
        os.chdir('all_competitors')<commit_msg>Use Agg for matplotlib import.<commit_after>import os

from pymatgen.phasediagram.pdanalyzer import PDAnalyzer
from pymatgen.phasediagram.pdmaker import PhaseDiagram
from pymatgen.core.structure import Structure
from pymatgen.io.vasp.outputs import Vasprun
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.matproj.rest import MPRester

from monty.serialization import loadfn

import twod_materials.standard as st

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt


MPR = MPRester(
    loadfn(os.path.join(os.path.expanduser('~'), 'dbauth.yaml'))['mp_api']
    )


def get_competing_species(directories):

    total_competing_species = []
    hull_distances = {}
    finished_competitors = {}

    # Determine which competing species have been relaxed in the current
    # framework and store them in a dictionary ({formula: entry}).
    if os.path.isdir('all_competitors'):
        os.chdir('all_competitors')
{'fraction_non_alphanumeric': 0.0840064620355412, 'fraction_numerical': 0.0, 'mean_word_length': 4.8427672955974845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6162461', 'n_tokens_mistral': 611, 'n_tokens_neox': 591, 'n_words': 146}