Skip to content

Commit

Permalink
Suppress GB warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Dec 14, 2018
1 parent b4348ff commit 24ef7ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions pymatgen/analysis/gb/test/test_grain.py
Expand Up @@ -7,6 +7,7 @@
from pymatgen.util.testing import PymatgenTest
import os
import numpy as np
import warnings
from pymatgen import Structure
from pymatgen.analysis.gb.grain import GrainBoundary, GrainBoundaryGenerator

Expand All @@ -27,6 +28,11 @@ def setUpClass(cls):
cls.Cu_GB2 = GB_Cu_conv.gb_from_parameters([1, 2, 3], 123.74898859588858,
expand_times=4, vacuum_thickness=1.5,
ab_shift=[0.2, 0.2], rm_ratio=0.0)
warnings.simplefilter("ignore")

@classmethod
def tearDownClass(cls):
warnings.simplefilter("default")

def test_init(self):
self.assertAlmostEqual(self.Cu_GB1.rotation_angle, 123.74898859588858)
Expand Down Expand Up @@ -120,6 +126,12 @@ def setUpClass(cls):
"Bi_mp-23152_primitive.cif"))
cls.GB_Bi = GrainBoundaryGenerator(cls.Bi)

warnings.simplefilter("ignore")

@classmethod
def tearDownClass(cls):
warnings.simplefilter("default")

def test_gb_from_parameters(self):
# from fcc primitive cell,axis[1,2,3],sigma 9.
gb_cu_123_prim1 = self.GB_Cu_prim.gb_from_parameters([1, 2, 3],
Expand Down
4 changes: 2 additions & 2 deletions pymatgen/core/structure.py
Expand Up @@ -3164,8 +3164,8 @@ def merge_sites(self, tol=0.01, mode="sum"):
for key in props.keys():
if props[key] is not None and self[i].properties[key] != props[key]:
props[key] = None
warnings.warn("Sites with different site property %s are merged."
"so property is set to none" % key)
warnings.warn("Sites with different site property %s are merged. "
"So property is set to none" % key)
sites.append(PeriodicSite(species, coords, self.lattice, properties=props))

self._sites = sites
Expand Down

0 comments on commit 24ef7ae

Please sign in to comment.