<commit_before>import warnings, sys, os
import unittest
import pymatgen
from pymatgen.io.vaspio import Poscar
from pymatgen.io.vaspio import Poscar
from pymatgen.io.vaspio import Vasprun
from pymatgen.io.cifio import CifWriter
from pymatgen.io.cifio import CifParser
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.transformations.standard_transformations import *
from pymatgen.core.structure_modifier import StructureEditor
from pymatgen.phonons.tensors import SQTensor
import numpy as np

__author__="<NAME>"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "<NAME>, <NAME>"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
__date__ ="March 22, 2012"

class Stress(SQTensor):
 
    def __init__(self, stress_matrix):
        self._sigma = stress_matrix
        super(Stress, self).__init__(self._sigma)

    def get_scaled(self, scale_factor):
        return super(Stress, self).get_scaled(scale_factor)

    @property
    def DeviatorPrincipalInvariants(self):
        I = self.PrincipalInvariants
        J1 = 0
        J2 = 1.0/3*I[0]**2 - I[1]
        J3 = 2.0/27*I[0]**3 - 1.0/3*I[0]*I[1] + I[2]
        J = [J1, J2, J3]
        return J

    @property
    def VonMises(self):
        if self.is_symmetric() == False:
            raise ValueError("The stress tensor is not symmetric, VM stress is based on a symmetric stress tensor.")
        J = self.DeviatorPrincipalInvariants        
        sigma_mises = math.sqrt(3*J[1])
        return sigma_mises

    @property
    def MeanStress(self):<commit_msg>add comments to Stress class<commit_after>import warnings, sys, os
import unittest
import pymatgen
from pymatgen.io.vaspio import Poscar
from pymatgen.io.vaspio import Poscar
from pymatgen.io.vaspio import Vasprun
from pymatgen.io.cifio import CifWriter
from pymatgen.io.cifio import CifParser
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.transformations.standard_transformations import *
from pymatgen.core.structure_modifier import StructureEditor
from pymatgen.phonons.tensors import SQTensor
import numpy as np

__author__="<NAME>"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "<NAME>, <NAME>"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
__date__ ="March 22, 2012"

class Stress(SQTensor):
    #TODO: AJ says method names are not PEP8. e.g., VonMises should be von_mises.
 
    def __init__(self, stress_matrix):
        self._sigma = stress_matrix
        super(Stress, self).__init__(self._sigma)
        #TODO: AJ says defining a sigma parameter is bad, just use the _matrix parameter from the superclass

    def get_scaled(self, scale_factor):
        return super(Stress, self).get_scaled(scale_factor)

    @property
    def DeviatorPrincipalInvariants(self):
        I = self.PrincipalInvariants
        J1 = 0
        J2 = 1.0/3*I[0]**2 - I[1]
        J3 = 2.0/27*I[0]**3 - 1.0/3*I[0]*I[1] + I[2]
        J = [J1, J2, J3]
        return J

    @property
    def VonMises(self):
        if self.is_symmetric() == False:
            raise ValueError("The stress tensor is not symmetric, VM stress is based on a symmetric stress tensor.")
        J = self.DeviatorPrincipalInvariants        
        sigma_mises = math.sqrt(3*J[1])
        return sigma_mises

    @property
    def MeanStress(self):
{'fraction_non_alphanumeric': 0.09603220241518114, 'fraction_numerical': 0.022714203565267394, 'mean_word_length': 3.5240572171651494, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1522636', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1149, 'n_words': 311}