Skip to content

Commit

Permalink
Automatic Py3k merge for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jul 19, 2016
2 parents b695114 + 4bd8d3e commit 9eb9d87
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pymatgen/analysis/tests/test_wulff.py
Expand Up @@ -147,10 +147,10 @@ def symmetry_test(self):
def test_get_azimuth_elev(self):

# Test out the viewing of the Wulff shape from Miller indices.
azim, elev = self.wulff_Ir.get_azimuth_elev((0, 0, 1))
azim, elev = self.wulff_Ir._get_azimuth_elev((0, 0, 1))
self.assertEqual(azim, 0)
self.assertEqual(elev, 90)
azim, elev = self.wulff_Ir.get_azimuth_elev((1, 1, 1))
azim, elev = self.wulff_Ir._get_azimuth_elev((1, 1, 1))
self.assertAlmostEqual(azim, 45)

def test_properties(self):
Expand Down
35 changes: 18 additions & 17 deletions pymatgen/analysis/wulff.py
Expand Up @@ -383,8 +383,8 @@ def get_plot(self, color_set='PuBu', grid_off=True, axis_off=True,

fig = plt.figure()
fig.set_size_inches(aspect_ratio[0], aspect_ratio[1])
azim, elev = self.get_azimuth_elev([direction[0], direction[1],
direction[-1]])
azim, elev = self._get_azimuth_elev([direction[0], direction[1],
direction[-1]])

wulff_pt_list = self.wulff_pt_list

Expand Down Expand Up @@ -466,19 +466,21 @@ def get_plot(self, color_set='PuBu', grid_off=True, axis_off=True,
ax.axis('off')
return plt

def get_azimuth_elev(self, miller_index):
"""
:param miller_index: viewing direction
:return: azim, elev for plotting
def _get_azimuth_elev(self, miller_index):
"""
Args:
miller_index: viewing direction
cart = self.lattice.get_cartesian_coords(miller_index)
azim = get_angle([cart[0], cart[1], 0], (1, 0, 0))
v = [cart[0], cart[1], 0]
elev = get_angle(cart, v)
Returns:
azim, elev for plotting
"""
if miller_index == (0, 0, 1) or miller_index == (0, 0, 0, 1):
return 0, 90
else:
cart = self.lattice.get_cartesian_coords(miller_index)
azim = get_angle([cart[0], cart[1], 0], (1, 0, 0))
v = [cart[0], cart[1], 0]
elev = get_angle(cart, v)
return azim, elev

@property
Expand Down Expand Up @@ -512,7 +514,7 @@ def surface_area(self):
@property
def weighted_surface_energy(self):
"""
:return:
Returns:
sum(surface_energy_hkl * area_hkl)/ sum(area_hkl)
"""
tot_area_energy = 0
Expand All @@ -524,7 +526,7 @@ def weighted_surface_energy(self):
@property
def area_fraction_dict(self):
"""
:return:
Returns:
(dict): {hkl: area_hkl/total area on wulff}
"""
return {hkl: self.miller_area_dict[hkl] / self.surface_area
Expand All @@ -533,8 +535,8 @@ def area_fraction_dict(self):
@property
def anisotropy(self):
"""
:return:
variation from weighted surface energy
Returns:
(float) Coefficient of Variation from weighted surface energy
The ideal sphere is 0.
"""
square_diff_energy = 0
Expand All @@ -555,8 +557,7 @@ def shape_factor(self):
See Ballufi, R. W., Allen, S. M. & Carter, W. C. Kinetics
of Materials. (John Wiley & Sons, 2005), p.461
:return:
variation from weighted surface energy
The ideal sphere is 0.
Returns:
(float) Shape factor.
"""
return self.surface_area / (self.volume ** (2 / 3))

0 comments on commit 9eb9d87

Please sign in to comment.