symmetry-operations-symbols 0.0.1.2 → 0.0.1.3
raw patch · 7 files changed
+85/−16 lines, 7 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- README.md +10/−4
- src/Data/Matrix/SymmetryOperationsSymbols.hs +9/−3
- src/Data/Matrix/SymmetryOperationsSymbols/Common.hs +17/−6
- src/Data/Matrix/SymmetryOperationsSymbols/GlideOrReflectionCase.hs +12/−0
- src/Data/Matrix/SymmetryOperationsSymbols/RotInversionCase.hs +21/−1
- src/Data/Matrix/SymmetryOperationsSymbols/RotationCase.hs +12/−0
- symmetry-operations-symbols.cabal +4/−2
README.md view
@@ -16,9 +16,18 @@ ``` extra-deps: - matrix-as-xyz-0.1.1.1-- symmetry-operations-symbols-0.0.1.2+- symmetry-operations-symbols-0.0.1.3 ``` +Edit dependencies part of package.yaml like below.++```+dependencies:+- base >= 4.7 && < 5+- matrix-as-xyz+- symmetry-operations-symbols+```+ Then start repl. ```shell@@ -28,9 +37,6 @@ Setup packages and load modules. ```haskell--- prepare-repl> :set -package hall-symbols-repl> :set -package symmetry-operations-symbols repl> :m Data.Matrix.AsXYZ Data.Matrix.SymmetryOperationsSymbols ```
src/Data/Matrix/SymmetryOperationsSymbols.hs view
@@ -46,13 +46,11 @@ -- for doctest import Data.Matrix.AsXYZ +#if MIN_VERSION_base(4,11,0) import Control.Monad.Fail (MonadFail) -#if MIN_VERSION_base(4,11,0) import qualified Control.Monad.Fail as Fail-#endif -#if MIN_VERSION_base(4,11,0) instance Fail.MonadFail (Either String) where fail = Left #endif@@ -76,14 +74,22 @@ -- -- jpn) 与えられた対称操作の行列から、対称操作の幾何的表現を導出 --+#if MIN_VERSION_base(4,11,0) fromMatrix' :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m String+#else+fromMatrix' :: (Monad m, Integral a) => Matrix (Ratio a) -> m String+#endif fromMatrix' m = showSymmetryOperation <$> fromMatrix'' m -- | 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)+#else+fromMatrix'' :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+#endif fromMatrix'' m -- (i) | rotPart m == identity 3 = unitMatrixCase m
src/Data/Matrix/SymmetryOperationsSymbols/Common.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module : Common Description : utilities@@ -42,7 +44,9 @@ import Data.Matrix.SymmetryOperationsSymbols.Symbol +#if MIN_VERSION_base(4,11,0) import Control.Monad.Fail (MonadFail)+#endif type ErrorMessage = String type SymbolSenseVectorOrientation = (Symbol,String,String,String)@@ -144,19 +148,26 @@ type MatrixLookupRecord a = ((Symbol,Sense,Matrix (Ratio a)),TransformedCoordinate) -lookupMatrixM :: (Monad m, MonadFail m) => Integral a => String -> [MatrixLookupRecord a] -> SymbolSenseVectorOrientation -> m TransformedCoordinate+lookupSSVO :: (Integral a) => (Symbol,String,String) -> [MatrixLookupRecord a] -> Maybe TransformedCoordinate+lookupSSVO (sym, sen, axis) d = lookup (sym, sen, rotPart . fromXYZ'' $ axis) d++#if MIN_VERSION_base(4,11,0)+lookupMatrixM :: (Monad m,MonadFail m) => Integral a => String -> [MatrixLookupRecord a] -> SymbolSenseVectorOrientation -> m TransformedCoordinate+properMatrixW :: (Monad m,MonadFail m) => SymbolSenseVectorOrientation -> m TransformedCoordinate+hexagonalMatrixW :: (Monad m,MonadFail m) => SymbolSenseVectorOrientation -> m TransformedCoordinate+#else+lookupMatrixM :: (Monad m) => Integral a => String -> [MatrixLookupRecord a] -> SymbolSenseVectorOrientation -> m TransformedCoordinate+properMatrixW :: (Monad m) => SymbolSenseVectorOrientation -> m TransformedCoordinate+hexagonalMatrixW :: (Monad m) => SymbolSenseVectorOrientation -> m TransformedCoordinate+#endif+ lookupMatrixM reason dataTable (sy,se,_,el) = case lookupSSVO (primeSymbol sy, se, el) dataTable of Nothing -> fail reason Just c -> return c -lookupSSVO :: (Integral a) => (Symbol,String,String) -> [MatrixLookupRecord a] -> Maybe TransformedCoordinate-lookupSSVO (sym, sen, axis) d = lookup (sym, sen, rotPart . fromXYZ'' $ axis) d--properMatrixW :: (Monad m, MonadFail m) => SymbolSenseVectorOrientation -> m TransformedCoordinate properMatrixW = lookupMatrixM "matrix W not found (proper)." (fromTbl properTbl) -hexagonalMatrixW :: (Monad m, MonadFail m) => SymbolSenseVectorOrientation -> m TransformedCoordinate hexagonalMatrixW = lookupMatrixM "matrix W not found (hexagonal)." (fromTbl hexagonalTbl) fromTbl :: (Integral a) => [Tbl] -> [MatrixLookupRecord a]
src/Data/Matrix/SymmetryOperationsSymbols/GlideOrReflectionCase.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module : GlideOrReflectionCase Copyright : (c) Jun Narumi, 2018@@ -27,10 +29,16 @@ import Data.Matrix.AsXYZ import qualified Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation as S +#if MIN_VERSION_base(4,11,0) 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)+#else+glideOrReflectionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (S.SymmetryOperation a)+#endif glideOrReflectionCase m = arrange m <$> solvingEquation m arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> S.SymmetryOperation a@@ -76,7 +84,11 @@ solvingEquation'' :: Integral a => Matrix (Ratio a) -> Maybe [Ratio a] 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]+#else+solvingEquation :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+#endif solvingEquation mat = case solvingEquation'' mat of Nothing -> fail "<GlideOrReflection> when calculate equation solve." Just a -> return a
src/Data/Matrix/SymmetryOperationsSymbols/RotInversionCase.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module : RotInversionCase Copyright : (c) Jun Narumi, 2018@@ -26,13 +28,23 @@ import Data.Matrix.AsXYZ import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation +#if MIN_VERSION_base(4,11,0) 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)+#else+rotInversionCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+#endif rotInversionCase m = arrange m <$> calc m -calc :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m ([Ratio a], Matrix (Ratio a)) +#if MIN_VERSION_base(4,11,0)+calc :: (Monad m, 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@@ -76,7 +88,11 @@ wl mat = elementwise (+) (wg mat) (transPart mat) -- (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))+#else+solvingEquation1 :: (Monad m, Integral a) => Matrix (Ratio a) -> m (Matrix (Ratio a))+#endif solvingEquation1 mat = case solvingEquation1' mat of Nothing -> fail "<RotInv> when calculate equation (W,w)x = x" Just a -> return a@@ -91,7 +107,11 @@ pow2 m = multStd m m w2 = pow2 (rotPart mat) +#if MIN_VERSION_base(4,11,0) solvingEquation2 :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+#else+solvingEquation2 :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+#endif solvingEquation2 mat = case result of Nothing -> fail "<RotInv> when calculate equation (W,w)^2 x = x." Just a -> return a
src/Data/Matrix/SymmetryOperationsSymbols/RotationCase.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module : RotationCase Copyright : (c) Jun Narumi, 2018@@ -25,10 +27,16 @@ import Data.Matrix.AsXYZ import Data.Matrix.SymmetryOperationsSymbols.SymmetryOperation +#if MIN_VERSION_base(4,11,0) 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)+#else+nFoldRotationCase :: (Monad m, Integral a) => Matrix (Ratio a) -> m (SymmetryOperation a)+#endif nFoldRotationCase m = arrange m <$> solvingEquation m arrange :: Integral a => Matrix (Ratio a) -> [Ratio a] -> SymmetryOperation a@@ -98,7 +106,11 @@ sol <- solvingEquation' mat adjustAnswerOnAxis mat (toList sol) +#if MIN_VERSION_base(4,11,0) solvingEquation :: (Monad m, MonadFail m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+#else+solvingEquation :: (Monad m, Integral a) => Matrix (Ratio a) -> m [Ratio a]+#endif solvingEquation mat = case solvingEquation'' mat of Nothing -> fail "<Rot> when calculate equation." Just a -> return a
symmetry-operations-symbols.cabal view
@@ -4,11 +4,13 @@ -- -- see: https://github.com/sol/hpack ----- hash: ad9aae34126c6880e0673941bf26f931a32589140d48d68735fe3519f77eb9b5+-- hash: 82bb89113dfde6977e72f2ae43146bc90ee15ade89e77e8e6e75ab49bc58b94c name: symmetry-operations-symbols-version: 0.0.1.2+version: 0.0.1.3+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 homepage: https://github.com/narumij/symmetry-operations-symbols#readme bug-reports: https://github.com/narumij/symmetry-operations-symbols/issues author: Jun Narumi