Permalink
Browse files

More cleanup.

  • Loading branch information...
1 parent d2392ca commit cae71dcec712f7569054524ac07cec6b1802b66d @shyuep shyuep committed Mar 1, 2014
@@ -4,9 +4,9 @@
This module defines classes for point defects
"""
from __future__ import division
+
import os
import abc
-import re
import json
from bisect import bisect_left
@@ -20,7 +20,7 @@
RelaxationAnalyzer
from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.analysis.bond_valence import BVAnalyzer
-from pymatgen.core.periodic_table import Specie, Element
+from pymatgen.core.periodic_table import Specie
file_dir = os.path.dirname(__file__)
rad_file = os.path.join(file_dir, 'ionic_radii.json')
@@ -378,7 +378,6 @@ def get_volume(self, n):
sc = self.make_supercells_with_defects(um)[1:]
rad_dict = self.struct_radii
for i in range(len(sc)):
- site_radi = rad_dict[self._defect_sites[i].specie.symbol]
vol, sa = get_void_volume_surfarea(sc[i], rad_dict)
self._vol.append(vol)
self._sa.append(sa)
@@ -657,8 +656,6 @@ def reduce_defectsites(self):
coordinates.
"""
distinct_radii = list(set(self._radii))
- no_dstnt_radii = len(distinct_radii)
- flag = [False] * no_dstnt_radii
for rad in distinct_radii:
ind = self._radii.index(rad) # Index of first site with 'rad'
for i in reversed(range(ind + 1, len(self._radii))):
@@ -788,8 +785,6 @@ def get_energy(self, n, relax=True):
scale_mat = [[scd, 0, 0], [0, scd, 0], [0, 0, scd]]
sc = self._inter.make_supercells_with_defects(scale_mat, self._el)
blk_energy = get_energy_buckingham(sc[0])
- no = len(sc[0].sites)
- #print no
for i in range(1, no_inter + 1):
inter_energy = get_energy_buckingham(
sc[i], keywords=inter_gulp_kw, valence_dict=val_dict
@@ -76,7 +76,6 @@ def get_chempot_range_map(self, limits=[[-2,16], [-4,4]]):
tol = PourbaixAnalyzer.numerical_tol
all_chempots = []
facets = self._pd.facets
- entries = self._pd.qhull_entries
for facet in facets:
chempots = self.get_facet_chempots(facet)
chempots["H+"] /= -0.0591
@@ -108,7 +107,7 @@ def get_chempot_range_map(self, limits=[[-2,16], [-4,4]]):
# Find point in half-space in which optimization is desired
ph_max_contrib = -1 * max([abs(0.0591 * row[0])
- for row in self._pd._qhull_data]) * limits[0][1]
+ for row in self._pd._qhull_data]) * limits[0][1]
V_max_contrib = -1 * max([abs(row[1]) for row in self._pd._qhull_data]) * limits[1][1]
g_max = (-1 * max([abs(pt[2]) for pt in on_plane_points])
+ ph_max_contrib + V_max_contrib) - 10
@@ -19,13 +19,10 @@
import logging
import numpy as np
import itertools
-import re
from itertools import chain
from pyhull.convex_hull import ConvexHull
from pymatgen.analysis.pourbaix.entry import MultiEntry, ion_or_solid_comp_object
from pymatgen.core.periodic_table import Element
-from pymatgen.core import Composition
-from pymatgen.core.ion import Ion
logger = logging.getLogger(__name__)
@@ -416,7 +416,6 @@ def get_pourbaix_plot_colorfill_by_element(self, limits=None, title="",
Color domains by element
"""
from matplotlib.patches import Polygon
- import matplotlib.patheffects as PathEffects
entry_dict_of_multientries = collections.defaultdict(list)
plt = get_publication_quality_plot(16)
@@ -501,7 +500,7 @@ def len_elts(entry):
patch = Polygon(xy, hatch=hatch[color_indx], closed=True, lw=3.0, fill=False)
hc = hatch[color_indx]
ax.add_patch(patch)
-
+
xy_center = (x_coord / npts, y_coord / npts)
if label_domains:
if color_indx >= len(optim_colors):
@@ -531,19 +531,6 @@ def test_site_properties(self):
self.assertEqual(propertied_mol[0].magmom, 0.5)
self.assertEqual(propertied_mol[1].magmom, -0.5)
- def test_to_from_dict(self):
- propertied_mol = Molecule(["C", "H", "H", "H", "H"], self.coords,
- charge=1,
- site_properties={'magmom':
- [0.5, -0.5, 1, 2, 3]})
- d = propertied_mol.to_dict
- self.assertEqual(d['sites'][0]['properties']['magmom'], 0.5)
- mol = Molecule.from_dict(d)
- self.assertEqual(propertied_mol, mol)
- self.assertEqual(mol[0].magmom, 0.5)
- self.assertEqual(mol.formula, "H4 C1")
- self.assertEqual(mol.charge, 1)
-
def test_get_boxed_structure(self):
s = self.mol.get_boxed_structure(9, 9, 9)
# C atom should be in center of box.
@@ -617,7 +604,17 @@ def test_to_from_dict(self):
d = self.mol.to_dict
mol2 = IMolecule.from_dict(d)
self.assertEqual(type(mol2), IMolecule)
-
+ propertied_mol = Molecule(["C", "H", "H", "H", "H"], self.coords,
+ charge=1,
+ site_properties={'magmom':
+ [0.5, -0.5, 1, 2, 3]})
+ d = propertied_mol.to_dict
+ self.assertEqual(d['sites'][0]['properties']['magmom'], 0.5)
+ mol = Molecule.from_dict(d)
+ self.assertEqual(propertied_mol, mol)
+ self.assertEqual(mol[0].magmom, 0.5)
+ self.assertEqual(mol.formula, "H4 C1")
+ self.assertEqual(mol.charge, 1)
class MoleculeTest(PymatgenTest):
@@ -1,7 +1,5 @@
import unittest
-import json
import os
-import numpy.testing as nptest
from pymatgen.electronic_structure.boltztrap import BoltztrapAnalyzer
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..",
@@ -14,9 +14,7 @@
import unittest
-from pymatgen.core.structure import Structure, Molecule
from pymatgen.core.periodic_table import Specie
-from pymatgen.core.sites import PeriodicSite
from pymatgen.io.cifio import CifParser
from pymatgen.io.zeoio import *
from pymatgen.io.vaspio.vasp_input import Poscar
@@ -131,7 +129,7 @@ def setUp(self):
[-0.513360, 0.889165, -0.363000]]
prop = [0.4, 0.2, 0.2, 0.2, 0.2]
self.mol = Molecule(
- ["C", "H", "H", "H", "H"], coords,
+ ["C", "H", "H", "H", "H"], coords,
site_properties={"voronoi_radius":prop})
self.xyz = ZeoVoronoiXYZ(self.mol)
@@ -219,7 +217,7 @@ def setUp(self):
self._radii[k1] = float(Specie(k1, v).ionic_radius)
p.remove(0)
self._vac_struct = p
-
+
def test_void_volume_surface_area(self):
pass
vol, sa = get_void_volume_surfarea(
View
@@ -45,9 +45,9 @@ class ZeoCssr(Cssr):
structure: A structure to create ZeoCssr object
"""
- @requires(zeo_found,
- "ZeoCssr requires Zeo++ cython extension to be installed. Please "
- "contact developers of Zeo++ to obtain it.")
+ # @requires(zeo_found,
+ # "ZeoCssr requires Zeo++ cython extension to be installed. Please "
+ # "contact developers of Zeo++ to obtain it.")
def __init__(self, structure):
super(ZeoCssr, self).__init__(structure)
@@ -17,7 +17,6 @@
import datetime
import unittest
import numpy as np
-import json
from pymatgen import Structure, Molecule
from pymatgen.matproj.snl import StructureNL, HistoryNode, Author

0 comments on commit cae71dc

Please sign in to comment.