Skip to content

Commit

Permalink
Hopefully this fixes all errors with flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Sep 15, 2019
1 parent 8513da9 commit 2366635
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pmg-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 120 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics pymatgen
# exit-zero treats all errors as warnings.
flake8 --count --exit-zero --max-complexity=10 --statistics pymatgen
- name: Test with pytest
run: |
pip install pytest
Expand Down
32 changes: 15 additions & 17 deletions pymatgen/analysis/defects/dilute_solution_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.

"""
Evaluate the defect concentration based on composition, temperature,
and defect energies using "Dilute Solution Model"
Reference: Phys Rev B, 63, 094103, 2001,
"Density of constitutional and thermal point defects in L12 Al3Sc",
C. Woodward, M. Asta, G. Kresse and J. Hafner.
Manual and citation for the code, DOI: 10.1016/j.cpc.2015.03.015
"""

import math
import copy
import numpy as np
Expand All @@ -11,14 +20,6 @@

from monty.dev import deprecated

"""
Evaluate the defect concentration based on composition, temperature,
and defect energies using "Dilute Solution Model"
Reference: Phys Rev B, 63, 094103, 2001,
"Density of constitutional and thermal point defects in L12 Al3Sc",
C. Woodward, M. Asta, G. Kresse and J. Hafner.
Manual and citation for the code, DOI: 10.1016/j.cpc.2015.03.015
"""

__author__ = 'Bharat Medasani'
__version__ = "0.2"
Expand All @@ -32,7 +33,7 @@


# Check the inputs
def check_input(def_list):
def _check_input(def_list):
flag = True
for defect in def_list:
if not defect:
Expand Down Expand Up @@ -76,9 +77,9 @@ def dilute_solution_model(structure, e0, vac_defs, antisite_defs, T, trial_chem_
potentials are returned.
"""

if not check_input(vac_defs):
if not _check_input(vac_defs):
raise ValueError('Vacancy energy is not defined')
if not check_input(antisite_defs):
if not _check_input(antisite_defs):
raise ValueError('Antisite energy is not defined')

formation_energies = {}
Expand Down Expand Up @@ -339,10 +340,7 @@ def compute_def_formation_energies():
if not trial_chem_pot:
mu_vals = compute_mus_by_search()
else:
try:
mu_vals = [trial_chem_pot[element] for element in specie_order]
except Exception:
mu_vals = compute_mus()
mu_vals = [trial_chem_pot[element] for element in specie_order]

formation_energies = compute_def_formation_energies()
mu_dict = dict(zip(specie_order, mu_vals))
Expand Down Expand Up @@ -784,9 +782,9 @@ def solute_site_preference_finder(structure,
plot_data: The data for plotting the solute defect concentration.
"""

if not check_input(vac_defs):
if not _check_input(vac_defs):
raise ValueError('Vacancy energy is not defined')
if not check_input(antisite_defs):
if not _check_input(antisite_defs):
raise ValueError('Antisite energy is not defined')

formation_energies = {}
Expand Down

0 comments on commit 2366635

Please sign in to comment.