module Bio.PDB.EventParser.ParseCRYST1(parseCRYST1)
where
import qualified Data.ByteString.Char8 as BS
import Bio.PDB.EventParser.PDBEvents
import Bio.PDB.EventParser.PDBParsingAbstractions
crystFields = [(6, mKeyword "record header" "CRYST1"),
(7, mSpc 1),
(15, mDouble "a" ),
(24, mDouble "b" ),
(33, mDouble "c" ),
(40, mDouble "alpha" ),
(47, mDouble "beta" ),
(54, mDouble "gamma" ),
(55, mSpc 1),
(66, mStr "space group" ),
(70, mInt "Z value" )]
parseCRYST1 :: (Monad m) => BS.ByteString -> Int -> m [PDBEvent]
parseCRYST1 line line_no = return $ if errs == []
then [result]
else errs--}
where
(fields, errs) = parseFields crystFields line line_no
[fRec, fSpc1, fA, fB, fC, fAlpha, fBeta, fGamma, fSpc2, fSpcGrp, fZValue] = fields
IFDouble a = fA
IFDouble b = fB
IFDouble c = fC
IFDouble alpha = fAlpha
IFDouble beta = fBeta
IFDouble gamma = fGamma
IFStr spcGrp = fSpcGrp
IFInt zValue = fZValue
result = CRYST1 a b c alpha beta gamma spcGrp zValue