packages feed

symmetry-operations-symbols 0.0.1.4 → 0.0.2.0

raw patch · 16 files changed

+375/−297 lines, 16 filesdep ~basedep ~matrix-as-xyz

Dependency ranges changed: base, matrix-as-xyz

Files

LICENSE view
@@ -1,30 +1,21 @@-Copyright Jun Narumi (c) 2018--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:+MIT License -    * Redistributions of source code must retain the above copyright-      notice, this list of conditions and the following disclaimer.+Copyright (c) 2018-2020 Jun Narumi. -    * Redistributions in binary form must reproduce the above-      copyright notice, this list of conditions and the following-      disclaimer in the documentation and/or other materials provided-      with the distribution.+Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions: -    * Neither the name of Jun Narumi nor the names of other-      contributors may be used to endorse or promote products derived-      from this software without specific prior written permission.+The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
README.md view
@@ -1,5 +1,9 @@ # symmetry-operations-symbols +[![Continuous Integration status][status-png]][status]+[![Hackage page (downloads and API reference)][hackage-png]][hackage]+[![Hackage-Deps][hackage-deps-png]][hackage-deps]+ Haskell Derivation of symbols and coordinate triplets Library  ## Quickstart@@ -15,17 +19,17 @@  ``` extra-deps:-- matrix-as-xyz-0.1.1.3-- symmetry-operations-symbols-0.0.1.4+- matrix-as-xyz-0.1.2.1+- symmetry-operations-symbols-0.0.2.0 ```  Edit dependencies part of package.yaml like below.  ``` dependencies:-- base >= 4.7 && < 5-- matrix-as-xyz-- symmetry-operations-symbols+- base >= 4.8 && < 5+- matrix-as-xyz >= 0.1.2 && < 2+- symmetry-operations-symbols >= 0.0 && < 0.1 ```  Then start repl.@@ -63,3 +67,11 @@  See the [LICENSE](https://raw.githubusercontent.com/narumij/symmetry-operations-symbols/master/LICENSE) file in the repository.++ [hackage]: http://hackage.haskell.org/package/symmetry-operations-symbols+ [hackage-png]: http://img.shields.io/hackage/v/symmetry-operations-symbols.svg+ [hackage-deps]: http://packdeps.haskellers.com/reverse/symmetry-operations-symbols+ [hackage-deps-png]: https://img.shields.io/hackage-deps/v/symmetry-operations-symbols.svg++ [status]: http://travis-ci.org/narumij/symmetry-operations-symbols?branch=master+ [status-png]: https://api.travis-ci.org/narumij/symmetry-operations-symbols.svg?branch=master
src/Data/Matrix/SymmetryOperationsSymbols.hs view
@@ -1,12 +1,12 @@ {-# LANGUAGE FlexibleInstances, CPP #-}  {-|-Module      : SymmetryOperationsSymbols-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols+Description : Read and Display Geometric representation of symmetry operation+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?  Haskell Derivation of symbols and coordinate triplets Library @@ -17,14 +17,16 @@ 2. Wondratschek, H. & Neubu ̈ser, J. (1967). Determination of the symmetry elements of a space group from the ‘general positions’ listed in International Tables for X-ray Crystallography, Vol. I. Acta Cryst. 23, 349–352.  -}- module Data.Matrix.SymmetryOperationsSymbols (   fromMatrix,   fromMatrix',+  readMatrix,+  readMatrix',   toMatrix,   toMatrixHex,   notHexagonal,-  hexagonal+  hexagonal,+  liftError,   ) where  import Data.Ratio (Ratio)    @@ -39,18 +41,17 @@ import Data.Matrix.SymmetryOperationsSymbols.RotInversionCase  import Data.Matrix.SymmetryOperationsSymbols.Parser-import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation -- (SymmetryOperation)+import Data.Matrix.SymmetryOperationsSymbols.SymopGeom import Data.Matrix.SymmetryOperationsSymbols.Calc +import Data.Matrix.SymmetryOperationsSymbols.PlainText  -- for doctest-import Data.Matrix.AsXYZ+import Data.Matrix.AsXYZ (fromXYZ,prettyXYZ)  #if MIN_VERSION_base(4,11,0)-import Control.Monad.Fail (MonadFail)-+import Control.Monad.Fail (MonadFail(..)) import qualified Control.Monad.Fail as Fail- instance Fail.MonadFail (Either String) where   fail = Left #endif@@ -75,22 +76,27 @@ -- jpn) 与えられた対称操作の行列から、対称操作の幾何的表現を導出 -- #if MIN_VERSION_base(4,11,0)-fromMatrix' :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m String+fromMatrix' :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f String #else fromMatrix' :: (Monad m, Integral a) => Matrix (Ratio a) -> m String #endif-fromMatrix' m = showSymmetryOperation <$> fromMatrix'' m+fromMatrix' m = showAsPlainText <$> readMatrix' m +readMatrix :: Integral a =>+              Matrix (Ratio a) -- ^ 3x4 or 4x4 Matrix+           -> Maybe (SymopGeom a)+readMatrix = readMatrix'+ -- | Derivation of geometric representation of symmetry operations from given matrix of symmetry operations -- -- jpn) 与えられた対称操作の行列から、対称操作の幾何的表現を導出 -- #if MIN_VERSION_base(4,11,0)-fromMatrix'' :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+readMatrix' :: (MonadFail m, Integral a) => Matrix (Ratio a) -> m (SymopGeom a) #else-fromMatrix'' :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+readMatrix' :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymopGeom a) #endif-fromMatrix'' m+readMatrix' m   -- (i)   | rotPart m == identity 3             = unitMatrixCase m   -- (ii) (a)@@ -100,12 +106,12 @@   -- -- (ii) (c)   | correpondToGlideOrReflection tr det = glideOrReflectionCase m   -- ---  | otherwise = fail "matrix is not symmetry operation."+  | otherwise = fail $ "coordinate triplet '" ++ prettyXYZ m ++ "' is not symmetry operation."   where   tr  = trace (rotPart m)   det = detLU (rotPart m) -  -- | Derivation of matrix representation from a string of geometric representations of symmetric operations+-- | Derivation of matrix representation from a string of geometric representations of symmetric operations -- for cubic, tetragonal, orthorhombic, monoclinic, triclinic or rhombohedral. -- -- jpn) 対称操作の幾何的表現の文字列から行列表現の導出@@ -130,3 +136,11 @@                String -- ^ like " -1 0,0,0"             -> Either ParseError (Matrix (Ratio a)) -- ^ 3x4 Matrix toMatrixHex st = parse hexagonal st st++#if MIN_VERSION_base(4,11,0)+liftError :: MonadFail m => Either ParseError a -> m a+#else+liftError :: Monad m => Either ParseError a -> m a+#endif+liftError (Left s) = fail ""+liftError (Right m) = return m
src/Data/Matrix/SymmetryOperationsSymbols/Calc.hs view
@@ -1,3 +1,11 @@+{-|+Module      : Data.Matrix.SymmetryOperationsSymbols.Calc+Description : Translate SymopGeom to matrix+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT+Maintainer  : narumij@gmail.com+Stability   : experimental+-} module Data.Matrix.SymmetryOperationsSymbols.Calc (     deriveSymmetryOperation     , correpondToRotInversion
src/Data/Matrix/SymmetryOperationsSymbols/Common.hs view
@@ -1,20 +1,12 @@ {-# LANGUAGE CPP #-}  {-|-Module      : Common-Description : utilities+Module      : Data.Matrix.SymmetryOperationsSymbols.Common+Description : Utilities and Matrix table Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?--[Reference]--W. Fischer. and E. Koch. (2006), Derivation of symbols and coordinate triplets--listed in International Tables for Crystallography (2006). Vol. A, Chapter 11.2, pp. 812–816.- -} module Data.Matrix.SymmetryOperationsSymbols.Common (   ErrorMessage,@@ -23,8 +15,8 @@   rotPart,   transPart,   iw,-  triplet,-  tripletParen,+--  triplet,+--  tripletParen,   adjustAnswerOnAxis,   axisOf,   senseOf,@@ -33,6 +25,10 @@   properMatrixW,   hexagonalMatrixW,   fromXYZ'',+  MatrixForPointGroupCorrespondingSymmetryElement(..),+  properMatricesForPointGroup,+  hexagonalMatricesForPointGroup,+  matricesForPointGroupCorrespondingSymmetryElements,   ) where  import Data.List@@ -51,23 +47,6 @@ type ErrorMessage = String type SymbolSenseVectorOrientation = (Symbol,String,String,String) --- | borrowed from Base ?.?.?-maybeToEither :: a -> Maybe b -> Either a b-maybeToEither _ (Just b) = Right b-maybeToEither a  Nothing = Left a---- |--- >>> triplet (1%2,3%4,5%6)--- "1/2,3/4,5/6"-triplet :: Integral a => (Ratio a,Ratio a,Ratio a) -> String-triplet (a,b,c) = intercalate "," . map (show . Slash) $ [a,b,c]---- |--- >>> triplet (1%2,3%4,5%6)--- "(1/2,3/4,5/6)"-tripletParen :: Integral a => (Ratio a,Ratio a,Ratio a) -> String-tripletParen = ("(" ++) . (++ ")") . triplet- -- | calculate (I-W) iw :: Num c => Matrix c -> Matrix c iw = elementwise (-) (identity 3) . rotPart@@ -166,21 +145,21 @@       Nothing -> fail reason       Just c  -> return c -properMatrixW = lookupMatrixM "matrix W not found (proper)." (fromTbl properTbl)+properMatrixW = lookupMatrixM "matrix W not found (proper)." (fromTbl properMatricesForPointGroup) -hexagonalMatrixW = lookupMatrixM "matrix W not found (hexagonal)." (fromTbl hexagonalTbl)+hexagonalMatrixW = lookupMatrixM "matrix W not found (hexagonal)." (fromTbl hexagonalMatricesForPointGroup) -fromTbl :: (Integral a) => [Tbl] -> [MatrixLookupRecord a]+fromTbl :: (Integral a) => [Tbl a] -> [MatrixLookupRecord a] fromTbl = map tblToMLR -tblToMLR :: (Integral a) => Tbl -> MatrixLookupRecord a+tblToMLR :: (Integral a) => Tbl a -> MatrixLookupRecord a tblToMLR (a,s,b,c,d,e,f,g) = ((s,c,rotPart . fromXYZ'' $ d),f) -properTbl :: [Tbl]-properTbl = filter (not . isHex) tbl+properMatricesForPointGroup :: Integral a => [Tbl a]+properMatricesForPointGroup = filter (not . isHex) tbl -hexagonalTbl :: [Tbl]-hexagonalTbl = filter isHex tbl ++ filter (not . isHex) tbl+hexagonalMatricesForPointGroup :: Integral a => [Tbl a]+hexagonalMatricesForPointGroup = filter isHex tbl ++ filter (not . isHex) tbl  primeSymbol :: Symbol -> Symbol primeSymbol T = Id@@ -192,101 +171,126 @@ primeSymbol G = M primeSymbol otherSymbol = otherSymbol -data Lattice = Hexagonal | AnythingElse deriving (Eq)+data TableType+   = Hexagonal -- ^ for hexagonal and trigonal crystal systems.+   | Others    -- ^ for cubic, tetragonal, orthorhombic, monoclinic and triclinic crystal systems.+   deriving (Eq)+ type SymbolLabel = String type Sense = String type SymmetryElement = String-type Orientation = [Integer] -- orientation or location+type Orientation a = [a] -- orientation or location type TransformedCoordinate = String-type AxisOrNormal = [Integer]+type AxisOrNormal a = [a] -type Tbl = (Lattice,Symbol,SymbolLabel,Sense,SymmetryElement,Orientation,TransformedCoordinate,AxisOrNormal)+type Tbl a = MatrixForPointGroupCorrespondingSymmetryElement a -tbl :: [Tbl]-tbl = [+type MatrixForPointGroupCorrespondingSymmetryElement a+  = ( TableType, Symbol, SymbolLabel, Sense, SymmetryElement, Orientation a, TransformedCoordinate, AxisOrNormal a )++tbl :: Integral a => [MatrixForPointGroupCorrespondingSymmetryElement a]+tbl = matricesForPointGroupCorrespondingSymmetryElements++-- | [Reference]+--+-- W. Fischer. and E. Koch. (2006), Derivation of symbols and coordinate triplets+--+-- listed in International Tables for Crystallography (2006). Vol. A, Chapter 11.2, pp. 812–816.+-- -- Table 11.2.2.1. Matrices for point-group symmetry operations and orientation -- of corresponding symmetry elements, referred to a cubic, tetragonal, orthorhombic, -- monoclinic, triclinic or rhombohedral coordinate system-  ( AnythingElse,  Id,  "1",  "",        "",         [],     "x,y,z", []),-  ( AnythingElse,  R2,  "2",  "",   "0,0,z", [ 0, 0, 1],   "-x,-y,z", []),-  ( AnythingElse,  R2,  "2",  "",   "0,y,0", [ 0, 1, 0],   "-x,y,-z", []),-  ( AnythingElse,  R2,  "2",  "",   "x,0,0", [ 1, 0, 0],   "x,-y,-z", []),-  ( AnythingElse,  R3,  "3", "+",   "x,x,x", [ 1, 1, 1],     "z,x,y", []),-  ( AnythingElse,  R3,  "3", "+", "x,-x,-x", [ 1,-1,-1],   "-z,-x,y", []),-  ( AnythingElse,  R3,  "3", "+", "-x,x,-x", [-1, 1,-1],   "z,-x,-y", []),-  ( AnythingElse,  R3,  "3", "+", "-x,-x,x", [-1,-1, 1],   "-z,x,-y", []),-  ( AnythingElse,  R3,  "3", "-",   "x,x,x", [ 1, 1, 1],     "y,z,x", []),-  ( AnythingElse,  R3,  "3", "-", "x,-x,-x", [ 1,-1,-1],   "-y,z,-x", []),-  ( AnythingElse,  R3,  "3", "-", "-x,x,-x", [-1, 1,-1],   "-y,-z,x", []),-  ( AnythingElse,  R3,  "3", "-", "-x,-x,x", [-1,-1, 1],   "y,-z,-x", []),-  ( AnythingElse,  R2,  "2",  "",   "x,x,0", [ 1, 1, 0],    "y,x,-z", []),-  ( AnythingElse,  R2,  "2",  "",   "x,0,x", [ 1, 0, 1],    "z,-y,x", []),-  ( AnythingElse,  R2,  "2",  "",   "0,y,y", [ 0, 1, 1],    "-x,z,y", []),-  ( AnythingElse,  R2,  "2",  "",  "x,-x,0", [ 1,-1, 0],  "-y,-x,-z", []),-  ( AnythingElse,  R2,  "2",  "",  "-x,0,x", [-1, 0, 1],  "-z,-y,-x", []),-  ( AnythingElse,  R2,  "2",  "",  "0,y,-y", [ 0, 1,-1],  "-x,-z,-y", []),-  ( AnythingElse,  R4,  "4", "+",   "0,0,z", [ 0, 0, 1],    "-y,x,z", []),-  ( AnythingElse,  R4,  "4", "+",   "0,y,0", [ 0, 1, 0],    "z,y,-x", []),-  ( AnythingElse,  R4,  "4", "+",   "x,0,0", [ 1, 0, 0],    "x,-z,y", []),-  ( AnythingElse,  R4,  "4", "-",   "0,0,z", [ 0, 0, 1],    "y,-x,z", []),-  ( AnythingElse,  R4,  "4", "-",   "0,y,0", [ 0, 1, 0],    "-z,y,x", []),-  ( AnythingElse,  R4,  "4", "-",   "x,0,0", [ 1, 0, 0],    "x,z,-y", []),+--+-- Table 11.2.2.2. Matrices for point-group symmetry operations and orientation+-- of corresponding symmetry elements, referred to a hexagonal coordinate system+--+matricesForPointGroupCorrespondingSymmetryElements ::+  Integral a => +  [MatrixForPointGroupCorrespondingSymmetryElement a]+matricesForPointGroupCorrespondingSymmetryElements = [+-- Table 11.2.2.1. Matrices for point-group symmetry operations and orientation+-- of corresponding symmetry elements, referred to a cubic, tetragonal, orthorhombic,+-- monoclinic, triclinic or rhombohedral coordinate system+  (    Others,  Id,  "1",  "",        "",         [],     "x,y,z", []),+  (    Others,  R2,  "2",  "",   "0,0,z", [ 0, 0, 1],   "-x,-y,z", []),+  (    Others,  R2,  "2",  "",   "0,y,0", [ 0, 1, 0],   "-x,y,-z", []),+  (    Others,  R2,  "2",  "",   "x,0,0", [ 1, 0, 0],   "x,-y,-z", []),+  (    Others,  R3,  "3", "+",   "x,x,x", [ 1, 1, 1],     "z,x,y", []),+  (    Others,  R3,  "3", "+", "x,-x,-x", [ 1,-1,-1],   "-z,-x,y", []),+  (    Others,  R3,  "3", "+", "-x,x,-x", [-1, 1,-1],   "z,-x,-y", []),+  (    Others,  R3,  "3", "+", "-x,-x,x", [-1,-1, 1],   "-z,x,-y", []),+  (    Others,  R3,  "3", "-",   "x,x,x", [ 1, 1, 1],     "y,z,x", []),+  (    Others,  R3,  "3", "-", "x,-x,-x", [ 1,-1,-1],   "-y,z,-x", []),+  (    Others,  R3,  "3", "-", "-x,x,-x", [-1, 1,-1],   "-y,-z,x", []),+  (    Others,  R3,  "3", "-", "-x,-x,x", [-1,-1, 1],   "y,-z,-x", []),+  (    Others,  R2,  "2",  "",   "x,x,0", [ 1, 1, 0],    "y,x,-z", []),+  (    Others,  R2,  "2",  "",   "x,0,x", [ 1, 0, 1],    "z,-y,x", []),+  (    Others,  R2,  "2",  "",   "0,y,y", [ 0, 1, 1],    "-x,z,y", []),+  (    Others,  R2,  "2",  "",  "x,-x,0", [ 1,-1, 0],  "-y,-x,-z", []),+  (    Others,  R2,  "2",  "",  "-x,0,x", [-1, 0, 1],  "-z,-y,-x", []),+  (    Others,  R2,  "2",  "",  "0,y,-y", [ 0, 1,-1],  "-x,-z,-y", []),+  (    Others,  R4,  "4", "+",   "0,0,z", [ 0, 0, 1],    "-y,x,z", []),+  (    Others,  R4,  "4", "+",   "0,y,0", [ 0, 1, 0],    "z,y,-x", []),+  (    Others,  R4,  "4", "+",   "x,0,0", [ 1, 0, 0],    "x,-z,y", []),+  (    Others,  R4,  "4", "-",   "0,0,z", [ 0, 0, 1],    "y,-x,z", []),+  (    Others,  R4,  "4", "-",   "0,y,0", [ 0, 1, 0],    "-z,y,x", []),+  (    Others,  R4,  "4", "-",   "x,0,0", [ 1, 0, 0],    "x,z,-y", []), -----  ( AnythingElse, Inv, "-1",  "",   "0,0,0",         [],  "-x,-y,-z", []),-  ( AnythingElse,   M,  "m",  "",   "x,y,0", [ 0, 0, 1],    "x,y,-z", []),-  ( AnythingElse,   M,  "m",  "",   "x,0,z", [ 0, 1, 0],    "x,-y,z", []),-  ( AnythingElse,   M,  "m",  "",   "0,y,z", [ 1, 0, 0],    "-x,y,z", []),-  ( AnythingElse, RI3, "-3", "+",   "x,x,x", [ 1, 1, 1],  "-z,-x,-y", []),-  ( AnythingElse, RI3, "-3", "+", "x,-x,-x", [ 1,-1,-1],    "z,x,-y", []),-  ( AnythingElse, RI3, "-3", "+", "-x,x,-x", [-1, 1,-1],    "-z,x,y", []),-  ( AnythingElse, RI3, "-3", "+", "-x,-x,x", [-1,-1, 1],    "z,-x,y", []),-  ( AnythingElse, RI3, "-3", "-",   "x,x,x", [ 1, 1, 1],  "-y,-z,-x", []),-  ( AnythingElse, RI3, "-3", "-", "x,-x,-x", [ 1,-1,-1],    "y,-z,x", []),-  ( AnythingElse, RI3, "-3", "-", "-x,x,-x", [-1, 1,-1],    "y,z,-x", []),-  ( AnythingElse, RI3, "-3", "-", "-x,-x,x", [-1,-1, 1],    "-y,z,x", []),-  ( AnythingElse,   M,  "m",  "",  "x,-x,z", [ 1, 1, 0],   "-y,-x,z", []),-  ( AnythingElse,   M,  "m",  "",  "-x,y,x", [ 1, 0, 1],   "-z,y,-x", []),-  ( AnythingElse,   M,  "m",  "",  "x,y,-y", [ 0, 1, 1],   "x,-z,-y", []),-  ( AnythingElse,   M,  "m",  "",   "x,x,z", [ 1,-1, 0],     "y,x,z", []),-  ( AnythingElse,   M,  "m",  "",   "x,y,x", [-1, 0, 1],     "z,y,x", []),-  ( AnythingElse,   M,  "m",  "",   "x,y,y", [ 0, 1,-1],     "x,z,y", []),-  ( AnythingElse, RI4, "-4", "+",   "0,0,z", [ 0, 0, 1],   "y,-x,-z", []),-  ( AnythingElse, RI4, "-4", "+",   "0,y,0", [ 0, 1, 0],   "-z,-y,x", []),-  ( AnythingElse, RI4, "-4", "+",   "x,0,0", [ 1, 0, 0],   "-x,z,-y", []),-  ( AnythingElse, RI4, "-4", "-",   "0,0,z", [ 0, 0, 1],   "-y,x,-z", []),-  ( AnythingElse, RI4, "-4", "-",   "0,y,0", [ 0, 1, 0],   "z,-y,-x", []),-  ( AnythingElse, RI4, "-4", "-",   "x,0,0", [ 1, 0, 0],   "-x,-z,y", []),+  (    Others, Inv, "-1",  "",   "0,0,0",         [],  "-x,-y,-z", []),+  (    Others,   M,  "m",  "",   "x,y,0", [ 0, 0, 1],    "x,y,-z", []),+  (    Others,   M,  "m",  "",   "x,0,z", [ 0, 1, 0],    "x,-y,z", []),+  (    Others,   M,  "m",  "",   "0,y,z", [ 1, 0, 0],    "-x,y,z", []),+  (    Others, RI3, "-3", "+",   "x,x,x", [ 1, 1, 1],  "-z,-x,-y", []),+  (    Others, RI3, "-3", "+", "x,-x,-x", [ 1,-1,-1],    "z,x,-y", []),+  (    Others, RI3, "-3", "+", "-x,x,-x", [-1, 1,-1],    "-z,x,y", []),+  (    Others, RI3, "-3", "+", "-x,-x,x", [-1,-1, 1],    "z,-x,y", []),+  (    Others, RI3, "-3", "-",   "x,x,x", [ 1, 1, 1],  "-y,-z,-x", []),+  (    Others, RI3, "-3", "-", "x,-x,-x", [ 1,-1,-1],    "y,-z,x", []),+  (    Others, RI3, "-3", "-", "-x,x,-x", [-1, 1,-1],    "y,z,-x", []),+  (    Others, RI3, "-3", "-", "-x,-x,x", [-1,-1, 1],    "-y,z,x", []),+  (    Others,   M,  "m",  "",  "x,-x,z", [ 1, 1, 0],   "-y,-x,z", []),+  (    Others,   M,  "m",  "",  "-x,y,x", [ 1, 0, 1],   "-z,y,-x", []),+  (    Others,   M,  "m",  "",  "x,y,-y", [ 0, 1, 1],   "x,-z,-y", []),+  (    Others,   M,  "m",  "",   "x,x,z", [ 1,-1, 0],     "y,x,z", []),+  (    Others,   M,  "m",  "",   "x,y,x", [-1, 0, 1],     "z,y,x", []),+  (    Others,   M,  "m",  "",   "x,y,y", [ 0, 1,-1],     "x,z,y", []),+  (    Others, RI4, "-4", "+",   "0,0,z", [ 0, 0, 1],   "y,-x,-z", []),+  (    Others, RI4, "-4", "+",   "0,y,0", [ 0, 1, 0],   "-z,-y,x", []),+  (    Others, RI4, "-4", "+",   "x,0,0", [ 1, 0, 0],   "-x,z,-y", []),+  (    Others, RI4, "-4", "-",   "0,0,z", [ 0, 0, 1],   "-y,x,-z", []),+  (    Others, RI4, "-4", "-",   "0,y,0", [ 0, 1, 0],   "z,-y,-x", []),+  (    Others, RI4, "-4", "-",   "x,0,0", [ 1, 0, 0],   "-x,-z,y", []), -- Table 11.2.2.2. Matrices for point-group symmetry operations and orientation -- of corresponding symmetry elements, referred to a hexagonal coordinate system-  (    Hexagonal,  Id,  "1",  "",        "",         [],     "x,y,z", []),-  (    Hexagonal,  R3,  "3", "+",   "0,0,z", [ 0, 0, 1],  "-y,x-y,z", []),-  (    Hexagonal,  R3,  "3", "-",   "0,0,z", [ 0, 0, 1],  "y-x,-x,z", []),-  (    Hexagonal,  R2,  "2",  "",   "0,0,z", [ 0, 0, 1],   "-x,-y,z", []),-  (    Hexagonal,  R6,  "6", "+",   "0,0,z", [ 0, 0, 1],   "x-y,x,z", []),-  (    Hexagonal,  R6,  "6", "-",   "0,0,z", [ 0, 0, 1],   "y,y-x,z", []),-  (    Hexagonal,  R2,  "2",  "",   "x,x,0", [ 1, 1, 0],    "y,x,-z", []),-  (    Hexagonal,  R2,  "2",  "",   "x,0,0", [ 1, 0, 0], "x-y,-y,-z", []),-  (    Hexagonal,  R2,  "2",  "",   "0,y,0", [ 0, 1, 0], "-x,y-x,-z", []),-  (    Hexagonal,  R2,  "2",  "",  "x,-x,0", [ 1,-1, 0],  "-y,-x,-z", []),+  ( Hexagonal,  Id,  "1",  "",        "",         [],     "x,y,z", []),+  ( Hexagonal,  R3,  "3", "+",   "0,0,z", [ 0, 0, 1],  "-y,x-y,z", []),+  ( Hexagonal,  R3,  "3", "-",   "0,0,z", [ 0, 0, 1],  "y-x,-x,z", []),+  ( Hexagonal,  R2,  "2",  "",   "0,0,z", [ 0, 0, 1],   "-x,-y,z", []),+  ( Hexagonal,  R6,  "6", "+",   "0,0,z", [ 0, 0, 1],   "x-y,x,z", []),+  ( Hexagonal,  R6,  "6", "-",   "0,0,z", [ 0, 0, 1],   "y,y-x,z", []),+  ( Hexagonal,  R2,  "2",  "",   "x,x,0", [ 1, 1, 0],    "y,x,-z", []),+  ( Hexagonal,  R2,  "2",  "",   "x,0,0", [ 1, 0, 0], "x-y,-y,-z", []),+  ( Hexagonal,  R2,  "2",  "",   "0,y,0", [ 0, 1, 0], "-x,y-x,-z", []),+  ( Hexagonal,  R2,  "2",  "",  "x,-x,0", [ 1,-1, 0],  "-y,-x,-z", []), ---  (    Hexagonal,  R2,  "2",  "",  "x,2x,0", [ 1, 2, 0],  "y-x,y,-z", []),-  (    Hexagonal,  R2,  "2",  "",  "2x,x,0", [ 2, 1, 0],  "x,x-y,-z", []),+  ( Hexagonal,  R2,  "2",  "",  "x,2x,0", [ 1, 2, 0],  "y-x,y,-z", []),+  ( Hexagonal,  R2,  "2",  "",  "2x,x,0", [ 2, 1, 0],  "x,x-y,-z", []), -- -  (    Hexagonal, Inv, "-1",  "",   "0,0,0",         [],  "-x,-y,-z", []),-  (    Hexagonal, RI3, "-3", "+",   "0,0,z", [ 0, 0, 1],  "y,y-x,-z", []),-  (    Hexagonal, RI3, "-3", "-",   "0,0,z", [ 0, 0, 1],  "x-y,x,-z", []),-  (    Hexagonal,   M,  "m",  "",   "x,y,0", [ 0, 0, 1],    "x,y,-z", []),-  (    Hexagonal, RI6, "-6", "+",   "0,0,z", [ 0, 0, 1], "y-x,-x,-z", []),-  (    Hexagonal, RI6, "-6", "-",   "0,0,z", [ 0, 0, 1], "-y,x-y,-z", []),-  (    Hexagonal,   M,  "m",  "",  "x,-x,z", [ 1, 1, 0],   "-y,-x,z", []),+  ( Hexagonal, Inv, "-1",  "",   "0,0,0",         [],  "-x,-y,-z", []),+  ( Hexagonal, RI3, "-3", "+",   "0,0,z", [ 0, 0, 1],  "y,y-x,-z", []),+  ( Hexagonal, RI3, "-3", "-",   "0,0,z", [ 0, 0, 1],  "x-y,x,-z", []),+  ( Hexagonal,   M,  "m",  "",   "x,y,0", [ 0, 0, 1],    "x,y,-z", []),+  ( Hexagonal, RI6, "-6", "+",   "0,0,z", [ 0, 0, 1], "y-x,-x,-z", []),+  ( Hexagonal, RI6, "-6", "-",   "0,0,z", [ 0, 0, 1], "-y,x-y,-z", []),+  ( Hexagonal,   M,  "m",  "",  "x,-x,z", [ 1, 1, 0],   "-y,-x,z", []), -- 以下二つが、Orientationを利用して解の補正をすることができなかったため、代替値を用意している -- 行列を解いた場合の解平面とorientationが一致していない可能性(2017の試行錯誤) -- そもそも勘違いの可能性もまだあるので、のちのち再確認する。 -- hackageに登録するに至らない理由の一つ -- 正規化された値として正しいが、正規化の結果、復元に必要な情報が欠落してしまった可能性(2020リファクタリング時の見解) -- どうしてこうなっているのか、やっぱりわからない。-  (    Hexagonal,   M,  "m",  "",  "x,2x,z", [ 1, 0, 0],   "y-x,y,z", [ 2,-1, 0]),-  (    Hexagonal,   M,  "m",  "",  "2x,x,z", [ 0, 1, 0],   "x,x-y,z", [-1, 2, 0]),+  ( Hexagonal,   M,  "m",  "",  "x,2x,z", [ 1, 0, 0],   "y-x,y,z", [ 2,-1, 0]),+  ( Hexagonal,   M,  "m",  "",  "2x,x,z", [ 0, 1, 0],   "x,x-y,z", [-1, 2, 0]),    (    Hexagonal,   M,  "m",  "",   "x,x,z", [ 1,-1, 0],     "y,x,z", []),   (    Hexagonal,   M,  "m",  "",   "x,0,z", [ 1, 2, 0],  "x-y,-y,z", []),
src/Data/Matrix/SymmetryOperationsSymbols/GlideOrReflectionCase.hs view
@@ -1,12 +1,12 @@ {-# LANGUAGE CPP #-}  {-|-Module      : GlideOrReflectionCase-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols.GlideOrReflectionCase+Description : Part of matrix reader (Glide and Reflection)+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?  [References] @@ -27,21 +27,22 @@ import Data.Matrix.SymmetryOperationsSymbols.Solve import Data.Matrix.SymmetryOperationsSymbols.Common import Data.Matrix.AsXYZ-import qualified Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation as S+-- import qualified Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation as S+import qualified Data.Matrix.SymmetryOperationsSymbols.SymopGeom as S  #if MIN_VERSION_base(4,11,0)-import Control.Monad.Fail (MonadFail)+import Control.Monad.Fail (MonadFail(..)) #endif  -- | Case (ii) (c) W corresponds to a (glide) reflection #if MIN_VERSION_base(4,11,0)-glideOrReflectionCase :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m (S.SymmetryOperation a)+glideOrReflectionCase :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f (S.SymopGeom a) #else-glideOrReflectionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (S.SymmetryOperation a)+glideOrReflectionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (S.SymopGeom a) #endif glideOrReflectionCase m = arrange m <$> solvingEquation m -arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> S.SymmetryOperation a+arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> S.SymopGeom a arrange m ans       | sym == M           = S.Reflection { S.plane = location }       | sym `elem` [A,B,C] = S.GlideABC { S.abc = abc, S.plane = location }@@ -55,7 +56,7 @@         dgn | sym == D = S.D             | sym == G = S.G             | sym == N = S.N-        location = locationOf m <|> fromList 3 1 ans+        location = toLists $ locationOf m <|> fromList 3 1 ans           -- for repl check@@ -85,9 +86,9 @@ solvingEquation'' mat = adjustAnswerOnPlane mat . toList =<< solvingEquation' mat  #if MIN_VERSION_base(4,11,0)-solvingEquation :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+solvingEquation :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f [Ratio a] #else-solvingEquation :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+solvingEquation :: (Integral a, Monad m) => Matrix (Ratio a) -> m [Ratio a] #endif solvingEquation mat = case solvingEquation'' mat of   Nothing -> fail "<GlideOrReflection> when calculate equation solve."
src/Data/Matrix/SymmetryOperationsSymbols/Parser.hs view
@@ -1,12 +1,10 @@ {-|-Module      : Parse-Description : pasing geometric representation part+Module      : Data.Matrix.SymmetryOperationsSymbols.Parser+Description : Parser of geometric representation Copyright   : (c) Jun Narumi, 2018 License     : BSD-3 Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?- -} module Data.Matrix.SymmetryOperationsSymbols.Parser (   -- symbolSenseVectorOrientation,
+ src/Data/Matrix/SymmetryOperationsSymbols/PlainText.hs view
@@ -0,0 +1,65 @@+{-|+Module      : Data.Matrix.SymmetryOperationsSymbols.PlainText+Description : Output as plain text+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT+Maintainer  : narumij@gmail.com+Stability   : experimental+-}+module Data.Matrix.SymmetryOperationsSymbols.PlainText (+  showAsPlainText,+) where++import Data.List+import Data.Ratio+import Data.Ratio.Slash+import Data.Matrix+import Data.Matrix.AsXYZ++import Data.Matrix.SymmetryOperationsSymbols.SymopGeom++-- |+-- >>> triplet (1%2,3%4,5%6)+-- "1/2,3/4,5/6"+triplet :: Integral a => (Ratio a,Ratio a,Ratio a) -> String+triplet (a,b,c) = intercalate "," . map (show . Slash) $ [a,b,c]++-- |+-- >>> triplet (1%2,3%4,5%6)+-- "(1/2,3/4,5/6)"+tripletParen :: Integral a => (Ratio a,Ratio a,Ratio a) -> String+tripletParen = ("(" ++) . (++ ")") . triplet++showSense :: Sense -> String+showSense Positive = "+"+showSense Negative = "-"++showPlane :: Integral a => SymopGeom a -> String+showPlane = prettyXYZ . fromLists . plane++showAxis :: Integral a => SymopGeom a -> String+showAxis = prettyXYZ . fromLists . axis++showAsPlainText :: Integral a => SymopGeom a -> String+showAsPlainText Identity = " 1 "+showAsPlainText val@Translation {}+  = concat [" t ",tripletParen $ vector val," "]+showAsPlainText val@Reflection {}+  = concat [" m  ", showPlane val]+showAsPlainText val@GlideABC {}+  = concat [" ",showABC $ abc val,"  ", showPlane val]+showAsPlainText val@GlideDGN {}+  = concat [" ",showDGN $ dgn val," ",tripletParen $ glide val," ", showPlane val]+showAsPlainText val@TwoFoldRotation {}+  = concat [" 2  ",showAxis val]+showAsPlainText val@TwoFoldScrew {}+  = concat [" 2 ",tripletParen $ vector val," ",showAxis val]+showAsPlainText val@NFoldRotation {}+  = concat [" ",showSymbol (nFold val),showSense (sense val)," ",showAxis val]+showAsPlainText val@NFoldScrew {}+  = concat [" ",showSymbol (nFold val),showSense (sense val),tripletParen $ vector val," ",showAxis val]+showAsPlainText val@Inversion {}+  = concat ["-1 ",triplet $ centre val]+showAsPlainText val@RotInversion {}+  = concat ["-",showSymbol (nFold val),showSense (sense val)," ",showAxis val,"; ",triplet $ point val]+
src/Data/Matrix/SymmetryOperationsSymbols/RotInversionCase.hs view
@@ -1,12 +1,11 @@ {-# LANGUAGE CPP #-}- {-|-Module      : RotInversionCase-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols.RotInversionCase+Description : Part of matrix reader (Inversion)+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?  [References] @@ -26,28 +25,29 @@ import Data.Matrix.SymmetryOperationsSymbols.Solve import Data.Matrix.SymmetryOperationsSymbols.Common import Data.Matrix.AsXYZ-import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+--import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+import Data.Matrix.SymmetryOperationsSymbols.SymopGeom  #if MIN_VERSION_base(4,11,0)-import Control.Monad.Fail (MonadFail)+import Control.Monad.Fail (MonadFail(..)) #endif  -- | Case (ii) (b) W corresponds to an n-fold rotation #if MIN_VERSION_base(4,11,0)-rotInversionCase :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+rotInversionCase :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f (SymopGeom a) #else-rotInversionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+rotInversionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymopGeom a) #endif rotInversionCase m = arrange m <$> calc m  #if MIN_VERSION_base(4,11,0)-calc :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m ([Ratio a], Matrix (Ratio a))+calc :: (MonadFail m, Integral a) => Matrix (Ratio a) -> m ([Ratio a], Matrix (Ratio a)) #else calc :: (Monad m, Integral a) => Matrix (Ratio a) -> m ([Ratio a], Matrix (Ratio a)) #endif calc m = (,) <$> solvingEquation2 m <*> solvingEquation1 m -arrange :: Integral a => Matrix (Ratio a) -> ([Ratio a], Matrix (Ratio a)) -> SymmetryOperation a+arrange :: Integral a => Matrix (Ratio a) -> ([Ratio a], Matrix (Ratio a)) -> SymopGeom a arrange m ([],b) = Inversion { centre = (i,j,k) }   where     [i,j,k] = toList b@@ -55,7 +55,7 @@   where     [i,j,k] = toList b     rt = rotationType m-    loc = locationOf m <|> fromList 3 1 a+    loc = toLists $ locationOf m <|> fromList 3 1 a     n | rt == -3 = ThreeFold       | rt == -4 = FourFold       | rt == -6 = SixFold@@ -89,7 +89,7 @@  -- (ii) (a) solving equation (W,w)x = x #if MIN_VERSION_base(4,11,0)-solvingEquation1 :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m (Matrix (Ratio a))+solvingEquation1 :: (MonadFail m, Integral a) => Matrix (Ratio a) -> m (Matrix (Ratio a)) #else solvingEquation1 :: (Monad m, Integral a) => Matrix (Ratio a) -> m (Matrix (Ratio a)) #endif@@ -108,7 +108,7 @@     w2 = pow2 (rotPart mat)  #if MIN_VERSION_base(4,11,0)-solvingEquation2 :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+solvingEquation2 :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f [Ratio a] #else solvingEquation2 :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a] #endif
src/Data/Matrix/SymmetryOperationsSymbols/RotationCase.hs view
@@ -1,9 +1,10 @@ {-# LANGUAGE CPP #-}  {-|-Module      : RotationCase-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols.RotationCase+Description : Part of matrix reader (Screw and Rotation)+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental Portability : ?@@ -25,21 +26,22 @@ import Data.Matrix.SymmetryOperationsSymbols.Solve import Data.Matrix.SymmetryOperationsSymbols.Common import Data.Matrix.AsXYZ-import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+--import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+import Data.Matrix.SymmetryOperationsSymbols.SymopGeom  #if MIN_VERSION_base(4,11,0)-import Control.Monad.Fail (MonadFail)+import Control.Monad.Fail (MonadFail(..)) #endif  -- | Case (ii) (a) W corresponds to a rotoinversion #if MIN_VERSION_base(4,11,0)-nFoldRotationCase :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+nFoldRotationCase :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f (SymopGeom a) #else-nFoldRotationCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+nFoldRotationCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymopGeom a) #endif nFoldRotationCase m = arrange m <$> solvingEquation m -arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> SymmetryOperation a+arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> SymopGeom a arrange m ans    | rt == 2 && noScrew = TwoFoldRotation { axis = location }   | rt == 2            = TwoFoldScrew { axis = location, vector = (sa,sb,sc) }@@ -58,7 +60,7 @@         s = if null . senseOf $ m then " " else senseOf m         sym = " " ++ show rt ++ s         screwPart@[sa,sb,sc] = toList (wg m)-        location = locationOf m <|> fromList 3 1 ans+        location = toLists $ locationOf m <|> fromList 3 1 ans      -- @@ -107,7 +109,7 @@   adjustAnswerOnAxis mat (toList sol)  #if MIN_VERSION_base(4,11,0)-solvingEquation :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+solvingEquation :: (Integral a, MonadFail f) => Matrix (Ratio a) -> f [Ratio a] #else solvingEquation :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a] #endif
src/Data/Matrix/SymmetryOperationsSymbols/Solve.hs view
@@ -1,12 +1,10 @@ {-|-Module      : Solve-Description : solving linear equation part-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols.Solve+Description : Solving linear equation part+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?- -} module Data.Matrix.SymmetryOperationsSymbols.Solve (   solve,
src/Data/Matrix/SymmetryOperationsSymbols/Symbol.hs view
@@ -1,8 +1,17 @@+{-|+Module      : Data.Matrix.SymmetryOperationsSymbols.Symbol+Description : Symmetry Operation Symbols+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT+Maintainer  : narumij@gmail.com+Stability   : experimental+-} module Data.Matrix.SymmetryOperationsSymbols.Symbol (     Symbol(..)   ) where  import Control.Monad+  data Symbol    = Id  --  '1'
− src/Data/Matrix/SymmetryOperationsSymbols/SymmetryOperation.hs
@@ -1,76 +0,0 @@-module Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation (-    SymmetryOperation(..),-    NFold(..),-    Sense(..),-    ABC(..),-    DGN(..),-    showSymmetryOperation,-    )-    where--import Data.Ratio-import Data.Matrix-import Data.Matrix.AsXYZ-import Data.Matrix.SymmetryOperationsSymbols.Common--data ABC = A | B | C deriving (Show,Eq)-data DGN = D | G | N deriving (Show,Eq)-data NFold = ThreeFold | FourFold | SixFold deriving (Show,Eq)-data Sense = Positive | Negative deriving (Show,Eq)--data SymmetryOperation a-  = Identity-  | Translation     { vector :: (Ratio a,Ratio a,Ratio a) }-  | Reflection      { plane :: Matrix (Ratio a) }-  | GlideABC        { abc :: ABC, plane :: Matrix (Ratio a) }-  | GlideDGN        { dgn :: DGN, plane :: Matrix (Ratio a), glide :: (Ratio a,Ratio a,Ratio a) }-  | TwoFoldRotation { axis :: Matrix (Ratio a) }-  | TwoFoldScrew    { axis :: Matrix (Ratio a), vector :: (Ratio a,Ratio a,Ratio a) }-  | NFoldRotation   { nFold :: NFold, sense :: Sense, axis :: Matrix (Ratio a) }-  | NFoldScrew      { nFold :: NFold, sense :: Sense, axis :: Matrix (Ratio a), vector :: (Ratio a,Ratio a,Ratio a) }-  | Inversion       { centre :: (Ratio a,Ratio a,Ratio a) }-  | RotInversion    { nFold :: NFold, sense :: Sense, axis :: Matrix (Ratio a), point :: (Ratio a,Ratio a,Ratio a) }-  deriving (Show,Eq)--showSymbol :: NFold -> String-showSymbol ThreeFold = "3"-showSymbol FourFold  = "4"-showSymbol SixFold   = "6"--showSense :: Sense -> String-showSense Positive = "+"-showSense Negative = "-"--showABC :: ABC -> String-showABC A = "a"-showABC B = "b"-showABC C = "c"--showDGN :: DGN -> String-showDGN D = "d"-showDGN G = "g"-showDGN N = "n"--showSymmetryOperation :: Integral a => SymmetryOperation a -> String-showSymmetryOperation Identity = " 1 "-showSymmetryOperation val@Translation {}-  = concat [" t ",tripletParen $ vector val," "]-showSymmetryOperation val@Reflection {}-  = concat [" m  ",prettyXYZ $ plane val]-showSymmetryOperation val@GlideABC {}-  = concat [" ",showABC $ abc val,"  ",prettyXYZ $ plane val]-showSymmetryOperation val@GlideDGN {}-  = concat [" ",showDGN $ dgn val," ",tripletParen $ glide val," ",prettyXYZ $ plane val]-showSymmetryOperation val@TwoFoldRotation {}-  = concat [" 2  ",prettyXYZ $ axis val]-showSymmetryOperation val@TwoFoldScrew {}-  = concat [" 2 ",tripletParen $ vector val," ",prettyXYZ $ axis val]-showSymmetryOperation val@NFoldRotation {}-  = concat [" ",showSymbol (nFold val),showSense (sense val)," ",prettyXYZ $ axis val]-showSymmetryOperation val@NFoldScrew {}-  = concat [" ",showSymbol (nFold val),showSense (sense val),tripletParen $ vector val," ",prettyXYZ $ axis val]-showSymmetryOperation val@Inversion {}-  = concat ["-1 ",triplet $ centre val]-showSymmetryOperation val@RotInversion {}-  = concat ["-",showSymbol (nFold val),showSense (sense val)," ",prettyXYZ $ axis val,"; ",triplet $ point val]-
+ src/Data/Matrix/SymmetryOperationsSymbols/SymopGeom.hs view
@@ -0,0 +1,45 @@+{-|+Module      : Data.Matrix.SymmetryOperationsSymbols.SymopGeom+Description : Type of geometric representation+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT+Maintainer  : narumij@gmail.com+Stability   : experimental+-}+module Data.Matrix.SymmetryOperationsSymbols.SymopGeom where++import Data.Ratio++data ABC = A | B | C deriving (Show,Read,Eq)+data DGN = D | G | N deriving (Show,Read,Eq)+data NFold = ThreeFold | FourFold | SixFold deriving (Show,Read,Eq)+data Sense = Positive | Negative deriving (Show,Read,Eq)++data SymopGeom a+  = Identity+  | Translation     { vector :: (Ratio a,Ratio a,Ratio a) }+  | Reflection      { plane :: [[Ratio a]] }+  | GlideABC        { abc :: ABC, plane :: [[Ratio a]] }+  | GlideDGN        { dgn :: DGN, plane :: [[Ratio a]], glide :: (Ratio a,Ratio a,Ratio a) }+  | TwoFoldRotation { axis :: [[Ratio a]] }+  | TwoFoldScrew    { axis :: [[Ratio a]], vector :: (Ratio a,Ratio a,Ratio a) }+  | NFoldRotation   { nFold :: NFold, sense :: Sense, axis :: [[Ratio a]] }+  | NFoldScrew      { nFold :: NFold, sense :: Sense, axis :: [[Ratio a]], vector :: (Ratio a,Ratio a,Ratio a) }+  | Inversion       { centre :: (Ratio a,Ratio a,Ratio a) }+  | RotInversion    { nFold :: NFold, sense :: Sense, axis :: [[Ratio a]], point :: (Ratio a,Ratio a,Ratio a) }+  deriving (Read,Show,Eq)++showSymbol :: NFold -> String+showSymbol ThreeFold = "3"+showSymbol FourFold  = "4"+showSymbol SixFold   = "6"++showABC :: ABC -> String+showABC A = "a"+showABC B = "b"+showABC C = "c"++showDGN :: DGN -> String+showDGN D = "d"+showDGN G = "g"+showDGN N = "n"
src/Data/Matrix/SymmetryOperationsSymbols/UnitMatrixCase.hs view
@@ -1,10 +1,10 @@ {-|-Module      : UnitMatrixCase-Copyright   : (c) Jun Narumi, 2018-License     : BSD-3+Module      : Data.Matrix.SymmetryOperationsSymbols.UnitMatrixCase+Description : Part of matrix reader (Translate and Identity)+Copyright   : (c) Jun Narumi, 2018-2020+License     : MIT Maintainer  : narumij@gmail.com Stability   : experimental-Portability : ?  [References] @@ -22,7 +22,7 @@ import Data.Ratio (Ratio)     import Data.Matrix import Data.Matrix.SymmetryOperationsSymbols.Common-import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+import Data.Matrix.SymmetryOperationsSymbols.SymopGeom  -- | Case (i) The matrix W is the unit matrix: unitMatrixCase w
symmetry-operations-symbols.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f949dea9599c61ffd1d9d7c38b387af9a60c67e79ac9d36cef15cf7ccb95a2f5+-- hash: d049352960db9423c5cc3e872b002a336e32458f133a79ca2dca62268afed868  name:           symmetry-operations-symbols-version:        0.0.1.4+version:        0.0.2.0 synopsis:       Derivation of symbols and coordinate triplets Library description:    Please see the README on GitHub at <https://github.com/narumij/symmetry-operations-symbols#readme> category:       Chemistry@@ -33,20 +33,24 @@       Data.Matrix.SymmetryOperationsSymbols.Common       Data.Matrix.SymmetryOperationsSymbols.GlideOrReflectionCase       Data.Matrix.SymmetryOperationsSymbols.Parser+      Data.Matrix.SymmetryOperationsSymbols.PlainText       Data.Matrix.SymmetryOperationsSymbols.RotationCase       Data.Matrix.SymmetryOperationsSymbols.RotInversionCase       Data.Matrix.SymmetryOperationsSymbols.Solve       Data.Matrix.SymmetryOperationsSymbols.Symbol-      Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation+      Data.Matrix.SymmetryOperationsSymbols.SymopGeom       Data.Matrix.SymmetryOperationsSymbols.UnitMatrixCase   other-modules:       Paths_symmetry_operations_symbols   hs-source-dirs:       src   build-depends:-      base >=4.8 && <5+      QuickCheck+    , base >=4.8 && <5+    , doctest+    , hspec     , matrix >=0.3.5 && <4-    , matrix-as-xyz >=0.1 && <1+    , matrix-as-xyz >=0.1.1 && <0.2     , parsec >=3.1 && <4   default-language: Haskell2010 @@ -57,10 +61,12 @@       Paths_symmetry_operations_symbols   ghc-options: -threaded -rtsopts -with-rtsopts=-N   build-depends:-      base >=4.8 && <5+      QuickCheck+    , base >=4.8 && <5     , doctest+    , hspec     , matrix >=0.3.5 && <4-    , matrix-as-xyz >=0.1 && <1+    , matrix-as-xyz >=0.1.1 && <0.2     , parsec >=3.1 && <4     , symmetry-operations-symbols   default-language: Haskell2010@@ -81,9 +87,10 @@   build-depends:       QuickCheck     , base >=4.8 && <5+    , doctest     , hspec     , matrix >=0.3.5 && <4-    , matrix-as-xyz >=0.1 && <1+    , matrix-as-xyz >=0.1.1 && <0.2     , parsec >=3.1 && <4     , symmetry-operations-symbols   default-language: Haskell2010